Repository: georgmangold/console Branch: main Commit: feff71e48e39 Files: 1535 Total size: 14.6 MB Directory structure: gitextract_jt61xs5i/ ├── .dockerignore ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ └── bug_report.md │ ├── dependabot.yml │ └── workflows/ │ ├── jobs.yaml │ ├── release.yaml │ └── vulncheck.yaml ├── .gitignore ├── .golangci.yml ├── .goreleaser.yml ├── .license.tmpl ├── .nvmrc ├── .prettierrc.json ├── .semgrepignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── CREDITS ├── DEVELOPMENT.md ├── Dockerfile ├── Dockerfile.assets ├── Dockerfile.goreleaser ├── Dockerfile.release ├── LICENSE ├── Makefile ├── NOTICE ├── README.md ├── SECURITY.md ├── VULNERABILITY_REPORT.md ├── api/ │ ├── admin_arns.go │ ├── admin_arns_test.go │ ├── admin_client_mock.go │ ├── admin_config.go │ ├── admin_config_test.go │ ├── admin_console.go │ ├── admin_console_test.go │ ├── admin_groups.go │ ├── admin_groups_test.go │ ├── admin_health_info.go │ ├── admin_health_info_test.go │ ├── admin_idp.go │ ├── admin_idp_test.go │ ├── admin_info.go │ ├── admin_info_test.go │ ├── admin_inspect.go │ ├── admin_kms.go │ ├── admin_kms_test.go │ ├── admin_nodes.go │ ├── admin_notification_endpoints.go │ ├── admin_notification_endpoints_test.go │ ├── admin_objects.go │ ├── admin_objects_test.go │ ├── admin_policies.go │ ├── admin_policies_test.go │ ├── admin_profiling.go │ ├── admin_profiling_test.go │ ├── admin_releases.go │ ├── admin_releases_test.go │ ├── admin_remote_buckets.go │ ├── admin_remote_buckets_test.go │ ├── admin_replication_status.go │ ├── admin_service.go │ ├── admin_service_test.go │ ├── admin_site_replication.go │ ├── admin_site_replication_test.go │ ├── admin_speedtest.go │ ├── admin_tiers.go │ ├── admin_tiers_test.go │ ├── admin_trace.go │ ├── admin_trace_test.go │ ├── admin_users.go │ ├── admin_users_test.go │ ├── client-admin.go │ ├── client.go │ ├── client_test.go │ ├── config.go │ ├── config_test.go │ ├── configure_console.go │ ├── configure_console_test.go │ ├── consts.go │ ├── custom-server.go │ ├── doc.go │ ├── embedded_spec.go │ ├── errors.go │ ├── errors_test.go │ ├── logs.go │ ├── logs_test.go │ ├── operations/ │ │ ├── account/ │ │ │ ├── account_change_password.go │ │ │ ├── account_change_password_parameters.go │ │ │ ├── account_change_password_responses.go │ │ │ ├── account_change_password_urlbuilder.go │ │ │ ├── change_user_password.go │ │ │ ├── change_user_password_parameters.go │ │ │ ├── change_user_password_responses.go │ │ │ └── change_user_password_urlbuilder.go │ │ ├── auth/ │ │ │ ├── login.go │ │ │ ├── login_detail.go │ │ │ ├── login_detail_parameters.go │ │ │ ├── login_detail_responses.go │ │ │ ├── login_detail_urlbuilder.go │ │ │ ├── login_oauth2_auth.go │ │ │ ├── login_oauth2_auth_parameters.go │ │ │ ├── login_oauth2_auth_responses.go │ │ │ ├── login_oauth2_auth_urlbuilder.go │ │ │ ├── login_parameters.go │ │ │ ├── login_responses.go │ │ │ ├── login_urlbuilder.go │ │ │ ├── logout.go │ │ │ ├── logout_parameters.go │ │ │ ├── logout_responses.go │ │ │ ├── logout_urlbuilder.go │ │ │ ├── session_check.go │ │ │ ├── session_check_parameters.go │ │ │ ├── session_check_responses.go │ │ │ └── session_check_urlbuilder.go │ │ ├── bucket/ │ │ │ ├── add_bucket_lifecycle.go │ │ │ ├── add_bucket_lifecycle_parameters.go │ │ │ ├── add_bucket_lifecycle_responses.go │ │ │ ├── add_bucket_lifecycle_urlbuilder.go │ │ │ ├── add_multi_bucket_lifecycle.go │ │ │ ├── add_multi_bucket_lifecycle_parameters.go │ │ │ ├── add_multi_bucket_lifecycle_responses.go │ │ │ ├── add_multi_bucket_lifecycle_urlbuilder.go │ │ │ ├── add_remote_bucket.go │ │ │ ├── add_remote_bucket_parameters.go │ │ │ ├── add_remote_bucket_responses.go │ │ │ ├── add_remote_bucket_urlbuilder.go │ │ │ ├── bucket_info.go │ │ │ ├── bucket_info_parameters.go │ │ │ ├── bucket_info_responses.go │ │ │ ├── bucket_info_urlbuilder.go │ │ │ ├── bucket_set_policy.go │ │ │ ├── bucket_set_policy_parameters.go │ │ │ ├── bucket_set_policy_responses.go │ │ │ ├── bucket_set_policy_urlbuilder.go │ │ │ ├── create_bucket_event.go │ │ │ ├── create_bucket_event_parameters.go │ │ │ ├── create_bucket_event_responses.go │ │ │ ├── create_bucket_event_urlbuilder.go │ │ │ ├── delete_access_rule_with_bucket.go │ │ │ ├── delete_access_rule_with_bucket_parameters.go │ │ │ ├── delete_access_rule_with_bucket_responses.go │ │ │ ├── delete_access_rule_with_bucket_urlbuilder.go │ │ │ ├── delete_all_replication_rules.go │ │ │ ├── delete_all_replication_rules_parameters.go │ │ │ ├── delete_all_replication_rules_responses.go │ │ │ ├── delete_all_replication_rules_urlbuilder.go │ │ │ ├── delete_bucket.go │ │ │ ├── delete_bucket_event.go │ │ │ ├── delete_bucket_event_parameters.go │ │ │ ├── delete_bucket_event_responses.go │ │ │ ├── delete_bucket_event_urlbuilder.go │ │ │ ├── delete_bucket_lifecycle_rule.go │ │ │ ├── delete_bucket_lifecycle_rule_parameters.go │ │ │ ├── delete_bucket_lifecycle_rule_responses.go │ │ │ ├── delete_bucket_lifecycle_rule_urlbuilder.go │ │ │ ├── delete_bucket_parameters.go │ │ │ ├── delete_bucket_replication_rule.go │ │ │ ├── delete_bucket_replication_rule_parameters.go │ │ │ ├── delete_bucket_replication_rule_responses.go │ │ │ ├── delete_bucket_replication_rule_urlbuilder.go │ │ │ ├── delete_bucket_responses.go │ │ │ ├── delete_bucket_urlbuilder.go │ │ │ ├── delete_remote_bucket.go │ │ │ ├── delete_remote_bucket_parameters.go │ │ │ ├── delete_remote_bucket_responses.go │ │ │ ├── delete_remote_bucket_urlbuilder.go │ │ │ ├── delete_selected_replication_rules.go │ │ │ ├── delete_selected_replication_rules_parameters.go │ │ │ ├── delete_selected_replication_rules_responses.go │ │ │ ├── delete_selected_replication_rules_urlbuilder.go │ │ │ ├── disable_bucket_encryption.go │ │ │ ├── disable_bucket_encryption_parameters.go │ │ │ ├── disable_bucket_encryption_responses.go │ │ │ ├── disable_bucket_encryption_urlbuilder.go │ │ │ ├── enable_bucket_encryption.go │ │ │ ├── enable_bucket_encryption_parameters.go │ │ │ ├── enable_bucket_encryption_responses.go │ │ │ ├── enable_bucket_encryption_urlbuilder.go │ │ │ ├── get_bucket_encryption_info.go │ │ │ ├── get_bucket_encryption_info_parameters.go │ │ │ ├── get_bucket_encryption_info_responses.go │ │ │ ├── get_bucket_encryption_info_urlbuilder.go │ │ │ ├── get_bucket_lifecycle.go │ │ │ ├── get_bucket_lifecycle_parameters.go │ │ │ ├── get_bucket_lifecycle_responses.go │ │ │ ├── get_bucket_lifecycle_urlbuilder.go │ │ │ ├── get_bucket_object_locking_status.go │ │ │ ├── get_bucket_object_locking_status_parameters.go │ │ │ ├── get_bucket_object_locking_status_responses.go │ │ │ ├── get_bucket_object_locking_status_urlbuilder.go │ │ │ ├── get_bucket_quota.go │ │ │ ├── get_bucket_quota_parameters.go │ │ │ ├── get_bucket_quota_responses.go │ │ │ ├── get_bucket_quota_urlbuilder.go │ │ │ ├── get_bucket_replication.go │ │ │ ├── get_bucket_replication_parameters.go │ │ │ ├── get_bucket_replication_responses.go │ │ │ ├── get_bucket_replication_rule.go │ │ │ ├── get_bucket_replication_rule_parameters.go │ │ │ ├── get_bucket_replication_rule_responses.go │ │ │ ├── get_bucket_replication_rule_urlbuilder.go │ │ │ ├── get_bucket_replication_urlbuilder.go │ │ │ ├── get_bucket_retention_config.go │ │ │ ├── get_bucket_retention_config_parameters.go │ │ │ ├── get_bucket_retention_config_responses.go │ │ │ ├── get_bucket_retention_config_urlbuilder.go │ │ │ ├── get_bucket_rewind.go │ │ │ ├── get_bucket_rewind_parameters.go │ │ │ ├── get_bucket_rewind_responses.go │ │ │ ├── get_bucket_rewind_urlbuilder.go │ │ │ ├── get_bucket_versioning.go │ │ │ ├── get_bucket_versioning_parameters.go │ │ │ ├── get_bucket_versioning_responses.go │ │ │ ├── get_bucket_versioning_urlbuilder.go │ │ │ ├── get_max_share_link_exp.go │ │ │ ├── get_max_share_link_exp_parameters.go │ │ │ ├── get_max_share_link_exp_responses.go │ │ │ ├── get_max_share_link_exp_urlbuilder.go │ │ │ ├── list_access_rules_with_bucket.go │ │ │ ├── list_access_rules_with_bucket_parameters.go │ │ │ ├── list_access_rules_with_bucket_responses.go │ │ │ ├── list_access_rules_with_bucket_urlbuilder.go │ │ │ ├── list_bucket_events.go │ │ │ ├── list_bucket_events_parameters.go │ │ │ ├── list_bucket_events_responses.go │ │ │ ├── list_bucket_events_urlbuilder.go │ │ │ ├── list_buckets.go │ │ │ ├── list_buckets_parameters.go │ │ │ ├── list_buckets_responses.go │ │ │ ├── list_buckets_urlbuilder.go │ │ │ ├── list_external_buckets.go │ │ │ ├── list_external_buckets_parameters.go │ │ │ ├── list_external_buckets_responses.go │ │ │ ├── list_external_buckets_urlbuilder.go │ │ │ ├── list_policies_with_bucket.go │ │ │ ├── list_policies_with_bucket_parameters.go │ │ │ ├── list_policies_with_bucket_responses.go │ │ │ ├── list_policies_with_bucket_urlbuilder.go │ │ │ ├── list_remote_buckets.go │ │ │ ├── list_remote_buckets_parameters.go │ │ │ ├── list_remote_buckets_responses.go │ │ │ ├── list_remote_buckets_urlbuilder.go │ │ │ ├── list_users_with_access_to_bucket.go │ │ │ ├── list_users_with_access_to_bucket_parameters.go │ │ │ ├── list_users_with_access_to_bucket_responses.go │ │ │ ├── list_users_with_access_to_bucket_urlbuilder.go │ │ │ ├── make_bucket.go │ │ │ ├── make_bucket_parameters.go │ │ │ ├── make_bucket_responses.go │ │ │ ├── make_bucket_urlbuilder.go │ │ │ ├── put_bucket_tags.go │ │ │ ├── put_bucket_tags_parameters.go │ │ │ ├── put_bucket_tags_responses.go │ │ │ ├── put_bucket_tags_urlbuilder.go │ │ │ ├── remote_bucket_details.go │ │ │ ├── remote_bucket_details_parameters.go │ │ │ ├── remote_bucket_details_responses.go │ │ │ ├── remote_bucket_details_urlbuilder.go │ │ │ ├── set_access_rule_with_bucket.go │ │ │ ├── set_access_rule_with_bucket_parameters.go │ │ │ ├── set_access_rule_with_bucket_responses.go │ │ │ ├── set_access_rule_with_bucket_urlbuilder.go │ │ │ ├── set_bucket_quota.go │ │ │ ├── set_bucket_quota_parameters.go │ │ │ ├── set_bucket_quota_responses.go │ │ │ ├── set_bucket_quota_urlbuilder.go │ │ │ ├── set_bucket_retention_config.go │ │ │ ├── set_bucket_retention_config_parameters.go │ │ │ ├── set_bucket_retention_config_responses.go │ │ │ ├── set_bucket_retention_config_urlbuilder.go │ │ │ ├── set_bucket_versioning.go │ │ │ ├── set_bucket_versioning_parameters.go │ │ │ ├── set_bucket_versioning_responses.go │ │ │ ├── set_bucket_versioning_urlbuilder.go │ │ │ ├── set_multi_bucket_replication.go │ │ │ ├── set_multi_bucket_replication_parameters.go │ │ │ ├── set_multi_bucket_replication_responses.go │ │ │ ├── set_multi_bucket_replication_urlbuilder.go │ │ │ ├── update_bucket_lifecycle.go │ │ │ ├── update_bucket_lifecycle_parameters.go │ │ │ ├── update_bucket_lifecycle_responses.go │ │ │ ├── update_bucket_lifecycle_urlbuilder.go │ │ │ ├── update_multi_bucket_replication.go │ │ │ ├── update_multi_bucket_replication_parameters.go │ │ │ ├── update_multi_bucket_replication_responses.go │ │ │ └── update_multi_bucket_replication_urlbuilder.go │ │ ├── configuration/ │ │ │ ├── add_notification_endpoint.go │ │ │ ├── add_notification_endpoint_parameters.go │ │ │ ├── add_notification_endpoint_responses.go │ │ │ ├── add_notification_endpoint_urlbuilder.go │ │ │ ├── config_info.go │ │ │ ├── config_info_parameters.go │ │ │ ├── config_info_responses.go │ │ │ ├── config_info_urlbuilder.go │ │ │ ├── export_config.go │ │ │ ├── export_config_parameters.go │ │ │ ├── export_config_responses.go │ │ │ ├── export_config_urlbuilder.go │ │ │ ├── list_config.go │ │ │ ├── list_config_parameters.go │ │ │ ├── list_config_responses.go │ │ │ ├── list_config_urlbuilder.go │ │ │ ├── notification_endpoint_list.go │ │ │ ├── notification_endpoint_list_parameters.go │ │ │ ├── notification_endpoint_list_responses.go │ │ │ ├── notification_endpoint_list_urlbuilder.go │ │ │ ├── post_configs_import.go │ │ │ ├── post_configs_import_parameters.go │ │ │ ├── post_configs_import_responses.go │ │ │ ├── post_configs_import_urlbuilder.go │ │ │ ├── reset_config.go │ │ │ ├── reset_config_parameters.go │ │ │ ├── reset_config_responses.go │ │ │ ├── reset_config_urlbuilder.go │ │ │ ├── set_config.go │ │ │ ├── set_config_parameters.go │ │ │ ├── set_config_responses.go │ │ │ └── set_config_urlbuilder.go │ │ ├── console_api.go │ │ ├── group/ │ │ │ ├── add_group.go │ │ │ ├── add_group_parameters.go │ │ │ ├── add_group_responses.go │ │ │ ├── add_group_urlbuilder.go │ │ │ ├── group_info.go │ │ │ ├── group_info_parameters.go │ │ │ ├── group_info_responses.go │ │ │ ├── group_info_urlbuilder.go │ │ │ ├── list_groups.go │ │ │ ├── list_groups_parameters.go │ │ │ ├── list_groups_responses.go │ │ │ ├── list_groups_urlbuilder.go │ │ │ ├── remove_group.go │ │ │ ├── remove_group_parameters.go │ │ │ ├── remove_group_responses.go │ │ │ ├── remove_group_urlbuilder.go │ │ │ ├── update_group.go │ │ │ ├── update_group_parameters.go │ │ │ ├── update_group_responses.go │ │ │ └── update_group_urlbuilder.go │ │ ├── idp/ │ │ │ ├── create_configuration.go │ │ │ ├── create_configuration_parameters.go │ │ │ ├── create_configuration_responses.go │ │ │ ├── create_configuration_urlbuilder.go │ │ │ ├── delete_configuration.go │ │ │ ├── delete_configuration_parameters.go │ │ │ ├── delete_configuration_responses.go │ │ │ ├── delete_configuration_urlbuilder.go │ │ │ ├── get_configuration.go │ │ │ ├── get_configuration_parameters.go │ │ │ ├── get_configuration_responses.go │ │ │ ├── get_configuration_urlbuilder.go │ │ │ ├── get_l_d_a_p_entities.go │ │ │ ├── get_l_d_a_p_entities_parameters.go │ │ │ ├── get_l_d_a_p_entities_responses.go │ │ │ ├── get_l_d_a_p_entities_urlbuilder.go │ │ │ ├── list_configurations.go │ │ │ ├── list_configurations_parameters.go │ │ │ ├── list_configurations_responses.go │ │ │ ├── list_configurations_urlbuilder.go │ │ │ ├── update_configuration.go │ │ │ ├── update_configuration_parameters.go │ │ │ ├── update_configuration_responses.go │ │ │ └── update_configuration_urlbuilder.go │ │ ├── inspect/ │ │ │ ├── inspect.go │ │ │ ├── inspect_parameters.go │ │ │ ├── inspect_responses.go │ │ │ └── inspect_urlbuilder.go │ │ ├── k_m_s/ │ │ │ ├── k_m_s_apis.go │ │ │ ├── k_m_s_apis_parameters.go │ │ │ ├── k_m_s_apis_responses.go │ │ │ ├── k_m_s_apis_urlbuilder.go │ │ │ ├── k_m_s_create_key.go │ │ │ ├── k_m_s_create_key_parameters.go │ │ │ ├── k_m_s_create_key_responses.go │ │ │ ├── k_m_s_create_key_urlbuilder.go │ │ │ ├── k_m_s_key_status.go │ │ │ ├── k_m_s_key_status_parameters.go │ │ │ ├── k_m_s_key_status_responses.go │ │ │ ├── k_m_s_key_status_urlbuilder.go │ │ │ ├── k_m_s_list_keys.go │ │ │ ├── k_m_s_list_keys_parameters.go │ │ │ ├── k_m_s_list_keys_responses.go │ │ │ ├── k_m_s_list_keys_urlbuilder.go │ │ │ ├── k_m_s_metrics.go │ │ │ ├── k_m_s_metrics_parameters.go │ │ │ ├── k_m_s_metrics_responses.go │ │ │ ├── k_m_s_metrics_urlbuilder.go │ │ │ ├── k_m_s_status.go │ │ │ ├── k_m_s_status_parameters.go │ │ │ ├── k_m_s_status_responses.go │ │ │ ├── k_m_s_status_urlbuilder.go │ │ │ ├── k_m_s_version.go │ │ │ ├── k_m_s_version_parameters.go │ │ │ ├── k_m_s_version_responses.go │ │ │ └── k_m_s_version_urlbuilder.go │ │ ├── logging/ │ │ │ ├── log_search.go │ │ │ ├── log_search_parameters.go │ │ │ ├── log_search_responses.go │ │ │ └── log_search_urlbuilder.go │ │ ├── object/ │ │ │ ├── delete_multiple_objects.go │ │ │ ├── delete_multiple_objects_parameters.go │ │ │ ├── delete_multiple_objects_responses.go │ │ │ ├── delete_multiple_objects_urlbuilder.go │ │ │ ├── delete_object.go │ │ │ ├── delete_object_parameters.go │ │ │ ├── delete_object_responses.go │ │ │ ├── delete_object_retention.go │ │ │ ├── delete_object_retention_parameters.go │ │ │ ├── delete_object_retention_responses.go │ │ │ ├── delete_object_retention_urlbuilder.go │ │ │ ├── delete_object_urlbuilder.go │ │ │ ├── download_multiple_objects.go │ │ │ ├── download_multiple_objects_parameters.go │ │ │ ├── download_multiple_objects_responses.go │ │ │ ├── download_multiple_objects_urlbuilder.go │ │ │ ├── download_object.go │ │ │ ├── download_object_parameters.go │ │ │ ├── download_object_responses.go │ │ │ ├── download_object_urlbuilder.go │ │ │ ├── get_object_metadata.go │ │ │ ├── get_object_metadata_parameters.go │ │ │ ├── get_object_metadata_responses.go │ │ │ ├── get_object_metadata_urlbuilder.go │ │ │ ├── list_objects.go │ │ │ ├── list_objects_parameters.go │ │ │ ├── list_objects_responses.go │ │ │ ├── list_objects_urlbuilder.go │ │ │ ├── post_buckets_bucket_name_objects_upload.go │ │ │ ├── post_buckets_bucket_name_objects_upload_parameters.go │ │ │ ├── post_buckets_bucket_name_objects_upload_responses.go │ │ │ ├── post_buckets_bucket_name_objects_upload_urlbuilder.go │ │ │ ├── put_object_legal_hold.go │ │ │ ├── put_object_legal_hold_parameters.go │ │ │ ├── put_object_legal_hold_responses.go │ │ │ ├── put_object_legal_hold_urlbuilder.go │ │ │ ├── put_object_restore.go │ │ │ ├── put_object_restore_parameters.go │ │ │ ├── put_object_restore_responses.go │ │ │ ├── put_object_restore_urlbuilder.go │ │ │ ├── put_object_retention.go │ │ │ ├── put_object_retention_parameters.go │ │ │ ├── put_object_retention_responses.go │ │ │ ├── put_object_retention_urlbuilder.go │ │ │ ├── put_object_tags.go │ │ │ ├── put_object_tags_parameters.go │ │ │ ├── put_object_tags_responses.go │ │ │ ├── put_object_tags_urlbuilder.go │ │ │ ├── share_object.go │ │ │ ├── share_object_parameters.go │ │ │ ├── share_object_responses.go │ │ │ └── share_object_urlbuilder.go │ │ ├── policy/ │ │ │ ├── add_policy.go │ │ │ ├── add_policy_parameters.go │ │ │ ├── add_policy_responses.go │ │ │ ├── add_policy_urlbuilder.go │ │ │ ├── get_s_a_user_policy.go │ │ │ ├── get_s_a_user_policy_parameters.go │ │ │ ├── get_s_a_user_policy_responses.go │ │ │ ├── get_s_a_user_policy_urlbuilder.go │ │ │ ├── get_user_policy.go │ │ │ ├── get_user_policy_parameters.go │ │ │ ├── get_user_policy_responses.go │ │ │ ├── get_user_policy_urlbuilder.go │ │ │ ├── list_groups_for_policy.go │ │ │ ├── list_groups_for_policy_parameters.go │ │ │ ├── list_groups_for_policy_responses.go │ │ │ ├── list_groups_for_policy_urlbuilder.go │ │ │ ├── list_policies.go │ │ │ ├── list_policies_parameters.go │ │ │ ├── list_policies_responses.go │ │ │ ├── list_policies_urlbuilder.go │ │ │ ├── list_users_for_policy.go │ │ │ ├── list_users_for_policy_parameters.go │ │ │ ├── list_users_for_policy_responses.go │ │ │ ├── list_users_for_policy_urlbuilder.go │ │ │ ├── policy_info.go │ │ │ ├── policy_info_parameters.go │ │ │ ├── policy_info_responses.go │ │ │ ├── policy_info_urlbuilder.go │ │ │ ├── remove_policy.go │ │ │ ├── remove_policy_parameters.go │ │ │ ├── remove_policy_responses.go │ │ │ ├── remove_policy_urlbuilder.go │ │ │ ├── set_policy.go │ │ │ ├── set_policy_multiple.go │ │ │ ├── set_policy_multiple_parameters.go │ │ │ ├── set_policy_multiple_responses.go │ │ │ ├── set_policy_multiple_urlbuilder.go │ │ │ ├── set_policy_parameters.go │ │ │ ├── set_policy_responses.go │ │ │ └── set_policy_urlbuilder.go │ │ ├── profile/ │ │ │ ├── profiling_start.go │ │ │ ├── profiling_start_parameters.go │ │ │ ├── profiling_start_responses.go │ │ │ ├── profiling_start_urlbuilder.go │ │ │ ├── profiling_stop.go │ │ │ ├── profiling_stop_parameters.go │ │ │ ├── profiling_stop_responses.go │ │ │ └── profiling_stop_urlbuilder.go │ │ ├── public/ │ │ │ ├── download_shared_object.go │ │ │ ├── download_shared_object_parameters.go │ │ │ ├── download_shared_object_responses.go │ │ │ └── download_shared_object_urlbuilder.go │ │ ├── release/ │ │ │ ├── list_releases.go │ │ │ ├── list_releases_parameters.go │ │ │ ├── list_releases_responses.go │ │ │ └── list_releases_urlbuilder.go │ │ ├── service/ │ │ │ ├── restart_service.go │ │ │ ├── restart_service_parameters.go │ │ │ ├── restart_service_responses.go │ │ │ └── restart_service_urlbuilder.go │ │ ├── service_account/ │ │ │ ├── create_service_account.go │ │ │ ├── create_service_account_creds.go │ │ │ ├── create_service_account_creds_parameters.go │ │ │ ├── create_service_account_creds_responses.go │ │ │ ├── create_service_account_creds_urlbuilder.go │ │ │ ├── create_service_account_parameters.go │ │ │ ├── create_service_account_responses.go │ │ │ ├── create_service_account_urlbuilder.go │ │ │ ├── delete_multiple_service_accounts.go │ │ │ ├── delete_multiple_service_accounts_parameters.go │ │ │ ├── delete_multiple_service_accounts_responses.go │ │ │ ├── delete_multiple_service_accounts_urlbuilder.go │ │ │ ├── delete_service_account.go │ │ │ ├── delete_service_account_parameters.go │ │ │ ├── delete_service_account_responses.go │ │ │ ├── delete_service_account_urlbuilder.go │ │ │ ├── get_service_account.go │ │ │ ├── get_service_account_parameters.go │ │ │ ├── get_service_account_responses.go │ │ │ ├── get_service_account_urlbuilder.go │ │ │ ├── list_user_service_accounts.go │ │ │ ├── list_user_service_accounts_parameters.go │ │ │ ├── list_user_service_accounts_responses.go │ │ │ ├── list_user_service_accounts_urlbuilder.go │ │ │ ├── update_service_account.go │ │ │ ├── update_service_account_parameters.go │ │ │ ├── update_service_account_responses.go │ │ │ └── update_service_account_urlbuilder.go │ │ ├── site_replication/ │ │ │ ├── get_site_replication_info.go │ │ │ ├── get_site_replication_info_parameters.go │ │ │ ├── get_site_replication_info_responses.go │ │ │ ├── get_site_replication_info_urlbuilder.go │ │ │ ├── get_site_replication_status.go │ │ │ ├── get_site_replication_status_parameters.go │ │ │ ├── get_site_replication_status_responses.go │ │ │ ├── get_site_replication_status_urlbuilder.go │ │ │ ├── site_replication_edit.go │ │ │ ├── site_replication_edit_parameters.go │ │ │ ├── site_replication_edit_responses.go │ │ │ ├── site_replication_edit_urlbuilder.go │ │ │ ├── site_replication_info_add.go │ │ │ ├── site_replication_info_add_parameters.go │ │ │ ├── site_replication_info_add_responses.go │ │ │ ├── site_replication_info_add_urlbuilder.go │ │ │ ├── site_replication_remove.go │ │ │ ├── site_replication_remove_parameters.go │ │ │ ├── site_replication_remove_responses.go │ │ │ └── site_replication_remove_urlbuilder.go │ │ ├── system/ │ │ │ ├── admin_info.go │ │ │ ├── admin_info_parameters.go │ │ │ ├── admin_info_responses.go │ │ │ ├── admin_info_urlbuilder.go │ │ │ ├── arn_list.go │ │ │ ├── arn_list_parameters.go │ │ │ ├── arn_list_responses.go │ │ │ ├── arn_list_urlbuilder.go │ │ │ ├── dashboard_widget_details.go │ │ │ ├── dashboard_widget_details_parameters.go │ │ │ ├── dashboard_widget_details_responses.go │ │ │ ├── dashboard_widget_details_urlbuilder.go │ │ │ ├── list_nodes.go │ │ │ ├── list_nodes_parameters.go │ │ │ ├── list_nodes_responses.go │ │ │ └── list_nodes_urlbuilder.go │ │ ├── tiering/ │ │ │ ├── add_tier.go │ │ │ ├── add_tier_parameters.go │ │ │ ├── add_tier_responses.go │ │ │ ├── add_tier_urlbuilder.go │ │ │ ├── edit_tier_credentials.go │ │ │ ├── edit_tier_credentials_parameters.go │ │ │ ├── edit_tier_credentials_responses.go │ │ │ ├── edit_tier_credentials_urlbuilder.go │ │ │ ├── get_tier.go │ │ │ ├── get_tier_parameters.go │ │ │ ├── get_tier_responses.go │ │ │ ├── get_tier_urlbuilder.go │ │ │ ├── remove_tier.go │ │ │ ├── remove_tier_parameters.go │ │ │ ├── remove_tier_responses.go │ │ │ ├── remove_tier_urlbuilder.go │ │ │ ├── tiers_list.go │ │ │ ├── tiers_list_names.go │ │ │ ├── tiers_list_names_parameters.go │ │ │ ├── tiers_list_names_responses.go │ │ │ ├── tiers_list_names_urlbuilder.go │ │ │ ├── tiers_list_parameters.go │ │ │ ├── tiers_list_responses.go │ │ │ └── tiers_list_urlbuilder.go │ │ └── user/ │ │ ├── add_user.go │ │ ├── add_user_parameters.go │ │ ├── add_user_responses.go │ │ ├── add_user_urlbuilder.go │ │ ├── bulk_update_users_groups.go │ │ ├── bulk_update_users_groups_parameters.go │ │ ├── bulk_update_users_groups_responses.go │ │ ├── bulk_update_users_groups_urlbuilder.go │ │ ├── check_user_service_accounts.go │ │ ├── check_user_service_accounts_parameters.go │ │ ├── check_user_service_accounts_responses.go │ │ ├── check_user_service_accounts_urlbuilder.go │ │ ├── create_a_user_service_account.go │ │ ├── create_a_user_service_account_parameters.go │ │ ├── create_a_user_service_account_responses.go │ │ ├── create_a_user_service_account_urlbuilder.go │ │ ├── create_service_account_credentials.go │ │ ├── create_service_account_credentials_parameters.go │ │ ├── create_service_account_credentials_responses.go │ │ ├── create_service_account_credentials_urlbuilder.go │ │ ├── get_user_info.go │ │ ├── get_user_info_parameters.go │ │ ├── get_user_info_responses.go │ │ ├── get_user_info_urlbuilder.go │ │ ├── list_a_user_service_accounts.go │ │ ├── list_a_user_service_accounts_parameters.go │ │ ├── list_a_user_service_accounts_responses.go │ │ ├── list_a_user_service_accounts_urlbuilder.go │ │ ├── list_users.go │ │ ├── list_users_parameters.go │ │ ├── list_users_responses.go │ │ ├── list_users_urlbuilder.go │ │ ├── remove_user.go │ │ ├── remove_user_parameters.go │ │ ├── remove_user_responses.go │ │ ├── remove_user_urlbuilder.go │ │ ├── update_user_groups.go │ │ ├── update_user_groups_parameters.go │ │ ├── update_user_groups_responses.go │ │ ├── update_user_groups_urlbuilder.go │ │ ├── update_user_info.go │ │ ├── update_user_info_parameters.go │ │ ├── update_user_info_responses.go │ │ └── update_user_info_urlbuilder.go │ ├── policy/ │ │ ├── policies.go │ │ └── policies_test.go │ ├── public_objects.go │ ├── public_objects_test.go │ ├── server.go │ ├── service_accounts_handlers.go │ ├── service_accounts_handlers_test.go │ ├── tls.go │ ├── user_account.go │ ├── user_account_test.go │ ├── user_bucket_quota.go │ ├── user_buckets.go │ ├── user_buckets_events.go │ ├── user_buckets_events_test.go │ ├── user_buckets_lifecycle.go │ ├── user_buckets_lifecycle_test.go │ ├── user_buckets_test.go │ ├── user_log_search.go │ ├── user_log_search_test.go │ ├── user_login.go │ ├── user_login_test.go │ ├── user_logout.go │ ├── user_logout_test.go │ ├── user_objects.go │ ├── user_objects_test.go │ ├── user_session.go │ ├── user_session_test.go │ ├── user_watch.go │ ├── user_watch_test.go │ ├── utils.go │ ├── utils_test.go │ ├── ws_handle.go │ ├── ws_handle_test.go │ └── ws_objects.go ├── code_of_conduct.md ├── cross-compile.sh ├── docs/ │ ├── Debug.md │ ├── Environment.md │ ├── OIDC.md │ ├── README.md │ ├── TLS.md │ └── ldap/ │ ├── LDAP.md │ └── billy.ldif ├── generator.config.js ├── go.mod ├── go.sum ├── hack/ │ ├── header.go.txt │ └── update-codegen.sh ├── integration/ │ ├── access_rules_test.go │ ├── admin_api_integration_test.go │ ├── buckets_test.go │ ├── config_test.go │ ├── groups_test.go │ ├── inspect_test.go │ ├── login_test.go │ ├── objects_test.go │ ├── policy_test.go │ ├── profiling_test.go │ ├── sample-import-config.txt │ ├── service_account_test.go │ ├── tiers_test.go │ ├── user_api_bucket_test.go │ └── users_test.go ├── models/ │ ├── a_user_policy_response.go │ ├── access_rule.go │ ├── account_change_password_request.go │ ├── add_bucket_lifecycle.go │ ├── add_bucket_replication.go │ ├── add_group_request.go │ ├── add_multi_bucket_lifecycle.go │ ├── add_policy_request.go │ ├── add_user_request.go │ ├── admin_info_response.go │ ├── api_error.go │ ├── api_key.go │ ├── arns_response.go │ ├── backend_properties.go │ ├── bucket.go │ ├── bucket_access.go │ ├── bucket_encryption_info.go │ ├── bucket_encryption_request.go │ ├── bucket_encryption_type.go │ ├── bucket_event_request.go │ ├── bucket_lifecycle_response.go │ ├── bucket_ob_locking_response.go │ ├── bucket_object.go │ ├── bucket_quota.go │ ├── bucket_replication_destination.go │ ├── bucket_replication_response.go │ ├── bucket_replication_rule.go │ ├── bucket_replication_rule_list.go │ ├── bucket_versioning_response.go │ ├── bulk_user_groups.go │ ├── change_user_password_request.go │ ├── config_description.go │ ├── config_export_response.go │ ├── configuration.go │ ├── configuration_k_v.go │ ├── create_remote_bucket.go │ ├── delete_file.go │ ├── env_override.go │ ├── environment_constants.go │ ├── expiration_response.go │ ├── get_bucket_retention_config.go │ ├── group.go │ ├── iam_entity.go │ ├── iam_policy.go │ ├── iam_policy_statement.go │ ├── idp_list_configurations_response.go │ ├── idp_server_configuration.go │ ├── idp_server_configuration_info.go │ ├── kms_api.go │ ├── kms_apis_response.go │ ├── kms_create_key_request.go │ ├── kms_endpoint.go │ ├── kms_key_info.go │ ├── kms_key_status_response.go │ ├── kms_latency_histogram.go │ ├── kms_list_keys_response.go │ ├── kms_metrics_response.go │ ├── kms_status_response.go │ ├── kms_version_response.go │ ├── ldap_entities.go │ ├── ldap_entities_request.go │ ├── ldap_group_policy_entity.go │ ├── ldap_policy_entity.go │ ├── ldap_user_policy_entity.go │ ├── lifecycle_tag.go │ ├── list_access_rules_response.go │ ├── list_bucket_events_response.go │ ├── list_buckets_response.go │ ├── list_config_response.go │ ├── list_external_buckets_params.go │ ├── list_groups_response.go │ ├── list_objects_response.go │ ├── list_policies_response.go │ ├── list_remote_buckets_response.go │ ├── list_users_response.go │ ├── log_search_response.go │ ├── login_details.go │ ├── login_oauth2_auth_request.go │ ├── login_request.go │ ├── login_response.go │ ├── logout_request.go │ ├── make_bucket_request.go │ ├── make_buckets_response.go │ ├── max_share_link_exp_response.go │ ├── metadata.go │ ├── multi_bucket_replication.go │ ├── multi_bucket_replication_edit.go │ ├── multi_bucket_response_item.go │ ├── multi_bucket_response_state.go │ ├── multi_buckets_relation.go │ ├── multi_lifecycle_result.go │ ├── multicycle_result_item.go │ ├── nofitication_service.go │ ├── notif_endpoint_response.go │ ├── notification_config.go │ ├── notification_delete_request.go │ ├── notification_endpoint.go │ ├── notification_endpoint_item.go │ ├── notification_event_type.go │ ├── object_bucket_lifecycle.go │ ├── object_legal_hold_status.go │ ├── object_retention_mode.go │ ├── object_retention_unit.go │ ├── peer_info.go │ ├── peer_info_remove.go │ ├── peer_site.go │ ├── peer_site_edit_response.go │ ├── peer_site_remove_response.go │ ├── permission_resource.go │ ├── policy.go │ ├── policy_args.go │ ├── policy_entity.go │ ├── prefix_access_pair.go │ ├── prefix_wrapper.go │ ├── principal.go │ ├── profiling_start_request.go │ ├── put_bucket_retention_request.go │ ├── put_bucket_tags_request.go │ ├── put_object_legal_hold_request.go │ ├── put_object_retention_request.go │ ├── put_object_tags_request.go │ ├── redirect_rule.go │ ├── release_author.go │ ├── release_info.go │ ├── release_list_response.go │ ├── release_metadata.go │ ├── remote_bucket.go │ ├── result_target.go │ ├── rewind_item.go │ ├── rewind_response.go │ ├── selected_s_as.go │ ├── selected_users.go │ ├── server_drives.go │ ├── server_properties.go │ ├── service_account.go │ ├── service_account_creds.go │ ├── service_account_request.go │ ├── service_account_request_creds.go │ ├── service_accounts.go │ ├── session_response.go │ ├── set_bucket_policy_request.go │ ├── set_bucket_quota.go │ ├── set_bucket_versioning.go │ ├── set_config_request.go │ ├── set_config_response.go │ ├── set_id_p_response.go │ ├── set_notification_endpoint_response.go │ ├── set_policy_multiple_name_request.go │ ├── set_policy_name_request.go │ ├── set_policy_request.go │ ├── site_replication_add_request.go │ ├── site_replication_add_response.go │ ├── site_replication_info_response.go │ ├── site_replication_status_response.go │ ├── start_profiling_item.go │ ├── start_profiling_list.go │ ├── tier.go │ ├── tier_azure.go │ ├── tier_credentials_request.go │ ├── tier_gcs.go │ ├── tier_list_response.go │ ├── tier_minio.go │ ├── tier_s3.go │ ├── tiers_name_list_response.go │ ├── transition_response.go │ ├── update_bucket_lifecycle.go │ ├── update_group_request.go │ ├── update_service_account_request.go │ ├── update_user.go │ ├── update_user_groups.go │ ├── user.go │ ├── user_s_as.go │ ├── user_service_account_item.go │ ├── user_service_account_summary.go │ ├── widget.go │ ├── widget_details.go │ └── widget_result.go ├── pkg/ │ ├── auth/ │ │ ├── idp/ │ │ │ └── oauth2/ │ │ │ ├── config.go │ │ │ ├── const.go │ │ │ ├── provider.go │ │ │ ├── provider_test.go │ │ │ └── proxy.go │ │ ├── idp.go │ │ ├── ldap/ │ │ │ ├── config.go │ │ │ └── const.go │ │ ├── ldap.go │ │ ├── token/ │ │ │ ├── config.go │ │ │ └── const.go │ │ ├── token.go │ │ ├── token_test.go │ │ └── utils/ │ │ ├── utils.go │ │ └── utils_test.go │ ├── build-constants.go │ ├── certs/ │ │ ├── certs.go │ │ └── const.go │ ├── http/ │ │ ├── headers.go │ │ └── http.go │ ├── kes/ │ │ └── kes.go │ ├── logger/ │ │ ├── audit.go │ │ ├── color/ │ │ │ └── color.go │ │ ├── config/ │ │ │ ├── bool-flag.go │ │ │ ├── bool-flag_test.go │ │ │ ├── certs.go │ │ │ └── config.go │ │ ├── config.go │ │ ├── console.go │ │ ├── const.go │ │ ├── logger.go │ │ ├── logger_test.go │ │ ├── logonce.go │ │ ├── message/ │ │ │ ├── audit/ │ │ │ │ ├── entry.go │ │ │ │ └── entry_test.go │ │ │ └── log/ │ │ │ └── entry.go │ │ ├── reqinfo.go │ │ ├── target/ │ │ │ ├── http/ │ │ │ │ └── http.go │ │ │ └── types/ │ │ │ └── types.go │ │ ├── targets.go │ │ └── utils.go │ └── utils/ │ ├── parity.go │ ├── parity_test.go │ ├── utils.go │ └── utils_test.go ├── policies/ │ └── mcsTestUserAddOnly.json ├── replication/ │ ├── admin_api_int_replication_test.go │ └── replication_test.go ├── semgrep.yaml ├── sso-integration/ │ ├── Dockerfile │ ├── allaccess.json │ ├── config.docker.yaml │ ├── dex-requests.py │ ├── set-sso.sh │ └── sso_test.go ├── swagger.yml ├── systemd/ │ ├── README.md │ └── console.service ├── verify-gofmt.sh └── web-app/ ├── .dockerignore ├── .gitignore ├── .prettierignore ├── .yarnrc.yml ├── Makefile ├── README.md ├── assets.go ├── build/ │ ├── asset-manifest.json │ ├── index.html │ ├── manifest.json │ ├── robots.txt │ ├── scripts/ │ │ └── pdf.worker.min.mjs │ ├── static/ │ │ ├── css/ │ │ │ └── main.849b542e.css │ │ └── js/ │ │ ├── 1004.94dbce53.chunk.js │ │ ├── 116.d72fac0b.chunk.js │ │ ├── 1366.a5842d56.chunk.js │ │ ├── 1378.ffc1d661.chunk.js │ │ ├── 1621.35fa42d6.chunk.js │ │ ├── 1621.35fa42d6.chunk.js.LICENSE.txt │ │ ├── 1634.23887961.chunk.js │ │ ├── 1715.61cf86b7.chunk.js │ │ ├── 1869.0f80c90a.chunk.js │ │ ├── 1988.2b6fa00d.chunk.js │ │ ├── 2258.bea2d07d.chunk.js │ │ ├── 2499.a423e5db.chunk.js │ │ ├── 2587.58909bb0.chunk.js │ │ ├── 2643.b6d050d3.chunk.js │ │ ├── 2684.cee177f0.chunk.js │ │ ├── 2797.c53d9c9c.chunk.js │ │ ├── 2896.27ff0208.chunk.js │ │ ├── 2928.af13ae72.chunk.js │ │ ├── 2979.d9dd067b.chunk.js │ │ ├── 3126.ab390859.chunk.js │ │ ├── 3214.fea55249.chunk.js │ │ ├── 3477.939cdb31.chunk.js │ │ ├── 3541.34ae70ef.chunk.js │ │ ├── 3576.48953e5a.chunk.js │ │ ├── 3697.280e7ecf.chunk.js │ │ ├── 4043.e97d09a3.chunk.js │ │ ├── 4121.672bbdc8.chunk.js │ │ ├── 4169.3a4d800e.chunk.js │ │ ├── 4186.1b3f78a1.chunk.js │ │ ├── 4274.d6ff493f.chunk.js │ │ ├── 4388.c0e588bd.chunk.js │ │ ├── 4402.d8bb81a3.chunk.js │ │ ├── 4517.15f50225.chunk.js │ │ ├── 4540.316758ac.chunk.js │ │ ├── 4599.93da78de.chunk.js │ │ ├── 4758.afaddc33.chunk.js │ │ ├── 4803.2a486f1b.chunk.js │ │ ├── 4857.67bcd6f9.chunk.js │ │ ├── 4860.8173be96.chunk.js │ │ ├── 4945.b4f6f750.chunk.js │ │ ├── 4964.f7712fa8.chunk.js │ │ ├── 5028.833420c4.chunk.js │ │ ├── 5169.56e4888a.chunk.js │ │ ├── 5238.898e912e.chunk.js │ │ ├── 5354.36064e92.chunk.js │ │ ├── 5412.b0127d7a.chunk.js │ │ ├── 5465.15dfdf24.chunk.js │ │ ├── 5503.a9d9da00.chunk.js │ │ ├── 5692.b701d50d.chunk.js │ │ ├── 583.e6916889.chunk.js │ │ ├── 593.fb5ea6de.chunk.js │ │ ├── 5938.d0dc8bf3.chunk.js │ │ ├── 6215.3dec8894.chunk.js │ │ ├── 6242.25b871ee.chunk.js │ │ ├── 6243.51dc4462.chunk.js │ │ ├── 6481.1beeaf32.chunk.js │ │ ├── 6582.fb2dceaa.chunk.js │ │ ├── 66.6c94b445.chunk.js │ │ ├── 6644.3349262e.chunk.js │ │ ├── 6681.f34cfbfa.chunk.js │ │ ├── 669.866766bf.chunk.js │ │ ├── 6777.1a21cf18.chunk.js │ │ ├── 68.5a8e7ba6.chunk.js │ │ ├── 7102.48ea23c8.chunk.js │ │ ├── 7356.1ab60708.chunk.js │ │ ├── 7401.cd4f5830.chunk.js │ │ ├── 7445.06fee929.chunk.js │ │ ├── 7470.4b28f453.chunk.js │ │ ├── 7470.4b28f453.chunk.js.LICENSE.txt │ │ ├── 7478.9b6bd422.chunk.js │ │ ├── 7726.c9f4960e.chunk.js │ │ ├── 7852.bfb1c5b8.chunk.js │ │ ├── 7945.1d42d287.chunk.js │ │ ├── 7958.d5f7989a.chunk.js │ │ ├── 8231.bab4a43e.chunk.js │ │ ├── 830.04e6023f.chunk.js │ │ ├── 8308.c3429aec.chunk.js │ │ ├── 8350.64629895.chunk.js │ │ ├── 8399.dbae1106.chunk.js │ │ ├── 8530.2dee5b9d.chunk.js │ │ ├── 8682.65338008.chunk.js │ │ ├── 8796.ac13ad63.chunk.js │ │ ├── 8814.7ba6f8b7.chunk.js │ │ ├── 8894.9c332859.chunk.js │ │ ├── 9010.7725b372.chunk.js │ │ ├── 9033.aff6b0dd.chunk.js │ │ ├── 9117.7b97d98c.chunk.js │ │ ├── 9185.d32ef307.chunk.js │ │ ├── 9287.b2ca0f5b.chunk.js │ │ ├── 9459.730903fb.chunk.js │ │ ├── 9506.7c8601f3.chunk.js │ │ ├── 9559.466e0cc4.chunk.js │ │ ├── 9636.04da1350.chunk.js │ │ ├── main.b547a4b9.js │ │ └── main.b547a4b9.js.LICENSE.txt │ └── styles/ │ └── root-styles.css ├── check-deadcode.sh ├── check-prettier.sh ├── check-warnings-istanbul-coverage.sh ├── check-warnings.sh ├── e2e/ │ ├── auth.setup.ts │ ├── buckets.spec.ts │ ├── consts.ts │ ├── fixtures/ │ │ └── baseFixture.ts │ ├── groups.spec.ts │ ├── lifecycle.spec.ts │ ├── login.spec.ts │ ├── policies.spec.ts │ └── pom/ │ ├── BucketSummaryPage.tsx │ ├── BucketsListPage.tsx │ └── CreateBucketPage.tsx ├── index.html ├── knip.config.ts ├── package.json ├── playwright/ │ └── jobs.yaml ├── playwright.config.ts ├── public/ │ ├── manifest.json │ ├── robots.txt │ ├── scripts/ │ │ └── pdf.worker.min.mjs │ └── styles/ │ └── root-styles.css ├── src/ │ ├── MainRouter.tsx │ ├── ProtectedRoutes.tsx │ ├── StyleHandler.tsx │ ├── api/ │ │ ├── consoleApi.ts │ │ ├── errors.ts │ │ └── index.ts │ ├── common/ │ │ ├── Copyright.tsx │ │ ├── LoadingComponent.tsx │ │ ├── MoreLink.tsx │ │ ├── SecureComponent/ │ │ │ ├── SecureComponent.tsx │ │ │ ├── accessControl.ts │ │ │ ├── index.ts │ │ │ └── permissions.ts │ │ ├── api/ │ │ │ └── index.ts │ │ ├── types.ts │ │ └── utils.ts │ ├── config.ts │ ├── history.ts │ ├── icons/ │ │ └── SidebarMenus/ │ │ ├── EncryptionIcon.tsx │ │ └── EncryptionStatusIcon.tsx │ ├── index.css │ ├── index.tsx │ ├── screens/ │ │ ├── AnonymousAccess/ │ │ │ └── AnonymousAccess.tsx │ │ ├── Console/ │ │ │ ├── Account/ │ │ │ │ ├── Account.tsx │ │ │ │ ├── AccountUtils.tsx │ │ │ │ ├── AddServiceAccountHelpBox.tsx │ │ │ │ ├── AddServiceAccountScreen.tsx │ │ │ │ ├── ChangePasswordModal.tsx │ │ │ │ ├── ChangeUserPasswordModal.tsx │ │ │ │ ├── DeleteServiceAccount.tsx │ │ │ │ ├── EditServiceAccount.tsx │ │ │ │ └── NotificationEndpointTypeSelectorHelpBox.tsx │ │ │ ├── Buckets/ │ │ │ │ ├── BucketDetails/ │ │ │ │ │ ├── AccessDetailsPanel.tsx │ │ │ │ │ ├── AccessRulePanel.tsx │ │ │ │ │ ├── AddAccessRule.tsx │ │ │ │ │ ├── AddBucketReplication.tsx │ │ │ │ │ ├── AddBucketTagModal.tsx │ │ │ │ │ ├── AddEvent.tsx │ │ │ │ │ ├── AddKeyModal.tsx │ │ │ │ │ ├── AddLifecycleModal.tsx │ │ │ │ │ ├── AddReplicationModal.tsx │ │ │ │ │ ├── BrowserHandler.tsx │ │ │ │ │ ├── BucketDetails.tsx │ │ │ │ │ ├── BucketEventsPanel.tsx │ │ │ │ │ ├── BucketLifecyclePanel.tsx │ │ │ │ │ ├── BucketReplicationPanel.tsx │ │ │ │ │ ├── BucketSummaryPanel.tsx │ │ │ │ │ ├── DeleteAccessRule.tsx │ │ │ │ │ ├── DeleteBucketLifecycleRule.tsx │ │ │ │ │ ├── DeleteBucketTagModal.tsx │ │ │ │ │ ├── DeleteEvent.tsx │ │ │ │ │ ├── DeleteReplicationRule.tsx │ │ │ │ │ ├── EditAccessRule.tsx │ │ │ │ │ ├── EditBucketReplication.tsx │ │ │ │ │ ├── EditLifecycleConfiguration.tsx │ │ │ │ │ ├── EditReplicationModal.tsx │ │ │ │ │ ├── EnableBucketEncryption.tsx │ │ │ │ │ ├── EnableQuota.tsx │ │ │ │ │ ├── EnableVersioningModal.tsx │ │ │ │ │ ├── SetAccessPolicy.tsx │ │ │ │ │ ├── SetRetentionConfig.tsx │ │ │ │ │ ├── SummaryItems/ │ │ │ │ │ │ ├── BucketQuotaSize.tsx │ │ │ │ │ │ ├── BucketTags.tsx │ │ │ │ │ │ ├── EditActionButton.tsx │ │ │ │ │ │ ├── EditablePropertyItem.tsx │ │ │ │ │ │ ├── LabelWithIcon.tsx │ │ │ │ │ │ └── ReportedUsage.tsx │ │ │ │ │ └── bucketDetailsSlice.ts │ │ │ │ ├── Buckets.tsx │ │ │ │ ├── ListBuckets/ │ │ │ │ │ ├── AddBucket/ │ │ │ │ │ │ ├── AddBucket.tsx │ │ │ │ │ │ ├── AddBucketModal.tsx │ │ │ │ │ │ ├── AddBucketName.tsx │ │ │ │ │ │ ├── BucketNamingRules.tsx │ │ │ │ │ │ ├── InvalidRule.tsx │ │ │ │ │ │ ├── NARule.tsx │ │ │ │ │ │ ├── ValidRule.tsx │ │ │ │ │ │ ├── addBucketThunks.ts │ │ │ │ │ │ └── addBucketsSlice.ts │ │ │ │ │ ├── BucketListItem.tsx │ │ │ │ │ ├── BulkLifecycleModal.tsx │ │ │ │ │ ├── BulkReplicationModal.tsx │ │ │ │ │ ├── DeleteBucket.tsx │ │ │ │ │ ├── ListBuckets.tsx │ │ │ │ │ ├── Objects/ │ │ │ │ │ │ ├── ListObjects/ │ │ │ │ │ │ │ ├── CreatePathModal.tsx │ │ │ │ │ │ │ ├── DeleteMultipleObjects.tsx │ │ │ │ │ │ │ ├── DeleteNonCurrent.tsx │ │ │ │ │ │ │ ├── DeleteObject.tsx │ │ │ │ │ │ │ ├── DetailsListPanel.tsx │ │ │ │ │ │ │ ├── IconWithLabel.tsx │ │ │ │ │ │ │ ├── InspectObject.tsx │ │ │ │ │ │ │ ├── ListObjects.tsx │ │ │ │ │ │ │ ├── ListObjectsHelpers.tsx │ │ │ │ │ │ │ ├── ListObjectsTable.tsx │ │ │ │ │ │ │ ├── ObjectDetailPanel.tsx │ │ │ │ │ │ │ ├── RewindEnable.tsx │ │ │ │ │ │ │ ├── types.tsx │ │ │ │ │ │ │ └── utils.tsx │ │ │ │ │ │ ├── ObjectDetails/ │ │ │ │ │ │ │ ├── DeleteSelectedVersions.tsx │ │ │ │ │ │ │ ├── FileVersionItem.tsx │ │ │ │ │ │ │ ├── ObjectMetaData.tsx │ │ │ │ │ │ │ ├── RestoreFileVersion.tsx │ │ │ │ │ │ │ ├── SetLegalHoldModal.tsx │ │ │ │ │ │ │ ├── SetRetention.tsx │ │ │ │ │ │ │ ├── ShareFile.tsx │ │ │ │ │ │ │ ├── SpecificVersionPill.tsx │ │ │ │ │ │ │ ├── TagsModal.tsx │ │ │ │ │ │ │ ├── VersionsNavigator.tsx │ │ │ │ │ │ │ └── types.ts │ │ │ │ │ │ ├── Preview/ │ │ │ │ │ │ │ ├── PreviewFileContent.tsx │ │ │ │ │ │ │ ├── PreviewFileModal.tsx │ │ │ │ │ │ │ └── PreviewPDF.tsx │ │ │ │ │ │ └── utils.ts │ │ │ │ │ ├── UploadFilesButton.tsx │ │ │ │ │ └── UploadPermissionUtils.ts │ │ │ │ ├── VersioningInfo.tsx │ │ │ │ └── types.tsx │ │ │ ├── CommandBar.tsx │ │ │ ├── Common/ │ │ │ │ ├── Components/ │ │ │ │ │ ├── AutoColorIcon.tsx │ │ │ │ │ └── withSuspense.tsx │ │ │ │ ├── ComponentsScreen.tsx │ │ │ │ ├── CredentialsPrompt/ │ │ │ │ │ ├── CredentialItem.tsx │ │ │ │ │ ├── CredentialsPrompt.tsx │ │ │ │ │ └── types.ts │ │ │ │ ├── DarkModeActivator/ │ │ │ │ │ └── DarkModeActivator.tsx │ │ │ │ ├── DistributedOnly/ │ │ │ │ │ └── DistributedOnly.tsx │ │ │ │ ├── FormComponents/ │ │ │ │ │ ├── CSVMultiSelector/ │ │ │ │ │ │ └── CSVMultiSelector.tsx │ │ │ │ │ ├── CodeMirrorWrapper/ │ │ │ │ │ │ └── CodeMirrorWrapper.tsx │ │ │ │ │ ├── DateRangeSelector/ │ │ │ │ │ │ └── DateRangeSelector.tsx │ │ │ │ │ ├── DateSelector/ │ │ │ │ │ │ ├── DateSelector.tsx │ │ │ │ │ │ └── utils.ts │ │ │ │ │ ├── DaysSelector/ │ │ │ │ │ │ └── DaysSelector.tsx │ │ │ │ │ ├── FilterInputWrapper/ │ │ │ │ │ │ └── FilterInputWrapper.tsx │ │ │ │ │ ├── InputUnitMenu/ │ │ │ │ │ │ └── InputUnitMenu.tsx │ │ │ │ │ ├── QueryMultiSelector/ │ │ │ │ │ │ └── QueryMultiSelector.tsx │ │ │ │ │ └── common/ │ │ │ │ │ └── styleLibrary.ts │ │ │ │ ├── Hooks/ │ │ │ │ │ └── useApi.tsx │ │ │ │ ├── IconsScreen.tsx │ │ │ │ ├── MainError/ │ │ │ │ │ └── MainError.tsx │ │ │ │ ├── MissingIntegration/ │ │ │ │ │ └── MissingIntegration.tsx │ │ │ │ ├── ModalWrapper/ │ │ │ │ │ ├── ConfirmDialog.tsx │ │ │ │ │ └── ModalWrapper.tsx │ │ │ │ ├── ObjectManager/ │ │ │ │ │ ├── ObjectHandled.tsx │ │ │ │ │ ├── ObjectManager.tsx │ │ │ │ │ ├── ObjectManagerButton.tsx │ │ │ │ │ └── TrafficMonitor.tsx │ │ │ │ ├── PageHeaderWrapper/ │ │ │ │ │ └── PageHeaderWrapper.tsx │ │ │ │ ├── PanelTitle/ │ │ │ │ │ └── PanelTitle.tsx │ │ │ │ ├── ProgressBarWrapper/ │ │ │ │ │ └── ProgressBarWrapper.tsx │ │ │ │ ├── SearchBox.tsx │ │ │ │ ├── TestWrapper/ │ │ │ │ │ └── TestWrapper.tsx │ │ │ │ ├── TooltipWrapper/ │ │ │ │ │ └── TooltipWrapper.tsx │ │ │ │ └── VirtualizedList/ │ │ │ │ └── VirtualizedList.tsx │ │ │ ├── Configurations/ │ │ │ │ ├── ConfigurationPanels/ │ │ │ │ │ ├── ConfigurationForm.tsx │ │ │ │ │ ├── ConfigurationOptions.tsx │ │ │ │ │ ├── ExportConfigButton.tsx │ │ │ │ │ └── ImportConfigButton.tsx │ │ │ │ ├── SiteReplication/ │ │ │ │ │ ├── AddReplicationSites.tsx │ │ │ │ │ ├── EditSiteEndPoint.tsx │ │ │ │ │ ├── EntityReplicationLookup.tsx │ │ │ │ │ ├── LookupStatus/ │ │ │ │ │ │ ├── BucketEntityStatus.tsx │ │ │ │ │ │ ├── GroupEntityStatus.tsx │ │ │ │ │ │ ├── LookupStatusTable.tsx │ │ │ │ │ │ ├── PolicyEntityStatus.tsx │ │ │ │ │ │ ├── UserEntityStatus.tsx │ │ │ │ │ │ └── Utils.tsx │ │ │ │ │ ├── ReplicationSites.tsx │ │ │ │ │ ├── SRSiteInputRow.tsx │ │ │ │ │ ├── SiteReplication.tsx │ │ │ │ │ ├── SiteReplicationStatus.tsx │ │ │ │ │ └── Types.tsx │ │ │ │ ├── TiersConfiguration/ │ │ │ │ │ ├── AddTierConfiguration.tsx │ │ │ │ │ ├── DeleteTierConfirmModal.tsx │ │ │ │ │ ├── ListTiersConfiguration.tsx │ │ │ │ │ ├── RegionSelectWrapper.tsx │ │ │ │ │ ├── TierTypeCard.tsx │ │ │ │ │ ├── TierTypeSelector.tsx │ │ │ │ │ ├── UpdateTierCredentialsModal.tsx │ │ │ │ │ ├── azure-regions.ts │ │ │ │ │ ├── gcs-regions.ts │ │ │ │ │ ├── s3-regions.tsx │ │ │ │ │ └── utils.tsx │ │ │ │ ├── types.ts │ │ │ │ └── utils.tsx │ │ │ ├── Console.tsx │ │ │ ├── ConsoleKBar.tsx │ │ │ ├── Dashboard/ │ │ │ │ ├── BasicDashboard/ │ │ │ │ │ ├── BasicDashboard.tsx │ │ │ │ │ ├── CounterCard.tsx │ │ │ │ │ ├── DriveInfoItem.tsx │ │ │ │ │ ├── ReportedUsage.tsx │ │ │ │ │ ├── ServerInfoItem.tsx │ │ │ │ │ ├── ServersList.tsx │ │ │ │ │ ├── StatusCountCard.tsx │ │ │ │ │ └── Utils.tsx │ │ │ │ ├── CommonCard.tsx │ │ │ │ ├── Dashboard.tsx │ │ │ │ ├── DashboardItemBox.tsx │ │ │ │ ├── DownloadWidgetDataButton.tsx │ │ │ │ ├── Prometheus/ │ │ │ │ │ ├── MergedWidgets.tsx │ │ │ │ │ ├── PrDashboard.tsx │ │ │ │ │ ├── Widgets/ │ │ │ │ │ │ ├── BarChartWidget.tsx │ │ │ │ │ │ ├── BucketsCountItem.tsx │ │ │ │ │ │ ├── CapacityItem.tsx │ │ │ │ │ │ ├── DualStatCard.tsx │ │ │ │ │ │ ├── EntityStateItemRenderer.tsx │ │ │ │ │ │ ├── EntityStateStatItem.tsx │ │ │ │ │ │ ├── ExpandGraphLink.tsx │ │ │ │ │ │ ├── HealActivityRenderer.tsx │ │ │ │ │ │ ├── LayoutUtil.tsx │ │ │ │ │ │ ├── LinearGraphWidget.tsx │ │ │ │ │ │ ├── MergedWidgetsRenderer.tsx │ │ │ │ │ │ ├── NetworkGetItem.tsx │ │ │ │ │ │ ├── NetworkItem.tsx │ │ │ │ │ │ ├── NetworkPutItem.tsx │ │ │ │ │ │ ├── NumericStatCard.tsx │ │ │ │ │ │ ├── ObjectsCountItem.tsx │ │ │ │ │ │ ├── PieChartWidget.tsx │ │ │ │ │ │ ├── ScanActivityRenderer.tsx │ │ │ │ │ │ ├── SimpleWidget.tsx │ │ │ │ │ │ ├── SingleRepWidget.tsx │ │ │ │ │ │ ├── SingleValueWidget.tsx │ │ │ │ │ │ ├── UptimeActivityRenderer.tsx │ │ │ │ │ │ ├── tooltips/ │ │ │ │ │ │ │ ├── BarChartTooltip.tsx │ │ │ │ │ │ │ └── LineChartTooltip.tsx │ │ │ │ │ │ └── types.ts │ │ │ │ │ ├── ZoomWidget.tsx │ │ │ │ │ ├── types.ts │ │ │ │ │ ├── utils.tsx │ │ │ │ │ └── widgetUtils.tsx │ │ │ │ ├── TimeStatItem.tsx │ │ │ │ ├── dashboardSlice.ts │ │ │ │ ├── dashboardThunks.ts │ │ │ │ └── types.ts │ │ │ ├── EventDestinations/ │ │ │ │ ├── AddEventDestination.tsx │ │ │ │ ├── ConfTargetGeneric.tsx │ │ │ │ ├── ConfirmDeleteDestinationModal.tsx │ │ │ │ ├── CustomForms/ │ │ │ │ │ ├── ConfMySql.tsx │ │ │ │ │ ├── ConfPostgres.tsx │ │ │ │ │ ├── EditConfiguration.tsx │ │ │ │ │ └── ResetConfigurationModal.tsx │ │ │ │ ├── DestinationButton.tsx │ │ │ │ ├── EventDestinations.tsx │ │ │ │ ├── EventTypeSelector.tsx │ │ │ │ ├── ListEventDestinations.tsx │ │ │ │ ├── TargetTitle.tsx │ │ │ │ ├── WebhookSettings/ │ │ │ │ │ ├── AddEndpointModal.tsx │ │ │ │ │ ├── DeleteWebhookEndpoint.tsx │ │ │ │ │ ├── EditWebhookEndpoint.tsx │ │ │ │ │ └── WebhookSettings.tsx │ │ │ │ ├── destinationsSlice.ts │ │ │ │ ├── types.ts │ │ │ │ └── utils.ts │ │ │ ├── Groups/ │ │ │ │ ├── AddGroupHelpBox.tsx │ │ │ │ ├── AddGroupMember.tsx │ │ │ │ ├── AddGroupScreen.tsx │ │ │ │ ├── DeleteGroup.tsx │ │ │ │ ├── Groups.tsx │ │ │ │ ├── GroupsDetails.tsx │ │ │ │ ├── UsersSelectors.tsx │ │ │ │ └── types.ts │ │ │ ├── HealthInfo/ │ │ │ │ ├── HealthInfo.tsx │ │ │ │ ├── HealthInfoResults.tsx │ │ │ │ ├── healthInfoSlice.ts │ │ │ │ └── types.ts │ │ │ ├── HelpItem.tsx │ │ │ ├── HelpMenu.tsx │ │ │ ├── HelpMenu.types.ts │ │ │ ├── IDP/ │ │ │ │ ├── AddIDPConfiguration.tsx │ │ │ │ ├── AddIDPConfigurationHelpbox.tsx │ │ │ │ ├── AddIDPOpenIDConfiguration.tsx │ │ │ │ ├── DeleteIDPConfigurationModal.tsx │ │ │ │ ├── IDPConfigurationDetails.tsx │ │ │ │ ├── IDPConfigurations.tsx │ │ │ │ ├── IDPOpenIDConfigurationDetails.tsx │ │ │ │ ├── IDPOpenIDConfigurations.tsx │ │ │ │ ├── LDAP/ │ │ │ │ │ ├── IDPLDAPConfigurationDetails.tsx │ │ │ │ │ ├── LDAPEntitiesQuery.tsx │ │ │ │ │ └── LDAPResultsBlock.tsx │ │ │ │ └── utils.tsx │ │ │ ├── KMS/ │ │ │ │ ├── AddKey.tsx │ │ │ │ ├── AddKeyForm.tsx │ │ │ │ ├── KMSHelpbox.tsx │ │ │ │ ├── KMSRoutes.tsx │ │ │ │ ├── ListKeys.tsx │ │ │ │ └── Status.tsx │ │ │ ├── License/ │ │ │ │ └── License.tsx │ │ │ ├── Logs/ │ │ │ │ ├── ErrorLogs/ │ │ │ │ │ ├── ErrorLogs.tsx │ │ │ │ │ └── LogLine.tsx │ │ │ │ ├── LogSearch/ │ │ │ │ │ ├── LogSearchFullModal.tsx │ │ │ │ │ ├── LogsSearchMain.tsx │ │ │ │ │ ├── types.ts │ │ │ │ │ └── utils.ts │ │ │ │ ├── logsSlice.ts │ │ │ │ └── types.ts │ │ │ ├── Menu/ │ │ │ │ ├── Listing/ │ │ │ │ │ ├── BucketFiltering.tsx │ │ │ │ │ ├── BucketListItem.tsx │ │ │ │ │ └── BucketsListing.tsx │ │ │ │ ├── MenuWrapper.tsx │ │ │ │ ├── UserMenu.tsx │ │ │ │ └── types.ts │ │ │ ├── ObjectBrowser/ │ │ │ │ ├── BrowserBreadcrumbs.tsx │ │ │ │ ├── FilterObjectsSB.tsx │ │ │ │ ├── OBBucketList.tsx │ │ │ │ ├── OBHeader.tsx │ │ │ │ ├── ObjectBrowser.tsx │ │ │ │ ├── RenameLongFilename.tsx │ │ │ │ ├── objectBrowserSlice.ts │ │ │ │ ├── objectBrowserThunks.ts │ │ │ │ ├── transferManager.ts │ │ │ │ ├── types.ts │ │ │ │ └── utils.ts │ │ │ ├── Policies/ │ │ │ │ ├── AddPolicyHelpBox.tsx │ │ │ │ ├── AddPolicyScreen.tsx │ │ │ │ ├── DeletePolicy.tsx │ │ │ │ ├── ListPolicies.tsx │ │ │ │ ├── Policies.tsx │ │ │ │ ├── PolicyDetails.tsx │ │ │ │ ├── PolicySelectors.tsx │ │ │ │ ├── PolicyView.tsx │ │ │ │ ├── SetPolicy.tsx │ │ │ │ ├── types.ts │ │ │ │ └── utils.ts │ │ │ ├── Speedtest/ │ │ │ │ ├── STResults.tsx │ │ │ │ ├── SpeedTestUnit.tsx │ │ │ │ ├── Speedtest.tsx │ │ │ │ ├── types.ts │ │ │ │ └── utils.ts │ │ │ ├── Support/ │ │ │ │ └── Profile.tsx │ │ │ ├── Tools/ │ │ │ │ ├── Inspect.tsx │ │ │ │ ├── KeyRevealer.tsx │ │ │ │ └── Tools.tsx │ │ │ ├── Trace/ │ │ │ │ ├── Trace.tsx │ │ │ │ ├── traceSlice.ts │ │ │ │ └── types.ts │ │ │ ├── Users/ │ │ │ │ ├── AddUserHelpBox.tsx │ │ │ │ ├── AddUserScreen.tsx │ │ │ │ ├── AddUserServiceAccountHelpBox.tsx │ │ │ │ ├── AddUserServiceAccountScreen.tsx │ │ │ │ ├── AddUsersSlice.tsx │ │ │ │ ├── BulkAddToGroup.tsx │ │ │ │ ├── ChangeUserGroups.tsx │ │ │ │ ├── DeleteMultipleServiceAccounts.tsx │ │ │ │ ├── DeleteUser.tsx │ │ │ │ ├── GroupsSelectors.tsx │ │ │ │ ├── ListUsers.tsx │ │ │ │ ├── PasswordSelector.tsx │ │ │ │ ├── SetUserPolicies.tsx │ │ │ │ ├── UserDetails.tsx │ │ │ │ ├── UserSelector.tsx │ │ │ │ ├── UserServiceAccountsPanel.tsx │ │ │ │ ├── Users.tsx │ │ │ │ ├── thunk/ │ │ │ │ │ └── AddUsersThunk.tsx │ │ │ │ └── types.tsx │ │ │ ├── Watch/ │ │ │ │ ├── Watch.tsx │ │ │ │ ├── types.ts │ │ │ │ └── watchSlice.ts │ │ │ ├── consoleSlice.ts │ │ │ ├── consoleSlice.types.ts │ │ │ ├── helpTopics.json │ │ │ ├── kbar-actions.tsx │ │ │ └── valid-routes.tsx │ │ ├── LoginPage/ │ │ │ ├── Login.tsx │ │ │ ├── LoginCallback.tsx │ │ │ ├── SSOLogin.tsx │ │ │ ├── StrategyForm.tsx │ │ │ ├── login.types.ts │ │ │ ├── login.utils.ts │ │ │ ├── loginSlice.ts │ │ │ ├── loginThunks.ts │ │ │ └── sessionThunk.ts │ │ ├── LogoutPage/ │ │ │ └── LogoutPage.tsx │ │ └── NotFoundPage.tsx │ ├── store.ts │ ├── systemSlice.ts │ ├── types.ts │ ├── utils/ │ │ ├── matchMedia.js │ │ ├── sortFunctions.ts │ │ ├── stylesUtils.ts │ │ ├── validationFunctions.ts │ │ └── wsUtils.ts │ ├── version.tsx │ ├── vite-env.d.ts │ └── websockets/ │ └── objectBrowserWSMiddleware.ts ├── tests/ │ ├── constants/ │ │ └── timestamp.txt │ ├── permissions-1/ │ │ ├── groups.ts │ │ ├── notificationEndpoints.ts │ │ ├── test-fix-ui-crash-for-policy.ts │ │ └── trace.ts │ ├── permissions-2/ │ │ ├── bucketWrite.ts │ │ ├── dashboard.ts │ │ ├── deleteObjectWithPrefixOnly.ts │ │ ├── inspect.ts │ │ ├── settings.ts │ │ ├── site-replication.ts │ │ └── tiers.ts │ ├── permissions-3/ │ │ ├── admin.ts │ │ ├── bucketAssignPolicy.ts │ │ ├── bucketDeleteAllVersions.ts │ │ ├── bucketObjectTags.ts │ │ ├── bucketRead.ts │ │ ├── bucketSpecific.ts │ │ └── logs.ts │ ├── permissions-4/ │ │ └── watch.ts │ ├── permissions-5/ │ │ └── diagnostics.ts │ ├── permissions-6/ │ │ ├── deleteWithPrefixes.ts │ │ ├── errorsVisibleOB.ts │ │ ├── filePreview.ts │ │ ├── resourceTesting.ts │ │ └── sameBucketPath.ts │ ├── permissions-7/ │ │ └── users.ts │ ├── permissions-8/ │ │ └── rewind.ts │ ├── permissions-A/ │ │ └── iamPolicies.ts │ ├── permissions-B/ │ │ └── bucketWritePrefixOnly.ts │ ├── policies/ │ │ ├── bucketAssignPolicy.json │ │ ├── bucketCannotTag.json │ │ ├── bucketRead.json │ │ ├── bucketReadWrite.json │ │ ├── bucketSpecific.json │ │ ├── bucketWrite.json │ │ ├── bucketWritePrefixOnlyPolicy.json │ │ ├── conditionsPolicy.json │ │ ├── conditionsPolicy2.json │ │ ├── conditionsPolicy3.json │ │ ├── conditionsPolicy4.json │ │ ├── dashboard.json │ │ ├── deleteObjectWithPrefix.json │ │ ├── diagnostics.json │ │ ├── fix-prefix-policy-ui-crash.json │ │ ├── groups.json │ │ ├── iamPolicies.json │ │ ├── inspect-allowed.json │ │ ├── inspect-not-allowed.json │ │ ├── logs.json │ │ ├── notificationEndpoints.json │ │ ├── rewind-allowed.json │ │ ├── rewind-not-allowed.json │ │ ├── settings.json │ │ ├── tiers.json │ │ ├── trace.json │ │ ├── users.json │ │ └── watch.json │ ├── scripts/ │ │ ├── cleanup-env.sh │ │ ├── common.sh │ │ ├── initialize-env.sh │ │ ├── operator.sh │ │ ├── permissions.sh │ │ ├── resources/ │ │ │ └── kustomization.yaml │ │ ├── tenant-kes-encryption/ │ │ │ └── kustomization.yaml │ │ └── tenant-lite/ │ │ └── kustomization.yaml │ ├── subpath-nginx/ │ │ ├── nginx.conf │ │ └── test-unauthenticated-user.ts │ ├── uploads/ │ │ ├── noextension │ │ └── test.txt │ └── utils/ │ ├── constants.ts │ ├── elements-menu.ts │ ├── elements.ts │ ├── functions.ts │ └── roles.ts ├── tests-examples/ │ └── demo-todo-app.spec.ts ├── tsconfig.dev.json ├── tsconfig.json └── vite.config.ts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .dockerignore ================================================ node_modules/ dist/ target/ console !console/ web-app/node_modules/ .git/ ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help us improve title: '' labels: community, triage assignees: '' --- ## NOTE This is just a fork for my own personal educational purposes, therefore no real support but thanks anyway. ## Expected Behavior ## Current Behavior ## Possible Solution ## Steps to Reproduce (for bugs) 1. 2. 3. 4. ## Context ## Regression ## Your Environment * MinIO version used (`minio --version`): * Server setup and configuration: * Operating System and version (`uname -a`): ================================================ FILE: .github/dependabot.yml ================================================ # To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file version: 2 updates: # GO - package-ecosystem: "gomod" cooldown: default-days: 7 semver-major-days: 14 semver-minor-days: 7 semver-patch-days: 7 directory: "/" schedule: interval: "monthly" day: "thursday" open-pull-requests-limit: 10 groups: go-minor-updates: applies-to: version-updates patterns: - "*" exclude-patterns: - github.com/minio/* update-types: - "minor" - "patch" # npm - package-ecosystem: "npm" cooldown: default-days: 7 semver-major-days: 14 semver-minor-days: 7 semver-patch-days: 7 directory: "/web-app/" schedule: interval: "monthly" day: "thursday" open-pull-requests-limit: 15 groups: react: applies-to: version-updates patterns: - "react" - "@types/react" - "react-dom" - "@types/react-dom" update-types: - "major" - "minor" - "patch" redux: applies-to: version-updates patterns: - "react-redux" - "@reduxjs/toolkit" update-types: - "major" - "minor" - "patch" npm-minor-updates: applies-to: version-updates patterns: - "*" exclude-patterns: - "react" - "@types/react" - "react-dom" - "@types/react-dom" - "react-redux" - "@reduxjs/toolkit" - "react-router" - "react-router-dom" update-types: - "minor" - "patch" # GitHub Actions - package-ecosystem: "github-actions" open-pull-requests-limit: 10 cooldown: default-days: 7 directory: "/" schedule: interval: "monthly" day: "thursday" ================================================ FILE: .github/workflows/jobs.yaml ================================================ # @format name: Workflow on: pull_request: branches: - main push: branches: - main permissions: contents: read # to fetch code (actions/checkout) # This ensures that previous jobs for the PR are canceled when the PR is # updated. concurrency: group: ${{ github.workflow }}-${{ github.head_ref }} cancel-in-progress: true env: FIREFOX_VERSION: latest TESTCAFE_VERSION: 3.7.4 jobs: lint-job: name: Checking Lint runs-on: [ubuntu-latest] strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Build on ${{ matrix.os }} env: GO111MODULE: on GOOS: linux run: | make verifiers semgrep-static-code-analysis: name: "semgrep checks" runs-on: ubuntu-latest strategy: matrix: os: [ubuntu-latest] steps: - name: Check out source code uses: actions/checkout@v6 - name: Scanning code on ${{ matrix.os }} continue-on-error: false run: | # Install semgrep rather than using a container due to: # https://github.com/actions/checkout/issues/334 sudo apt install -y python3-pip || apt install -y python3-pip pip3 install semgrep semgrep --config semgrep.yaml $(pwd)/web-app --error ui-assets: name: "React Code Has No Warnings & Prettified" runs-on: ubuntu-latest strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - uses: actions/cache@v5 id: assets-cache name: Assets Cache with: path: | ./web-app/build/ key: ${{ runner.os }}-assets-${{ github.run_id }} - name: Install Dependencies working-directory: ./web-app continue-on-error: false run: | yarn install --immutable - name: Check for Warnings in build output working-directory: ./web-app continue-on-error: false run: | ./check-warnings.sh - name: Check if Files are Prettified working-directory: ./web-app continue-on-error: false run: | ./check-prettier.sh - name: Check for dead code working-directory: ./web-app continue-on-error: false run: | ./check-deadcode.sh swagger-codegen: name: "Check for uncommitted changes through Swagger Codegen Changes." needs: - lint-job - ui-assets runs-on: ubuntu-latest strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - name: Setup Node uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install NPM Dependencies working-directory: ./web-app continue-on-error: false run: | yarn install --immutable - name: Install go-swagger run: | go tool swagger version - name: Validate swagger.yml run: go tool swagger validate ./swagger.yml - name: Run Swagger Codegen run: make swagger-gen - name: Check for uncommitted changes id: git-status run: | if [[ -n "$(git status --porcelain)" ]]; then echo "Codegen modified files. Please run "make swagger-gen" and commit the changes first:" git status --porcelain echo "##### Git Diff: #####" git --no-pager diff exit 1 else echo "No changes detected after codegen." fi latest-minio: name: Test Build latest MinIO with Console needs: - swagger-codegen - ui-assets runs-on: [ubuntu-latest] strategy: matrix: go-version: [1.26.x] steps: # Clone Console Repo - name: Check out code uses: actions/checkout@v6 # To build minio image, we need to clone the repository first - name: Clone github.com/minio/minio uses: actions/checkout@v6 with: repository: minio/minio path: "minio_repository" - name: Check-out matching MinIO branch env: GH_BRANCH: ${{ github.head_ref || github.ref_name }} GH_PR_REPO: ${{ github.event.pull_request.head.repo.full_name }} run: | cd $GITHUB_WORKSPACE/minio_repository; GH_PR_ACCOUNT=`echo $GH_PR_REPO | sed "s/\\/.*//"` if [ ! -z "$GH_PR_ACCOUNT" ] && [ ! "$GH_PR_ACCOUNT" = "minio" ]; then ALTREPO="https://github.com/$GH_PR_ACCOUNT/minio.git" echo "Attempting to fetch $ALTREPO..." git remote add alt $ALTREPO (git fetch alt && git checkout "alt/$GH_BRANCH") || echo "$ALTREPO ($GH_BRANCH) not available, so keeping default repository/branch" fi cd $GITHUB_WORKSPACE; - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go-minio - uses: actions/cache@v5 id: assets-cache name: Assets Cache with: path: | ./web-app/build/ key: ${{ runner.os }}-assets-${{ github.run_id }} - name: Build on ${{ matrix.os }} if: steps.minio-latest-cache.outputs.cache-hit != 'true' run: | echo "Create minio binary"; cd $GITHUB_WORKSPACE/minio_repository; echo "Replace Console with local repo" echo "replace github.com/minio/console => ../" >> go.mod echo "updates to go.mod needed; to update it: go mod tidy" go mod tidy make build; cd $GITHUB_WORKSPACE cp $GITHUB_WORKSPACE/minio_repository/minio . - uses: actions/cache/save@v5 # skip minio binary cache if: false id: minio-latest-cache name: MinIO Latest Cache with: path: | ./minio key: ${{ runner.os }}-minio-latest-${{ github.run_id }} - uses: actions/upload-artifact@v7 # skip minio binary upload if: false with: name: minio-console-binary path: | ./minio compile-binary: name: Compiles on Go ${{ matrix.go-version }} and ${{ matrix.os }} needs: - lint-job - ui-assets - semgrep-static-code-analysis - swagger-codegen runs-on: ${{ matrix.os }} strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - uses: actions/cache@v5 id: assets-cache name: Assets Cache with: path: | ./web-app/build/ key: ${{ runner.os }}-assets-${{ github.run_id }} - name: Build on ${{ matrix.os }} env: GO111MODULE: on GOOS: linux run: | make console test-nginx-subpath: name: Test Subpath with Nginx needs: - compile-binary runs-on: [ubuntu-latest] timeout-minutes: 10 strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, MinIO and Nginx run: | (CONSOLE_SUBPATH=/console/subpath ./console server ) & (make test-initialize-minio-nginx) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests run: npx testcafe "firefox:headless" web-app/tests/subpath-nginx/ -q --skip-js-errors -c 3 - name: Clean up docker if: always() run: | make cleanup-minio-nginx all-permissions-1: name: Permissions Tests Part 1 needs: - compile-binary runs-on: [ubuntu-latest] timeout-minutes: 10 strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests run: npx testcafe "firefox:headless" web-app/tests/permissions-1/ -q --skip-js-errors -c 3 - name: Clean up users & policies run: | make cleanup-permissions all-permissions-2: name: Permissions Tests Part 2 needs: - compile-binary runs-on: [ubuntu-latest] timeout-minutes: 10 strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests run: npx testcafe "firefox:headless" web-app/tests/permissions-2/ -q --skip-js-errors -c 3 - name: Clean up users & policies run: | make cleanup-permissions all-permissions-3: name: Permissions Tests Part 3 needs: - compile-binary runs-on: [ubuntu-latest] timeout-minutes: 10 strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests run: npx testcafe "firefox:headless" web-app/tests/permissions-3/ -q --skip-js-errors -c 1 - name: Clean up users & policies run: | make cleanup-permissions all-permissions-4: name: Permissions Tests Part 4 needs: - compile-binary runs-on: [ubuntu-latest] timeout-minutes: 15 strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests timeout-minutes: 10 run: npx testcafe "firefox:headless" web-app/tests/permissions-4/ --skip-js-errors all-permissions-5: name: Permissions Tests Part 5 needs: - compile-binary runs-on: [ubuntu-latest] strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests timeout-minutes: 5 run: npx testcafe "firefox:headless" web-app/tests/permissions-5/ --skip-js-errors all-permissions-6: name: Permissions Tests Part 6 needs: - compile-binary runs-on: [ubuntu-latest] strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests timeout-minutes: 5 run: npx testcafe "firefox:headless" web-app/tests/permissions-6/ --skip-js-errors all-permissions-7: name: Permissions Tests Part 7 needs: - compile-binary runs-on: [ubuntu-latest] strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests timeout-minutes: 5 run: npx testcafe "firefox:headless" web-app/tests/permissions-7/ --skip-js-errors -c 1 all-permissions-8: name: Permissions Tests Part 8 needs: - compile-binary runs-on: [ubuntu-latest] strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests timeout-minutes: 5 run: npx testcafe "firefox:headless" web-app/tests/permissions-8/ --skip-js-errors all-permissions-A: name: Permissions Tests Part A needs: - compile-binary runs-on: [ubuntu-latest] strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests run: npx testcafe "firefox:headless" web-app/tests/permissions-A/ --skip-js-errors -c 1 - name: Clean up users & policies run: | make cleanup-permissions all-permissions-B: name: Permissions Tests Part B needs: - compile-binary runs-on: [ubuntu-latest] strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install MinIO JS working-directory: ./ continue-on-error: false run: | yarn add minio - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: clean-previous-containers-if-any run: | docker stop minio || true; docker container prune -f || true; - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Setup firefox if: false id: setup-firefox uses: browser-actions/setup-firefox@v1 with: firefox-version: ${{ env.FIREFOX_VERSION }} - name: Install TestCafe run: npm install testcafe@${{ env.TESTCAFE_VERSION }} - name: Run TestCafe Tests run: npx testcafe "firefox:headless" web-app/tests/permissions-B/ --skip-js-errors -c 3 - name: Clean up users & policies run: | make cleanup-permissions test-pkg-on-go: name: Test Pkg on Go ${{ matrix.go-version }} and ${{ matrix.os }} needs: - lint-job - ui-assets - semgrep-static-code-analysis runs-on: ${{ matrix.os }} strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Build on ${{ matrix.os }} env: GO111MODULE: on GOOS: linux run: | make test-pkg - uses: actions/cache@v5 id: coverage-cache-pkg name: Coverage Cache Pkg with: path: | ./pkg/coverage/ key: ${{ runner.os }}-coverage-pkg-2-${{ github.run_id }} test-api-on-go: name: Test API on Go ${{ matrix.go-version }} and ${{ matrix.os }} needs: - lint-job - ui-assets - semgrep-static-code-analysis runs-on: ${{ matrix.os }} strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Build on ${{ matrix.os }} env: GO111MODULE: on GOOS: linux run: | make test - uses: actions/cache@v5 id: coverage-cache-api name: Coverage Cache API with: path: | ./api/coverage/ key: ${{ runner.os }}-coverage-api-2-${{ github.run_id }} b-integration-tests: name: Integration Tests with Latest Distributed MinIO needs: - lint-job - ui-assets - semgrep-static-code-analysis - compile-binary runs-on: ubuntu-latest strategy: matrix: go-version: [1.26.x] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - uses: actions/cache@v5 name: Console Binary Cache with: path: | ./console key: ${{ runner.os }}-binary-${{ github.run_id }} - name: Build on ${{ matrix.os }} run: | echo "The idea is to build console image from cached binary"; cd $GITHUB_WORKSPACE; TAG="ghcr.io/georgmangold/console:dev" echo "Create Console image: $TAG"; docker build -q --no-cache -t $TAG . -f Dockerfile.release echo "We are going to use the latest minio image on test-integration"; MINIO_VERSION="quay.io/minio/minio:latest"; echo $MINIO_VERSION; make test-integration MINIO_VERSION=$MINIO_VERSION TAG=$TAG; - uses: actions/cache@v5 id: coverage-cache name: Coverage Cache with: path: | ./integration/coverage/ key: ${{ runner.os }}-coverage-2-${{ github.run_id }} react-tests: name: React Tests # there are no react tests for vitest or yest if: false needs: - lint-job - ui-assets - semgrep-static-code-analysis runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Enable Corepack run: corepack enable - name: Install modules working-directory: ./web-app run: yarn install --immutable - name: Run tests working-directory: ./web-app run: yarn test replication: name: Site Replication Test needs: - lint-job - ui-assets - semgrep-static-code-analysis - compile-binary runs-on: [ubuntu-latest] strategy: matrix: go-version: [1.26.x] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Build on ${{ matrix.os }} run: | echo "We are going to use the latest minio image on test-integration"; MINIO_VERSION="quay.io/minio/minio:latest"; echo $MINIO_VERSION; make test-replication MINIO_VERSION=$MINIO_VERSION; - uses: actions/cache@v5 id: coverage-cache-replication name: Coverage Cache Replication with: path: | ./replication/coverage/ key: ${{ runner.os }}-replication-coverage-2-${{ github.run_id }} sso-integration: name: SSO Integration Test needs: - lint-job - ui-assets - semgrep-static-code-analysis - compile-binary runs-on: ubuntu-latest strategy: matrix: go-version: [1.26.x] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Build on ${{ matrix.os }} run: | echo "We are going to use the latest minio image on test-integration"; MINIO_VERSION="quay.io/minio/minio:latest"; echo $MINIO_VERSION; make test-sso-integration MINIO_VERSION=$MINIO_VERSION; - uses: actions/cache@v5 id: coverage-cache-sso name: Coverage Cache SSO with: path: | ./sso-integration/coverage/ key: ${{ runner.os }}-sso-coverage-2-${{ github.run_id }} coverage: name: "Coverage Limit Check" needs: - b-integration-tests - test-api-on-go - test-pkg-on-go - sso-integration - replication runs-on: ${{ matrix.os }} strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Check out gocovmerge as a nested repository uses: actions/checkout@v6 with: repository: wadey/gocovmerge path: gocovmerge - uses: actions/cache@v5 id: coverage-cache name: Coverage Cache with: path: | ./integration/coverage/ key: ${{ runner.os }}-coverage-2-${{ github.run_id }} - uses: actions/cache@v5 id: coverage-cache-sso name: Coverage Cache SSO with: path: | ./sso-integration/coverage/ key: ${{ runner.os }}-sso-coverage-2-${{ github.run_id }} - uses: actions/cache@v5 id: coverage-cache-replication name: Coverage Cache Replication with: path: | ./replication/coverage/ key: ${{ runner.os }}-replication-coverage-2-${{ github.run_id }} - uses: actions/cache@v5 id: coverage-cache-api name: Coverage Cache API with: path: | ./api/coverage/ key: ${{ runner.os }}-coverage-api-2-${{ github.run_id }} - uses: actions/cache@v5 id: coverage-cache-pkg name: Coverage Cache Pkg with: path: | ./pkg/coverage/ key: ${{ runner.os }}-coverage-pkg-2-${{ github.run_id }} - name: Get coverage run: | echo "change directory to gocovmerge" cd gocovmerge echo "download golang x tools" go mod download golang.org/x/tools echo "go mod tidy compat mode" go mod tidy -compat=1.26 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 ../api/coverage/coverage.out ../pkg/coverage/coverage-pkg.out > all.out go tool cover -html=all.out -o $GITHUB_WORKSPACE/all-coverage.html go tool cover -html=../integration/coverage/system.out -o $GITHUB_WORKSPACE/system.html go tool cover -html=../sso-integration/coverage/sso-system.out -o $GITHUB_WORKSPACE/sso-system.html go tool cover -html=../api/coverage/coverage.out -o $GITHUB_WORKSPACE/coverage.html go tool cover -html=../pkg/coverage/coverage-pkg.out -o $GITHUB_WORKSPACE/coverage-pkg.html echo "grep to obtain the result" go tool cover -func=all.out | grep total > tmp2 result=`cat tmp2 | awk 'END {print $3}'` result=${result%\%} threshold=1.0 echo "Result:" echo "$result%" if (( $(echo "$result >= $threshold" |bc -l) )); then echo "It is equal or greater than threshold ($threshold%), passed!" else echo "It is smaller than threshold ($threshold%) value, failed!" exit 1 fi # To save our all.out and all-coverage.html file into an artifact. # By default, GitHub stores build logs and artifacts for 90 days. - uses: actions/upload-artifact@v7 with: name: coverage-artifact path: | ./all.out ./all-coverage.html if-no-files-found: error ui-assets-istanbul-coverage: name: "Assets with Istanbul Plugin for coverage" runs-on: ubuntu-latest strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - uses: actions/cache@v5 id: assets-cache-istanbul-coverage name: Assets Cache Istanbul Coverage with: path: | ./web-app/build/ key: ${{ runner.os }}-assets-istanbul-coverage-${{ github.run_id }} - name: Install Dependencies working-directory: ./web-app continue-on-error: false run: | yarn install --immutable - name: Check for Warnings in build output working-directory: ./web-app continue-on-error: false run: | ./check-warnings-istanbul-coverage.sh compile-binary-istanbul-coverage: name: "Compile Console Binary with Istanbul Plugin for Coverage" needs: - lint-job - ui-assets-istanbul-coverage - semgrep-static-code-analysis - compile-binary runs-on: ${{ matrix.os }} strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - uses: actions/cache@v5 name: Console Binary Cache Istanbul Coverage with: path: | ./console key: ${{ runner.os }}-binary-istanbul-coverage-${{ github.run_id }} - uses: actions/cache@v5 id: assets-cache-istanbul-coverage name: Assets Cache Istanbul Coverage with: path: | ./web-app/build/ key: ${{ runner.os }}-assets-istanbul-coverage-${{ github.run_id }} - name: Build on ${{ matrix.os }} env: GO111MODULE: on GOOS: linux run: | make console cross-compile-1: name: Cross compile needs: - lint-job - ui-assets - semgrep-static-code-analysis runs-on: ${{ matrix.os }} strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Build on ${{ matrix.os }} env: GO111MODULE: on GOOS: linux run: | make crosscompile arg1="'linux/ppc64le linux/mips64'" cross-compile-2: name: Cross compile 2 needs: - lint-job - ui-assets - semgrep-static-code-analysis runs-on: ${{ matrix.os }} strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Build on ${{ matrix.os }} env: GO111MODULE: on GOOS: linux run: | make crosscompile arg1="'linux/arm64 linux/s390x'" cross-compile-3: name: Cross compile 3 needs: - lint-job - ui-assets - semgrep-static-code-analysis runs-on: ${{ matrix.os }} strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Build on ${{ matrix.os }} env: GO111MODULE: on GOOS: linux run: | make crosscompile arg1="'darwin/amd64 freebsd/amd64'" cross-compile-4: name: Cross compile 4 needs: - lint-job - ui-assets - semgrep-static-code-analysis runs-on: ${{ matrix.os }} strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Build on ${{ matrix.os }} env: GO111MODULE: on GOOS: linux run: | make crosscompile arg1="'windows/amd64 linux/arm'" cross-compile-5: name: Cross compile 5 needs: - lint-job - ui-assets - semgrep-static-code-analysis runs-on: ${{ matrix.os }} strategy: matrix: go-version: [1.26.x] os: [ubuntu-latest] steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} id: go - name: Build on ${{ matrix.os }} env: GO111MODULE: on GOOS: linux run: | make crosscompile arg1="'linux/386 netbsd/amd64'" playwright: needs: - compile-binary-istanbul-coverage timeout-minutes: 60 runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} cache: "yarn" cache-dependency-path: web-app/yarn.lock - name: Install dependencies run: | echo "Install dependencies" cd $GITHUB_WORKSPACE/web-app yarn init -y yarn add -D playwright nyc @playwright/test echo "yarn install" yarn install --no-immutable - name: Install Playwright Browsers run: npx playwright install --with-deps - uses: actions/cache@v5 name: Console Binary Cache Istanbul Coverage with: path: | ./console key: ${{ runner.os }}-binary-istanbul-coverage-${{ github.run_id }} - name: Start Console, front-end app and initialize users/policies run: | (./console server) & (make initialize-permissions) - name: Run Playwright tests run: | echo "Run tests under playwright folder only" cd $GITHUB_WORKSPACE/web-app yarn remove playwright yarn add --dev @playwright/test echo "npx playwright test" npx playwright test # To run the tests echo "npx nyc report" npx nyc report # To see report printed in logs as text echo "npx nyc report --reporter=html" npx playwright test --reporter github # To run the tests ================================================ FILE: .github/workflows/release.yaml ================================================ name: goreleaser on: # Run only manually for now workflow_dispatch: #push: # branches: ["main"] # tags: ["v*"] permissions: contents: write packages: write jobs: goreleaser: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v6 with: go-version-file: "go.mod" - name: Login to ghcr.io uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Run GoReleaser uses: goreleaser/goreleaser-action@v7 with: version: "~> v2" args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ================================================ FILE: .github/workflows/vulncheck.yaml ================================================ # @format name: Vulnerability Check on: pull_request: branches: - main permissions: contents: read # to fetch code (actions/checkout) env: GO_VERSION: 1.26.2 jobs: vulncheck: name: Analysis runs-on: ubuntu-latest steps: - name: Check out code into the Go module directory uses: actions/checkout@v6 - name: Set up Go uses: actions/setup-go@v6 with: go-version: ${{ env.GO_VERSION }} check-latest: true - name: Get official govulncheck run: go install golang.org/x/vuln/cmd/govulncheck@latest shell: bash - name: Run govulncheck run: govulncheck ./... shell: bash react-code-known-vulnerabilities: name: "React Code Has No Known Vulnerable Deps" runs-on: ubuntu-latest strategy: matrix: go-version: [ 1.26.x ] os: [ ubuntu-latest ] steps: - name: Check out code uses: actions/checkout@v6 - name: Read .nvmrc id: node_version run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - name: Enable Corepack run: corepack enable - uses: actions/setup-node@v6 with: node-version: ${{ env.NVMRC }} - name: Checks for known security issues with the installed packages working-directory: ./web-app continue-on-error: false run: | yarn npm audit --recursive --environment production --no-deprecations ================================================ FILE: .gitignore ================================================ # Playwright Data web-app/storage/ web-app/playwright/.auth/admin.json web-app/test-results/ # Report from Playwright web-app/playwright-report/ # Coverage from Playwright web-app/.nyc_output/ # Binaries for programs and plugins *.exe *.exe~ *.dll *.so *.dylib .DS_Store *.swp *.orig # Test binary, build with `go test -c` *.test .idea/ vendor/ # Output of the go coverage tool, specifically when used with LiteIDE *.out # Ignore executables target/ !pkg/logger/target/ console !console/ dist/ # Ignore node_modules web-app/node_modules/ # Ignore tls cert and key private.key public.crt # Ignore VsCode files .vscode/ *.code-workspace *~ .eslintcache # Ignore Bin files bin/ ================================================ FILE: .golangci.yml ================================================ version: "2" linters: default: none enable: - durationcheck - gocritic - gomodguard - govet - ineffassign - misspell - revive - staticcheck - unconvert - unused settings: goheader: values: regexp: copyright-holder: Copyright \(c\) (20\d\d\-20\d\d)|2021|({{year}}) template-path: .license.tmpl misspell: locale: US staticcheck: checks: - all - -QF1001 - -QF1008 - -QF1010 - -QF1012 - -SA1008 - -SA1019 - -SA4000 - -SA9004 - -ST1000 - -ST1005 - -ST1016 - -ST1019 - -U1000 testifylint: disable: - go-require revive: rules: - name: var-naming # does not like package names utils and types.. disabled: true exclusions: generated: lax rules: - path: (.+)\.go$ text: should have a package comment - path: (.+)\.go$ text: comment on exported function - path: (.+)\.go$ text: comment on exported type - path: (.+)\.go$ text: should have comment - path: (.+)\.go$ text: use leading k in Go names - path: (.+)\.go$ text: comment on exported const paths: - api/operations - third_party$ - builtin$ - examples$ formatters: enable: - gofmt - gofumpt - goimports exclusions: generated: lax paths: - api/operations - third_party$ - builtin$ - examples$ ================================================ FILE: .goreleaser.yml ================================================ # Make sure to check the documentation at http://goreleaser.com version: 2 project_name: console release: name_template: "Release version {{.Tag}}" github: owner: georgmangold name: console before: hooks: # you may remove this if you don't use vgo - go mod tidy builds: - goos: - linux - darwin - windows goarch: - amd64 - arm64 - arm ignore: - goos: darwin goarch: arm - goos: windows goarch: arm64 - goos: windows goarch: arm env: - CGO_ENABLED=0 main: ./cmd/console/ flags: - -trimpath - --tags=kqueue,operator ldflags: - -s -w -X github.com/minio/console/pkg.ReleaseTag={{.Tag}} -X github.com/minio/console/pkg.CommitID={{.FullCommit}} -X github.com/minio/console/pkg.Version={{.Version}} -X github.com/minio/console/pkg.ShortCommitID={{.ShortCommit}} -X github.com/minio/console/pkg.ReleaseTime={{.Date}} archives: - name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" formats: ["binary"] snapshot: version_template: SNAPSHOT@{{.ShortCommit}} changelog: sort: asc nfpms: - vendor: "Georg Mangold" homepage: https://github.com/georgmangold/console maintainer: "Georg Mangold" description: Console UI for MinIO Server license: GNU Affero General Public License v3.0 bindir: /usr/local/bin formats: - deb - rpm contents: # Basic file that applies to all packagers - src: systemd/console.service dst: /etc/systemd/system/minio-console.service dockers_v2: - dockerfile: Dockerfile.goreleaser images: - "ghcr.io/georgmangold/console" platforms: - linux/amd64 - linux/arm64 tags: - "{{ .Tag }}" - "latest" build_args: TAG: "{{ .Tag }}" labels: "org.opencontainers.image.authors": "Georg Mangold" "org.opencontainers.image.vendor": "Georg Mangold" "org.opencontainers.image.name": "{{.ProjectName}}" "org.opencontainers.image.title": "{{.ProjectName}}" "org.opencontainers.image.description": "A graphical user interface for MinIO®" "org.opencontainers.image.created": "{{.Date}}" "org.opencontainers.image.revision": "{{.FullCommit}}" "org.opencontainers.image.version": "{{.Tag}}" "org.opencontainers.image.url": "{{.GitURL}}" "org.opencontainers.image.documentation": "{{.GitURL}}" "org.opencontainers.image.source": "{{.GitURL}}" "org.opencontainers.image.licenses": "AGPL-3.0-or-later" "org.opencontainers.image.base.name": "scratch" annotations: "org.opencontainers.image.authors": "Georg Mangold" "org.opencontainers.image.vendor": "Georg Mangold" "org.opencontainers.image.name": "{{.ProjectName}}" "org.opencontainers.image.title": "{{.ProjectName}}" "org.opencontainers.image.description": "A graphical user interface for MinIO®" "org.opencontainers.image.created": "{{.Date}}" "org.opencontainers.image.revision": "{{.FullCommit}}" "org.opencontainers.image.version": "{{.Tag}}" "org.opencontainers.image.url": "{{.GitURL}}" "org.opencontainers.image.documentation": "{{.GitURL}}" "org.opencontainers.image.source": "{{.GitURL}}" "org.opencontainers.image.licenses": "AGPL-3.0-or-later" "org.opencontainers.image.base.name": "scratch" ================================================ FILE: .license.tmpl ================================================ This file is part of MinIO Console Server {{copyright-holder}} MinIO, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . ================================================ FILE: .nvmrc ================================================ 24 ================================================ FILE: .prettierrc.json ================================================ {} ================================================ FILE: .semgrepignore ================================================ # Ignore git items .gitignore .git/ :include .gitignore # Common large paths node_modules/ web-app/node_modules/ build/ dist/ .idea/ vendor/ .env/ .venv/ .tox/ *.min.js # Common test paths test/ tests/ *_test.go # Semgrep rules folder .semgrep # Semgrep-action log folder .semgrep_logs/ # Ignore VsCode files .vscode/ *.code-workspace *~ .eslintcache consoleApi.ts ================================================ FILE: CHANGELOG.md ================================================ # Changelog ## Release v1.9.1 Bug Fix: - Updated project dependencies - Updated go version from 1.24.10 to 1.24.11 to fix Security vulnerability ## Release v1.9.0 Breaking Change: - ODIC: `CONSOLE_IDP_CALLBACK` and `MINIO_BROWSER_REDIRECT_URL` now expect the Console URL without `/oauth_callback` at the end Features: - Supports Prometheus basic auth - ReadOnly and disabled feature for CodeEditor, SpeedtestResult Json - Adds View to see Health Info Report Results as JSON Preview - New SSO URL `/sso` for auto redirect to OIDC Provider - Shows and option to load more than 20 versions - Login page shows an indicator that LDAP is enabled - Use Quota Size field instead of the deprecated Quota field - Console container now runs rootless as user 1000:1000 - Show console package version on license page Bug Fix: - Some OIDC confussion around ROLE_POLICY vs. ROLE_ARN - Fix download option in file preview - Set goreleaser bindir for linux packages to /usr/local/bin - Fix tag retrieval in ObjectDetailPanel component - Fix metrics display for objects sizes between 1024B and 1MB Additional Changes: - Alot of dependencies updates ## Release v1.8.1 Release focuses on debranding by dropping **MinIO®** from names and logos Features: - OIDC SSO Login support see [docs](./docs/OIDC.md) - Self-Update of binarys over Github Releases with `./console update` Deprecations: - Deprecates CONSOLE_ANIMATED_LOGIN animated Login video background - Deprecates Inclusion of sourcemaps in Prod Releases of Web-App Build: - web-app frontend build size 28 MB down to 9 MB - reduced binary size ~60 MB to ~45 MB Pictures see releases ## Release v1.8.0 This release is bringing back long-deprecated features: - Undeprecated Lifecyle and Tierung UI (minio#3470) - Undeprecated Site Replication in UI (minio#3469) - Unremoved Tools support (minio#3467) - Health Info - Speedtest - Profiling - Inspect - Trace - Watch - Removed Subnet, Registration, Call Home Support again after Revert - Small License and Login Page updated ## Release v1.7.8 Bug Fix: - Fixed Dependencies vulnerabilities + updated Dependencies - Allow console to recognize s3.Delete* - Fix regex pattern in webhook management - Fix golangci-lint issues - Decreased Browser direct download threshold to 5GiB ## Release v1.7.7 There are actually no changes compared to v1.7.6; I'm just getting the release and builds ready. - Binary Releases - Packages - Container Builds See Releases ## Release v1.7.6 Bug Fix: - Fix null pointer exception in Admin Info - Ignore leading or trailing spaces in login request - Fix file path on drag and drop - Fix typo in User DN Search Filter example ## Release v1.7.5 Bug Fix: - Fixed leaks during ZIP multiobject downloads - Allow spaces in Policy names ## Release v1.7.4 Deprecations: - Deprecated support tools User Interface in favor of mc admin commands. Please refer to the [MinIO Client documentation page](https://docs.min.io/community/minio-object-store/reference/minio-mc.html) for more information. - Deprecated Site replication User Interface in favor of mc admin commands. Please refer to the [MinIO Site Replication page](https://docs.min.io/community/minio-object-store/reference/minio-mc-admin/mc-admin-replicate.html) for more information. - Deprecated Lifecycle & Tiers User Interface in favor of mc admin commands. Please refer to the [MinIO Tiers page](https://docs.min.io/community/minio-object-store/reference/minio-mc/mc-ilm-tier.html) for more information. Bug Fix: - Avoid loading unpkg.com call when login animation is off ## Release v1.7.3 Bug Fix: - Use a fixed public license verification key - Show non-expiring access keys as `no-expiry` instead of Jan 1, 1970 - Use "join Slack" button for non-commercial edition instead of "Signup" - Fix setting policies on groups that have spaces ## Release v1.7.2 Bug Fix: - Fixed issue in Server Health Info - Fixed Security vulnerability in dependencies - Fixed client string in trace message Additional Changes: - Remove live logs in Call Home Page - Update License page ## Release v1.7.1 Bug Fix: - Fixed issue that could cause a failure when attempting to view deleted files in the object browser - Return network error when logging in and the network connection fails Additional Changes: - Added debug logging for console HTTP request (see [PR #3440](https://github.com/minio/console/pull/3440) for more detailed information) ## Release v1.7.0 Bug Fix: - Fixed directory listing - Fix MinIO videos link Additional Changes: - Removed deprecated KES functionality ## Release v1.6.3 Additional Changes: - Updated go.mod version ## Release v1.6.2 Bug Fix: - Fixed minor user session issues - Updated project dependencies Additional Changes: - Improved Drives List visualization - Improved WS request logic - Updated License page with current MinIO plans. ## Release v1.6.1 Bug Fix: - Fixed objectManager issues under certain conditions - Fixed Security vulnerability in dependencies Additional Changes: - Improved Share Link behavior ## Release v1.6.0 Bug Fix: - Fixed share link encoding - Fixed Edit Lifecycle Storage Class - Added Tiers Improvements for Bucket Lifecycle management Additional Changes: - Vulnerability updates - Update Logo logic ## Release v1.5.0 Features: - Added remove Tier functionality Bug Fix: - Fixed ILM rule tags not being shown - Fixed race condition Object Browser websocket - Fixed Encryption page crashing on empty response - Fixed Replication Delete Marker comparisons Additional Changes: - Use automatic URI encoding for APIs - Vulnerability updates ## Release v1.4.0 Features: - Added VersionID support to metadata details - Improved Websockets handlers Bug Fix: - Fixed vulnerabilities and updated dependencies - Fixed an issue with Download URL decoding - Fixed leak in Object Browser Websocket - Minor UX fixes ## Release v1.3.0 Features: - Adds ExpireDeleteMarker status to BucketLifecycleRule UI Bug Fix: - Fixed vulnerability - Used URL-safe base64 enconding for Share API - Made Prefix field optional when Adding Tier - Added Console user agent in MinIO Admin Client ## Release v1.2.0 Features: - Updated file share logic to work as Proxy Bug Fix: - Updated project dependencies - Fixed Key Permissions UX - Added permissions validation to rewind button - Fixed Health report upload to SUBNET - Misc Cosmetic fixes ## Release v1.1.1 Bug Fix: - Fixed folder download issue ## Release v1.1.0 Features: - Added Set Expired object all versions selector Bug Fix: - Updated Go Dependencies ## Release v1.0.0 Features: - Updated Preview message alert Bug Fix: - Updated Websocket API - Fixed issues with download manager - Fixed policies issues ## Release v0.46.0 Features: - Added latest help content to forms Bug Fix: - Disabled Create User button in certain policy cases - Fixed an issue with Logout request - Upgraded project dependencies ## Release v0.45.0 Deprecated: - Deprecated Heal / Drives page Features: - Updated tines on menus & pages Bug Fix: - Upgraded project dependencies ## Release v0.44.0 Bug Fix: - Upgraded project dependencies - Fixed events icons not loading in subpaths ## Release v0.43.1 Bug Fix: - Update Share Object UI to reflect maximum expiration time in UI ## Release v0.43.0 Features: - Updated PDF preview method Bug Fix: - Fixed vulnerabilities - Prevented non-necessary metadata calls in object browser ## Release v0.42.2 Bug Fix: - Hidden Prometheus metrics if URL is empty ## Release v0.42.1 Bug Fix: - Reset go version to 1.19 ## Release v0.42.0 Features: - Introducing Dark Mode Bug Fix: - Fixed vulnerabilities - Changes on Upload and Delete object urls - Fixed blocking subpath creation if not enough permissions - Removed share object option at prefix level - Updated allowed actions for a deleted object ## Release v0.41.0 Features: - Updated pages to use mds components - support for resolving IPv4/IPv6 Bug Fix: - Remove cache for ClientIP - Fixed override environment variables display in settings page - Fixed daylight savings time support in share modal ## Release v0.40.0 Features: - Updated OpenID page - Added New bucket event types support Bug Fix: - Fixed crash in access keys page - Fixed AuditLog filters issue - Fixed multiple issues with Object Browser ## Release v0.39.0 Features: - Migrated metrics page to mds - Migrated Register page to mds Bug Fix: - Fixed LDAP configuration page issues - Load available certificates in logout - Updated dependencies & go version - Fixed delete objects functionality ## Release v0.38.0 Features: - Added extra information to Service Accounts page - Updated Tiers, Site Replication, Speedtest, Heal & Watch pages components Bug Fix: - Fixed IDP expiry time errors - Updated project Dependencies ## Release v0.37.0 Features: - Updated Trace and Logs page components - Updated Prometheus metrics Bug Fix: - Disabled input fields for Subscription features if MinIO is not registered ## Release v0.36.0 Features: - Updated Settings page components Bug Fix: - Show LDAP Enabled value LDAP configuration - Download multiple objects in same path as they were selected ## Release v0.35.1 Bug Fix: - Change timestamp format for zip creation ## Release v0.35.0 Features: - Add Exclude Folders and Exclude Prefixes during bucket creation - Download multiple selected objects as zip and ignore deleted objects - Updated Call Home, Inspet, Profile and Health components Bug Fix: - Remove extra white spaces for configuration strings - Allow Create New Path in bucket view when having right permissions ## Release v0.34.0 Features: - Updated Buckets components Bug Fix: - Fixed SUBNET Health report upload - Updated Download Handler - Fixes issue with rewind - Avoid 1 hour expiration for IDP credentials --- ## Release v0.33.0 Features: - Updated OpenID, LDAP components Bug Fix: - Fixed security issues - Fixed navigation issues in Object Browser - Fixed Dashboard metrics --- ## Release v0.32.0 Features: - Updated Users and Groups components - Added placeholder image for Help Menu Bug Fix: - Fixed memory leak in WebSocket API for Object Browser --- ## Release v0.31.0 **Breaking Changes:** - **Removed support for Standalone Deployments** Features: - Updated way files are displayed in uploading component - Updated Audit Logs and Policies components Bug Fix: - Fixed Download folders issue in Object Browser - Added missing Notification Events (ILM & REPLICA) in Events Notification Page - Fixed Security Vulnerability for `semver` dependency --- ## Release v0.30.0 Features: - Added MinIO Console Help Menu - Updated UI Menu components Bug Fix: - Disable the Upload button on Object Browser if the user is not allowed - Fixed security vulnerability for `lestrrat-go/jwx` and `fast-xml-parser` - Fixed bug on sub-paths for Object Browser - Reduce the number of calls to `/session` API endpoint to improve performance - Rolled back the previous change for the Share File feature to no longer ask for Service Account access keys ================================================ FILE: CONTRIBUTING.md ================================================ # Console Server Contribution Guide This is a REST portal server created using [go-swagger](https://github.com/go-swagger/go-swagger) The API handlers are created using a YAML definition located in `swagger.YAML`. To add new api, the YAML file needs to be updated with all the desired apis using the [Swagger Basic Structure](https://swagger.io/docs/specification/2-0/basic-structure/), this includes paths, parameters, definitions, tags, etc. ## Generate server from YAML Once the YAML file is ready we can autogenerate the code needed for the new api by just running: Validate it: ``` swagger validate ./swagger.yml ``` Update server code: ``` make swagger-gen ``` This will update all the necessary code. `./api/configure_console.go` is a file that contains the handlers to be used by the application, here is the only place where we need to update our code to support the new apis. This file is not affected when running the swagger generator and it is safe to edit. ## Unit Tests `./api/handlers_test.go` needs to be updated with the proper tests for the new api. To run tests: ``` go test ./api ``` ## Commit changes After verification, commit your changes. This is a [great post](https://chris.beams.io/posts/git-commit/) on how to write useful commit messages ``` $ git commit -am 'Add some feature' ``` ### Push to the branch Push your locally committed changes to the remote origin (your fork) ``` $ git push origin my-new-feature ``` ### Create a Pull Request Pull requests can be created via GitHub. Refer to [this document](https://help.github.com/articles/creating-a-pull-request/) for detailed steps on how to create a pull request. After a Pull Request gets peer reviewed and approved, it will be merged. ## FAQs ### How does ``console`` manages dependencies? ``MinIO`` uses `go mod` to manage its dependencies. - Run `go get foo/bar` in the source folder to add the dependency to `go.mod` file. To remove a dependency - Edit your code and remove the import reference. - Run `go mod tidy` in the source folder to remove dependency from `go.mod` file. ### What are the coding guidelines for console? ``console`` is fully conformant with Golang style. Refer: [Effective Go](https://go.dev/doc/effective_go) and [CodeReviewComments](https://go.dev/wiki/CodeReviewComments) article from Golang project. ================================================ FILE: CREDITS ================================================ Go (the standard library) https://golang.org/ ---------------------------------------------------------------- Copyright (c) 2009 The Go Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ aead.dev/mem https://aead.dev/mem ---------------------------------------------------------------- MIT License Copyright (c) 2022 Andreas Auernhammer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ aead.dev/minisign https://aead.dev/minisign ---------------------------------------------------------------- MIT License Copyright (c) 2021 Andreas Auernhammer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/VividCortex/ewma https://github.com/VividCortex/ewma ---------------------------------------------------------------- The MIT License Copyright (c) 2013 VividCortex Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/acarl005/stripansi https://github.com/acarl005/stripansi ---------------------------------------------------------------- MIT License Copyright (c) 2018 Andrew Carlson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/asaskevich/govalidator https://github.com/asaskevich/govalidator ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2014-2020 Alex Saskevich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/aymanbagabas/go-osc52/v2 https://github.com/aymanbagabas/go-osc52/v2 ---------------------------------------------------------------- MIT License Copyright (c) 2022 Ayman Bagabas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/beorn7/perks https://github.com/beorn7/perks ---------------------------------------------------------------- Copyright (C) 2013 Blake Mizerany Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/blang/semver/v4 https://github.com/blang/semver/v4 ---------------------------------------------------------------- The MIT License Copyright (c) 2014 Benedikt Lang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/cespare/xxhash/v2 https://github.com/cespare/xxhash/v2 ---------------------------------------------------------------- Copyright (c) 2016 Caleb Spare MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/charmbracelet/bubbles https://github.com/charmbracelet/bubbles ---------------------------------------------------------------- MIT License Copyright (c) 2020-2023 Charmbracelet, Inc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/charmbracelet/bubbletea https://github.com/charmbracelet/bubbletea ---------------------------------------------------------------- MIT License Copyright (c) 2020-2023 Charmbracelet, Inc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/charmbracelet/lipgloss https://github.com/charmbracelet/lipgloss ---------------------------------------------------------------- MIT License Copyright (c) 2021-2023 Charmbracelet, Inc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/charmbracelet/x/ansi https://github.com/charmbracelet/x/ansi ---------------------------------------------------------------- MIT License Copyright (c) 2023 Charmbracelet, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/charmbracelet/x/exp/golden https://github.com/charmbracelet/x/exp/golden ---------------------------------------------------------------- MIT License Copyright (c) 2023 Charmbracelet, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/charmbracelet/x/term https://github.com/charmbracelet/x/term ---------------------------------------------------------------- MIT License Copyright (c) 2023 Charmbracelet, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/cheggaaa/pb https://github.com/cheggaaa/pb ---------------------------------------------------------------- Copyright (c) 2012-2015, Sergey Cherepanov All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/cheggaaa/pb/v3 https://github.com/cheggaaa/pb/v3 ---------------------------------------------------------------- Copyright (c) 2012-2024, Sergey Cherepanov All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/coreos/go-semver https://github.com/coreos/go-semver ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/coreos/go-systemd/v22 https://github.com/coreos/go-systemd/v22 ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/davecgh/go-spew https://github.com/davecgh/go-spew ---------------------------------------------------------------- ISC License Copyright (c) 2012-2016 Dave Collins Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ================================================================ github.com/decred/dcrd/dcrec/secp256k1/v4 https://github.com/decred/dcrd/dcrec/secp256k1/v4 ---------------------------------------------------------------- ISC License Copyright (c) 2013-2017 The btcsuite developers Copyright (c) 2015-2024 The Decred developers Copyright (c) 2017 The Lightning Network Developers Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ================================================================ github.com/docker/go-units https://github.com/docker/go-units ---------------------------------------------------------------- Apache License Version 2.0, January 2004 https://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS Copyright 2015 Docker, Inc. 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 https://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. ================================================================ github.com/dustin/go-humanize https://github.com/dustin/go-humanize ---------------------------------------------------------------- Copyright (c) 2005-2008 Dustin Sallings Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/erikgeiser/coninput https://github.com/erikgeiser/coninput ---------------------------------------------------------------- MIT License Copyright (c) 2021 Erik G. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/fatih/color https://github.com/fatih/color ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2013 Fatih Arslan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/fatih/structs https://github.com/fatih/structs ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2014 Fatih Arslan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/go-ini/ini https://github.com/go-ini/ini ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2014 Unknwon 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. ================================================================ github.com/go-logr/logr https://github.com/go-logr/logr ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} 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. ================================================================ github.com/go-logr/stdr https://github.com/go-logr/stdr ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/go-ole/go-ole https://github.com/go-ole/go-ole ---------------------------------------------------------------- The MIT License (MIT) Copyright © 2013-2017 Yasuhiro Matsumoto, Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/go-openapi/analysis https://github.com/go-openapi/analysis ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/go-openapi/errors https://github.com/go-openapi/errors ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/go-openapi/jsonpointer https://github.com/go-openapi/jsonpointer ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/go-openapi/jsonreference https://github.com/go-openapi/jsonreference ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/go-openapi/loads https://github.com/go-openapi/loads ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/go-openapi/runtime https://github.com/go-openapi/runtime ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/go-openapi/spec https://github.com/go-openapi/spec ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/go-openapi/strfmt https://github.com/go-openapi/strfmt ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/go-openapi/swag https://github.com/go-openapi/swag ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/go-openapi/validate https://github.com/go-openapi/validate ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/goccy/go-json https://github.com/goccy/go-json ---------------------------------------------------------------- MIT License Copyright (c) 2020 Masaaki Goshima Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/gogo/protobuf https://github.com/gogo/protobuf ---------------------------------------------------------------- Copyright (c) 2013, The GoGo Authors. All rights reserved. Protocol Buffers for Go with Gadgets Go support for Protocol Buffers - Google's data interchange format Copyright 2010 The Go Authors. All rights reserved. https://github.com/golang/protobuf Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/golang-jwt/jwt/v4 https://github.com/golang-jwt/jwt/v4 ---------------------------------------------------------------- Copyright (c) 2012 Dave Grijalva Copyright (c) 2021 golang-jwt maintainers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/golang/protobuf https://github.com/golang/protobuf ---------------------------------------------------------------- Copyright 2010 The Go Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/google/go-cmp https://github.com/google/go-cmp ---------------------------------------------------------------- Copyright (c) 2017 The Go Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/google/shlex https://github.com/google/shlex ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/google/uuid https://github.com/google/uuid ---------------------------------------------------------------- Copyright (c) 2009,2014 Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/hashicorp/errwrap https://github.com/hashicorp/errwrap ---------------------------------------------------------------- Mozilla Public License, version 2.0 1. Definitions 1.1. “Contributor” means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. “Contributor Version” means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor’s Contribution. 1.3. “Contribution” means Covered Software of a particular Contributor. 1.4. “Covered Software” means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. “Incompatible With Secondary Licenses” means a. that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or b. that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. “Executable Form” means any form of the work other than Source Code Form. 1.7. “Larger Work” means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. “License” means this document. 1.9. “Licensable” means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. “Modifications” means any of the following: a. any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or b. any new file in Source Code Form that contains any Covered Software. 1.11. “Patent Claims” of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. “Secondary License” means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. “Source Code Form” means the form of the work preferred for making modifications. 1.14. “You” (or “Your”) means an individual or a legal entity exercising rights under this License. For legal entities, “You” includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: a. under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and b. under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: a. for any code that a Contributor has removed from Covered Software; or b. for infringements caused by: (i) Your and any other third party’s modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or c. under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients’ rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: a. such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and b. You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients’ rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. 6. Disclaimer of Warranty Covered Software is provided under this License on an “as is” basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necessary servicing, repair, or correction. This disclaimer of warranty constitutes an essential part of this License. No use of any Covered Software is authorized under this License except under this disclaimer. 7. Limitation of Liability Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party’s negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You. 8. Litigation Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party’s ability to bring cross-claims or counter-claims. 9. Miscellaneous This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - “Incompatible With Secondary Licenses” Notice This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0. ================================================================ github.com/hashicorp/go-multierror https://github.com/hashicorp/go-multierror ---------------------------------------------------------------- Mozilla Public License, version 2.0 1. Definitions 1.1. “Contributor” means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. “Contributor Version” means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor’s Contribution. 1.3. “Contribution” means Covered Software of a particular Contributor. 1.4. “Covered Software” means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. “Incompatible With Secondary Licenses” means a. that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or b. that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. “Executable Form” means any form of the work other than Source Code Form. 1.7. “Larger Work” means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. “License” means this document. 1.9. “Licensable” means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. “Modifications” means any of the following: a. any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or b. any new file in Source Code Form that contains any Covered Software. 1.11. “Patent Claims” of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. “Secondary License” means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. “Source Code Form” means the form of the work preferred for making modifications. 1.14. “You” (or “Your”) means an individual or a legal entity exercising rights under this License. For legal entities, “You” includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: a. under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and b. under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: a. for any code that a Contributor has removed from Covered Software; or b. for infringements caused by: (i) Your and any other third party’s modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or c. under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients’ rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: a. such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and b. You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients’ rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. 6. Disclaimer of Warranty Covered Software is provided under this License on an “as is” basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necessary servicing, repair, or correction. This disclaimer of warranty constitutes an essential part of this License. No use of any Covered Software is authorized under this License except under this disclaimer. 7. Limitation of Liability Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party’s negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You. 8. Litigation Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party’s ability to bring cross-claims or counter-claims. 9. Miscellaneous This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - “Incompatible With Secondary Licenses” Notice This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0. ================================================================ github.com/inconshreveable/mousetrap https://github.com/inconshreveable/mousetrap ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2022 Alan Shreve (@inconshreveable) 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. ================================================================ github.com/jedib0t/go-pretty/v6 https://github.com/jedib0t/go-pretty/v6 ---------------------------------------------------------------- MIT License Copyright (c) 2018 jedib0t Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/jessevdk/go-flags https://github.com/jessevdk/go-flags ---------------------------------------------------------------- Copyright (c) 2012 Jesse van den Kieboom. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/josharian/intern https://github.com/josharian/intern ---------------------------------------------------------------- MIT License Copyright (c) 2019 Josh Bleecher Snyder Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/juju/ratelimit https://github.com/juju/ratelimit ---------------------------------------------------------------- All files in this repository are licensed as follows. If you contribute to this repository, it is assumed that you license your contribution under the same license unless you state otherwise. All files Copyright (C) 2015 Canonical Ltd. unless otherwise specified in the file. This software is licensed under the LGPLv3, included below. As a special exception to the GNU Lesser General Public License version 3 ("LGPL3"), the copyright holders of this Library give you permission to convey to a third party a Combined Work that links statically or dynamically to this Library without providing any Minimal Corresponding Source or Minimal Application Code as set out in 4d or providing the installation information set out in section 4e, provided that you comply with the other provisions of LGPL3 and provided that you meet, for the Application the terms and conditions of the license(s) which apply to the Application. Except as stated in this special exception, the provisions of LGPL3 will continue to comply in full to this Library. If you modify this Library, you may apply this exception to your version of this Library, but you are not obliged to do so. If you do not wish to do so, delete this exception statement from your version. This exception does not (and cannot) modify any license terms which apply to the Application, with which you must still comply. GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ================================================================ github.com/klauspost/compress https://github.com/klauspost/compress ---------------------------------------------------------------- Copyright (c) 2012 The Go Authors. All rights reserved. Copyright (c) 2019 Klaus Post. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------ Files: gzhttp/* Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2016-2017 The New York Times Company 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. ------------------ Files: s2/cmd/internal/readahead/* The MIT License (MIT) Copyright (c) 2015 Klaus Post Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------- Files: snappy/* Files: internal/snapref/* Copyright (c) 2011 The Snappy-Go Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------- Files: s2/cmd/internal/filepathx/* Copyright 2016 The filepathx Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/klauspost/cpuid/v2 https://github.com/klauspost/cpuid/v2 ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2015 Klaus Post Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/kr/pretty https://github.com/kr/pretty ---------------------------------------------------------------- Copyright 2012 Keith Rarick Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/kr/text https://github.com/kr/text ---------------------------------------------------------------- Copyright 2012 Keith Rarick Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/kylelemons/godebug https://github.com/kylelemons/godebug ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/lestrrat-go/blackmagic https://github.com/lestrrat-go/blackmagic ---------------------------------------------------------------- MIT License Copyright (c) 2021 lestrrat-go Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/lestrrat-go/httpcc https://github.com/lestrrat-go/httpcc ---------------------------------------------------------------- MIT License Copyright (c) 2020 lestrrat-go Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/lestrrat-go/httprc https://github.com/lestrrat-go/httprc ---------------------------------------------------------------- MIT License Copyright (c) 2022 lestrrat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/lestrrat-go/iter https://github.com/lestrrat-go/iter ---------------------------------------------------------------- MIT License Copyright (c) 2020 lestrrat-go Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/lestrrat-go/jwx/v2 https://github.com/lestrrat-go/jwx/v2 ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2015 lestrrat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/lestrrat-go/option https://github.com/lestrrat-go/option ---------------------------------------------------------------- MIT License Copyright (c) 2021 lestrrat-go Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/lucasb-eyer/go-colorful https://github.com/lucasb-eyer/go-colorful ---------------------------------------------------------------- Copyright (c) 2013 Lucas Beyer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/lufia/plan9stats https://github.com/lufia/plan9stats ---------------------------------------------------------------- BSD 3-Clause License Copyright (c) 2019, KADOTA, Kyohei All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/mailru/easyjson https://github.com/mailru/easyjson ---------------------------------------------------------------- Copyright (c) 2016 Mail.Ru Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/mattn/go-colorable https://github.com/mattn/go-colorable ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2016 Yasuhiro Matsumoto Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/mattn/go-ieproxy https://github.com/mattn/go-ieproxy ---------------------------------------------------------------- MIT License Copyright (c) 2014 mattn Copyright (c) 2017 oliverpool Copyright (c) 2019 Adele Reed Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/mattn/go-isatty https://github.com/mattn/go-isatty ---------------------------------------------------------------- Copyright (c) Yasuhiro MATSUMOTO MIT License (Expat) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/mattn/go-runewidth https://github.com/mattn/go-runewidth ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2016 Yasuhiro Matsumoto Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/matttproud/golang_protobuf_extensions https://github.com/matttproud/golang_protobuf_extensions ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} 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. ================================================================ github.com/minio/cli https://github.com/minio/cli ---------------------------------------------------------------- MIT License Copyright (c) 2016 Jeremy Saenz & Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/minio/highwayhash https://github.com/minio/highwayhash ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/minio/kes https://github.com/minio/kes ---------------------------------------------------------------- GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================================ github.com/minio/kms-go/kes https://github.com/minio/kms-go/kes ---------------------------------------------------------------- GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================================ github.com/minio/madmin-go/v3 https://github.com/minio/madmin-go/v3 ---------------------------------------------------------------- GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================================ github.com/minio/mc https://github.com/minio/mc ---------------------------------------------------------------- GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================================ github.com/minio/md5-simd https://github.com/minio/md5-simd ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/minio/minio-go/v7 https://github.com/minio/minio-go/v7 ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/minio/mux https://github.com/minio/mux ---------------------------------------------------------------- Copyright (c) 2012-2018 The Gorilla Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/minio/pkg/v3 https://github.com/minio/pkg/v3 ---------------------------------------------------------------- GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================================ github.com/minio/selfupdate https://github.com/minio/selfupdate ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/minio/websocket https://github.com/minio/websocket ---------------------------------------------------------------- Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/mitchellh/go-homedir https://github.com/mitchellh/go-homedir ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2013 Mitchell Hashimoto Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/mitchellh/mapstructure https://github.com/mitchellh/mapstructure ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2013 Mitchell Hashimoto Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/montanaflynn/stats https://github.com/montanaflynn/stats ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2014-2023 Montana Flynn (https://montanaflynn.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/muesli/ansi https://github.com/muesli/ansi ---------------------------------------------------------------- MIT License Copyright (c) 2021 Christian Muehlhaeuser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/muesli/cancelreader https://github.com/muesli/cancelreader ---------------------------------------------------------------- MIT License Copyright (c) 2022 Erik Geiser and Christian Muehlhaeuser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/muesli/reflow https://github.com/muesli/reflow ---------------------------------------------------------------- MIT License Copyright (c) 2019 Christian Muehlhaeuser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/muesli/termenv https://github.com/muesli/termenv ---------------------------------------------------------------- MIT License Copyright (c) 2019 Christian Muehlhaeuser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/munnerz/goautoneg https://github.com/munnerz/goautoneg ---------------------------------------------------------------- Copyright (c) 2011, Open Knowledge Foundation Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the Open Knowledge Foundation Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/oklog/ulid https://github.com/oklog/ulid ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/olekukonko/tablewriter https://github.com/olekukonko/tablewriter ---------------------------------------------------------------- Copyright (C) 2014 by Oleku Konko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/philhofer/fwd https://github.com/philhofer/fwd ---------------------------------------------------------------- Copyright (c) 2014-2015, Philip Hofer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/pkg/xattr https://github.com/pkg/xattr ---------------------------------------------------------------- Copyright (c) 2012 Dave Cheney. All rights reserved. Copyright (c) 2014 Kuba Podgórski. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/pmezard/go-difflib https://github.com/pmezard/go-difflib ---------------------------------------------------------------- Copyright (c) 2013, Patrick Mezard All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/posener/complete https://github.com/posener/complete ---------------------------------------------------------------- The MIT License Copyright (c) 2017 Eyal Posener Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/power-devops/perfstat https://github.com/power-devops/perfstat ---------------------------------------------------------------- MIT License Copyright (c) 2020 Power DevOps Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/prometheus/client_golang https://github.com/prometheus/client_golang ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/prometheus/client_model https://github.com/prometheus/client_model ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/prometheus/common https://github.com/prometheus/common ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/prometheus/procfs https://github.com/prometheus/procfs ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/prometheus/prom2json https://github.com/prometheus/prom2json ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/prometheus/prometheus https://github.com/prometheus/prometheus ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/rivo/uniseg https://github.com/rivo/uniseg ---------------------------------------------------------------- MIT License Copyright (c) 2019 Oliver Kuederle Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/rjeczalik/notify https://github.com/rjeczalik/notify ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2014-2015 The Notify Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/rogpeppe/go-internal https://github.com/rogpeppe/go-internal ---------------------------------------------------------------- Copyright (c) 2018 The Go Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/rs/xid https://github.com/rs/xid ---------------------------------------------------------------- Copyright (c) 2015 Olivier Poitrey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/safchain/ethtool https://github.com/safchain/ethtool ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright (c) 2015 The Ethtool 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. ================================================================ github.com/secure-io/sio-go https://github.com/secure-io/sio-go ---------------------------------------------------------------- MIT License Copyright (c) 2019 SecureIO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/segmentio/asm https://github.com/segmentio/asm ---------------------------------------------------------------- MIT License Copyright (c) 2021 Segment Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/shirou/gopsutil/v3 https://github.com/shirou/gopsutil/v3 ---------------------------------------------------------------- gopsutil is distributed under BSD license reproduced below. Copyright (c) 2014, WAKAYAMA Shirou All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the gopsutil authors nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------- internal/common/binary.go in the gopsutil is copied and modified from golang/encoding/binary.go. Copyright (c) 2009 The Go Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/shoenig/go-m1cpu https://github.com/shoenig/go-m1cpu ---------------------------------------------------------------- Mozilla Public License, version 2.0 1. Definitions 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. 1.3. "Contribution" means Covered Software of a particular Contributor. 1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. "Incompatible With Secondary Licenses" means a. that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or b. that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. "Executable Form" means any form of the work other than Source Code Form. 1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" means this document. 1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. "Modifications" means any of the following: a. any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or b. any new file in Source Code Form that contains any Covered Software. 1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. "Source Code Form" means the form of the work preferred for making modifications. 1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: a. under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and b. under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: a. for any code that a Contributor has removed from Covered Software; or b. for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or c. under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: a. such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and b. You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. 6. Disclaimer of Warranty Covered Software is provided under this License on an "as is" basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necessary servicing, repair, or correction. This disclaimer of warranty constitutes an essential part of this License. No use of any Covered Software is authorized under this License except under this disclaimer. 7. Limitation of Liability Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You. 8. Litigation Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. 9. Miscellaneous This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - "Incompatible With Secondary Licenses" Notice This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. ================================================================ github.com/shoenig/test https://github.com/shoenig/test ---------------------------------------------------------------- Mozilla Public License, version 2.0 1. Definitions 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. 1.3. "Contribution" means Covered Software of a particular Contributor. 1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. "Incompatible With Secondary Licenses" means a. that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or b. that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. "Executable Form" means any form of the work other than Source Code Form. 1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" means this document. 1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. "Modifications" means any of the following: a. any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or b. any new file in Source Code Form that contains any Covered Software. 1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. "Source Code Form" means the form of the work preferred for making modifications. 1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: a. under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and b. under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: a. for any code that a Contributor has removed from Covered Software; or b. for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or c. under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: a. such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and b. You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. 6. Disclaimer of Warranty Covered Software is provided under this License on an "as is" basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necessary servicing, repair, or correction. This disclaimer of warranty constitutes an essential part of this License. No use of any Covered Software is authorized under this License except under this disclaimer. 7. Limitation of Liability Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You. 8. Litigation Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. 9. Miscellaneous This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - "Incompatible With Secondary Licenses" Notice This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. ================================================================ github.com/stretchr/testify https://github.com/stretchr/testify ---------------------------------------------------------------- MIT License Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/tidwall/gjson https://github.com/tidwall/gjson ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2016 Josh Baker Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/tidwall/match https://github.com/tidwall/match ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2016 Josh Baker Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/tidwall/pretty https://github.com/tidwall/pretty ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2017 Josh Baker Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/tinylib/msgp https://github.com/tinylib/msgp ---------------------------------------------------------------- Copyright (c) 2014 Philip Hofer Portions Copyright (c) 2009 The Go Authors (license at http://golang.org) where indicated Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/tklauser/go-sysconf https://github.com/tklauser/go-sysconf ---------------------------------------------------------------- BSD 3-Clause License Copyright (c) 2018-2022, Tobias Klauser All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ github.com/tklauser/numcpus https://github.com/tklauser/numcpus ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ github.com/unrolled/secure https://github.com/unrolled/secure ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2014 Cory Jacobsen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ github.com/vbauerster/mpb/v8 https://github.com/vbauerster/mpb/v8 ---------------------------------------------------------------- This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to ================================================================ github.com/yusufpapurcu/wmi https://github.com/yusufpapurcu/wmi ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2013 Stack Exchange Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ go.etcd.io/etcd/api/v3 https://go.etcd.io/etcd/api/v3 ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ go.etcd.io/etcd/client/pkg/v3 https://go.etcd.io/etcd/client/pkg/v3 ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ go.etcd.io/etcd/client/v3 https://go.etcd.io/etcd/client/v3 ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ go.mongodb.org/mongo-driver https://go.mongodb.org/mongo-driver ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ go.opentelemetry.io/auto/sdk https://go.opentelemetry.io/auto/sdk ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ go.opentelemetry.io/otel https://go.opentelemetry.io/otel ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ go.opentelemetry.io/otel/metric https://go.opentelemetry.io/otel/metric ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ go.opentelemetry.io/otel/sdk https://go.opentelemetry.io/otel/sdk ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ go.opentelemetry.io/otel/sdk/metric https://go.opentelemetry.io/otel/sdk/metric ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ go.opentelemetry.io/otel/trace https://go.opentelemetry.io/otel/trace ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ go.uber.org/goleak https://go.uber.org/goleak ---------------------------------------------------------------- The MIT License (MIT) Copyright (c) 2018 Uber Technologies, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ go.uber.org/multierr https://go.uber.org/multierr ---------------------------------------------------------------- Copyright (c) 2017-2021 Uber Technologies, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ go.uber.org/zap https://go.uber.org/zap ---------------------------------------------------------------- Copyright (c) 2016-2017 Uber Technologies, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ golang.org/x/crypto https://golang.org/x/crypto ---------------------------------------------------------------- Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ golang.org/x/net https://golang.org/x/net ---------------------------------------------------------------- Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ golang.org/x/oauth2 https://golang.org/x/oauth2 ---------------------------------------------------------------- Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ golang.org/x/sync https://golang.org/x/sync ---------------------------------------------------------------- Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ golang.org/x/sys https://golang.org/x/sys ---------------------------------------------------------------- Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ golang.org/x/term https://golang.org/x/term ---------------------------------------------------------------- Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ golang.org/x/text https://golang.org/x/text ---------------------------------------------------------------- Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ google.golang.org/genproto/googleapis/api https://google.golang.org/genproto/googleapis/api ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ google.golang.org/genproto/googleapis/rpc https://google.golang.org/genproto/googleapis/rpc ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ google.golang.org/grpc https://google.golang.org/grpc ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. ================================================================ google.golang.org/protobuf https://google.golang.org/protobuf ---------------------------------------------------------------- Copyright (c) 2018 The Go Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ gopkg.in/check.v1 https://gopkg.in/check.v1 ---------------------------------------------------------------- Gocheck - A rich testing framework for Go Copyright (c) 2010-2013 Gustavo Niemeyer All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ gopkg.in/yaml.v2 https://gopkg.in/yaml.v2 ---------------------------------------------------------------- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} 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. ================================================================ gopkg.in/yaml.v3 https://gopkg.in/yaml.v3 ---------------------------------------------------------------- This project is covered by two different licenses: MIT and Apache. #### MIT License #### The following files were ported to Go from C files of libyaml, and thus are still covered by their original MIT license, with the additional copyright staring in 2011 when the project was ported over: apic.go emitterc.go parserc.go readerc.go scannerc.go writerc.go yamlh.go yamlprivateh.go Copyright (c) 2006-2010 Kirill Simonov Copyright (c) 2006-2011 Kirill Simonov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ### Apache License ### All the remaining project files are covered by the Apache license: Copyright (c) 2011-2019 Canonical Ltd 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. ================================================================ ================================================ FILE: DEVELOPMENT.md ================================================ # Developing Console Console requires the [MinIO® Server](https://github.com/minio/minio). For development purposes, you also need to run both the Console web app and the Console server. > [!IMPORTANT] > **MINIO** is a registered trademark of the MinIO Corporation. Consequently, this project is not affiliated with or endorsed by the MinIO Corporation. ## Console Architecture Overview ```mermaid graph TD; A(User Browser) -- HTTPS/HTTP --> B["Console
Frontend Application
(React/TypeScript)"]; B -- REST API Calls --> D["Console
Backend Server
(Go)"]; D -- "HTTPS/HTTP
Admin Operations" --> E["MinIO Server
Object Storage"]; E@{ shape: cyl} ``` ## Running Console server Build the server in the main folder by running: ``` make ``` > [!NOTE] > If it's the first time running the server, you might need to run `go mod tidy` to ensure you have all modules > required. To start the server run: ``` CONSOLE_ACCESS_KEY= CONSOLE_SECRET_KEY= CONSOLE_MINIO_SERVER= CONSOLE_DEV_MODE=on ./console server ``` ## Running Console web app Refer to `/web-app` [instructions](/web-app/README.md) to run the web app locally. # 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 with a Container If you want to test console in a container, 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. You can use it in your local kubernetes environment aswell. For example, if you are using kind: ```shell kind load docker-image miniodev/console:dev ``` and then deploy any `Tenant` that uses this image ================================================ FILE: Dockerfile ================================================ ARG GO_VERSION=1.26 ARG NODE_VERSION=24 FROM node:${NODE_VERSION}-alpine AS uilayer WORKDIR /app # Git is required for some dependencies pulled from repositories RUN apk add --no-cache git RUN corepack enable COPY ./web-app/package.json ./web-app/yarn.lock ./web-app/.yarnrc.yml ./ RUN yarn install COPY ./web-app . RUN yarn build USER node FROM golang:${GO_VERSION}-alpine AS golayer WORKDIR /console/ ADD go.mod . ADD go.sum . # Get dependencies - will also be cached if we won't change mod/sum RUN go mod download ADD . . ENV CGO_ENABLED=0 ENV GO111MODULE=on COPY --from=uilayer /app/build ./web-app/build RUN go build -trimpath --tags=kqueue,operator -ldflags "-w -s" -a -o console ./cmd/console FROM scratch EXPOSE 9090 COPY --from=golayer /console/console . USER 1000:1000 ENTRYPOINT ["/console"] CMD [ "server"] ================================================ FILE: Dockerfile.assets ================================================ ARG NODE_VERSION=24 FROM node:${NODE_VERSION}-alpine AS uilayer WORKDIR /app # Git is required for some dependencies pulled from repositories RUN apk add --no-cache git RUN corepack enable COPY ./web-app/package.json ./web-app/yarn.lock ./web-app/.yarnrc.yml ./ RUN yarn install COPY ./web-app . RUN yarn build USER node ================================================ FILE: Dockerfile.goreleaser ================================================ FROM scratch ARG TARGETPLATFORM ARG TAG ARG SOURCE LABEL name="Console" \ maintainer="Georg Mangold" \ version="${TAG}" \ release="${TAG}" \ summary="A graphical user interface for MinIO®" \ description="See Github for more information https://github.com/georgmangold/console" \ org.opencontainers.image.source="https://github.com/georgmangold/console" \ org.opencontainers.image.description="A graphical user interface for MinIO®" \ org.opencontainers.image.licenses="AGPL-3.0-or-later" COPY $TARGETPLATFORM/console /console EXPOSE 9090 USER 1000:1000 ENTRYPOINT ["/console"] CMD ["server"] ================================================ FILE: Dockerfile.release ================================================ FROM scratch ARG TAG ARG SOURCE LABEL name="Console" \ maintainer="Georg Mangold" \ version="${TAG}" \ release="${TAG}" \ summary="A graphical user interface for MinIO" \ description="See Github for more information https://github.com/georgmangold/console" \ org.opencontainers.image.source="https://github.com/georgmangold/console" \ org.opencontainers.image.description="A graphical user interface for MinIO" \ org.opencontainers.image.licenses="AGPL-3.0-or-later" COPY console /console EXPOSE 9090 USER 1000:1000 ENTRYPOINT ["/console"] CMD [ "server"] ================================================ FILE: LICENSE ================================================ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================ FILE: Makefile ================================================ PWD := $(shell pwd) GOPATH := $(shell go env GOPATH) # Sets the build version based on the output of the following command, if we are building for a tag, that's the build else it uses the current git branch as the build BUILD_VERSION:=$(shell git describe --exact-match --tags $(git log -n1 --pretty='%h') 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null) BUILD_TIME:=$(shell date 2>/dev/null) TAG ?= "ghcr.io/georgmangold/console:$(BUILD_VERSION)-dev" #TAG ?= "ghcr.io/georgmangold/console:dev" MINIO_VERSION ?= "quay.io/minio/minio:latest" #MINIO_VERSION ?= "quay.io/minio/minio:RELEASE.2025-04-22T22-12-26Z" TARGET_BUCKET ?= "target" NODE_VERSION := $(shell cat .nvmrc) default: console .PHONY: console console: @echo "Building Console binary to './console'" @(GO111MODULE=on CGO_ENABLED=0 go build -trimpath --tags=kqueue --ldflags "-s -w" -o console ./cmd/console) getdeps: @mkdir -p ${GOPATH}/bin @echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin verifiers: getdeps fmt lint fmt: @echo "Running $@ check" @(env bash $(PWD)/verify-gofmt.sh) crosscompile: @(env bash $(PWD)/cross-compile.sh $(arg1)) lint: @echo "Running $@ check" @GO111MODULE=on ${GOPATH}/bin/golangci-lint cache clean @GO111MODULE=on ${GOPATH}/bin/golangci-lint run --timeout=5m --config ./.golangci.yml lint-fix: getdeps ## runs golangci-lint suite of linters with automatic fixes @echo "Running $@ check" @GO111MODULE=on ${GOPATH}/bin/golangci-lint run --timeout=5m --config ./.golangci.yml --fix install: console @echo "Installing console binary to '$(GOPATH)/bin/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 apply-gofmt @echo "Done Generating swagger server code from yaml" apply-gofmt: @echo "Applying gofmt to all generated an existing files" @GO111MODULE=on gofmt -w . clean-swagger: @echo "cleaning" @rm -rf models @rm -rf api/operations swagger-console: @echo "Generating swagger server code from yaml" @go tool swagger version @go tool swagger generate server -A console --main-package=management --server-package=api --exclude-main -P models.Principal -f ./swagger.yml -r NOTICE @echo "Ensure basic install" @(cd web-app; yarn; cd ..) @echo "Generating typescript api" @make swagger-typescript-api path="../swagger.yml" output="./src/api" name="consoleApi.ts" @git restore api/server.go swagger-typescript-api: @(cd web-app; yarn swagger-typescript-api generate -p $(path) -o $(output) -n $(name) --custom-config ../generator.config.js; cd ..) assets: @(if [ -f "${NVM_DIR}/nvm.sh" ]; then \. "${NVM_DIR}/nvm.sh" && nvm install && nvm use && npm install -g yarn ; fi &&\ cd web-app; corepack enable; yarn install; make build-static; yarn prettier --write . --log-level warn; cd ..) test-integration: @(docker stop pgsqlcontainer || true) @(docker stop minio || true) @(docker stop console || true) @(docker stop minio2 || true) @(docker stop console2 || true) @(docker network rm mynet123 || true) @echo "create docker network to communicate containers MinIO & PostgreSQL" @(docker network create --subnet=173.18.0.0/29 mynet123) @echo "docker run with MinIO Version below:" @echo $(MINIO_VERSION) @echo "MinIO 1" @(docker run -v /data1 -v /data2 -v /data3 -v /data4 --net=mynet123 --ip=173.18.0.2 -d --name minio --rm -p 9000:9000 -e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= -e MINIO_UPDATE=off -e MINIO_BROWSER=off $(MINIO_VERSION) server /data{1...4} --console-address ':9091' && sleep 5) @(docker run -p 9091:9091 --net=mynet123 --ip=173.18.0.5 -e CONSOLE_MINIO_SERVER=http://173.18.0.2:9000 -e CONSOLE_PORT=9091 --rm -d --name console $(TAG) && sleep 5) @echo "MinIO 2" @(docker run -v /data1 -v /data2 -v /data3 -v /data4 --net=mynet123 --ip=173.18.0.3 -d --name minio2 --rm -p 9001:9001 -e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= -e MINIO_UPDATE=off -e MINIO_BROWSER=off $(MINIO_VERSION) server /data{1...4} --address ':9001' --console-address ':9092' && sleep 5) @(docker run -p 9092:9092 --net=mynet123 --ip=173.18.0.6 -e CONSOLE_MINIO_SERVER=http://173.18.0.3:9001 -e CONSOLE_PORT=9092 --rm -d --name console2 $(TAG) && sleep 5) @echo "Postgres" @(docker run --net=mynet123 --ip=173.18.0.4 --name pgsqlcontainer --rm -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres && sleep 5) @echo "execute test and get coverage for test-integration:" @(cd integration && go test -coverpkg=../api -c -tags testrunmain . && mkdir -p coverage && ./integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/system.out) @(docker stop pgsqlcontainer) @(docker stop minio) @(docker stop console) @(docker stop minio2) @(docker stop console2) @(docker network rm mynet123) test-replication: @(docker stop minio || true) @(docker stop minio1 || true) @(docker stop minio2 || true) @(docker network rm mynet123 || true) @(docker network create mynet123) @(docker run -v /data1 -v /data2 -v /data3 -v /data4 \ --net=mynet123 -d \ --name minio \ --rm \ -p 9000:9000 \ -p 6000:6000 \ -e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= \ -e MINIO_ROOT_USER="minioadmin" \ -e MINIO_ROOT_PASSWORD="minioadmin" \ -e MINIO_UPDATE=off \ $(MINIO_VERSION) server /data{1...4} \ --address :9000 \ --console-address :6000) @(docker run -v /data1 -v /data2 -v /data3 -v /data4 \ --net=mynet123 -d \ --name minio1 \ --rm \ -p 9001:9001 \ -p 6001:6001 \ -e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= \ -e MINIO_ROOT_USER="minioadmin" \ -e MINIO_ROOT_PASSWORD="minioadmin" \ -e MINIO_UPDATE=off \ $(MINIO_VERSION) server /data{1...4} \ --address :9001 \ --console-address :6001) @(docker run -v /data1 -v /data2 -v /data3 -v /data4 \ --net=mynet123 -d \ --name minio2 \ --rm \ -p 9002:9002 \ -p 6002:6002 \ -e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= \ -e MINIO_ROOT_USER="minioadmin" \ -e MINIO_ROOT_PASSWORD="minioadmin" \ -e MINIO_UPDATE=off \ $(MINIO_VERSION) server /data{1...4} \ --address :9002 \ --console-address :6002) @(cd replication && go test -coverpkg=../api -c -tags testrunmain . && mkdir -p coverage && ./replication.test -test.v -test.run "^Test*" -test.coverprofile=coverage/replication.out) @(docker stop minio || true) @(docker stop minio1 || true) @(docker stop minio2 || true) @(docker network rm mynet123 || true) test-sso-integration: @echo "create the network in bridge mode to communicate all containers" @(docker network create my-net) @echo "run openldap container using MinIO Image: quay.io/minio/openldap:latest" @(docker run \ -e LDAP_ORGANIZATION="MinIO Inc" \ -e LDAP_DOMAIN="min.io" \ -e LDAP_ADMIN_PASSWORD="admin" \ --network my-net \ -p 389:389 \ -p 636:636 \ --name openldap \ --detach quay.io/minio/openldap:latest) @echo "Run Dex container using MinIO Image: quay.io/minio/dex:latest" @(docker run \ -e DEX_ISSUER=http://dex:5556/dex \ -e DEX_CLIENT_REDIRECT_URI=http://127.0.0.1:9090/oauth_callback \ -e DEX_LDAP_SERVER=openldap:389 \ --network my-net \ -p 5556:5556 \ --name dex \ --detach quay.io/minio/dex:latest) @echo "running minio server" @(docker run \ -v /data1 -v /data2 -v /data3 -v /data4 \ --network my-net \ -d \ --name minio \ --rm \ -p 9000:9000 \ -p 9001:9001 \ -e MINIO_IDENTITY_OPENID_CLIENT_ID="minio-client-app" \ -e MINIO_IDENTITY_OPENID_CLIENT_SECRET="minio-client-app-secret" \ -e MINIO_IDENTITY_OPENID_CLAIM_NAME=name \ -e MINIO_IDENTITY_OPENID_CONFIG_URL=http://dex:5556/dex/.well-known/openid-configuration \ -e MINIO_IDENTITY_OPENID_REDIRECT_URI=http://127.0.0.1:9090/oauth_callback \ -e MINIO_ROOT_USER=minio \ -e MINIO_UPDATE=off \ -e MINIO_ROOT_PASSWORD=minio123 $(MINIO_VERSION) server /data{1...4} --address :9000 --console-address :9001) @echo "run mc commands to set the policy" @(docker run -e MC_UPDATE=off --name minio-client --network my-net -dit --entrypoint=/bin/sh minio/mc) @(docker exec minio-client mc alias set myminio/ http://minio:9000 minio minio123) @echo "adding policy to Dillon Harper to be able to login:" @(cd sso-integration && docker cp allaccess.json minio-client:/ && docker exec minio-client mc admin policy create myminio "Dillon Harper" allaccess.json) @echo "starting bash script" @(env bash $(PWD)/sso-integration/set-sso.sh) @echo "add python module" @(pip3 install bs4) @echo "Executing the test:" @(cd sso-integration && go test -coverpkg=../api -c -tags testrunmain . && mkdir -p coverage && ./sso-integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/sso-system.out) test-permissions-1: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-1/") @(docker stop minio) test-permissions-2: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-2/") @(docker stop minio) test-permissions-3: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-3/") @(docker stop minio) test-permissions-4: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-4/") @(docker stop minio) test-permissions-5: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-5/") @(docker stop minio) test-permissions-6: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-6/") @(docker stop minio) test-permissions-7: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-7/") @(docker stop minio) test-permissions-8: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-8/") @(docker stop minio) test-permissions-A: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-A/") @(docker stop minio) test-permissions-B: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-B/") @(docker stop minio) test-apply-permissions: @(env bash $(PWD)/web-app/tests/scripts/initialize-env.sh) test-start-docker-minio: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -e MINIO_UPDATE=off -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) initialize-permissions: test-start-docker-minio test-apply-permissions @echo "Done initializing permissions test" cleanup-permissions: @(env bash $(PWD)/web-app/tests/scripts/cleanup-env.sh) @(docker stop minio) initialize-docker-network: @(docker network create test-network) test-start-docker-minio-w-redirect-url: initialize-docker-network @(docker run \ -e MINIO_BROWSER_REDIRECT_URL='http://localhost:8000/console/subpath/' \ -e MINIO_SERVER_URL='http://localhost:9000' \ -e MINIO_UPDATE=off \ -v /data1 -v /data2 -v /data3 -v /data4 \ -d --network host --name minio --rm\ quay.io/minio/minio:latest server /data{1...4}) test-start-docker-nginx-w-subpath: @(docker run \ --network host \ -d --rm \ --add-host=host.docker.internal:host-gateway \ -v ./web-app/tests/subpath-nginx/nginx.conf:/etc/nginx/nginx.conf \ -e MINIO_UPDATE=off \ --name test-nginx nginx) test-initialize-minio-nginx: test-start-docker-minio-w-redirect-url test-start-docker-nginx-w-subpath cleanup-minio-nginx: @(docker stop minio test-nginx & docker network rm test-network) # https://stackoverflow.com/questions/19200235/golang-tests-in-sub-directory # Note: go test ./... will run tests on the current folder and all subfolders. # This is needed because tests can be in the folder or sub-folder(s), let's include them all please!. test: @echo "execute test and get coverage" @(cd api && mkdir -p coverage && GO111MODULE=on go test ./... -test.v -coverprofile=coverage/coverage.out) # https://stackoverflow.com/questions/19200235/golang-tests-in-sub-directory # Note: go test ./... will run tests on the current folder and all subfolders. # This is since tests in pkg folder are in subfolders and were not executed. test-pkg: @echo "execute test and get coverage" @(cd pkg && mkdir -p coverage && GO111MODULE=on go test ./... -test.v -coverprofile=coverage/coverage-pkg.out) coverage: @(GO111MODULE=on go test -v -coverprofile=coverage.out github.com/minio/console/api/... && go tool cover -html=coverage.out && open coverage.html) clean: @echo "Cleaning up all the generated files" @find . -name '*.test' | xargs rm -fv @find . -name '*~' | xargs rm -fv @rm -vf console docker: @docker buildx build --output=type=docker --platform linux/amd64 -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' --build-arg NODE_VERSION='$(NODE_VERSION)' . release: swagger-gen @echo "Generating Release: $(RELEASE)" @make assets @git add -u . @git add web-app/build/ ================================================ FILE: NOTICE ================================================ This file is part of Console Server This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . ================================================ FILE: README.md ================================================ # Console ![Workflow](https://github.com/georgmangold/console/actions/workflows/jobs.yaml/badge.svg) ![license](https://img.shields.io/badge/license-AGPL%20V3-blue) ![binarydownloads](https://img.shields.io/github/downloads/georgmangold/console/total?label=GitHub%20Release%20Downloads) ![ghcr](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fghcr-badge.elias.eu.org%2Fapi%2Fgeorgmangold%2Fconsole%2Fconsole&query=downloadCount&logo=refinedgithub&label=ghcr.io%20Container%20Pulls&color=9E95B7) Console is a graphical admin management browser user interface for [MinIO® Server](https://github.com/minio/minio) > [!NOTE] > Console is a fork of the old [MinIO Console](https://github.com/minio/object-browser) for my own personal educational purposes, and therefore it incorporates MinIO® source code. You may also want to look for other maintained [forks](https://github.com/minio/object-browser/forks). > [!IMPORTANT] > **MINIO** is a registered trademark of the MinIO Corporation. Consequently, this project is not affiliated with or endorsed by the MinIO Corporation. | Login | Metrics | Object Browser | |------------------------------------------|-----------------------------------------------------|----------------------------------------| | ![Login](images/1_login.png) | ![Metrics](images/2_metrics.png) | ![Object Browser](images/3_bucket.png) | | ![Performance](images/4_performance.png) | ![CommandInterface](images/5_command_interface.png) | | | **Performance/ Speedtest** | **Ctrl/Strg + k** | | **Table of Contents** - [Console](#console) - [Install](#install) - [Binary Releases](#binary-releases) - [Docker](#docker) - [Build from source](#build-from-source) - [Setup](#setup) - [1. Create a user `console` using `mc`](#1-create-a-user-console-using-mc) - [2. Create a policy for `console` with admin access to all resources (for testing)](#2-create-a-policy-for-console-with-admin-access-to-all-resources-for-testing) - [3. Set the policy for the new `console` user](#3-set-the-policy-for-the-new-console-user) - [Start Console service:](#start-console-service) - [Documentation](#documentation) - [Contribute to Console Project](#contribute-to-console-project) - [License](#license) ## Install ### Binary Releases ![binarydownloads](https://img.shields.io/github/downloads/georgmangold/console/total) | OS | ARCH | Binary | |:-------:|:-------:|:-----------------------------------------------------------------------------------------------------------:| | Linux | amd64 | [linux-amd64](https://github.com/georgmangold/console/releases/latest/download/console-linux-amd64) | | Linux | arm64 | [linux-arm64](https://github.com/georgmangold/console/releases/latest/download/console-linux-arm64) | | Linux | arm | [linux-arm](https://github.com/georgmangold/console/releases/latest/download/console-linux-arm) | | Apple | amd64 | [darwin-amd64](https://github.com/georgmangold/console/releases/latest/download/console-darwin-amd64) | | Apple | arm64 | [darwin-amd64](https://github.com/georgmangold/console/releases/latest/download/console-darwin-arm64) | | Windows | amd64 | [windows-amd64](https://github.com/georgmangold/console/releases/latest/download/console-windows-amd64.exe) | For Checksums, DEB and RPM Packages visit latest [Release Page](https://github.com/georgmangold/console/releases/latest/). ### Docker Pull the latest release via: [Github Packages](https://github.com/georgmangold/console/pkgs/container/console) ![ghcr](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fghcr-badge.elias.eu.org%2Fapi%2Fgeorgmangold%2Fconsole%2Fconsole&query=downloadCount&logo=refinedgithub&label=ghcr.io%20Container%20Pulls&color=9E95B7) ``` docker pull ghcr.io/georgmangold/console ``` Run it with and replace `YOUR_MINIO_SERVER_URL` with your own MinIO Server URL ``` docker run -p 127.0.0.1:9090:9090 -e CONSOLE_MINIO_SERVER=https://YOUR_MINIO_SERVER_URL ghcr.io/georgmangold/console ``` > [!NOTE] > If you have changed the region on your MinIO Server from the default `us-east-1` you need to set the Environment Variable `CONSOLE_MINIO_REGION=` as well. ### Build from source > [!NOTE] > You will need a working Go environment. Therefore, please follow [How to install Go](https://golang.org/doc/install). > Minimum version required is ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/georgmangold/console) ``` go install github.com/georgmangold/console/cmd/console@latest ``` Refer to [DEVELOPMENT.md](DEVELOPMENT.md) and [CONTRIBUTING.md](CONTRIBUTING.md) for more Information on how to build this project. ## Setup All `console` needs is a MinIO user with admin privileges and URL pointing to your MinIO deployment. > [!NOTE] > We don't recommend using MinIO's Root Admin Credentials ### 1. Create a user `console` using `mc` ```bash mc admin user add myminio/ Enter Access Key: console Enter Secret Key: xxxxxxxx ``` ### 2. Create a policy for `console` with admin access to all resources (for testing) ```sh cat > admin.json << EOF { "Version": "2012-10-17", "Statement": [{ "Action": [ "admin:*" ], "Effect": "Allow", "Sid": "" }, { "Action": [ "s3:*" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::*" ], "Sid": "" } ] } EOF ``` ```sh mc admin policy create myminio/ consoleAdmin admin.json ``` ### 3. Set the policy for the new `console` user ```sh mc admin policy attach myminio consoleAdmin --user=console ``` > [!NOTE] > Additionally, you can create policies to limit the privileges for other `console` users, for example, if you > want the user to only have access to dashboard, buckets, notifications and watch page, the policy should look like > this: > ```json > { > "Version": "2012-10-17", > "Statement": [ > { > "Action": [ > "admin:ServerInfo" > ], > "Effect": "Allow", > "Sid": "" > }, > { > "Action": [ > "s3:ListenBucketNotification", > "s3:PutBucketNotification", > "s3:GetBucketNotification", > "s3:ListMultipartUploadParts", > "s3:ListBucketMultipartUploads", > "s3:ListBucket", > "s3:HeadBucket", > "s3:GetObject", > "s3:GetBucketLocation", > "s3:AbortMultipartUpload", > "s3:CreateBucket", > "s3:PutObject", > "s3:DeleteObject", > "s3:DeleteBucket", > "s3:PutBucketPolicy", > "s3:DeleteBucketPolicy", > "s3:GetBucketPolicy" > ], > "Effect": "Allow", > "Resource": [ > "arn:aws:s3:::*" > ], > "Sid": "" > } > ] > } > ``` ## Start Console service: Before running console service, following environment settings must be supplied ```sh # MinIO Endpoint export CONSOLE_MINIO_SERVER=http://localhost:9000 ``` Now start the console service. ``` ./console server 2021-01-19 02:36:08.893735 I | 2021/01/19 02:36:08 server.go:129: Serving console at http://localhost:9090 ``` By default `console` runs on port `9090` this can be changed with `--port` of your choice. > [!NOTE] > If you have changed the region on your MinIO Server from the default `us-east-1` you need to set the Environment Variable `CONSOLE_MINIO_REGION=` as well. ## Documentation See [documentation](docs/README.md) and [FAQ](docs/README.md#faq) for more information. ## Contribute to console Project Please follow console [Contributor's Guide](./CONTRIBUTING.md) ## License Console is licensed under the [GNU AGPLv3](LICENSE). ## Star History Console Star History Chart ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Supported Versions We always provide security updates for the [latest release](https://github.com/georgmangold/console/releases/latest). Whenever there is a security update you just need to upgrade to the latest version. ## Reporting a Vulnerability Please use Githubs [private vulnerability reporting](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability) feature to report security bugs in [console](https://github.com/georgmangold/console) directly and privately to the maintainers. Please, provide a detailed explanation of the issue. In particular, outline the type of the security issue (DoS, authentication bypass, information disclose, ...) and the assumptions you're making (e.g. do you need access credentials for a successful exploit). ================================================ FILE: VULNERABILITY_REPORT.md ================================================ ## Vulnerability Management Policy This document formally describes the process of addressing and managing a reported vulnerability that has been found in the Console server code base, any directly connected ecosystem component or a direct / indirect dependency of the code base. ### Scope The vulnerability management policy described in this document covers the process of investigating, assessing and resolving a vulnerability report opened by a Console member or an external third party. Therefore, it lists pre-conditions and actions that should be performed to resolve and fix a reported vulnerability. ### Vulnerability Management Process The vulnerability management process requires that the vulnerability report contains the following information: - The project / component that contains the reported vulnerability. - A description of the vulnerability. In particular, the type of the reported vulnerability and how it might be exploited. Alternatively, a well-established vulnerability identifier, e.g. CVE number, can be used instead. Based on the description mentioned above, a Console team member investigates: - Whether the reported vulnerability exists. - The conditions that are required such that the vulnerability can be exploited. - The steps required to fix the vulnerability. In general, if the vulnerability exists in one of the Console code bases itself - not in a code dependency - then Console will, if possible, fix the vulnerability or implement reasonable countermeasures such that the vulnerability cannot be exploited anymore. ================================================ FILE: api/admin_arns.go ================================================ // 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 api import ( "context" systemApi "github.com/minio/console/api/operations/system" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" "github.com/minio/console/models" ) func registerAdminArnsHandlers(api *operations.ConsoleAPI) { // return a list of arns api.SystemArnListHandler = systemApi.ArnListHandlerFunc(func(params systemApi.ArnListParams, session *models.Principal) middleware.Responder { arnsResp, err := getArnsResponse(session, params) if err != nil { return systemApi.NewArnListDefault(err.Code).WithPayload(err.APIError) } return systemApi.NewArnListOK().WithPayload(arnsResp) }) } // getArns invokes admin info and returns a list of arns func getArns(ctx context.Context, client MinioAdmin) (*models.ArnsResponse, error) { serverInfo, err := client.serverInfo(ctx) if err != nil { return nil, err } // build response return &models.ArnsResponse{ Arns: serverInfo.SQSARN, }, nil } // getArnsResponse returns a list of active arns in the instance func getArnsResponse(session *models.Principal, params systemApi.ArnListParams) (*models.ArnsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // serialize output arnsList, err := getArns(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } return arnsList, nil } ================================================ FILE: api/admin_arns_test.go ================================================ // 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 api import ( "context" "errors" "fmt" "net/http" "strings" "testing" "github.com/minio/console/api/operations/system" "github.com/minio/console/models" "github.com/go-openapi/loads" "github.com/minio/console/api/operations" "github.com/minio/madmin-go/v3" asrt "github.com/stretchr/testify/assert" ) func TestArnsList(t *testing.T) { assert := asrt.New(t) adminClient := AdminClientMock{} // Test-1 : getArns() returns proper arn list MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { return madmin.InfoMessage{ SQSARN: []string{"uno"}, }, nil } ctx, cancel := context.WithCancel(context.Background()) defer cancel() arnsList, err := getArns(ctx, adminClient) assert.NotNil(arnsList, "arn list was returned nil") if arnsList != nil { assert.Equal(len(arnsList.Arns), 1, "Incorrect arns count") } assert.Nil(err, "Error should have been nil") // Test-2 : getArns(ctx) fails for whatever reason MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { return madmin.InfoMessage{}, errors.New("some reason") } arnsList, err = getArns(ctx, adminClient) assert.Nil(arnsList, "arn list was not returned nil") assert.NotNil(err, "An error should have been returned") } func TestRegisterAdminArnsHandlers(t *testing.T) { assert := asrt.New(t) swaggerSpec, err := loads.Embedded(SwaggerJSON, FlatSwaggerJSON) if err != nil { assert.Fail("Error") } api := operations.NewConsoleAPI(swaggerSpec) api.SystemArnListHandler = nil registerAdminArnsHandlers(api) if api.SystemArnListHandler == nil { assert.Fail("Assignment should happen") } else { fmt.Println("Function got assigned: ", api.SystemArnListHandler) } // To test error case in registerAdminArnsHandlers request, _ := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/", nil, ) ArnListParamsStruct := system.ArnListParams{ HTTPRequest: request, } modelsPrincipal := models.Principal{ STSAccessKeyID: "accesskey", } value := api.SystemArnListHandler.Handle(ArnListParamsStruct, &modelsPrincipal) str := fmt.Sprintf("%#v", value) fmt.Println("value: ", str) assert.Equal(strings.Contains(str, "_statusCode:500"), true) } ================================================ FILE: api/admin_client_mock.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package api import ( "context" "io" "time" "github.com/minio/madmin-go/v3" iampolicy "github.com/minio/pkg/v3/policy" ) type AdminClientMock struct{} var ( MinioServerInfoMock func(ctx context.Context) (madmin.InfoMessage, error) minioChangePasswordMock func(ctx context.Context, accessKey, secretKey string) error minioHelpConfigKVMock func(subSys, key string, envOnly bool) (madmin.Help, error) minioGetConfigKVMock func(key string) ([]byte, error) minioSetConfigKVMock func(kv string) (restart bool, err error) minioDelConfigKVMock func(name string) (err error) minioHelpConfigKVGlobalMock func(envOnly bool) (madmin.Help, error) minioGetLogsMock func(ctx context.Context, node string, lineCnt int, logKind string) <-chan madmin.LogInfo minioListGroupsMock func() ([]string, error) minioUpdateGroupMembersMock func(madmin.GroupAddRemove) error minioGetGroupDescriptionMock func(group string) (*madmin.GroupDesc, error) minioSetGroupStatusMock func(group string, status madmin.GroupStatus) error minioHealMock func(ctx context.Context, bucket, prefix string, healOpts madmin.HealOpts, clientToken string, forceStart, forceStop bool) (healStart madmin.HealStartSuccess, healTaskStatus madmin.HealTaskStatus, err error) minioServerHealthInfoMock func(ctx context.Context, deadline time.Duration) (interface{}, string, error) minioListPoliciesMock func() (map[string]*iampolicy.Policy, error) minioGetPolicyMock func(name string) (*iampolicy.Policy, error) minioRemovePolicyMock func(name string) error minioAddPolicyMock func(name string, policy *iampolicy.Policy) error minioSetPolicyMock func(policyName, entityName string, isGroup bool) error minioStartProfiling func(profiler madmin.ProfilerType, duration time.Duration) (io.ReadCloser, error) minioServiceRestartMock func(ctx context.Context) error getSiteReplicationInfo func(ctx context.Context) (*madmin.SiteReplicationInfo, error) addSiteReplicationInfo func(ctx context.Context, sites []madmin.PeerSite) (*madmin.ReplicateAddStatus, error) editSiteReplicationInfo func(ctx context.Context, site madmin.PeerInfo) (*madmin.ReplicateEditStatus, error) deleteSiteReplicationInfoMock func(ctx context.Context, removeReq madmin.SRRemoveReq) (*madmin.ReplicateRemoveStatus, error) getSiteReplicationStatus func(ctx context.Context, params madmin.SRStatusOptions) (*madmin.SRStatusInfo, error) minioListTiersMock func(ctx context.Context) ([]*madmin.TierConfig, error) minioTierStatsMock func(ctx context.Context) ([]madmin.TierInfo, error) minioAddTiersMock func(ctx context.Context, tier *madmin.TierConfig) error minioRemoveTierMock func(ctx context.Context, tierName string) error minioEditTiersMock func(ctx context.Context, tierName string, creds madmin.TierCreds) error minioVerifyTierStatusMock func(ctx context.Context, tierName string) error minioServiceTraceMock func(ctx context.Context, threshold int64, s3, internal, storage, os, errTrace bool) <-chan madmin.ServiceTraceInfo minioListUsersMock func() (map[string]madmin.UserInfo, error) minioAddUserMock func(accessKey, secreyKey string) error minioRemoveUserMock func(accessKey string) error minioGetUserInfoMock func(accessKey string) (madmin.UserInfo, error) minioSetUserStatusMock func(accessKey string, status madmin.AccountStatus) error minioAccountInfoMock func(ctx context.Context) (madmin.AccountInfo, error) minioAddServiceAccountMock func(ctx context.Context, policy string, user string, accessKey string, secretKey string, description string, name string, expiry *time.Time, status string) (madmin.Credentials, error) minioListServiceAccountsMock func(ctx context.Context, user string) (madmin.ListServiceAccountsResp, error) minioDeleteServiceAccountMock func(ctx context.Context, serviceAccount string) error minioInfoServiceAccountMock func(ctx context.Context, serviceAccount string) (madmin.InfoServiceAccountResp, error) minioUpdateServiceAccountMock func(ctx context.Context, serviceAccount string, opts madmin.UpdateServiceAccountReq) error minioGetLDAPPolicyEntitiesMock func(ctx context.Context, query madmin.PolicyEntitiesQuery) (madmin.PolicyEntitiesResult, error) minioListRemoteBucketsMock func(ctx context.Context, bucket, arnType string) (targets []madmin.BucketTarget, err error) minioGetRemoteBucketMock func(ctx context.Context, bucket, arnType string) (targets *madmin.BucketTarget, err error) minioAddRemoteBucketMock func(ctx context.Context, bucket string, target *madmin.BucketTarget) (string, error) ) func (ac AdminClientMock) serverInfo(ctx context.Context) (madmin.InfoMessage, error) { return MinioServerInfoMock(ctx) } func (ac AdminClientMock) listRemoteBuckets(ctx context.Context, bucket, arnType string) (targets []madmin.BucketTarget, err error) { return minioListRemoteBucketsMock(ctx, bucket, arnType) } func (ac AdminClientMock) getRemoteBucket(ctx context.Context, bucket, arnType string) (targets *madmin.BucketTarget, err error) { return minioGetRemoteBucketMock(ctx, bucket, arnType) } func (ac AdminClientMock) removeRemoteBucket(_ context.Context, _, _ string) error { return nil } func (ac AdminClientMock) addRemoteBucket(ctx context.Context, bucket string, target *madmin.BucketTarget) (string, error) { return minioAddRemoteBucketMock(ctx, bucket, target) } func (ac AdminClientMock) changePassword(ctx context.Context, accessKey, secretKey string) error { return minioChangePasswordMock(ctx, accessKey, secretKey) } func (ac AdminClientMock) speedtest(_ context.Context, _ madmin.SpeedtestOpts) (chan madmin.SpeedTestResult, error) { return nil, nil } func (ac AdminClientMock) verifyTierStatus(ctx context.Context, tier string) error { return minioVerifyTierStatusMock(ctx, tier) } // mock function helpConfigKV() func (ac AdminClientMock) helpConfigKV(_ context.Context, subSys, key string, envOnly bool) (madmin.Help, error) { return minioHelpConfigKVMock(subSys, key, envOnly) } // mock function getConfigKV() func (ac AdminClientMock) getConfigKV(_ context.Context, name string) ([]byte, error) { return minioGetConfigKVMock(name) } // mock function setConfigKV() func (ac AdminClientMock) setConfigKV(_ context.Context, kv string) (restart bool, err error) { return minioSetConfigKVMock(kv) } // mock function helpConfigKV() func (ac AdminClientMock) helpConfigKVGlobal(_ context.Context, envOnly bool) (madmin.Help, error) { return minioHelpConfigKVGlobalMock(envOnly) } func (ac AdminClientMock) delConfigKV(_ context.Context, name string) (err error) { return minioDelConfigKVMock(name) } func (ac AdminClientMock) getLogs(ctx context.Context, node string, lineCnt int, logKind string) <-chan madmin.LogInfo { return minioGetLogsMock(ctx, node, lineCnt, logKind) } func (ac AdminClientMock) listGroups(_ context.Context) ([]string, error) { return minioListGroupsMock() } func (ac AdminClientMock) updateGroupMembers(_ context.Context, req madmin.GroupAddRemove) error { return minioUpdateGroupMembersMock(req) } func (ac AdminClientMock) getGroupDescription(_ context.Context, group string) (*madmin.GroupDesc, error) { return minioGetGroupDescriptionMock(group) } func (ac AdminClientMock) setGroupStatus(_ context.Context, group string, status madmin.GroupStatus) error { return minioSetGroupStatusMock(group, status) } func (ac AdminClientMock) heal(ctx context.Context, bucket, prefix string, healOpts madmin.HealOpts, clientToken string, forceStart, forceStop bool, ) (healStart madmin.HealStartSuccess, healTaskStatus madmin.HealTaskStatus, err error) { return minioHealMock(ctx, bucket, prefix, healOpts, clientToken, forceStart, forceStop) } func (ac AdminClientMock) serverHealthInfo(ctx context.Context, deadline time.Duration) (interface{}, string, error) { return minioServerHealthInfoMock(ctx, deadline) } func (ac AdminClientMock) addOrUpdateIDPConfig(_ context.Context, _, _, _ string, _ bool) (restart bool, err error) { return true, nil } func (ac AdminClientMock) listIDPConfig(_ context.Context, _ string) ([]madmin.IDPListItem, error) { return []madmin.IDPListItem{{Name: "mock"}}, nil } func (ac AdminClientMock) deleteIDPConfig(_ context.Context, _, _ string) (restart bool, err error) { return true, nil } func (ac AdminClientMock) getIDPConfig(_ context.Context, _, _ string) (c madmin.IDPConfig, err error) { return madmin.IDPConfig{Info: []madmin.IDPCfgInfo{{Key: "mock", Value: "mock"}}}, nil } func (ac AdminClientMock) kmsStatus(_ context.Context) (madmin.KMSStatus, error) { return madmin.KMSStatus{Name: "name", DefaultKeyID: "key", Endpoints: map[string]madmin.ItemState{"localhost": madmin.ItemState("online")}}, nil } func (ac AdminClientMock) kmsAPIs(_ context.Context) ([]madmin.KMSAPI, error) { return []madmin.KMSAPI{{Method: "GET", Path: "/mock"}}, nil } func (ac AdminClientMock) kmsMetrics(_ context.Context) (*madmin.KMSMetrics, error) { return &madmin.KMSMetrics{}, nil } func (ac AdminClientMock) kmsVersion(_ context.Context) (*madmin.KMSVersion, error) { return &madmin.KMSVersion{Version: "test-version"}, nil } func (ac AdminClientMock) createKey(_ context.Context, _ string) error { return nil } func (ac AdminClientMock) listKeys(_ context.Context, _ string) ([]madmin.KMSKeyInfo, error) { return []madmin.KMSKeyInfo{{ Name: "name", CreatedBy: "by", }}, nil } func (ac AdminClientMock) keyStatus(_ context.Context, _ string) (*madmin.KMSKeyStatus, error) { return &madmin.KMSKeyStatus{KeyID: "key"}, nil } func (ac AdminClientMock) listPolicies(_ context.Context) (map[string]*iampolicy.Policy, error) { return minioListPoliciesMock() } func (ac AdminClientMock) getPolicy(_ context.Context, name string) (*iampolicy.Policy, error) { return minioGetPolicyMock(name) } func (ac AdminClientMock) removePolicy(_ context.Context, name string) error { return minioRemovePolicyMock(name) } func (ac AdminClientMock) addPolicy(_ context.Context, name string, policy *iampolicy.Policy) error { return minioAddPolicyMock(name, policy) } func (ac AdminClientMock) setPolicy(_ context.Context, policyName, entityName string, isGroup bool) error { return minioSetPolicyMock(policyName, entityName, isGroup) } // mock function for startProfiling() func (ac AdminClientMock) startProfiling(_ context.Context, profiler madmin.ProfilerType, duration time.Duration) (io.ReadCloser, error) { return minioStartProfiling(profiler, duration) } // mock function of serviceRestart() func (ac AdminClientMock) serviceRestart(ctx context.Context) error { return minioServiceRestartMock(ctx) } func (ac AdminClientMock) getSiteReplicationInfo(ctx context.Context) (*madmin.SiteReplicationInfo, error) { return getSiteReplicationInfo(ctx) } func (ac AdminClientMock) addSiteReplicationInfo(ctx context.Context, sites []madmin.PeerSite, _ madmin.SRAddOptions) (*madmin.ReplicateAddStatus, error) { return addSiteReplicationInfo(ctx, sites) } func (ac AdminClientMock) editSiteReplicationInfo(ctx context.Context, site madmin.PeerInfo, _ madmin.SREditOptions) (*madmin.ReplicateEditStatus, error) { return editSiteReplicationInfo(ctx, site) } func (ac AdminClientMock) deleteSiteReplicationInfo(ctx context.Context, removeReq madmin.SRRemoveReq) (*madmin.ReplicateRemoveStatus, error) { return deleteSiteReplicationInfoMock(ctx, removeReq) } func (ac AdminClientMock) getSiteReplicationStatus(ctx context.Context, params madmin.SRStatusOptions) (*madmin.SRStatusInfo, error) { return getSiteReplicationStatus(ctx, params) } func (ac AdminClientMock) listTiers(ctx context.Context) ([]*madmin.TierConfig, error) { return minioListTiersMock(ctx) } func (ac AdminClientMock) tierStats(ctx context.Context) ([]madmin.TierInfo, error) { return minioTierStatsMock(ctx) } func (ac AdminClientMock) addTier(ctx context.Context, tier *madmin.TierConfig) error { return minioAddTiersMock(ctx, tier) } func (ac AdminClientMock) removeTier(ctx context.Context, tierName string) error { return minioRemoveTierMock(ctx, tierName) } func (ac AdminClientMock) editTierCreds(ctx context.Context, tierName string, creds madmin.TierCreds) error { return minioEditTiersMock(ctx, tierName, creds) } func (ac AdminClientMock) serviceTrace(ctx context.Context, threshold int64, s3, internal, storage, os, errTrace bool) <-chan madmin.ServiceTraceInfo { return minioServiceTraceMock(ctx, threshold, s3, internal, storage, os, errTrace) } func (ac AdminClientMock) listUsers(_ context.Context) (map[string]madmin.UserInfo, error) { return minioListUsersMock() } func (ac AdminClientMock) addUser(_ context.Context, accessKey, secretKey string) error { return minioAddUserMock(accessKey, secretKey) } func (ac AdminClientMock) removeUser(_ context.Context, accessKey string) error { return minioRemoveUserMock(accessKey) } func (ac AdminClientMock) getUserInfo(_ context.Context, accessKey string) (madmin.UserInfo, error) { return minioGetUserInfoMock(accessKey) } func (ac AdminClientMock) setUserStatus(_ context.Context, accessKey string, status madmin.AccountStatus) error { return minioSetUserStatusMock(accessKey, status) } func (ac AdminClientMock) AccountInfo(ctx context.Context) (madmin.AccountInfo, error) { return minioAccountInfoMock(ctx) } func (ac AdminClientMock) addServiceAccount(ctx context.Context, policy string, user string, accessKey string, secretKey string, description string, name string, expiry *time.Time, status string) (madmin.Credentials, error) { return minioAddServiceAccountMock(ctx, policy, user, accessKey, secretKey, description, name, expiry, status) } func (ac AdminClientMock) listServiceAccounts(ctx context.Context, user string) (madmin.ListServiceAccountsResp, error) { return minioListServiceAccountsMock(ctx, user) } func (ac AdminClientMock) deleteServiceAccount(ctx context.Context, serviceAccount string) error { return minioDeleteServiceAccountMock(ctx, serviceAccount) } func (ac AdminClientMock) infoServiceAccount(ctx context.Context, serviceAccount string) (madmin.InfoServiceAccountResp, error) { return minioInfoServiceAccountMock(ctx, serviceAccount) } func (ac AdminClientMock) updateServiceAccount(ctx context.Context, serviceAccount string, opts madmin.UpdateServiceAccountReq) error { return minioUpdateServiceAccountMock(ctx, serviceAccount, opts) } func (ac AdminClientMock) getLDAPPolicyEntities(ctx context.Context, query madmin.PolicyEntitiesQuery) (madmin.PolicyEntitiesResult, error) { return minioGetLDAPPolicyEntitiesMock(ctx, query) } ================================================ FILE: api/admin_config.go ================================================ // 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 api import ( "context" "encoding/base64" "fmt" "strings" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/swag" "github.com/minio/console/api/operations" "github.com/minio/console/models" madmin "github.com/minio/madmin-go/v3" cfgApi "github.com/minio/console/api/operations/configuration" ) func registerConfigHandlers(api *operations.ConsoleAPI) { // List Configurations api.ConfigurationListConfigHandler = cfgApi.ListConfigHandlerFunc(func(params cfgApi.ListConfigParams, session *models.Principal) middleware.Responder { configListResp, err := getListConfigResponse(session, params) if err != nil { return cfgApi.NewListConfigDefault(err.Code).WithPayload(err.APIError) } return cfgApi.NewListConfigOK().WithPayload(configListResp) }) // Configuration Info api.ConfigurationConfigInfoHandler = cfgApi.ConfigInfoHandlerFunc(func(params cfgApi.ConfigInfoParams, session *models.Principal) middleware.Responder { config, err := getConfigResponse(session, params) if err != nil { return cfgApi.NewConfigInfoDefault(err.Code).WithPayload(err.APIError) } return cfgApi.NewConfigInfoOK().WithPayload(config) }) // Set Configuration api.ConfigurationSetConfigHandler = cfgApi.SetConfigHandlerFunc(func(params cfgApi.SetConfigParams, session *models.Principal) middleware.Responder { resp, err := setConfigResponse(session, params) if err != nil { return cfgApi.NewSetConfigDefault(err.Code).WithPayload(err.APIError) } return cfgApi.NewSetConfigOK().WithPayload(resp) }) // Reset Configuration api.ConfigurationResetConfigHandler = cfgApi.ResetConfigHandlerFunc(func(params cfgApi.ResetConfigParams, session *models.Principal) middleware.Responder { resp, err := resetConfigResponse(session, params) if err != nil { return cfgApi.NewResetConfigDefault(err.Code).WithPayload(err.APIError) } return cfgApi.NewResetConfigOK().WithPayload(resp) }) // Export Configuration as base64 string. api.ConfigurationExportConfigHandler = cfgApi.ExportConfigHandlerFunc(func(params cfgApi.ExportConfigParams, session *models.Principal) middleware.Responder { resp, err := exportConfigResponse(session, params) if err != nil { return cfgApi.NewExportConfigDefault(err.Code).WithPayload(err.APIError) } return cfgApi.NewExportConfigOK().WithPayload(resp) }) api.ConfigurationPostConfigsImportHandler = cfgApi.PostConfigsImportHandlerFunc(func(params cfgApi.PostConfigsImportParams, session *models.Principal) middleware.Responder { _, err := importConfigResponse(session, params) if err != nil { return cfgApi.NewPostConfigsImportDefault(err.Code).WithPayload(err.APIError) } return cfgApi.NewPostConfigsImportDefault(200) }) } // listConfig gets all configurations' names and their descriptions func listConfig(client MinioAdmin) ([]*models.ConfigDescription, error) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() configKeysHelp, err := client.helpConfigKV(ctx, "", "", false) if err != nil { return nil, err } var configDescs []*models.ConfigDescription for _, c := range configKeysHelp.KeysHelp { desc := &models.ConfigDescription{ Key: c.Key, Description: c.Description, } configDescs = append(configDescs, desc) } return configDescs, nil } // getListConfigResponse performs listConfig() and serializes it to the handler's output func getListConfigResponse(session *models.Principal, params cfgApi.ListConfigParams) (*models.ListConfigResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} configDescs, err := listConfig(adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } listGroupsResponse := &models.ListConfigResponse{ Configurations: configDescs, Total: int64(len(configDescs)), } return listGroupsResponse, nil } // getConfig gets the key values for a defined configuration. func getConfig(ctx context.Context, client MinioAdmin, name string) ([]*models.Configuration, error) { configBytes, err := client.getConfigKV(ctx, name) if err != nil { return nil, err } subSysConfigs, err := madmin.ParseServerConfigOutput(string(configBytes)) if err != nil { return nil, err } var configSubSysList []*models.Configuration for _, scfg := range subSysConfigs { if !madmin.SubSystems.Contains(scfg.SubSystem) { return nil, fmt.Errorf("no sub-systems found") } var confkv []*models.ConfigurationKV for _, kv := range scfg.KV { var envOverride *models.EnvOverride if kv.EnvOverride != nil { envOverride = &models.EnvOverride{ Name: kv.EnvOverride.Name, Value: kv.EnvOverride.Value, } } confkv = append(confkv, &models.ConfigurationKV{Key: kv.Key, Value: kv.Value, EnvOverride: envOverride}) } if len(confkv) == 0 { continue } var fullConfigName string if scfg.Target == "" { fullConfigName = scfg.SubSystem } else { fullConfigName = scfg.SubSystem + ":" + scfg.Target } configSubSysList = append(configSubSysList, &models.Configuration{KeyValues: confkv, Name: fullConfigName}) } return configSubSysList, nil } // getConfigResponse performs getConfig() and serializes it to the handler's output func getConfigResponse(session *models.Principal, params cfgApi.ConfigInfoParams) ([]*models.Configuration, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} configurations, err := getConfig(ctx, adminClient, params.Name) if err != nil { errorVal := ErrorWithContext(ctx, err) minioError := madmin.ToErrorResponse(err) if minioError.Code == "XMinioConfigError" { errorVal.Code = 404 } return nil, errorVal } return configurations, nil } // setConfig sets a configuration with the defined key values func setConfig(ctx context.Context, client MinioAdmin, configName *string, kvs []*models.ConfigurationKV) (restart bool, err error) { config := buildConfig(configName, kvs) restart, err = client.setConfigKV(ctx, *config) if err != nil { return false, err } return restart, nil } func setConfigWithARNAccountID(ctx context.Context, client MinioAdmin, configName *string, kvs []*models.ConfigurationKV, arnAccountID string) (restart bool, err error) { // if arnAccountID is not empty the configuration will be treated as a notification target // arnAccountID will be used as an identifier for that specific target // docs: https://docs.min.io/community/minio-object-store/administration/monitoring/bucket-notifications.html if arnAccountID != "" { configName = swag.String(fmt.Sprintf("%s:%s", *configName, arnAccountID)) } return setConfig(ctx, client, configName, kvs) } // buildConfig builds a concatenated string including name and keyvalues // e.g. `region name=us-west-1` func buildConfig(configName *string, kvs []*models.ConfigurationKV) *string { var builder strings.Builder builder.WriteString(*configName) for _, kv := range kvs { key := strings.TrimSpace(kv.Key) if key == "" { continue } builder.WriteString(" ") builder.WriteString(key) builder.WriteString("=") // All newlines must be converted to ',' builder.WriteString(strings.ReplaceAll(strings.TrimSpace(fmt.Sprintf("\"%s\"", kv.Value)), "\n", ",")) } config := builder.String() return &config } // setConfigResponse implements setConfig() to be used by handler func setConfigResponse(session *models.Principal, params cfgApi.SetConfigParams) (*models.SetConfigResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} configName := params.Name needsRestart, err := setConfigWithARNAccountID(ctx, adminClient, &configName, params.Body.KeyValues, params.Body.ArnResourceID) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.SetConfigResponse{Restart: needsRestart}, nil } func resetConfig(ctx context.Context, client MinioAdmin, configName *string) (err error) { err = client.delConfigKV(ctx, *configName) return err } // resetConfigResponse implements resetConfig() to be used by handler func resetConfigResponse(session *models.Principal, params cfgApi.ResetConfigParams) (*models.SetConfigResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} err = resetConfig(ctx, adminClient, ¶ms.Name) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.SetConfigResponse{Restart: true}, nil } func exportConfigResponse(session *models.Principal, params cfgApi.ExportConfigParams) (*models.ConfigExportResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } configRes, err := mAdmin.GetConfig(ctx) if err != nil { return nil, ErrorWithContext(ctx, err) } // may contain sensitive information so unpack only when required. return &models.ConfigExportResponse{ Status: "success", Value: base64.StdEncoding.EncodeToString(configRes), }, nil } func importConfigResponse(session *models.Principal, params cfgApi.PostConfigsImportParams) (*cfgApi.PostConfigsImportDefault, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } file, _, err := params.HTTPRequest.FormFile("file") if err != nil { return nil, ErrorWithContext(ctx, err) } defer file.Close() err = mAdmin.SetConfig(ctx, file) if err != nil { return nil, ErrorWithContext(ctx, err) } return &cfgApi.PostConfigsImportDefault{}, nil } ================================================ FILE: api/admin_config_test.go ================================================ // 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 api import ( "context" "encoding/json" "errors" "fmt" "reflect" "testing" "github.com/go-openapi/swag" "github.com/stretchr/testify/assert" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" ) const ( NotifyPostgresSubSys = "notify_postgres" PostgresFormat = "format" PostgresConnectionString = "connection_string" PostgresTable = "table" PostgresQueueDir = "queue_dir" PostgresQueueLimit = "queue_limit" ) func TestListConfig(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} function := "listConfig()" // Test-1 : listConfig() get list of two configurations and ensure is output correctly configListMock := []madmin.HelpKV{ { Key: "region", Description: "label the location of the server", }, { Key: "notify_nsq", Description: "publish bucket notifications to NSQ endpoints", }, } mockConfigList := madmin.Help{ SubSys: "sys", Description: "desc", MultipleTargets: false, KeysHelp: configListMock, } expectedKeysDesc := mockConfigList.KeysHelp // mock function response from listConfig() minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { return mockConfigList, nil } configList, err := listConfig(adminClient) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of keys is correct assert.Equal(len(expectedKeysDesc), len(configList), fmt.Sprintf("Failed on %s: length of Configs's lists is not the same", function)) // verify KeysHelp content for i, kv := range configList { assert.Equal(expectedKeysDesc[i].Key, kv.Key) assert.Equal(expectedKeysDesc[i].Description, kv.Description) } // Test-2 : listConfig() Return error and see that the error is handled correctly and returned // mock function response from listConfig() minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { return madmin.Help{}, errors.New("error") } _, err = listConfig(adminClient) if assert.Error(err) { assert.Equal("error", err.Error()) } } func TestSetConfig(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} function := "setConfig()" // mock function response from setConfig() minioSetConfigKVMock = func(_ string) (restart bool, err error) { return false, nil } configName := "notify_postgres" kvs := []*models.ConfigurationKV{ { Key: "enable", Value: "off", }, { Key: "connection_string", Value: "", }, } ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : setConfig() sets a config with two key value pairs restart, err := setConfig(ctx, adminClient, &configName, kvs) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } assert.Equal(restart, false) // Test-2 : setConfig() returns error, handle properly minioSetConfigKVMock = func(_ string) (restart bool, err error) { return false, errors.New("error") } restart, err = setConfig(ctx, adminClient, &configName, kvs) if assert.Error(err) { assert.Equal("error", err.Error()) } assert.Equal(restart, false) // Test-4 : setConfig() set config, need restart minioSetConfigKVMock = func(_ string) (restart bool, err error) { return true, nil } restart, err = setConfig(ctx, adminClient, &configName, kvs) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } assert.Equal(restart, true) } func TestDelConfig(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} function := "resetConfig()" // mock function response from setConfig() minioDelConfigKVMock = func(_ string) (err error) { return nil } configName := "region" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : resetConfig() resets a config with the config name err := resetConfig(ctx, adminClient, &configName) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2 : resetConfig() returns error, handle properly minioDelConfigKVMock = func(_ string) (err error) { return errors.New("error") } err = resetConfig(ctx, adminClient, &configName) if assert.Error(err) { assert.Equal("error", err.Error()) } } func Test_buildConfig(t *testing.T) { type args struct { configName *string kvs []*models.ConfigurationKV } tests := []struct { name string args args want *string }{ // Test-1: buildConfig() format correctly configuration as "config_name k=v k2=v2" { name: "format correctly", args: args{ configName: swag.String("notify_postgres"), kvs: []*models.ConfigurationKV{ { Key: "enable", Value: "off", }, { Key: "connection_string", Value: "", }, }, }, want: swag.String("notify_postgres enable=\"off\" connection_string=\"\""), }, // Test-2: buildConfig() format correctly configuration as "config_name k=v k2=v2 k2=v3" with duplicate keys { name: "duplicated keys in config", args: args{ configName: swag.String("notify_postgres"), kvs: []*models.ConfigurationKV{ { Key: "enable", Value: "off", }, { Key: "connection_string", Value: "", }, { Key: "connection_string", Value: "x", }, }, }, want: swag.String("notify_postgres enable=\"off\" connection_string=\"\" connection_string=\"x\""), }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if got := buildConfig(tt.args.configName, tt.args.kvs); !reflect.DeepEqual(got, tt.want) { t.Errorf("buildConfig() = %s, want %s", *got, *tt.want) } }) } } func Test_setConfigWithARN(t *testing.T) { assert := assert.New(t) client := AdminClientMock{} type args struct { ctx context.Context client MinioAdmin configName *string kvs []*models.ConfigurationKV arn string } tests := []struct { name string args args mockSetConfig func(kv string) (restart bool, err error) wantErr bool expected bool }{ { name: "Set valid config with arn", args: args{ ctx: context.Background(), client: client, configName: swag.String("notify_kafka"), kvs: []*models.ConfigurationKV{ { Key: "brokers", Value: "http://localhost:8080/broker1,http://localhost:8080/broker2", }, }, arn: "1", }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, wantErr: false, expected: false, }, { name: "Set valid config, expect restart", args: args{ ctx: context.Background(), client: client, configName: swag.String("notify_kafka"), kvs: []*models.ConfigurationKV{ { Key: "brokers", Value: "http://localhost:8080/broker1,http://localhost:8080/broker2", }, }, arn: "1", }, mockSetConfig: func(_ string) (restart bool, err error) { return true, nil }, wantErr: false, expected: true, }, { name: "Set valid config without arn", args: args{ ctx: context.Background(), client: client, configName: swag.String("region"), kvs: []*models.ConfigurationKV{ { Key: "name", Value: "us-west-1", }, }, arn: "", }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, wantErr: false, expected: false, }, { name: "Setting an incorrect config", args: args{ ctx: context.Background(), client: client, configName: swag.String("oorgle"), kvs: []*models.ConfigurationKV{ { Key: "name", Value: "us-west-1", }, }, arn: "", }, mockSetConfig: func(_ string) (restart bool, err error) { return false, errors.New("error") }, wantErr: true, expected: false, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // mock function response from setConfig() minioSetConfigKVMock = tt.mockSetConfig restart, err := setConfigWithARNAccountID(tt.args.ctx, tt.args.client, tt.args.configName, tt.args.kvs, tt.args.arn) if (err != nil) != tt.wantErr { t.Errorf("setConfigWithARNAccountID() error = %v, wantErr %v", err, tt.wantErr) } assert.Equal(restart, tt.expected) }) } } func Test_getConfig(t *testing.T) { client := AdminClientMock{} type args struct { client MinioAdmin name string } tests := []struct { name string args args mock func() want []*models.Configuration wantErr bool }{ { name: "get config", args: args{ client: client, name: "notify_postgres", }, mock: func() { // mock function response from getConfig() minioGetConfigKVMock = func(_ string) ([]byte, error) { return []byte(`notify_postgres:_ connection_string="host=localhost dbname=minio_events user=postgres password=password port=5432 sslmode=disable" table=bucketevents`), nil } configListMock := []madmin.HelpKV{ { Key: PostgresConnectionString, Description: `Postgres server connection-string e.g. "host=localhost port=5432 dbname=minio_events user=postgres password=password sslmode=disable"`, Type: "string", }, { Key: PostgresTable, Description: "DB table name to store/update events, table is auto-created", Type: "string", }, { Key: PostgresFormat, Description: "desc", Type: "namespace*|access", }, { Key: PostgresQueueDir, Description: "des", Optional: true, Type: "path", }, { Key: PostgresQueueLimit, Description: "desc", Optional: true, Type: "number", }, { Key: madmin.CommentKey, Description: "", Optional: true, Type: "sentence", }, } mockConfigList := madmin.Help{ SubSys: NotifyPostgresSubSys, Description: "publish bucket notifications to Postgres databases", MultipleTargets: true, KeysHelp: configListMock, } // mock function response from listConfig() minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { return mockConfigList, nil } }, want: []*models.Configuration{ { KeyValues: []*models.ConfigurationKV{ { Key: PostgresConnectionString, Value: "host=localhost dbname=minio_events user=postgres password=password port=5432 sslmode=disable", }, { Key: PostgresTable, Value: "bucketevents", }, }, Name: "notify_postgres", }, }, wantErr: false, }, { name: "valid config, but server returned empty", args: args{ client: client, name: NotifyPostgresSubSys, }, mock: func() { // mock function response from getConfig() minioGetConfigKVMock = func(_ string) ([]byte, error) { return []byte(`notify_postgres:_`), nil } configListMock := []madmin.HelpKV{ { Key: PostgresConnectionString, Description: `Postgres server connection-string e.g. "host=localhost port=5432 dbname=minio_events user=postgres password=password sslmode=disable"`, Type: "string", }, { Key: PostgresTable, Description: "DB table name to store/update events, table is auto-created", Type: "string", }, { Key: PostgresFormat, Description: "desc", Type: "namespace*|access", }, { Key: PostgresQueueDir, Description: "des", Optional: true, Type: "path", }, { Key: PostgresQueueLimit, Description: "desc", Optional: true, Type: "number", }, { Key: madmin.CommentKey, Description: "optionally add a comment to this setting", Optional: true, Type: "sentence", }, } mockConfigList := madmin.Help{ SubSys: NotifyPostgresSubSys, Description: "publish bucket notifications to Postgres databases", MultipleTargets: true, KeysHelp: configListMock, } // mock function response from listConfig() minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { return mockConfigList, nil } }, want: nil, wantErr: false, }, { name: "random bytes coming out of getConfigKv", args: args{ client: client, name: "notify_postgres", }, mock: func() { // mock function response from getConfig() minioGetConfigKVMock = func(_ string) ([]byte, error) { x := make(map[string]string) x["x"] = "x" j, _ := json.Marshal(x) return j, nil } configListMock := []madmin.HelpKV{ { Key: PostgresConnectionString, Description: `Postgres server connection-string e.g. "host=localhost port=5432 dbname=minio_events user=postgres password=password sslmode=disable"`, Type: "string", }, { Key: PostgresTable, Description: "DB table name to store/update events, table is auto-created", Type: "string", }, { Key: PostgresFormat, Description: "desc", Type: "namespace*|access", }, { Key: PostgresQueueDir, Description: "des", Optional: true, Type: "path", }, { Key: PostgresQueueLimit, Description: "desc", Optional: true, Type: "number", }, { Key: madmin.CommentKey, Description: "optionally add a comment to this setting", Optional: true, Type: "sentence", }, } mockConfigList := madmin.Help{ SubSys: NotifyPostgresSubSys, Description: "publish bucket notifications to Postgres databases", MultipleTargets: true, KeysHelp: configListMock, } // mock function response from listConfig() minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { return mockConfigList, nil } }, want: nil, wantErr: true, }, { name: "bad config", args: args{ client: client, name: "notify_postgresx", }, mock: func() { // mock function response from getConfig() minioGetConfigKVMock = func(_ string) ([]byte, error) { return nil, errors.New("invalid config") } mockConfigList := madmin.Help{} // mock function response from listConfig() minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { return mockConfigList, nil } }, want: nil, wantErr: true, }, { name: "no help", args: args{ client: client, name: "notify_postgresx", }, mock: func() { // mock function response from getConfig() minioGetConfigKVMock = func(_ string) ([]byte, error) { return nil, errors.New("invalid config") } // mock function response from listConfig() minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { return madmin.Help{}, errors.New("no help") } }, want: nil, wantErr: true, }, } for _, tt := range tests { tt.mock() t.Run(tt.name, func(_ *testing.T) { got, err := getConfig(context.Background(), tt.args.client, tt.args.name) if (err != nil) != tt.wantErr { t.Errorf("getConfig() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("getConfig() got = %v, want %v", got, tt.want) } }) } } ================================================ FILE: api/admin_console.go ================================================ // 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 api import ( "context" "encoding/json" "strings" "time" "github.com/minio/madmin-go/v3" "github.com/minio/websocket" ) const logTimeFormat string = "15:04:05 MST 01/02/2006" // startConsoleLog starts log of the servers func startConsoleLog(ctx context.Context, conn WSConn, client MinioAdmin, logRequest LogRequest) error { var node string // name of node, default = "" (all) if logRequest.node == "all" { node = "" } else { node = logRequest.node } trimNode := strings.Split(node, ":") // number of log lines lineCount := 100 // type of logs "minio"|"application"|"all" default = "all" var logKind string if logRequest.logType == "minio" || logRequest.logType == "application" || logRequest.logType == "all" { logKind = logRequest.logType } else { logKind = "all" } // Start listening on all Console Log activity. logCh := client.getLogs(ctx, trimNode[0], lineCount, logKind) for { select { case <-ctx.Done(): return nil case logInfo, ok := <-logCh: // zero value returned because the channel is closed and empty if !ok { return nil } if logInfo.Err != nil { LogError("error on console logs: %v", logInfo.Err) return logInfo.Err } // Serialize message to be sent bytes, err := json.Marshal(serializeConsoleLogInfo(&logInfo)) if err != nil { LogError("error on json.Marshal: %v", err) return err } // Send Message through websocket connection err = conn.writeMessage(websocket.TextMessage, bytes) if err != nil { LogError("error writeMessage: %v", err) return err } } } } func serializeConsoleLogInfo(l *madmin.LogInfo) (logInfo madmin.LogInfo) { logInfo = *l if logInfo.ConsoleMsg != "" { logInfo.ConsoleMsg = strings.TrimPrefix(logInfo.ConsoleMsg, "\n") } if logInfo.Time != "" { logInfo.Time = getLogTime(logInfo.Time) } return logInfo } func getLogTime(lt string) string { tm, err := time.Parse(time.RFC3339Nano, lt) if err != nil { return lt } return tm.Format(logTimeFormat) } ================================================ FILE: api/admin_console_test.go ================================================ // 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 api import ( "context" "encoding/json" "fmt" "testing" "github.com/minio/madmin-go/v3" "github.com/stretchr/testify/assert" ) func TestAdminConsoleLog(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} mockWSConn := mockConn{} function := "startConsoleLog(ctx, )" ctx, cancel := context.WithCancel(context.Background()) defer cancel() testReceiver := make(chan madmin.LogInfo, 5) textToReceive := "test message" testStreamSize := 5 isClosed := false // testReceiver is closed? // Test-1: Serve Console with no errors until Console finishes sending // define mock function behavior for minio server Console minioGetLogsMock = func(_ context.Context, _ string, _ int, _ string) <-chan madmin.LogInfo { ch := make(chan madmin.LogInfo) // Only success, start a routine to start reading line by line. go func(ch chan<- madmin.LogInfo) { defer close(ch) lines := make([]int, testStreamSize) // mocking sending 5 lines of info for range lines { info := madmin.LogInfo{ ConsoleMsg: textToReceive, } ch <- info } }(ch) return ch } writesCount := 1 // mock connection WriteMessage() no error connWriteMessageMock = func(_ int, data []byte) error { // emulate that receiver gets the message written var t madmin.LogInfo _ = json.Unmarshal(data, &t) if writesCount == testStreamSize { if !isClosed { close(testReceiver) isClosed = true } return nil } testReceiver <- t writesCount++ return nil } if err := startConsoleLog(ctx, mockWSConn, adminClient, LogRequest{node: "", logType: "all"}); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // check that the TestReceiver got the same number of data from Console. for i := range testReceiver { assert.Equal(textToReceive, i.ConsoleMsg) } // Test-2: if error happens while writing, return error connWriteMessageMock = func(_ int, _ []byte) error { return fmt.Errorf("error on write") } if err := startConsoleLog(ctx, mockWSConn, adminClient, LogRequest{node: "", logType: "all"}); assert.Error(err) { assert.Equal("error on write", err.Error()) } // Test-3: error happens on GetLogs Minio, Console should stop // and error shall be returned. minioGetLogsMock = func(_ context.Context, _ string, _ int, _ string) <-chan madmin.LogInfo { ch := make(chan madmin.LogInfo) // Only success, start a routine to start reading line by line. go func(ch chan<- madmin.LogInfo) { defer close(ch) lines := make([]int, 2) // mocking sending 5 lines of info for range lines { info := madmin.LogInfo{ ConsoleMsg: textToReceive, } ch <- info } ch <- madmin.LogInfo{Err: fmt.Errorf("error on Console")} }(ch) return ch } connWriteMessageMock = func(_ int, _ []byte) error { return nil } if err := startConsoleLog(ctx, mockWSConn, adminClient, LogRequest{node: "", logType: "all"}); assert.Error(err) { assert.Equal("error on Console", err.Error()) } } ================================================ FILE: api/admin_groups.go ================================================ // 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 api import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" "github.com/minio/madmin-go/v3" groupApi "github.com/minio/console/api/operations/group" "github.com/minio/console/models" ) func registerGroupsHandlers(api *operations.ConsoleAPI) { // List Groups api.GroupListGroupsHandler = groupApi.ListGroupsHandlerFunc(func(params groupApi.ListGroupsParams, session *models.Principal) middleware.Responder { listGroupsResponse, err := getListGroupsResponse(session, params) if err != nil { return groupApi.NewListGroupsDefault(err.Code).WithPayload(err.APIError) } return groupApi.NewListGroupsOK().WithPayload(listGroupsResponse) }) // Group Info api.GroupGroupInfoHandler = groupApi.GroupInfoHandlerFunc(func(params groupApi.GroupInfoParams, session *models.Principal) middleware.Responder { groupInfo, err := getGroupInfoResponse(session, params) if err != nil { return groupApi.NewGroupInfoDefault(err.Code).WithPayload(err.APIError) } return groupApi.NewGroupInfoOK().WithPayload(groupInfo) }) // Add Group api.GroupAddGroupHandler = groupApi.AddGroupHandlerFunc(func(params groupApi.AddGroupParams, session *models.Principal) middleware.Responder { if err := getAddGroupResponse(session, params); err != nil { return groupApi.NewAddGroupDefault(err.Code).WithPayload(err.APIError) } return groupApi.NewAddGroupCreated() }) // Remove Group api.GroupRemoveGroupHandler = groupApi.RemoveGroupHandlerFunc(func(params groupApi.RemoveGroupParams, session *models.Principal) middleware.Responder { if err := getRemoveGroupResponse(session, params); err != nil { return groupApi.NewRemoveGroupDefault(err.Code).WithPayload(err.APIError) } return groupApi.NewRemoveGroupNoContent() }) // Update Group api.GroupUpdateGroupHandler = groupApi.UpdateGroupHandlerFunc(func(params groupApi.UpdateGroupParams, session *models.Principal) middleware.Responder { groupUpdateResp, err := getUpdateGroupResponse(session, params) if err != nil { return groupApi.NewUpdateGroupDefault(err.Code).WithPayload(err.APIError) } return groupApi.NewUpdateGroupOK().WithPayload(groupUpdateResp) }) } // getListGroupsResponse performs listGroups() and serializes it to the handler's output func getListGroupsResponse(session *models.Principal, params groupApi.ListGroupsParams) (*models.ListGroupsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} groups, err := adminClient.listGroups(ctx) if err != nil { return nil, ErrorWithContext(ctx, err) } // serialize output listGroupsResponse := &models.ListGroupsResponse{ Groups: groups, Total: int64(len(groups)), } return listGroupsResponse, nil } // groupInfo calls MinIO server get Group's info func groupInfo(ctx context.Context, client MinioAdmin, group string) (*madmin.GroupDesc, error) { groupDesc, err := client.getGroupDescription(ctx, group) if err != nil { return nil, err } return groupDesc, nil } // getGroupInfoResponse performs groupInfo() and serializes it to the handler's output func getGroupInfoResponse(session *models.Principal, params groupApi.GroupInfoParams) (*models.Group, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} groupDesc, err := groupInfo(ctx, adminClient, params.Name) if err != nil { return nil, ErrorWithContext(ctx, err) } groupResponse := &models.Group{ Members: groupDesc.Members, Name: groupDesc.Name, Policy: groupDesc.Policy, Status: groupDesc.Status, } return groupResponse, nil } // addGroupAdd a MinIO group with the defined members func addGroup(ctx context.Context, client MinioAdmin, group string, members []string) error { gAddRemove := madmin.GroupAddRemove{ Group: group, Members: members, IsRemove: false, } err := client.updateGroupMembers(ctx, gAddRemove) if err != nil { return err } return nil } // getAddGroupResponse performs addGroup() and serializes it to the handler's output func getAddGroupResponse(session *models.Principal, params groupApi.AddGroupParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() // AddGroup request needed to proceed if params.Body == nil { return ErrorWithContext(ctx, ErrGroupBodyNotInRequest) } groupRequest := params.Body mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} groupList, _ := adminClient.listGroups(ctx) for _, b := range groupList { if b == *groupRequest.Group { return ErrorWithContext(ctx, ErrGroupAlreadyExists) } } if err := addGroup(ctx, adminClient, *groupRequest.Group, groupRequest.Members); err != nil { return ErrorWithContext(ctx, err) } return nil } // removeGroup deletes a minIO group only if it has no members func removeGroup(ctx context.Context, client MinioAdmin, group string) error { gAddRemove := madmin.GroupAddRemove{ Group: group, Members: []string{}, IsRemove: true, } err := client.updateGroupMembers(ctx, gAddRemove) if err != nil { return err } return nil } // getRemoveGroupResponse performs removeGroup() and serializes it to the handler's output func getRemoveGroupResponse(session *models.Principal, params groupApi.RemoveGroupParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() if params.Name == "" { return ErrorWithContext(ctx, ErrGroupNameNotInRequest) } mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // Create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} if err := removeGroup(ctx, adminClient, params.Name); err != nil { minioError := madmin.ToErrorResponse(err) err2 := ErrorWithContext(ctx, err) if minioError.Code == "XMinioAdminNoSuchGroup" { err2.Code = 404 } return err2 } return nil } // updateGroup updates a group by adding/removing members and setting the status to the desired one // // isRemove: whether remove members or not func updateGroupMembers(ctx context.Context, client MinioAdmin, group string, members []string, isRemove bool) error { gAddRemove := madmin.GroupAddRemove{ Group: group, Members: members, IsRemove: isRemove, } err := client.updateGroupMembers(ctx, gAddRemove) if err != nil { return err } return nil } // addOrDeleteMembers updates a group members by adding or deleting them based on the expectedMembers func addOrDeleteMembers(ctx context.Context, client MinioAdmin, group *madmin.GroupDesc, expectedMembers []string) error { // get members to delete/add membersToDelete := DifferenceArrays(group.Members, expectedMembers) membersToAdd := DifferenceArrays(expectedMembers, group.Members) // delete members if any to be deleted if len(membersToDelete) > 0 { err := updateGroupMembers(ctx, client, group.Name, membersToDelete, true) if err != nil { return err } } // add members if any to be added if len(membersToAdd) > 0 { err := updateGroupMembers(ctx, client, group.Name, membersToAdd, false) if err != nil { return err } } return nil } func setGroupStatus(ctx context.Context, client MinioAdmin, group, status string) error { var setStatus madmin.GroupStatus switch status { case "enabled": setStatus = madmin.GroupEnabled case "disabled": setStatus = madmin.GroupDisabled default: return errors.New(500, "status not valid") } return client.setGroupStatus(ctx, group, setStatus) } // getUpdateGroupResponse updates a group by adding or removing it's members depending on the request, // also sets the group's status if status in the request is different than the current one. // Then serializes the output to be used by the handler. func getUpdateGroupResponse(session *models.Principal, params groupApi.UpdateGroupParams) (*models.Group, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() if params.Name == "" { return nil, ErrorWithContext(ctx, ErrGroupNameNotInRequest) } if params.Body == nil { return nil, ErrorWithContext(ctx, ErrGroupBodyNotInRequest) } expectedGroupUpdate := params.Body mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} groupUpdated, err := groupUpdate(ctx, adminClient, params.Name, expectedGroupUpdate) if err != nil { return nil, ErrorWithContext(ctx, err) } groupResponse := &models.Group{ Name: groupUpdated.Name, Members: groupUpdated.Members, Policy: groupUpdated.Policy, Status: groupUpdated.Status, } return groupResponse, nil } // groupUpdate updates a group given the expected parameters, compares the expected parameters against the current ones // and updates them accordingly, status is only updated if the expected status is different than the current one. // Then fetches the group again to return the object updated. func groupUpdate(ctx context.Context, client MinioAdmin, groupName string, expectedGroup *models.UpdateGroupRequest) (*madmin.GroupDesc, error) { expectedMembers := expectedGroup.Members expectedStatus := *expectedGroup.Status // get current members and status groupDescription, err := groupInfo(ctx, client, groupName) if err != nil { LogInfo("error getting group info: %v", err) return nil, err } // update group members err = addOrDeleteMembers(ctx, client, groupDescription, expectedMembers) if err != nil { LogInfo("error updating group: %v", err) return nil, err } // update group status only if different from current status if expectedStatus != groupDescription.Status { err = setGroupStatus(ctx, client, groupDescription.Name, expectedStatus) if err != nil { LogInfo("error updating group's status: %v", err) return nil, err } } // return latest group info to verify that changes were applied correctly groupDescription, err = groupInfo(ctx, client, groupName) if err != nil { LogInfo("error getting group info: %v", err) return nil, err } return groupDescription, nil } ================================================ FILE: api/admin_groups_test.go ================================================ // 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 api import ( "context" "errors" "fmt" "testing" "github.com/go-openapi/swag" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" "github.com/stretchr/testify/assert" ) func TestListGroups(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : listGroups() Get response from minio client with two Groups and return the same number on listGroups() mockGroupsList := []string{"group1", "group2"} // mock function response from listGroups() minioListGroupsMock = func() ([]string, error) { return mockGroupsList, nil } // get list Groups response this response should have Name, CreationDate, Size and Access // as part of of each Groups function := "listGroups()" groupsList, err := adminClient.listGroups(ctx) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of Groupss is correct assert.Equal(len(mockGroupsList), len(groupsList), fmt.Sprintf("Failed on %s: length of Groups's lists is not the same", function)) for i, g := range groupsList { assert.Equal(mockGroupsList[i], g) } // Test-2 : listGroups() Return error and see that the error is handled correctly and returned minioListGroupsMock = func() ([]string, error) { return nil, errors.New("error") } _, err = adminClient.listGroups(ctx) if assert.Error(err) { assert.Equal("error", err.Error()) } } func TestAddGroup(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : addGroup() add a new group with two members newGroup := "acmeGroup" groupMembers := []string{"user1", "user2"} // mock function response from updateGroupMembers() minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { return nil } function := "addGroup()" if err := addGroup(ctx, adminClient, newGroup, groupMembers); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2 : addGroup() Return error and see that the error is handled correctly and returned minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { return errors.New("error") } if err := addGroup(ctx, adminClient, newGroup, groupMembers); assert.Error(err) { assert.Equal("error", err.Error()) } } func TestRemoveGroup(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : removeGroup() remove group assume it has no members groupToRemove := "acmeGroup" // mock function response from updateGroupMembers() minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { return nil } function := "removeGroup()" if err := removeGroup(ctx, adminClient, groupToRemove); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2 : removeGroup() Return error and see that the error is handled correctly and returned minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { return errors.New("error") } if err := removeGroup(ctx, adminClient, groupToRemove); assert.Error(err) { assert.Equal("error", err.Error()) } } func TestGroupInfo(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : groupInfo() get group info groupName := "acmeGroup" mockResponse := &madmin.GroupDesc{ Name: groupName, Policy: "policyTest", Members: []string{"user1", "user2"}, Status: "enabled", } // mock function response from updateGroupMembers() minioGetGroupDescriptionMock = func(_ string) (*madmin.GroupDesc, error) { return mockResponse, nil } function := "groupInfo()" info, err := groupInfo(ctx, adminClient, groupName) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } assert.Equal(groupName, info.Name) assert.Equal("policyTest", info.Policy) assert.ElementsMatch([]string{"user1", "user2"}, info.Members) assert.Equal("enabled", info.Status) // Test-2 : groupInfo() Return error and see that the error is handled correctly and returned minioGetGroupDescriptionMock = func(_ string) (*madmin.GroupDesc, error) { return nil, errors.New("error") } _, err = groupInfo(ctx, adminClient, groupName) if assert.Error(err) { assert.Equal("error", err.Error()) } } func TestUpdateGroup(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : addOrDeleteMembers() update group members add user3 and delete user2 function := "addOrDeleteMembers()" groupName := "acmeGroup" mockGroupDesc := &madmin.GroupDesc{ Name: groupName, Policy: "policyTest", Members: []string{"user1", "user2"}, Status: "enabled", } membersDesired := []string{"user3", "user1"} minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { return nil } if err := addOrDeleteMembers(ctx, adminClient, mockGroupDesc, membersDesired); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2 : addOrDeleteMembers() handle error correctly minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { return errors.New("error") } if err := addOrDeleteMembers(ctx, adminClient, mockGroupDesc, membersDesired); assert.Error(err) { assert.Equal("error", err.Error()) } // Test-3 : addOrDeleteMembers() only add members but handle error on adding minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { return errors.New("error") } membersDesired = []string{"user3", "user1", "user2"} if err := addOrDeleteMembers(ctx, adminClient, mockGroupDesc, membersDesired); assert.Error(err) { assert.Equal("error", err.Error()) } // Test-4: addOrDeleteMembers() no updates needed so error shall not be triggered or handled. minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { return errors.New("error") } membersDesired = []string{"user1", "user2"} if err := addOrDeleteMembers(ctx, adminClient, mockGroupDesc, membersDesired); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-5 : groupUpdate() integrate all from getting current group to update it and see if it changed. // This test mocks one function twice and makes sure it returns different content on each call. function = "groupUpdate()" groupName = "acmeGroup" membersDesired = []string{"user1", "user2", "user3"} expectedGroupUpdate := &models.UpdateGroupRequest{ Members: membersDesired, Status: swag.String("disabled"), } mockResponseBeforeUpdate := &madmin.GroupDesc{ Name: groupName, Policy: "policyTest", Members: []string{"user1", "user2"}, Status: "enabled", } mockResponseAfterUpdate := &madmin.GroupDesc{ Name: groupName, Policy: "policyTest", Members: []string{"user1", "user2", "user3"}, Status: "disabled", } // groupUpdate uses getInfo() twice which uses getGroupDescription() so we need to mock as if it called // the function twice but the second time returned an error is2ndRunGroupInfo := false // mock function response from updateGroupMembers() minioGetGroupDescriptionMock = func(_ string) (*madmin.GroupDesc, error) { if is2ndRunGroupInfo { return mockResponseAfterUpdate, nil } is2ndRunGroupInfo = true return mockResponseBeforeUpdate, nil } minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { return nil } minioSetGroupStatusMock = func(_ string, _ madmin.GroupStatus) error { return nil } groupUpdated, err := groupUpdate(ctx, adminClient, groupName, expectedGroupUpdate) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // assert elements were updated as expected assert.ElementsMatch(membersDesired, groupUpdated.Members) assert.Equal(groupName, groupUpdated.Name) assert.Equal(*expectedGroupUpdate.Status, groupUpdated.Status) } func TestSetGroupStatus(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} function := "setGroupStatus()" groupName := "acmeGroup" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1: setGroupStatus() update valid disabled status expectedStatus := "disabled" minioSetGroupStatusMock = func(_ string, _ madmin.GroupStatus) error { return nil } if err := setGroupStatus(ctx, adminClient, groupName, expectedStatus); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2: setGroupStatus() update valid enabled status expectedStatus = "enabled" minioSetGroupStatusMock = func(_ string, _ madmin.GroupStatus) error { return nil } if err := setGroupStatus(ctx, adminClient, groupName, expectedStatus); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-3: setGroupStatus() update invalid status, should send error expectedStatus = "invalid" minioSetGroupStatusMock = func(_ string, _ madmin.GroupStatus) error { return nil } if err := setGroupStatus(ctx, adminClient, groupName, expectedStatus); assert.Error(err) { assert.Equal("status not valid", err.Error()) } // Test-4: setGroupStatus() handler error correctly expectedStatus = "enabled" minioSetGroupStatusMock = func(_ string, _ madmin.GroupStatus) error { return errors.New("error") } if err := setGroupStatus(ctx, adminClient, groupName, expectedStatus); assert.Error(err) { assert.Equal("error", err.Error()) } } ================================================ FILE: api/admin_health_info.go ================================================ // 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 api import ( "context" b64 "encoding/base64" "encoding/json" "errors" "net/http" "time" mc "github.com/minio/mc/cmd" "github.com/minio/websocket" ) // startHealthInfo starts fetching mc.ServerHealthInfo and // sends messages with the corresponding data on the websocket connection func startHealthInfo(ctx context.Context, conn WSConn, client MinioAdmin, deadline *time.Duration) error { if deadline == nil { return errors.New("duration can't be nil on startHealthInfo") } // Fetch info of all servers (cluster or single server) healthInfo, version, err := client.serverHealthInfo(ctx, *deadline) if err != nil { return err } compressedDiag, err := mc.TarGZHealthInfo(healthInfo, version) if err != nil { return err } encodedDiag := b64.StdEncoding.EncodeToString(compressedDiag) type messageReport struct { Encoded string `json:"encoded"` ServerHealthInfo interface{} `json:"serverHealthInfo"` SubnetResponse string `json:"subnetResponse"` } report := messageReport{ Encoded: encodedDiag, ServerHealthInfo: healthInfo, SubnetResponse: "/health", } message, err := json.Marshal(report) if err != nil { return err } // Send Message through websocket connection return conn.writeMessage(websocket.TextMessage, message) } // getHealthInfoOptionsFromReq gets duration for startHealthInfo request // path come as : `/health-info?deadline=2h` func getHealthInfoOptionsFromReq(req *http.Request) (*time.Duration, error) { deadlineDuration, err := time.ParseDuration(req.FormValue("deadline")) if err != nil { return nil, err } return &deadlineDuration, nil } ================================================ FILE: api/admin_health_info_test.go ================================================ // 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 api import ( "context" "encoding/json" "errors" "reflect" "testing" "time" madmin "github.com/minio/madmin-go/v3" ) func Test_serverHealthInfo(t *testing.T) { var testReceiver chan madmin.HealthInfo ctx, cancel := context.WithCancel(context.Background()) defer cancel() client := AdminClientMock{} mockWSConn := mockConn{} deadlineDuration, _ := time.ParseDuration("1h") type args struct { deadline time.Duration wsWriteMock func(messageType int, data []byte) error mockMessages []madmin.HealthInfo } tests := []struct { test string args args wantError error }{ { test: "Return simple health info, no errors", args: args{ deadline: deadlineDuration, mockMessages: []madmin.HealthInfo{{}, {}}, wsWriteMock: func(_ int, data []byte) error { // mock connection WriteMessage() no error // emulate that receiver gets the message written var t madmin.HealthInfo _ = json.Unmarshal(data, &t) testReceiver <- t return nil }, }, wantError: nil, }, { test: "Return simple health info2, no errors", args: args{ deadline: deadlineDuration, mockMessages: []madmin.HealthInfo{{}}, wsWriteMock: func(_ int, data []byte) error { // mock connection WriteMessage() no error // emulate that receiver gets the message written var t madmin.HealthInfo _ = json.Unmarshal(data, &t) testReceiver <- t return nil }, }, wantError: nil, }, { test: "Handle error on ws write", args: args{ deadline: deadlineDuration, mockMessages: []madmin.HealthInfo{{}}, wsWriteMock: func(_ int, data []byte) error { // mock connection WriteMessage() no error // emulate that receiver gets the message written var t madmin.HealthInfo _ = json.Unmarshal(data, &t) return errors.New("error on write") }, }, wantError: errors.New("error on write"), }, { test: "Handle error on health function", args: args{ deadline: deadlineDuration, mockMessages: []madmin.HealthInfo{ { Error: "error on healthInfo", }, }, wsWriteMock: func(_ int, data []byte) error { // mock connection WriteMessage() no error // emulate that receiver gets the message written var t madmin.HealthInfo _ = json.Unmarshal(data, &t) return nil }, }, wantError: nil, }, } for _, tt := range tests { tt := tt t.Run(tt.test, func(_ *testing.T) { // make testReceiver channel testReceiver = make(chan madmin.HealthInfo, len(tt.args.mockMessages)) // mock function same for all tests, changes mockMessages minioServerHealthInfoMock = func(_ context.Context, _ time.Duration, ) (interface{}, string, error) { info := tt.args.mockMessages[0] return info, madmin.HealthInfoVersion, nil } connWriteMessageMock = tt.args.wsWriteMock err := startHealthInfo(ctx, mockWSConn, client, &deadlineDuration) // close test mock channel close(testReceiver) // check that the TestReceiver got the same number of data from Console. index := 0 for info := range testReceiver { if !reflect.DeepEqual(info, tt.args.mockMessages[index]) { t.Errorf("startHealthInfo() got: %v, want: %v", info, tt.args.mockMessages[index]) return } index++ } if !reflect.DeepEqual(err, tt.wantError) { t.Errorf("startHealthInfo() error: %v, wantError: %v", err, tt.wantError) return } }) } } ================================================ FILE: api/admin_idp.go ================================================ // 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 api import ( "context" "fmt" "time" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" "github.com/minio/console/api/operations/idp" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" ) var errInvalidIDPType = fmt.Errorf("IDP type must be one of %v", madmin.ValidIDPConfigTypes) func registerIDPHandlers(api *operations.ConsoleAPI) { api.IdpCreateConfigurationHandler = idp.CreateConfigurationHandlerFunc(func(params idp.CreateConfigurationParams, session *models.Principal) middleware.Responder { response, err := createIDPConfigurationResponse(session, params) if err != nil { return idp.NewCreateConfigurationDefault(err.Code).WithPayload(err.APIError) } return idp.NewCreateConfigurationCreated().WithPayload(response) }) api.IdpUpdateConfigurationHandler = idp.UpdateConfigurationHandlerFunc(func(params idp.UpdateConfigurationParams, session *models.Principal) middleware.Responder { response, err := updateIDPConfigurationResponse(session, params) if err != nil { return idp.NewUpdateConfigurationDefault(err.Code).WithPayload(err.APIError) } return idp.NewUpdateConfigurationOK().WithPayload(response) }) api.IdpListConfigurationsHandler = idp.ListConfigurationsHandlerFunc(func(params idp.ListConfigurationsParams, session *models.Principal) middleware.Responder { response, err := listIDPConfigurationsResponse(session, params) if err != nil { return idp.NewListConfigurationsDefault(err.Code).WithPayload(err.APIError) } return idp.NewListConfigurationsOK().WithPayload(response) }) api.IdpDeleteConfigurationHandler = idp.DeleteConfigurationHandlerFunc(func(params idp.DeleteConfigurationParams, session *models.Principal) middleware.Responder { response, err := deleteIDPConfigurationResponse(session, params) if err != nil { return idp.NewDeleteConfigurationDefault(err.Code).WithPayload(err.APIError) } return idp.NewDeleteConfigurationOK().WithPayload(response) }) api.IdpGetConfigurationHandler = idp.GetConfigurationHandlerFunc(func(params idp.GetConfigurationParams, session *models.Principal) middleware.Responder { response, err := getIDPConfigurationsResponse(session, params) if err != nil { return idp.NewGetConfigurationDefault(err.Code).WithPayload(err.APIError) } return idp.NewGetConfigurationOK().WithPayload(response) }) api.IdpGetLDAPEntitiesHandler = idp.GetLDAPEntitiesHandlerFunc(func(params idp.GetLDAPEntitiesParams, session *models.Principal) middleware.Responder { response, err := getLDAPEntitiesResponse(session, params) if err != nil { return idp.NewGetLDAPEntitiesDefault(err.Code).WithPayload(err.APIError) } return idp.NewGetLDAPEntitiesOK().WithPayload(response) }) } func createIDPConfigurationResponse(session *models.Principal, params idp.CreateConfigurationParams) (*models.SetIDPResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } restart, err := createOrUpdateIDPConfig(ctx, params.Type, params.Body.Name, params.Body.Input, false, AdminClient{Client: mAdmin}) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.SetIDPResponse{Restart: restart}, nil } func updateIDPConfigurationResponse(session *models.Principal, params idp.UpdateConfigurationParams) (*models.SetIDPResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } restart, err := createOrUpdateIDPConfig(ctx, params.Type, params.Name, params.Body.Input, true, AdminClient{Client: mAdmin}) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.SetIDPResponse{Restart: restart}, nil } func createOrUpdateIDPConfig(ctx context.Context, idpType, name, input string, update bool, client MinioAdmin) (bool, error) { if !madmin.ValidIDPConfigTypes.Contains(idpType) { return false, errInvalidIDPType } restart, err := client.addOrUpdateIDPConfig(ctx, idpType, name, input, update) if err != nil { return false, err } return restart, nil } func listIDPConfigurationsResponse(session *models.Principal, params idp.ListConfigurationsParams) (*models.IdpListConfigurationsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } results, err := listIDPConfigurations(ctx, params.Type, AdminClient{Client: mAdmin}) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.IdpListConfigurationsResponse{Results: results}, nil } func listIDPConfigurations(ctx context.Context, idpType string, client MinioAdmin) ([]*models.IdpServerConfiguration, error) { if !madmin.ValidIDPConfigTypes.Contains(idpType) { return nil, errInvalidIDPType } results, err := client.listIDPConfig(ctx, idpType) if err != nil { return nil, err } return parseIDPConfigurations(results), nil } func parseIDPConfigurations(configs []madmin.IDPListItem) (serverConfigs []*models.IdpServerConfiguration) { for _, c := range configs { serverConfigs = append(serverConfigs, &models.IdpServerConfiguration{ Name: c.Name, Enabled: c.Enabled, Type: c.Type, }) } return serverConfigs } func deleteIDPConfigurationResponse(session *models.Principal, params idp.DeleteConfigurationParams) (*models.SetIDPResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } restart, err := deleteIDPConfig(ctx, params.Type, params.Name, AdminClient{Client: mAdmin}) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.SetIDPResponse{Restart: restart}, nil } func deleteIDPConfig(ctx context.Context, idpType, name string, client MinioAdmin) (bool, error) { if !madmin.ValidIDPConfigTypes.Contains(idpType) { return false, errInvalidIDPType } restart, err := client.deleteIDPConfig(ctx, idpType, name) if err != nil { return false, err } return restart, nil } func getIDPConfigurationsResponse(session *models.Principal, params idp.GetConfigurationParams) (*models.IdpServerConfiguration, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } result, err := getIDPConfiguration(ctx, params.Type, params.Name, AdminClient{Client: mAdmin}) if err != nil { return nil, ErrorWithContext(ctx, err) } return result, nil } func getIDPConfiguration(ctx context.Context, idpType, name string, client MinioAdmin) (*models.IdpServerConfiguration, error) { if !madmin.ValidIDPConfigTypes.Contains(idpType) { return nil, errInvalidIDPType } config, err := client.getIDPConfig(ctx, idpType, name) if err != nil { return nil, err } return &models.IdpServerConfiguration{ Name: config.Name, Type: config.Type, Info: parseIDPConfigurationsInfo(config.Info), }, nil } func parseIDPConfigurationsInfo(infoList []madmin.IDPCfgInfo) (results []*models.IdpServerConfigurationInfo) { for _, info := range infoList { results = append(results, &models.IdpServerConfigurationInfo{ Key: info.Key, Value: info.Value, IsCfg: info.IsCfg, IsEnv: info.IsEnv, }) } return results } func getLDAPEntitiesResponse(session *models.Principal, params idp.GetLDAPEntitiesParams) (*models.LdapEntities, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } result, err := getEntitiesResult(ctx, AdminClient{Client: mAdmin}, params.Body.Users, params.Body.Groups, params.Body.Policies) if err != nil { return nil, ErrorWithContext(ctx, err) } return result, nil } func getEntitiesResult(ctx context.Context, client MinioAdmin, users, groups, policies []string) (*models.LdapEntities, error) { entities, err := client.getLDAPPolicyEntities(ctx, madmin.PolicyEntitiesQuery{ Users: users, Groups: groups, Policy: policies, }) if err != nil { return nil, err } var result models.LdapEntities var usersEntity []*models.LdapUserPolicyEntity var groupsEntity []*models.LdapGroupPolicyEntity var policiesEntity []*models.LdapPolicyEntity result.Timestamp = entities.Timestamp.Format(time.RFC3339) for _, userMapping := range entities.UserMappings { mapItem := models.LdapUserPolicyEntity{ User: userMapping.User, Policies: userMapping.Policies, } usersEntity = append(usersEntity, &mapItem) } result.Users = usersEntity for _, groupsMapping := range entities.GroupMappings { mapItem := models.LdapGroupPolicyEntity{ Group: groupsMapping.Group, Policies: groupsMapping.Policies, } groupsEntity = append(groupsEntity, &mapItem) } result.Groups = groupsEntity for _, policyMapping := range entities.PolicyMappings { mapItem := models.LdapPolicyEntity{ Policy: policyMapping.Policy, Users: policyMapping.Users, Groups: policyMapping.Groups, } policiesEntity = append(policiesEntity, &mapItem) } result.Policies = policiesEntity return &result, nil } ================================================ FILE: api/admin_idp_test.go ================================================ // 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 api import ( "context" "errors" "fmt" "net/http" "net/http/httptest" "os" "testing" "github.com/minio/madmin-go/v3" "github.com/minio/console/api/operations" "github.com/minio/console/api/operations/idp" "github.com/minio/console/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) type IDPTestSuite struct { suite.Suite assert *assert.Assertions currentServer string isServerSet bool server *httptest.Server adminClient AdminClientMock } func (suite *IDPTestSuite) SetupSuite() { suite.assert = assert.New(suite.T()) suite.adminClient = AdminClientMock{} minioServiceRestartMock = func(_ context.Context) error { return nil } } func (suite *IDPTestSuite) SetupTest() { suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler)) suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer) os.Setenv(ConsoleMinIOServer, suite.server.URL) } func (suite *IDPTestSuite) serverHandler(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(400) } func (suite *IDPTestSuite) TearDownSuite() { } func (suite *IDPTestSuite) TearDownTest() { if suite.isServerSet { os.Setenv(ConsoleMinIOServer, suite.currentServer) } else { os.Unsetenv(ConsoleMinIOServer) } } func (suite *IDPTestSuite) TestRegisterIDPHandlers() { api := &operations.ConsoleAPI{} suite.assertHandlersAreNil(api) registerIDPHandlers(api) suite.assertHandlersAreNotNil(api) } func (suite *IDPTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) { suite.assert.Nil(api.IdpCreateConfigurationHandler) suite.assert.Nil(api.IdpListConfigurationsHandler) suite.assert.Nil(api.IdpUpdateConfigurationHandler) suite.assert.Nil(api.IdpGetConfigurationHandler) suite.assert.Nil(api.IdpGetConfigurationHandler) suite.assert.Nil(api.IdpDeleteConfigurationHandler) } func (suite *IDPTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) { suite.assert.NotNil(api.IdpCreateConfigurationHandler) suite.assert.NotNil(api.IdpListConfigurationsHandler) suite.assert.NotNil(api.IdpUpdateConfigurationHandler) suite.assert.NotNil(api.IdpGetConfigurationHandler) suite.assert.NotNil(api.IdpGetConfigurationHandler) suite.assert.NotNil(api.IdpDeleteConfigurationHandler) } func (suite *IDPTestSuite) TestCreateIDPConfigurationHandlerWithError() { params, api := suite.initCreateIDPConfigurationRequest() response := api.IdpCreateConfigurationHandler.Handle(params, &models.Principal{}) _, ok := response.(*idp.CreateConfigurationDefault) suite.assert.True(ok) } func (suite *IDPTestSuite) initCreateIDPConfigurationRequest() (params idp.CreateConfigurationParams, api operations.ConsoleAPI) { registerIDPHandlers(&api) params.HTTPRequest = &http.Request{} params.Body = &models.IdpServerConfiguration{} params.Type = "ldap" return params, api } func (suite *IDPTestSuite) TestCreateIDPConfigurationWithoutError() { ctx := context.Background() _, err := createOrUpdateIDPConfig(ctx, "ldap", "", "", false, suite.adminClient) suite.assert.Nil(err) } func (suite *IDPTestSuite) TestCreateIDPConfigurationWithWrongType() { ctx := context.Background() _, err := createOrUpdateIDPConfig(ctx, "", "", "", false, suite.adminClient) suite.assert.NotNil(err) } func (suite *IDPTestSuite) TestUpdateIDPConfigurationHandlerWithError() { params, api := suite.initUpdateIDPConfigurationRequest() response := api.IdpUpdateConfigurationHandler.Handle(params, &models.Principal{}) _, ok := response.(*idp.UpdateConfigurationDefault) suite.assert.True(ok) } func (suite *IDPTestSuite) initUpdateIDPConfigurationRequest() (params idp.UpdateConfigurationParams, api operations.ConsoleAPI) { registerIDPHandlers(&api) params.HTTPRequest = &http.Request{} params.Body = &models.IdpServerConfiguration{} params.Type = "ldap" return params, api } func (suite *IDPTestSuite) TestUpdateIDPConfigurationWithoutError() { ctx := context.Background() _, err := createOrUpdateIDPConfig(ctx, "ldap", "", "", true, suite.adminClient) suite.assert.Nil(err) } func (suite *IDPTestSuite) TestUpdateIDPConfigurationWithWrongType() { ctx := context.Background() _, err := createOrUpdateIDPConfig(ctx, "", "", "", true, suite.adminClient) suite.assert.NotNil(err) } func (suite *IDPTestSuite) TestListIDPConfigurationHandlerWithError() { params, api := suite.initListIDPConfigurationsRequest() response := api.IdpListConfigurationsHandler.Handle(params, &models.Principal{}) _, ok := response.(*idp.ListConfigurationsDefault) suite.assert.True(ok) } func (suite *IDPTestSuite) initListIDPConfigurationsRequest() (params idp.ListConfigurationsParams, api operations.ConsoleAPI) { registerIDPHandlers(&api) params.HTTPRequest = &http.Request{} params.Type = "ldap" return params, api } func (suite *IDPTestSuite) TestListIDPConfigurationsWithoutError() { ctx := context.Background() res, err := listIDPConfigurations(ctx, "ldap", suite.adminClient) suite.assert.NotNil(res) suite.assert.Nil(err) } func (suite *IDPTestSuite) TestListIDPConfigurationsWithWrongType() { ctx := context.Background() res, err := listIDPConfigurations(ctx, "", suite.adminClient) suite.assert.Nil(res) suite.assert.NotNil(err) } func (suite *IDPTestSuite) TestDeleteIDPConfigurationHandlerWithError() { params, api := suite.initDeleteIDPConfigurationRequest() response := api.IdpDeleteConfigurationHandler.Handle(params, &models.Principal{}) _, ok := response.(*idp.DeleteConfigurationDefault) suite.assert.True(ok) } func (suite *IDPTestSuite) initDeleteIDPConfigurationRequest() (params idp.DeleteConfigurationParams, api operations.ConsoleAPI) { registerIDPHandlers(&api) params.HTTPRequest = &http.Request{} params.Type = "ldap" return params, api } func (suite *IDPTestSuite) TestDeleteIDPConfigurationWithoutError() { ctx := context.Background() _, err := deleteIDPConfig(ctx, "ldap", "", suite.adminClient) suite.assert.Nil(err) } func (suite *IDPTestSuite) TestDeleteIDPConfigurationWithWrongType() { ctx := context.Background() _, err := deleteIDPConfig(ctx, "", "", suite.adminClient) suite.assert.NotNil(err) } func (suite *IDPTestSuite) TestGetIDPConfigurationHandlerWithError() { params, api := suite.initGetIDPConfigurationRequest() response := api.IdpGetConfigurationHandler.Handle(params, &models.Principal{}) _, ok := response.(*idp.GetConfigurationDefault) suite.assert.True(ok) } func (suite *IDPTestSuite) initGetIDPConfigurationRequest() (params idp.GetConfigurationParams, api operations.ConsoleAPI) { registerIDPHandlers(&api) params.HTTPRequest = &http.Request{} params.Type = "ldap" return params, api } func (suite *IDPTestSuite) TestGetIDPConfigurationWithoutError() { ctx := context.Background() res, err := getIDPConfiguration(ctx, "ldap", "", suite.adminClient) suite.assert.NotNil(res) suite.assert.Nil(err) } func (suite *IDPTestSuite) TestGetIDPConfigurationWithWrongType() { ctx := context.Background() res, err := getIDPConfiguration(ctx, "", "", suite.adminClient) suite.assert.Nil(res) suite.assert.NotNil(err) } func TestIDP(t *testing.T) { suite.Run(t, new(IDPTestSuite)) } func TestGetEntitiesResult(t *testing.T) { assert := assert.New(t) // mock minIO client client := AdminClientMock{} function := "getEntitiesResult()" usersList := []string{"user1", "user2", "user3"} policiesList := []string{"policy1", "policy2", "policy3"} groupsList := []string{"group1", "group3", "group5"} policyMap := []madmin.PolicyEntities{ {Policy: "testPolicy0", Groups: groupsList, Users: usersList}, {Policy: "testPolicy1", Groups: groupsList, Users: usersList}, } usersMap := []madmin.UserPolicyEntities{ {User: "testUser0", Policies: policiesList}, {User: "testUser1", Policies: policiesList}, } groupsMap := []madmin.GroupPolicyEntities{ {Group: "group0", Policies: policiesList}, {Group: "group1", Policies: policiesList}, } // Test-1: getEntitiesResult list all information provided ctx, cancel := context.WithCancel(context.Background()) defer cancel() mockResponse := madmin.PolicyEntitiesResult{ PolicyMappings: policyMap, GroupMappings: groupsMap, UserMappings: usersMap, } minioGetLDAPPolicyEntitiesMock = func(_ context.Context, _ madmin.PolicyEntitiesQuery) (madmin.PolicyEntitiesResult, error) { return mockResponse, nil } entities, err := getEntitiesResult(ctx, client, usersList, groupsList, policiesList) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } for i, groupIt := range entities.Groups { assert.Equal(fmt.Sprintf("group%d", i), groupIt.Group) for i, polItm := range groupIt.Policies { assert.Equal(policiesList[i], polItm) } } for i, usrIt := range entities.Users { assert.Equal(fmt.Sprintf("testUser%d", i), usrIt.User) for i, polItm := range usrIt.Policies { assert.Equal(policiesList[i], polItm) } } for i, policyIt := range entities.Policies { assert.Equal(fmt.Sprintf("testPolicy%d", i), policyIt.Policy) for i, userItm := range policyIt.Users { assert.Equal(usersList[i], userItm) } for i, grItm := range policyIt.Groups { assert.Equal(groupsList[i], grItm) } } // Test-2: getEntitiesResult error is returned from getLDAPPolicyEntities() minioGetLDAPPolicyEntitiesMock = func(_ context.Context, _ madmin.PolicyEntitiesQuery) (madmin.PolicyEntitiesResult, error) { return madmin.PolicyEntitiesResult{}, errors.New("error") } _, err = getEntitiesResult(ctx, client, usersList, groupsList, policiesList) if assert.Error(err) { assert.Equal("error", err.Error()) } } ================================================ FILE: api/admin_info.go ================================================ // 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 api import ( "context" "encoding/json" "errors" "fmt" "net/http" "net/url" "regexp" "strings" "sync" "time" "github.com/minio/console/pkg/utils" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" systemApi "github.com/minio/console/api/operations/system" "github.com/minio/console/models" ) func registerAdminInfoHandlers(api *operations.ConsoleAPI) { // return usage stats api.SystemAdminInfoHandler = systemApi.AdminInfoHandlerFunc(func(params systemApi.AdminInfoParams, session *models.Principal) middleware.Responder { infoResp, err := getAdminInfoResponse(session, params) if err != nil { return systemApi.NewAdminInfoDefault(err.Code).WithPayload(err.APIError) } return systemApi.NewAdminInfoOK().WithPayload(infoResp) }) // return single widget results api.SystemDashboardWidgetDetailsHandler = systemApi.DashboardWidgetDetailsHandlerFunc(func(params systemApi.DashboardWidgetDetailsParams, _ *models.Principal) middleware.Responder { infoResp, err := getAdminInfoWidgetResponse(params) if err != nil { return systemApi.NewDashboardWidgetDetailsDefault(err.Code).WithPayload(err.APIError) } return systemApi.NewDashboardWidgetDetailsOK().WithPayload(infoResp) }) } type UsageInfo struct { Buckets int64 Objects int64 Usage int64 DrivesUsage int64 Servers []*models.ServerProperties EndpointNotReady bool Backend *models.BackendProperties } // GetAdminInfo invokes admin info and returns a parsed `UsageInfo` structure func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) { serverInfo, err := client.serverInfo(ctx) if err != nil { return nil, err } // we are trimming uint64 to int64 this will report an incorrect measurement for numbers greater than // 9,223,372,036,854,775,807 backendType := serverInfo.Backend.Type rrSCParity := serverInfo.Backend.RRSCParity standardSCParity := serverInfo.Backend.StandardSCParity onlineDrives := serverInfo.Backend.OnlineDisks offlineDrives := serverInfo.Backend.OfflineDisks var usedSpace int64 // serverArray contains the serverProperties which describe the servers in the network var serverArray []*models.ServerProperties for _, serv := range serverInfo.Servers { drives := []*models.ServerDrives{} for _, drive := range serv.Disks { usedSpace += int64(drive.UsedSpace) drives = append(drives, &models.ServerDrives{ State: drive.State, UUID: drive.UUID, Endpoint: drive.Endpoint, RootDisk: drive.RootDisk, DrivePath: drive.DrivePath, Healing: drive.Healing, Model: drive.Model, TotalSpace: int64(drive.TotalSpace), UsedSpace: int64(drive.UsedSpace), AvailableSpace: int64(drive.AvailableSpace), }) } newServer := &models.ServerProperties{ State: serv.State, Endpoint: serv.Endpoint, Uptime: serv.Uptime, Version: serv.Version, CommitID: serv.CommitID, PoolNumber: int64(serv.PoolNumber), Network: serv.Network, Drives: drives, } serverArray = append(serverArray, newServer) } backendData := &models.BackendProperties{ BackendType: string(backendType), RrSCParity: int64(rrSCParity), StandardSCParity: int64(standardSCParity), OnlineDrives: int64(onlineDrives), OfflineDrives: int64(offlineDrives), } return &UsageInfo{ Buckets: int64(serverInfo.Buckets.Count), Objects: int64(serverInfo.Objects.Count), Usage: int64(serverInfo.Usage.Size), DrivesUsage: usedSpace, Servers: serverArray, Backend: backendData, }, nil } type Target struct { Expr string Interval string LegendFormat string Step int32 InitialTime int64 } type ReduceOptions struct { Calcs []string } type MetricOptions struct { ReduceOptions ReduceOptions } type Metric struct { ID int32 Title string Type string Options MetricOptions Targets []Target GridPos GridPos MaxDataPoints int32 } type GridPos struct { H int32 W int32 X int32 Y int32 } type WidgetLabel struct { Name string } var labels = []WidgetLabel{ {Name: "instance"}, {Name: "drive"}, {Name: "server"}, {Name: "api"}, } var widgets = []Metric{ { ID: 1, Title: "Uptime", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 6, W: 3, X: 0, Y: 0, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "mean", }, }, }, Targets: []Target{ { Expr: `time() - max(minio_node_process_starttime_seconds{$__query})`, LegendFormat: "{{instance}}", Step: 60, }, }, }, { ID: 65, Title: "Total S3 Traffic Inbound", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 3, W: 3, X: 3, Y: 0, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "last", }, }, }, Targets: []Target{ { Expr: `sum by (instance) (minio_s3_traffic_received_bytes{$__query})`, LegendFormat: "{{instance}}", Step: 60, }, }, }, { ID: 50, Title: "Current Usable Free Capacity", Type: "gauge", MaxDataPoints: 100, GridPos: GridPos{ H: 6, W: 3, X: 6, Y: 0, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "lastNotNull", }, }, }, Targets: []Target{ { Expr: `topk(1, sum(minio_cluster_capacity_usable_total_bytes{$__query}) by (instance))`, LegendFormat: "Total Usable", Step: 300, }, { Expr: `topk(1, sum(minio_cluster_capacity_usable_free_bytes{$__query}) by (instance))`, LegendFormat: "Usable Free", Step: 300, }, { Expr: `topk(1, sum(minio_cluster_capacity_usable_total_bytes{$__query}) by (instance)) - topk(1, sum(minio_cluster_capacity_usable_free_bytes{$__query}) by (instance))`, LegendFormat: "Used Space", Step: 300, }, }, }, { ID: 51, Title: "Current Usable Total Bytes", Type: "gauge", MaxDataPoints: 100, GridPos: GridPos{ H: 6, W: 3, X: 6, Y: 0, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "lastNotNull", }, }, }, Targets: []Target{ { Expr: `topk(1, sum(minio_cluster_capacity_usable_total_bytes{$__query}) by (instance))`, LegendFormat: "", Step: 300, }, }, }, { ID: 68, Title: "Data Usage Growth", Type: "graph", GridPos: GridPos{ H: 6, W: 7, X: 9, Y: 0, }, Targets: []Target{ { Expr: `minio_cluster_usage_total_bytes{$__query}`, LegendFormat: "Used Capacity", InitialTime: -180, Step: 10, }, }, }, { ID: 52, Title: "Object size distribution", Type: "bargauge", GridPos: GridPos{ H: 6, W: 5, X: 16, Y: 0, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "mean", }, }, }, Targets: []Target{ { Expr: `minio_cluster_objects_size_distribution{$__query}`, LegendFormat: "{{range}}", Step: 300, }, }, }, { ID: 61, Title: "Total Open FDs", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 3, W: 3, X: 21, Y: 0, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "last", }, }, }, Targets: []Target{ { Expr: `sum(minio_node_file_descriptor_open_total{$__query})`, LegendFormat: "", Step: 60, }, }, }, { ID: 64, Title: "Total S3 Traffic Outbound", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 3, W: 3, X: 3, Y: 3, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "last", }, }, }, Targets: []Target{ { Expr: `sum by (instance) (minio_s3_traffic_sent_bytes{$__query})`, LegendFormat: "", Step: 60, }, }, }, { ID: 62, Title: "Total Goroutines", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 3, W: 3, X: 21, Y: 3, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "last", }, }, }, Targets: []Target{ { Expr: `sum without (server,instance) (minio_node_go_routine_total{$__query})`, LegendFormat: "", Step: 60, }, }, }, { ID: 53, Title: "Total Online Servers", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 2, W: 3, X: 0, Y: 6, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "mean", }, }, }, Targets: []Target{ { Expr: `minio_cluster_nodes_online_total{$__query}`, LegendFormat: "", Step: 60, }, }, }, { ID: 9, Title: "Total Online Drives", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 2, W: 3, X: 3, Y: 6, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "mean", }, }, }, Targets: []Target{ { Expr: `minio_cluster_drive_online_total{$__query}`, LegendFormat: "Total online drives in MinIO Cluster", Step: 60, }, }, }, { ID: 66, Title: "Number of Buckets", Type: "stat", MaxDataPoints: 5, GridPos: GridPos{ H: 3, W: 3, X: 6, Y: 6, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "lastNotNull", }, }, }, Targets: []Target{ { Expr: `minio_cluster_bucket_total{$__query}`, LegendFormat: "", Step: 100, }, }, }, { ID: 63, Title: "S3 API Data Received Rate ", Type: "graph", GridPos: GridPos{ H: 6, W: 7, X: 9, Y: 6, }, Targets: []Target{ { Expr: `sum by (server) (rate(minio_s3_traffic_received_bytes{$__query}[$__rate_interval]))`, LegendFormat: "Data Received [{{server}}]", }, }, }, { ID: 70, Title: "S3 API Data Sent Rate ", Type: "graph", GridPos: GridPos{ H: 6, W: 8, X: 16, Y: 6, }, Targets: []Target{ { Expr: `sum by (server) (rate(minio_s3_traffic_sent_bytes{$__query}[$__rate_interval]))`, LegendFormat: "Data Sent [{{server}}]", }, }, }, { ID: 69, Title: "Total Offline Servers", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 2, W: 3, X: 0, Y: 8, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "mean", }, }, }, Targets: []Target{ { Expr: `minio_cluster_nodes_offline_total{$__query}`, LegendFormat: "", Step: 60, }, }, }, { ID: 78, Title: "Total Offline Drives", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 2, W: 3, X: 3, Y: 8, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "mean", }, }, }, Targets: []Target{ { Expr: `minio_cluster_drive_offline_total{$__query}`, LegendFormat: "", Step: 60, }, }, }, { ID: 44, Title: "Number of Objects", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 3, W: 3, X: 6, Y: 9, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "lastNotNull", }, }, }, Targets: []Target{ { Expr: `minio_cluster_usage_object_total{$__query}`, LegendFormat: "", }, }, }, { ID: 80, Title: "Time Since Last Heal Activity", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 2, W: 3, X: 0, Y: 10, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "last", }, }, }, Targets: []Target{ { Expr: `minio_heal_time_last_activity_nano_seconds{$__query}`, LegendFormat: "{{server}}", Step: 60, }, }, }, { ID: 81, Title: "Time Since Last Scan Activity", Type: "stat", MaxDataPoints: 100, GridPos: GridPos{ H: 2, W: 3, X: 3, Y: 10, }, Options: MetricOptions{ ReduceOptions: ReduceOptions{ Calcs: []string{ "last", }, }, }, Targets: []Target{ { Expr: `minio_usage_last_activity_nano_seconds{$__query}`, LegendFormat: "{{server}}", Step: 60, }, }, }, { ID: 60, Title: "S3 API Request Rate", Type: "graph", GridPos: GridPos{ H: 10, W: 12, X: 0, Y: 12, }, Targets: []Target{ { Expr: `sum by (server,api) (increase(minio_s3_requests_total{$__query}[$__rate_interval]))`, LegendFormat: "{{server,api}}", }, }, }, { ID: 71, Title: "S3 API Request Error Rate", Type: "graph", GridPos: GridPos{ H: 10, W: 12, X: 12, Y: 12, }, Targets: []Target{ { Expr: `sum by (server,api) (increase(minio_s3_requests_errors_total{$__query}[$__rate_interval]))`, LegendFormat: "{{server,api}}", }, }, }, { ID: 17, Title: "Internode Data Transfer", Type: "graph", GridPos: GridPos{ H: 8, W: 24, X: 0, Y: 22, }, Targets: []Target{ { Expr: `rate(minio_inter_node_traffic_sent_bytes{$__query}[$__rate_interval])`, LegendFormat: "Internode Bytes Received [{{server}}]", Step: 4, }, { Expr: `rate(minio_inter_node_traffic_sent_bytes{$__query}[$__rate_interval])`, LegendFormat: "Internode Bytes Received [{{server}}]", }, }, }, { ID: 77, Title: "Node CPU Usage", Type: "graph", GridPos: GridPos{ H: 9, W: 12, X: 0, Y: 30, }, Targets: []Target{ { Expr: `rate(minio_node_process_cpu_total_seconds{$__query}[$__rate_interval])`, LegendFormat: "CPU Usage Rate [{{server}}]", }, }, }, { ID: 76, Title: "Node Memory Usage", Type: "graph", GridPos: GridPos{ H: 9, W: 12, X: 12, Y: 30, }, Targets: []Target{ { Expr: `minio_node_process_resident_memory_bytes{$__query}`, LegendFormat: "Memory Used [{{server}}]", }, }, }, { ID: 74, Title: "Drive Used Capacity", Type: "graph", GridPos: GridPos{ H: 8, W: 12, X: 0, Y: 39, }, Targets: []Target{ { Expr: `minio_node_drive_used_bytes{$__query}`, LegendFormat: "Used Capacity [{{server}}:{{drive}}]", }, }, }, { ID: 82, Title: "Drives Free Inodes", Type: "graph", GridPos: GridPos{ H: 8, W: 12, X: 12, Y: 39, }, Targets: []Target{ { Expr: `minio_node_drive_free_inodes{$__query}`, LegendFormat: "Free Inodes [{{server}}:{{drive}}]", }, }, }, { ID: 11, Title: "Node Syscalls", Type: "graph", GridPos: GridPos{ H: 9, W: 12, X: 0, Y: 47, }, Targets: []Target{ { Expr: `rate(minio_node_syscall_read_total{$__query}[$__rate_interval])`, LegendFormat: "Read Syscalls [{{server}}]", Step: 60, }, { Expr: `rate(minio_node_syscall_read_total{$__query}[$__rate_interval])`, LegendFormat: "Read Syscalls [{{server}}]", }, }, }, { ID: 8, Title: "Node File Descriptors", Type: "graph", GridPos: GridPos{ H: 9, W: 12, X: 12, Y: 47, }, Targets: []Target{ { Expr: `minio_node_file_descriptor_open_total{$__query}`, LegendFormat: "Open FDs [{{server}}]", }, }, }, { ID: 73, Title: "Node IO", Type: "graph", GridPos: GridPos{ H: 8, W: 24, X: 0, Y: 56, }, Targets: []Target{ { Expr: `rate(minio_node_io_rchar_bytes{$__query}[$__rate_interval])`, LegendFormat: "Node RChar [{{server}}]", }, { Expr: `rate(minio_node_io_wchar_bytes{$__query}[$__rate_interval])`, LegendFormat: "Node WChar [{{server}}]", }, }, }, } type Widget struct { Title string Type string } type DataResult struct { Metric map[string]string `json:"metric"` Values []interface{} `json:"values"` } type PromRespData struct { ResultType string `json:"resultType"` Result []DataResult `json:"result"` } type PromResp struct { Status string `json:"status"` Data PromRespData `json:"data"` } type LabelResponse struct { Status string `json:"status"` Data []string `json:"data"` } type LabelResults struct { Label string Response LabelResponse } // getAdminInfoResponse returns the response containing total buckets, objects and usage. func getAdminInfoResponse(session *models.Principal, params systemApi.AdminInfoParams) (*models.AdminInfoResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() prometheusURL := "" if !*params.DefaultOnly { promURL := getPrometheusURL() if promURL != "" { prometheusURL = promURL } } mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } sessionResp, err2 := getUsageWidgetsForDeployment(ctx, prometheusURL, AdminClient{Client: mAdmin}) if err2 != nil { return nil, ErrorWithContext(ctx, err2) } return sessionResp, nil } func getUsageWidgetsForDeployment(ctx context.Context, prometheusURL string, adminClient MinioAdmin) (*models.AdminInfoResponse, error) { prometheusStatus := models.AdminInfoResponseAdvancedMetricsStatusAvailable if prometheusURL == "" { prometheusStatus = models.AdminInfoResponseAdvancedMetricsStatusNotConfigured } if prometheusURL != "" && !testPrometheusURL(ctx, prometheusURL) { prometheusStatus = models.AdminInfoResponseAdvancedMetricsStatusUnavailable } sessionResp := &models.AdminInfoResponse{ AdvancedMetricsStatus: prometheusStatus, } doneCh := make(chan error) go func() { defer close(doneCh) // serialize output usage, err := GetAdminInfo(ctx, adminClient) if err != nil { doneCh <- err } if usage != nil { sessionResp.Buckets = usage.Buckets sessionResp.Objects = usage.Objects sessionResp.Usage = usage.Usage sessionResp.Servers = usage.Servers sessionResp.Backend = usage.Backend } }() var wdgts []*models.Widget if prometheusStatus == models.AdminInfoResponseAdvancedMetricsStatusAvailable { // We will tell the frontend about a list of widgets so it can fetch the ones it wants for _, m := range widgets { wdgtResult := models.Widget{ ID: m.ID, Title: m.Title, Type: m.Type, } if len(m.Options.ReduceOptions.Calcs) > 0 { wdgtResult.Options = &models.WidgetOptions{ ReduceOptions: &models.WidgetOptionsReduceOptions{ Calcs: m.Options.ReduceOptions.Calcs, }, } } wdgts = append(wdgts, &wdgtResult) } sessionResp.Widgets = wdgts } // wait for mc admin info err := <-doneCh if err != nil { return nil, err } return sessionResp, nil } func unmarshalPrometheus(ctx context.Context, httpClnt *http.Client, endpoint string, data interface{}) bool { req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil) if err != nil { ErrorWithContext(ctx, fmt.Errorf("unable to create the request to fetch labels from prometheus: %w", err)) return true } if prometheusBearer := getPrometheusAuthToken(); prometheusBearer != "" { req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", prometheusBearer)) } else if username, password, ok := getPrometheusAuthUserPass(); ok { req.SetBasicAuth(username, password) } resp, err := httpClnt.Do(req) if err != nil { ErrorWithContext(ctx, fmt.Errorf("unable to fetch labels from prometheus: %w", err)) return true } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { ErrorWithContext(ctx, fmt.Errorf("unexpected status code from prometheus (%s)", resp.Status)) return true } if err = json.NewDecoder(resp.Body).Decode(data); err != nil { ErrorWithContext(ctx, fmt.Errorf("unexpected error from prometheus: %w", err)) return true } return false } func testPrometheusURL(ctx context.Context, url string) bool { req, err := http.NewRequestWithContext(ctx, http.MethodGet, url+"/-/healthy", nil) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error Building Request: (%v)", err)) return false } prometheusBearer := getPrometheusAuthToken() if prometheusBearer != "" { req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", prometheusBearer)) } clientIP := utils.ClientIPFromContext(ctx) httpClnt := GetConsoleHTTPClient(clientIP) response, err := httpClnt.Do(req) if err != nil { ErrorWithContext(ctx, fmt.Errorf("default Prometheus URL not reachable, trying root testing: (%v)", err)) newTestURL := req.URL.Scheme + "://" + req.URL.Host + "/-/healthy" req2, err := http.NewRequestWithContext(ctx, http.MethodGet, newTestURL, nil) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error Building Root Request: (%v)", err)) return false } rootResponse, err := httpClnt.Do(req2) if err != nil { // URL & Root tests didn't work. Prometheus not reachable ErrorWithContext(ctx, fmt.Errorf("root Prometheus URL not reachable: (%v)", err)) return false } return rootResponse.StatusCode == http.StatusOK } return response.StatusCode == http.StatusOK } func getAdminInfoWidgetResponse(params systemApi.DashboardWidgetDetailsParams) (*models.WidgetDetails, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() prometheusURL := getPrometheusURL() prometheusJobID := getPrometheusJobID() prometheusExtraLabels := getPrometheusExtraLabels() selector := fmt.Sprintf(`job="%s"`, prometheusJobID) if strings.TrimSpace(prometheusExtraLabels) != "" { selector = fmt.Sprintf(`job="%s",%s`, prometheusJobID, prometheusExtraLabels) } clientIP := getClientIP(params.HTTPRequest) ctx = context.WithValue(ctx, utils.ContextClientIP, clientIP) return getWidgetDetails(ctx, prometheusURL, selector, params.WidgetID, params.Step, params.Start, params.End) } func getWidgetDetails(ctx context.Context, prometheusURL string, selector string, widgetID int32, step *int32, start *int64, end *int64) (*models.WidgetDetails, *CodedAPIError) { // We test if prometheus URL is reachable. this is meant to avoid unuseful calls and application hang. if !testPrometheusURL(ctx, prometheusURL) { return nil, ErrorWithContext(ctx, errors.New("prometheus URL is unreachable")) } clientIP := utils.ClientIPFromContext(ctx) httpClnt := GetConsoleHTTPClient(clientIP) labelResultsCh := make(chan LabelResults) for _, lbl := range labels { go func(lbl WidgetLabel) { endpoint := fmt.Sprintf("%s/api/v1/label/%s/values", prometheusURL, lbl.Name) var response LabelResponse if unmarshalPrometheus(ctx, httpClnt, endpoint, &response) { return } labelResultsCh <- LabelResults{Label: lbl.Name, Response: response} }(lbl) } labelMap := make(map[string][]string) // wait for as many goroutines that come back in less than 1 second LabelsWaitLoop: for { select { case <-time.After(1 * time.Second): break LabelsWaitLoop case res := <-labelResultsCh: labelMap[res.Label] = res.Response.Data if len(labelMap) >= len(labels) { break LabelsWaitLoop } } } // launch a goroutines per widget for _, m := range widgets { if m.ID != widgetID { continue } var ( wg sync.WaitGroup targetResults = make([]*models.ResultTarget, len(m.Targets)) ) // for each target we will launch another goroutine to fetch the values for idx, target := range m.Targets { wg.Add(1) go func(idx int, target Target, inStep *int32, inStart *int64, inEnd *int64) { defer wg.Done() apiType := "query_range" now := time.Now() var initTime int64 = -15 if target.InitialTime != 0 { initTime = target.InitialTime } timeCalculated := time.Duration(initTime * int64(time.Minute)) extraParamters := fmt.Sprintf("&start=%d&end=%d", now.Add(timeCalculated).Unix(), now.Unix()) var step int32 = 60 if target.Step > 0 { step = target.Step } if inStep != nil && *inStep > 0 { step = *inStep } if inStart != nil && inEnd != nil { extraParamters = fmt.Sprintf("&start=%d&end=%d", *inStart, *inEnd) } if step > 0 { extraParamters = fmt.Sprintf("%s&step=%d", extraParamters, step) } // replace the `$__rate_interval` global for step with unit (s for seconds) queryExpr := strings.ReplaceAll(target.Expr, "$__rate_interval", fmt.Sprintf("%ds", 240)) if strings.Contains(queryExpr, "$") { re := regexp.MustCompile(`\$([a-z]+)`) for _, match := range re.FindAllStringSubmatch(queryExpr, -1) { if val, ok := labelMap[match[1]]; ok { queryExpr = strings.ReplaceAll(queryExpr, "$"+match[1], fmt.Sprintf("(%s)", strings.Join(val, "|"))) } } } queryExpr = strings.ReplaceAll(queryExpr, "$__query", selector) endpoint := fmt.Sprintf("%s/api/v1/%s?query=%s%s", prometheusURL, apiType, url.QueryEscape(queryExpr), extraParamters) var response PromResp if unmarshalPrometheus(ctx, httpClnt, endpoint, &response) { return } targetResult := models.ResultTarget{ LegendFormat: target.LegendFormat, ResultType: response.Data.ResultType, } for _, r := range response.Data.Result { targetResult.Result = append(targetResult.Result, &models.WidgetResult{ Metric: r.Metric, Values: r.Values, }) } targetResults[idx] = &targetResult }(idx, target, step, start, end) } wg.Wait() wdgtResult := models.WidgetDetails{ ID: m.ID, Title: m.Title, Type: m.Type, } if len(m.Options.ReduceOptions.Calcs) > 0 { wdgtResult.Options = &models.WidgetDetailsOptions{ ReduceOptions: &models.WidgetDetailsOptionsReduceOptions{ Calcs: m.Options.ReduceOptions.Calcs, }, } } for _, res := range targetResults { if res != nil { wdgtResult.Targets = append(wdgtResult.Targets, res) } } return &wdgtResult, nil } return nil, &CodedAPIError{Code: 404, APIError: &models.APIError{Message: "Widget not found"}} } ================================================ FILE: api/admin_info_test.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package api import ( "context" "net/http" "net/http/httptest" "os" "testing" "github.com/minio/console/pkg/utils" "github.com/minio/console/api/operations" systemApi "github.com/minio/console/api/operations/system" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) type AdminInfoTestSuite struct { suite.Suite assert *assert.Assertions currentServer string isServerSet bool isPrometheusRequest bool server *httptest.Server adminClient AdminClientMock } func (suite *AdminInfoTestSuite) SetupSuite() { suite.assert = assert.New(suite.T()) suite.adminClient = AdminClientMock{} MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { return madmin.InfoMessage{ Servers: []madmin.ServerProperties{{ Disks: []madmin.Disk{{}}, }}, Backend: madmin.ErasureBackend{Type: "mock"}, }, nil } } func (suite *AdminInfoTestSuite) SetupTest() { suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler)) suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer) os.Setenv(ConsoleMinIOServer, suite.server.URL) } func (suite *AdminInfoTestSuite) serverHandler(w http.ResponseWriter, _ *http.Request) { if suite.isPrometheusRequest { w.WriteHeader(200) } else { w.WriteHeader(400) } } func (suite *AdminInfoTestSuite) TearDownSuite() { } func (suite *AdminInfoTestSuite) TearDownTest() { if suite.isServerSet { os.Setenv(ConsoleMinIOServer, suite.currentServer) } else { os.Unsetenv(ConsoleMinIOServer) } } func (suite *AdminInfoTestSuite) TestRegisterAdminInfoHandlers() { api := &operations.ConsoleAPI{} suite.assertHandlersAreNil(api) registerAdminInfoHandlers(api) suite.assertHandlersAreNotNil(api) } func (suite *AdminInfoTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) { suite.assert.Nil(api.SystemAdminInfoHandler) suite.assert.Nil(api.SystemDashboardWidgetDetailsHandler) } func (suite *AdminInfoTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) { suite.assert.NotNil(api.SystemAdminInfoHandler) suite.assert.NotNil(api.SystemDashboardWidgetDetailsHandler) } func (suite *AdminInfoTestSuite) TestSystemAdminInfoHandlerWithError() { params, api := suite.initSystemAdminInfoRequest() response := api.SystemAdminInfoHandler.Handle(params, &models.Principal{}) _, ok := response.(*systemApi.AdminInfoDefault) suite.assert.True(ok) } func (suite *AdminInfoTestSuite) initSystemAdminInfoRequest() (params systemApi.AdminInfoParams, api operations.ConsoleAPI) { registerAdminInfoHandlers(&api) params.HTTPRequest = &http.Request{} defaultOnly := false params.DefaultOnly = &defaultOnly return params, api } func (suite *AdminInfoTestSuite) TestSystemDashboardWidgetDetailsHandlerWithError() { params, api := suite.initSystemDashboardWidgetDetailsRequest() response := api.SystemDashboardWidgetDetailsHandler.Handle(params, &models.Principal{}) _, ok := response.(*systemApi.DashboardWidgetDetailsDefault) suite.assert.True(ok) } func (suite *AdminInfoTestSuite) initSystemDashboardWidgetDetailsRequest() (params systemApi.DashboardWidgetDetailsParams, api operations.ConsoleAPI) { registerAdminInfoHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *AdminInfoTestSuite) TestGetUsageWidgetsForDeploymentWithoutError() { ctx := context.WithValue(context.Background(), utils.ContextClientIP, "127.0.0.1") suite.isPrometheusRequest = true res, err := getUsageWidgetsForDeployment(ctx, suite.server.URL, suite.adminClient) suite.assert.Nil(err) suite.assert.NotNil(res) suite.isPrometheusRequest = false } func (suite *AdminInfoTestSuite) TestGetWidgetDetailsWithoutError() { ctx := context.WithValue(context.Background(), utils.ContextClientIP, "127.0.0.1") suite.isPrometheusRequest = true var step int32 = 1 var start int64 var end int64 = 1 res, err := getWidgetDetails(ctx, suite.server.URL, "mock", 1, &step, &start, &end) suite.assert.Nil(err) suite.assert.NotNil(res) suite.isPrometheusRequest = false } func TestAdminInfo(t *testing.T) { suite.Run(t, new(AdminInfoTestSuite)) } ================================================ FILE: api/admin_inspect.go ================================================ // 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 api import ( "encoding/base64" "fmt" "io" "net/http" "strings" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" inspectApi "github.com/minio/console/api/operations/inspect" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" "github.com/secure-io/sio-go" ) func registerInspectHandler(api *operations.ConsoleAPI) { api.InspectInspectHandler = inspectApi.InspectHandlerFunc(func(params inspectApi.InspectParams, principal *models.Principal) middleware.Responder { k, r, err := getInspectResult(principal, ¶ms) if err != nil { return inspectApi.NewInspectDefault(err.Code).WithPayload(err.APIError) } return middleware.ResponderFunc(processInspectResponse(¶ms, k, r)) }) } func getInspectResult(session *models.Principal, params *inspectApi.InspectParams) ([]byte, io.ReadCloser, *CodedAPIError) { ctx := params.HTTPRequest.Context() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, nil, ErrorWithContext(ctx, err) } cfg := madmin.InspectOptions{ File: params.File, Volume: params.Volume, } // TODO: Remove encryption option and always encrypt. // Maybe also add public key field. if params.Encrypt != nil && *params.Encrypt { cfg.PublicKey, _ = base64.StdEncoding.DecodeString("MIIBCgKCAQEAs/128UFS9A8YSJY1XqYKt06dLVQQCGDee69T+0Tip/1jGAB4z0/3QMpH0MiS8Wjs4BRWV51qvkfAHzwwdU7y6jxU05ctb/H/WzRj3FYdhhHKdzear9TLJftlTs+xwj2XaADjbLXCV1jGLS889A7f7z5DgABlVZMQd9BjVAR8ED3xRJ2/ZCNuQVJ+A8r7TYPGMY3wWvhhPgPk3Lx4WDZxDiDNlFs4GQSaESSsiVTb9vyGe/94CsCTM6Cw9QG6ifHKCa/rFszPYdKCabAfHcS3eTr0GM+TThSsxO7KfuscbmLJkfQev1srfL2Ii2RbnysqIJVWKEwdW05ID8ryPkuTuwIDAQAB") } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} k, r, err := adminClient.inspect(ctx, cfg) if err != nil { return nil, nil, ErrorWithContext(ctx, err) } return k, r, nil } // borrowed from mc cli func decryptInspectV1(key [32]byte, r io.Reader) io.ReadCloser { stream, err := sio.AES_256_GCM.Stream(key[:]) if err != nil { return nil } nonce := make([]byte, stream.NonceSize()) return io.NopCloser(stream.DecryptReader(r, nonce, nil)) } func processInspectResponse(params *inspectApi.InspectParams, k []byte, r io.ReadCloser) func(w http.ResponseWriter, _ runtime.Producer) { isEnc := params.Encrypt != nil && *params.Encrypt return func(w http.ResponseWriter, _ runtime.Producer) { ext := "enc" if len(k) == 32 && !isEnc { ext = "zip" r = decryptInspectV1(*(*[32]byte)(k), r) } fileName := fmt.Sprintf("inspect-%s-%s.%s", params.Volume, params.File, ext) fileName = strings.Map(func(r rune) rune { switch { case r >= 'A' && r <= 'Z': return r case r >= 'a' && r <= 'z': return r case r >= '0' && r <= '9': return r default: if strings.ContainsAny(string(r), "-+._") { return r } return '_' } }, fileName) w.Header().Set("Content-Type", "application/octet-stream") w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", fileName)) _, err := io.Copy(w, r) if err != nil { LogError("unable to write all the data: %v", err) } } } ================================================ FILE: api/admin_kms.go ================================================ // 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 api import ( "context" "sort" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" kmsAPI "github.com/minio/console/api/operations/k_m_s" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" ) func registerKMSHandlers(api *operations.ConsoleAPI) { registerKMSStatusHandlers(api) registerKMSKeyHandlers(api) } func registerKMSStatusHandlers(api *operations.ConsoleAPI) { api.KmsKMSStatusHandler = kmsAPI.KMSStatusHandlerFunc(func(params kmsAPI.KMSStatusParams, session *models.Principal) middleware.Responder { resp, err := GetKMSStatusResponse(session, params) if err != nil { return kmsAPI.NewKMSStatusDefault(err.Code).WithPayload(err.APIError) } return kmsAPI.NewKMSStatusOK().WithPayload(resp) }) api.KmsKMSMetricsHandler = kmsAPI.KMSMetricsHandlerFunc(func(params kmsAPI.KMSMetricsParams, session *models.Principal) middleware.Responder { resp, err := GetKMSMetricsResponse(session, params) if err != nil { return kmsAPI.NewKMSMetricsDefault(err.Code).WithPayload(err.APIError) } return kmsAPI.NewKMSMetricsOK().WithPayload(resp) }) api.KmsKMSAPIsHandler = kmsAPI.KMSAPIsHandlerFunc(func(params kmsAPI.KMSAPIsParams, session *models.Principal) middleware.Responder { resp, err := GetKMSAPIsResponse(session, params) if err != nil { return kmsAPI.NewKMSAPIsDefault(err.Code).WithPayload(err.APIError) } return kmsAPI.NewKMSApisOK().WithPayload(resp) }) api.KmsKMSVersionHandler = kmsAPI.KMSVersionHandlerFunc(func(params kmsAPI.KMSVersionParams, session *models.Principal) middleware.Responder { resp, err := GetKMSVersionResponse(session, params) if err != nil { return kmsAPI.NewKMSVersionDefault(err.Code).WithPayload(err.APIError) } return kmsAPI.NewKMSVersionOK().WithPayload(resp) }) } func GetKMSStatusResponse(session *models.Principal, params kmsAPI.KMSStatusParams) (*models.KmsStatusResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } return kmsStatus(ctx, AdminClient{Client: mAdmin}) } func kmsStatus(ctx context.Context, minioClient MinioAdmin) (*models.KmsStatusResponse, *CodedAPIError) { st, err := minioClient.kmsStatus(ctx) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.KmsStatusResponse{ DefaultKeyID: st.DefaultKeyID, Name: st.Name, Endpoints: parseStatusEndpoints(st.Endpoints), }, nil } func parseStatusEndpoints(endpoints map[string]madmin.ItemState) (kmsEndpoints []*models.KmsEndpoint) { for key, value := range endpoints { kmsEndpoints = append(kmsEndpoints, &models.KmsEndpoint{URL: key, Status: string(value)}) } return kmsEndpoints } func GetKMSMetricsResponse(session *models.Principal, params kmsAPI.KMSMetricsParams) (*models.KmsMetricsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } return kmsMetrics(ctx, AdminClient{Client: mAdmin}) } func kmsMetrics(ctx context.Context, minioClient MinioAdmin) (*models.KmsMetricsResponse, *CodedAPIError) { metrics, err := minioClient.kmsMetrics(ctx) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.KmsMetricsResponse{ RequestOK: &metrics.RequestOK, RequestErr: &metrics.RequestErr, RequestFail: &metrics.RequestFail, RequestActive: &metrics.RequestActive, AuditEvents: &metrics.AuditEvents, ErrorEvents: &metrics.ErrorEvents, LatencyHistogram: parseHistogram(metrics.LatencyHistogram), Uptime: &metrics.UpTime, Cpus: &metrics.CPUs, UsableCPUs: &metrics.UsableCPUs, Threads: &metrics.Threads, HeapAlloc: &metrics.HeapAlloc, HeapObjects: metrics.HeapObjects, StackAlloc: &metrics.StackAlloc, }, nil } func parseHistogram(histogram map[int64]int64) (records []*models.KmsLatencyHistogram) { for duration, total := range histogram { records = append(records, &models.KmsLatencyHistogram{Duration: duration, Total: total}) } cp := func(i, j int) bool { return records[i].Duration < records[j].Duration } sort.Slice(records, cp) return records } func GetKMSAPIsResponse(session *models.Principal, params kmsAPI.KMSAPIsParams) (*models.KmsAPIsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } return kmsAPIs(ctx, AdminClient{Client: mAdmin}) } func kmsAPIs(ctx context.Context, minioClient MinioAdmin) (*models.KmsAPIsResponse, *CodedAPIError) { apis, err := minioClient.kmsAPIs(ctx) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.KmsAPIsResponse{ Results: parseApis(apis), }, nil } func parseApis(apis []madmin.KMSAPI) (data []*models.KmsAPI) { for _, api := range apis { data = append(data, &models.KmsAPI{ Method: api.Method, Path: api.Path, MaxBody: api.MaxBody, Timeout: api.Timeout, }) } return data } func GetKMSVersionResponse(session *models.Principal, params kmsAPI.KMSVersionParams) (*models.KmsVersionResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } return kmsVersion(ctx, AdminClient{Client: mAdmin}) } func kmsVersion(ctx context.Context, minioClient MinioAdmin) (*models.KmsVersionResponse, *CodedAPIError) { version, err := minioClient.kmsVersion(ctx) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.KmsVersionResponse{ Version: version.Version, }, nil } func registerKMSKeyHandlers(api *operations.ConsoleAPI) { api.KmsKMSCreateKeyHandler = kmsAPI.KMSCreateKeyHandlerFunc(func(params kmsAPI.KMSCreateKeyParams, session *models.Principal) middleware.Responder { err := GetKMSCreateKeyResponse(session, params) if err != nil { return kmsAPI.NewKMSCreateKeyDefault(err.Code).WithPayload(err.APIError) } return kmsAPI.NewKMSCreateKeyCreated() }) api.KmsKMSListKeysHandler = kmsAPI.KMSListKeysHandlerFunc(func(params kmsAPI.KMSListKeysParams, session *models.Principal) middleware.Responder { resp, err := GetKMSListKeysResponse(session, params) if err != nil { return kmsAPI.NewKMSListKeysDefault(err.Code).WithPayload(err.APIError) } return kmsAPI.NewKMSListKeysOK().WithPayload(resp) }) api.KmsKMSKeyStatusHandler = kmsAPI.KMSKeyStatusHandlerFunc(func(params kmsAPI.KMSKeyStatusParams, session *models.Principal) middleware.Responder { resp, err := GetKMSKeyStatusResponse(session, params) if err != nil { return kmsAPI.NewKMSKeyStatusDefault(err.Code).WithPayload(err.APIError) } return kmsAPI.NewKMSKeyStatusOK().WithPayload(resp) }) } func GetKMSCreateKeyResponse(session *models.Principal, params kmsAPI.KMSCreateKeyParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } return createKey(ctx, *params.Body.Key, AdminClient{Client: mAdmin}) } func createKey(ctx context.Context, key string, minioClient MinioAdmin) *CodedAPIError { if err := minioClient.createKey(ctx, key); err != nil { return ErrorWithContext(ctx, err) } return nil } func GetKMSListKeysResponse(session *models.Principal, params kmsAPI.KMSListKeysParams) (*models.KmsListKeysResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } pattern := "" if params.Pattern != nil { pattern = *params.Pattern } return listKeys(ctx, pattern, AdminClient{Client: mAdmin}) } func listKeys(ctx context.Context, pattern string, minioClient MinioAdmin) (*models.KmsListKeysResponse, *CodedAPIError) { results, err := minioClient.listKeys(ctx, pattern) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.KmsListKeysResponse{Results: parseKeys(results)}, nil } // printDate - human friendly formatted date. const ( printDate = "2006-01-02 15:04:05 MST" ) func parseKeys(results []madmin.KMSKeyInfo) (data []*models.KmsKeyInfo) { for _, key := range results { data = append(data, &models.KmsKeyInfo{ CreatedAt: key.CreatedAt.Format(printDate), CreatedBy: key.CreatedBy, Name: key.Name, }) } return data } func GetKMSKeyStatusResponse(session *models.Principal, params kmsAPI.KMSKeyStatusParams) (*models.KmsKeyStatusResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } return keyStatus(ctx, params.Name, AdminClient{Client: mAdmin}) } func keyStatus(ctx context.Context, key string, minioClient MinioAdmin) (*models.KmsKeyStatusResponse, *CodedAPIError) { ks, err := minioClient.keyStatus(ctx, key) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.KmsKeyStatusResponse{ KeyID: ks.KeyID, EncryptionErr: ks.EncryptionErr, DecryptionErr: ks.DecryptionErr, }, nil } ================================================ FILE: api/admin_kms_test.go ================================================ // 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 api import ( "context" "net/http" "net/http/httptest" "os" "testing" "github.com/minio/console/api/operations" kmsAPI "github.com/minio/console/api/operations/k_m_s" "github.com/minio/console/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) type KMSTestSuite struct { suite.Suite assert *assert.Assertions currentServer string isServerSet bool server *httptest.Server adminClient AdminClientMock } func (suite *KMSTestSuite) SetupSuite() { suite.assert = assert.New(suite.T()) suite.adminClient = AdminClientMock{} } func (suite *KMSTestSuite) SetupTest() { suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler)) suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer) os.Setenv(ConsoleMinIOServer, suite.server.URL) } func (suite *KMSTestSuite) serverHandler(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(400) } func (suite *KMSTestSuite) TearDownSuite() { } func (suite *KMSTestSuite) TearDownTest() { if suite.isServerSet { os.Setenv(ConsoleMinIOServer, suite.currentServer) } else { os.Unsetenv(ConsoleMinIOServer) } } func (suite *KMSTestSuite) TestRegisterKMSHandlers() { api := &operations.ConsoleAPI{} suite.assertHandlersAreNil(api) registerKMSHandlers(api) suite.assertHandlersAreNotNil(api) } func (suite *KMSTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) { suite.assert.Nil(api.KmsKMSStatusHandler) suite.assert.Nil(api.KmsKMSMetricsHandler) suite.assert.Nil(api.KmsKMSAPIsHandler) suite.assert.Nil(api.KmsKMSVersionHandler) suite.assert.Nil(api.KmsKMSCreateKeyHandler) suite.assert.Nil(api.KmsKMSListKeysHandler) suite.assert.Nil(api.KmsKMSKeyStatusHandler) } func (suite *KMSTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) { suite.assert.NotNil(api.KmsKMSStatusHandler) suite.assert.NotNil(api.KmsKMSMetricsHandler) suite.assert.NotNil(api.KmsKMSAPIsHandler) suite.assert.NotNil(api.KmsKMSVersionHandler) suite.assert.NotNil(api.KmsKMSCreateKeyHandler) suite.assert.NotNil(api.KmsKMSListKeysHandler) suite.assert.NotNil(api.KmsKMSKeyStatusHandler) } func (suite *KMSTestSuite) TestKMSStatusHandlerWithError() { params, api := suite.initKMSStatusRequest() response := api.KmsKMSStatusHandler.Handle(params, &models.Principal{}) _, ok := response.(*kmsAPI.KMSStatusDefault) suite.assert.True(ok) } func (suite *KMSTestSuite) initKMSStatusRequest() (params kmsAPI.KMSStatusParams, api operations.ConsoleAPI) { registerKMSHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *KMSTestSuite) TestKMSStatusWithoutError() { ctx := context.Background() res, err := kmsStatus(ctx, suite.adminClient) suite.assert.NotNil(res) suite.assert.Nil(err) } func (suite *KMSTestSuite) TestKMSMetricsHandlerWithError() { params, api := suite.initKMSMetricsRequest() response := api.KmsKMSMetricsHandler.Handle(params, &models.Principal{}) _, ok := response.(*kmsAPI.KMSMetricsDefault) suite.assert.True(ok) } func (suite *KMSTestSuite) initKMSMetricsRequest() (params kmsAPI.KMSMetricsParams, api operations.ConsoleAPI) { registerKMSHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *KMSTestSuite) TestKMSMetricsWithoutError() { ctx := context.Background() res, err := kmsMetrics(ctx, suite.adminClient) suite.assert.NotNil(res) suite.assert.Nil(err) } func (suite *KMSTestSuite) TestKMSAPIsHandlerWithError() { params, api := suite.initKMSAPIsRequest() response := api.KmsKMSAPIsHandler.Handle(params, &models.Principal{}) _, ok := response.(*kmsAPI.KMSAPIsDefault) suite.assert.True(ok) } func (suite *KMSTestSuite) initKMSAPIsRequest() (params kmsAPI.KMSAPIsParams, api operations.ConsoleAPI) { registerKMSHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *KMSTestSuite) TestKMSAPIsWithoutError() { ctx := context.Background() res, err := kmsAPIs(ctx, suite.adminClient) suite.assert.NotNil(res) suite.assert.Nil(err) } func (suite *KMSTestSuite) TestKMSVersionHandlerWithError() { params, api := suite.initKMSVersionRequest() response := api.KmsKMSVersionHandler.Handle(params, &models.Principal{}) _, ok := response.(*kmsAPI.KMSVersionDefault) suite.assert.True(ok) } func (suite *KMSTestSuite) initKMSVersionRequest() (params kmsAPI.KMSVersionParams, api operations.ConsoleAPI) { registerKMSHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *KMSTestSuite) TestKMSVersionWithoutError() { ctx := context.Background() res, err := kmsVersion(ctx, suite.adminClient) suite.assert.NotNil(res) suite.assert.Nil(err) } func (suite *KMSTestSuite) TestKMSCreateKeyHandlerWithError() { params, api := suite.initKMSCreateKeyRequest() response := api.KmsKMSCreateKeyHandler.Handle(params, &models.Principal{}) _, ok := response.(*kmsAPI.KMSCreateKeyDefault) suite.assert.True(ok) } func (suite *KMSTestSuite) initKMSCreateKeyRequest() (params kmsAPI.KMSCreateKeyParams, api operations.ConsoleAPI) { registerKMSHandlers(&api) params.HTTPRequest = &http.Request{} key := "key" params.Body = &models.KmsCreateKeyRequest{Key: &key} return params, api } func (suite *KMSTestSuite) TestKMSCreateKeyWithoutError() { ctx := context.Background() err := createKey(ctx, "key", suite.adminClient) suite.assert.Nil(err) } func (suite *KMSTestSuite) TestKMSListKeysHandlerWithError() { params, api := suite.initKMSListKeysRequest() response := api.KmsKMSListKeysHandler.Handle(params, &models.Principal{}) _, ok := response.(*kmsAPI.KMSListKeysDefault) suite.assert.True(ok) } func (suite *KMSTestSuite) initKMSListKeysRequest() (params kmsAPI.KMSListKeysParams, api operations.ConsoleAPI) { registerKMSHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *KMSTestSuite) TestKMSListKeysWithoutError() { ctx := context.Background() res, err := listKeys(ctx, "", suite.adminClient) suite.assert.NotNil(res) suite.assert.Nil(err) } func (suite *KMSTestSuite) TestKMSKeyStatusHandlerWithError() { params, api := suite.initKMSKeyStatusRequest() response := api.KmsKMSKeyStatusHandler.Handle(params, &models.Principal{}) _, ok := response.(*kmsAPI.KMSKeyStatusDefault) suite.assert.True(ok) } func (suite *KMSTestSuite) initKMSKeyStatusRequest() (params kmsAPI.KMSKeyStatusParams, api operations.ConsoleAPI) { registerKMSHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *KMSTestSuite) TestKMSKeyStatusWithoutError() { ctx := context.Background() res, err := keyStatus(ctx, "key", suite.adminClient) suite.assert.NotNil(res) suite.assert.Nil(err) } func TestKMS(t *testing.T) { suite.Run(t, new(KMSTestSuite)) } ================================================ FILE: api/admin_nodes.go ================================================ // 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 api import ( "context" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" systemApi "github.com/minio/console/api/operations/system" "github.com/minio/console/models" ) func registerNodesHandler(api *operations.ConsoleAPI) { api.SystemListNodesHandler = systemApi.ListNodesHandlerFunc(func(params systemApi.ListNodesParams, session *models.Principal) middleware.Responder { listNodesResponse, err := getListNodesResponse(session, params) if err != nil { return systemApi.NewListNodesDefault(err.Code).WithPayload(err.APIError) } return systemApi.NewListNodesOK().WithPayload(listNodesResponse) }) } // getListNodesResponse returns a list of available node endpoints . func getListNodesResponse(session *models.Principal, params systemApi.ListNodesParams) ([]string, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } var nodeList []string adminResources, _ := mAdmin.ServerInfo(ctx) for _, n := range adminResources.Servers { nodeList = append(nodeList, n.Endpoint) } return nodeList, nil } ================================================ FILE: api/admin_notification_endpoints.go ================================================ // 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 api import ( "context" "errors" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" configurationApi "github.com/minio/console/api/operations/configuration" "github.com/minio/console/models" ) func registerAdminNotificationEndpointsHandlers(api *operations.ConsoleAPI) { // return a list of notification endpoints api.ConfigurationNotificationEndpointListHandler = configurationApi.NotificationEndpointListHandlerFunc(func(params configurationApi.NotificationEndpointListParams, session *models.Principal) middleware.Responder { notifEndpoints, err := getNotificationEndpointsResponse(session, params) if err != nil { return configurationApi.NewNotificationEndpointListDefault(err.Code).WithPayload(err.APIError) } return configurationApi.NewNotificationEndpointListOK().WithPayload(notifEndpoints) }) // add a new notification endpoints api.ConfigurationAddNotificationEndpointHandler = configurationApi.AddNotificationEndpointHandlerFunc(func(params configurationApi.AddNotificationEndpointParams, session *models.Principal) middleware.Responder { notifEndpoints, err := getAddNotificationEndpointResponse(session, params) if err != nil { return configurationApi.NewAddNotificationEndpointDefault(err.Code).WithPayload(err.APIError) } return configurationApi.NewAddNotificationEndpointCreated().WithPayload(notifEndpoints) }) } // getNotificationEndpoints invokes admin info and returns a list of notification endpoints func getNotificationEndpoints(ctx context.Context, client MinioAdmin) (*models.NotifEndpointResponse, error) { serverInfo, err := client.serverInfo(ctx) if err != nil { return nil, err } var listEndpoints []*models.NotificationEndpointItem for i := range serverInfo.Services.Notifications { for service, endpointStatus := range serverInfo.Services.Notifications[i] { for j := range endpointStatus { for account, status := range endpointStatus[j] { listEndpoints = append(listEndpoints, &models.NotificationEndpointItem{ Service: models.NofiticationService(service), AccountID: account, Status: status.Status, }) } } } } // build response return &models.NotifEndpointResponse{ NotificationEndpoints: listEndpoints, }, nil } // getNotificationEndpointsResponse returns a list of notification endpoints in the instance func getNotificationEndpointsResponse(session *models.Principal, params configurationApi.NotificationEndpointListParams) (*models.NotifEndpointResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // serialize output notfEndpointResp, err := getNotificationEndpoints(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } return notfEndpointResp, nil } func addNotificationEndpoint(ctx context.Context, client MinioAdmin, params *configurationApi.AddNotificationEndpointParams) (*models.SetNotificationEndpointResponse, error) { configs := []*models.ConfigurationKV{} var configName string // we have different add validations for each service switch *params.Body.Service { case models.NofiticationServiceAmqp: configName = "notify_amqp" case models.NofiticationServiceMqtt: configName = "notify_mqtt" case models.NofiticationServiceElasticsearch: configName = "notify_elasticsearch" case models.NofiticationServiceRedis: configName = "notify_redis" case models.NofiticationServiceNats: configName = "notify_nats" case models.NofiticationServicePostgres: configName = "notify_postgres" case models.NofiticationServiceMysql: configName = "notify_mysql" case models.NofiticationServiceKafka: configName = "notify_kafka" case models.NofiticationServiceWebhook: configName = "notify_webhook" case models.NofiticationServiceNsq: configName = "notify_nsq" default: return nil, errors.New("provided service is not supported") } // set all the config values if found on the param.Body.Properties for k, val := range params.Body.Properties { configs = append(configs, &models.ConfigurationKV{ Key: k, Value: val, }) } needsRestart, err := setConfigWithARNAccountID(ctx, client, &configName, configs, *params.Body.AccountID) if err != nil { return nil, err } return &models.SetNotificationEndpointResponse{ AccountID: params.Body.AccountID, Properties: params.Body.Properties, Service: params.Body.Service, Restart: needsRestart, }, nil } // getNotificationEndpointsResponse returns a list of notification endpoints in the instance func getAddNotificationEndpointResponse(session *models.Principal, params configurationApi.AddNotificationEndpointParams) (*models.SetNotificationEndpointResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // serialize output notfEndpointResp, err := addNotificationEndpoint(ctx, adminClient, ¶ms) if err != nil { return nil, ErrorWithContext(ctx, err) } return notfEndpointResp, nil } ================================================ FILE: api/admin_notification_endpoints_test.go ================================================ // 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 api import ( "context" "errors" "reflect" "testing" "github.com/go-openapi/swag" cfgApi "github.com/minio/console/api/operations/configuration" "github.com/minio/console/models" ) func Test_addNotificationEndpoint(t *testing.T) { client := AdminClientMock{} type args struct { ctx context.Context client MinioAdmin params *cfgApi.AddNotificationEndpointParams } tests := []struct { name string args args mockSetConfig func(kv string) (restart bool, err error) want *models.SetNotificationEndpointResponse wantErr bool }{ { name: "valid postgres", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "host": "localhost", "user": "user", "password": "passwrd", }, Service: models.NewNofiticationService("postgres"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "host": "localhost", "user": "user", "password": "passwrd", }, Service: models.NewNofiticationService("postgres"), Restart: false, }, wantErr: false, }, { name: "set config returns error", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "host": "localhost", "user": "user", "password": "passwrd", }, Service: models.NewNofiticationService("postgres"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, errors.New("error") }, want: nil, wantErr: true, }, { name: "valid mysql", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "host": "localhost", "user": "user", "password": "passwrd", }, Service: models.NewNofiticationService("mysql"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "host": "localhost", "user": "user", "password": "passwrd", }, Service: models.NewNofiticationService("mysql"), Restart: false, }, wantErr: false, }, { name: "valid kafka", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "brokers": "http://localhost:8080/broker1", }, Service: models.NewNofiticationService("kafka"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "brokers": "http://localhost:8080/broker1", }, Service: models.NewNofiticationService("kafka"), Restart: false, }, wantErr: false, }, { name: "valid amqp", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "url": "http://localhost:8080/broker1", }, Service: models.NewNofiticationService("amqp"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "url": "http://localhost:8080/broker1", }, Service: models.NewNofiticationService("amqp"), Restart: false, }, wantErr: false, }, { name: "valid mqtt", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "broker": "http://localhost:8080/broker1", "topic": "minio", }, Service: models.NewNofiticationService("mqtt"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "broker": "http://localhost:8080/broker1", "topic": "minio", }, Service: models.NewNofiticationService("mqtt"), Restart: false, }, wantErr: false, }, { name: "valid elasticsearch", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "url": "http://localhost:8080/broker1", "index": "minio", "format": "namespace", }, Service: models.NewNofiticationService("elasticsearch"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "url": "http://localhost:8080/broker1", "index": "minio", "format": "namespace", }, Service: models.NewNofiticationService("elasticsearch"), Restart: false, }, wantErr: false, }, { name: "valid redis", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "address": "http://localhost:8080/broker1", "key": "minio", "format": "namespace", }, Service: models.NewNofiticationService("redis"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "address": "http://localhost:8080/broker1", "key": "minio", "format": "namespace", }, Service: models.NewNofiticationService("redis"), Restart: false, }, wantErr: false, }, { name: "valid nats", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "address": "http://localhost:8080/broker1", "subject": "minio", }, Service: models.NewNofiticationService("nats"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "address": "http://localhost:8080/broker1", "subject": "minio", }, Service: models.NewNofiticationService("nats"), Restart: false, }, wantErr: false, }, { name: "valid webhook", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "endpoint": "http://localhost:8080/broker1", }, Service: models.NewNofiticationService("webhook"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "endpoint": "http://localhost:8080/broker1", }, Service: models.NewNofiticationService("webhook"), Restart: false, }, wantErr: false, }, { name: "valid nsq", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "nsqd_address": "http://localhost:8080/broker1", "topic": "minio", }, Service: models.NewNofiticationService("nsq"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "nsqd_address": "http://localhost:8080/broker1", "topic": "minio", }, Service: models.NewNofiticationService("nsq"), Restart: false, }, wantErr: false, }, { name: "invalid service", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "host": "localhost", "user": "user", "password": "passwrd", }, Service: models.NewNofiticationService("oorgle"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return false, errors.New("invalid config") }, want: nil, wantErr: true, }, { name: "valid config, restart required", args: args{ ctx: context.Background(), client: client, params: &cfgApi.AddNotificationEndpointParams{ HTTPRequest: nil, Body: &models.NotificationEndpoint{ AccountID: swag.String("1"), Properties: map[string]string{ "host": "localhost", "user": "user", "password": "passwrd", }, Service: models.NewNofiticationService("postgres"), }, }, }, mockSetConfig: func(_ string) (restart bool, err error) { return true, nil }, want: &models.SetNotificationEndpointResponse{ AccountID: swag.String("1"), Properties: map[string]string{ "host": "localhost", "user": "user", "password": "passwrd", }, Service: models.NewNofiticationService("postgres"), Restart: true, }, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // mock function response from setConfig() minioSetConfigKVMock = tt.mockSetConfig got, err := addNotificationEndpoint(tt.args.ctx, tt.args.client, tt.args.params) if (err != nil) != tt.wantErr { t.Errorf("addNotificationEndpoint() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("addNotificationEndpoint() got = %v, want %v", got, tt.want) } }) } } ================================================ FILE: api/admin_objects.go ================================================ // 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 api import ( "context" "time" "github.com/minio/mc/cmd" "github.com/minio/minio-go/v7" ) type objectsListOpts struct { BucketName string Prefix string Date time.Time } type ObjectsRequest struct { Mode string `json:"mode,omitempty"` BucketName string `json:"bucket_name"` Prefix string `json:"prefix"` Date string `json:"date"` RequestID int64 `json:"request_id"` } type WSResponse struct { RequestID int64 `json:"request_id,omitempty"` Error *CodedAPIError `json:"error,omitempty"` RequestEnd bool `json:"request_end,omitempty"` Prefix string `json:"prefix,omitempty"` BucketName string `json:"bucketName,omitempty"` Data []ObjectResponse `json:"data,omitempty"` } type ObjectResponse struct { Name string `json:"name,omitempty"` LastModified string `json:"last_modified,omitempty"` Size int64 `json:"size,omitempty"` VersionID string `json:"version_id,omitempty"` DeleteMarker bool `json:"delete_flag,omitempty"` IsLatest bool `json:"is_latest,omitempty"` } func getObjectsOptionsFromReq(request ObjectsRequest) (*objectsListOpts, error) { pOptions := objectsListOpts{ BucketName: request.BucketName, Prefix: request.Prefix, } if request.Mode == "rewind" { parsedDate, errDate := time.Parse(time.RFC3339, request.Date) if errDate != nil { return nil, errDate } pOptions.Date = parsedDate } return &pOptions, nil } func startObjectsListing(ctx context.Context, client MinioClient, objOpts *objectsListOpts) <-chan minio.ObjectInfo { opts := minio.ListObjectsOptions{ Prefix: objOpts.Prefix, } return client.listObjects(ctx, objOpts.BucketName, opts) } func startRewindListing(ctx context.Context, client MCClient, objOpts *objectsListOpts) <-chan *cmd.ClientContent { lsRewind := client.list(ctx, cmd.ListOptions{TimeRef: objOpts.Date, WithDeleteMarkers: true}) return lsRewind } ================================================ FILE: api/admin_objects_test.go ================================================ // 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 api import ( "context" "testing" "time" mc "github.com/minio/mc/cmd" "github.com/minio/minio-go/v7" "github.com/stretchr/testify/assert" ) func TestWSRewindObjects(t *testing.T) { assert := assert.New(t) client := s3ClientMock{} tests := []struct { name string testOptions objectsListOpts testMessages []*mc.ClientContent }{ { name: "Get list with multiple elements", testOptions: objectsListOpts{ BucketName: "buckettest", Prefix: "/", Date: time.Now(), }, testMessages: []*mc.ClientContent{ { BucketName: "buckettest", URL: mc.ClientURL{Path: "/file1.txt"}, }, { BucketName: "buckettest", URL: mc.ClientURL{Path: "/file2.txt"}, }, { BucketName: "buckettest", URL: mc.ClientURL{Path: "/path1"}, }, }, }, { name: "Empty list of elements", testOptions: objectsListOpts{ BucketName: "emptybucket", Prefix: "/", Date: time.Now(), }, testMessages: []*mc.ClientContent{}, }, { name: "Get list with one element", testOptions: objectsListOpts{ BucketName: "buckettest", Prefix: "/", Date: time.Now(), }, testMessages: []*mc.ClientContent{ { BucketName: "buckettestsingle", URL: mc.ClientURL{Path: "/file12.txt"}, }, }, }, { name: "Get data from subpaths", testOptions: objectsListOpts{ BucketName: "buckettest", Prefix: "/path1/path2", Date: time.Now(), }, testMessages: []*mc.ClientContent{ { BucketName: "buckettestsingle", URL: mc.ClientURL{Path: "/path1/path2/file12.txt"}, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() mcListMock = func(_ context.Context, _ mc.ListOptions) <-chan *mc.ClientContent { ch := make(chan *mc.ClientContent) go func() { defer close(ch) for _, m := range tt.testMessages { ch <- m } }() return ch } rewindList := startRewindListing(ctx, client, &tt.testOptions) // check that the rewindList got the same number of data from Console. totalItems := 0 for data := range rewindList { // Compare elements as we are defining the channel responses assert.Equal(tt.testMessages[totalItems].URL.Path, data.URL.Path) totalItems++ } assert.Equal(len(tt.testMessages), totalItems) }) } } func TestWSListObjects(t *testing.T) { assert := assert.New(t) client := minioClientMock{} tests := []struct { name string wantErr bool testOptions objectsListOpts testMessages []minio.ObjectInfo }{ { name: "Get list with multiple elements", wantErr: false, testOptions: objectsListOpts{ BucketName: "buckettest", Prefix: "/", }, testMessages: []minio.ObjectInfo{ { Key: "/file1.txt", Size: 500, IsLatest: true, LastModified: time.Now(), }, { Key: "/file2.txt", Size: 500, IsLatest: true, LastModified: time.Now(), }, { Key: "/path1", }, }, }, { name: "Empty list of elements", wantErr: false, testOptions: objectsListOpts{ BucketName: "emptybucket", Prefix: "/", }, testMessages: []minio.ObjectInfo{}, }, { name: "Get list with one element", wantErr: false, testOptions: objectsListOpts{ BucketName: "buckettest", Prefix: "/", }, testMessages: []minio.ObjectInfo{ { Key: "/file2.txt", Size: 500, IsLatest: true, LastModified: time.Now(), }, }, }, { name: "Get data from subpaths", wantErr: false, testOptions: objectsListOpts{ BucketName: "buckettest", Prefix: "/path1/path2", }, testMessages: []minio.ObjectInfo{ { Key: "/path1/path2/file1.txt", Size: 500, IsLatest: true, LastModified: time.Now(), }, }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() minioListObjectsMock = func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo { ch := make(chan minio.ObjectInfo) go func() { defer close(ch) for _, m := range tt.testMessages { ch <- m } }() return ch } objectsListing := startObjectsListing(ctx, client, &tt.testOptions) // check that the TestReceiver got the same number of data from Console totalItems := 0 for data := range objectsListing { // Compare elements as we are defining the channel responses assert.Equal(tt.testMessages[totalItems].Key, data.Key) totalItems++ } assert.Equal(len(tt.testMessages), totalItems) }) } } ================================================ FILE: api/admin_policies.go ================================================ // 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 api import ( "bytes" "context" "encoding/json" "fmt" "sort" "strings" bucketApi "github.com/minio/console/api/operations/bucket" policyApi "github.com/minio/console/api/operations/policy" s3 "github.com/minio/minio-go/v7" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" "github.com/minio/console/models" iampolicy "github.com/minio/pkg/v3/policy" policies "github.com/minio/console/api/policy" ) func registersPoliciesHandler(api *operations.ConsoleAPI) { // List Policies api.PolicyListPoliciesHandler = policyApi.ListPoliciesHandlerFunc(func(params policyApi.ListPoliciesParams, session *models.Principal) middleware.Responder { listPoliciesResponse, err := getListPoliciesResponse(session, params) if err != nil { return policyApi.NewListPoliciesDefault(err.Code).WithPayload(err.APIError) } return policyApi.NewListPoliciesOK().WithPayload(listPoliciesResponse) }) // Policy Info api.PolicyPolicyInfoHandler = policyApi.PolicyInfoHandlerFunc(func(params policyApi.PolicyInfoParams, session *models.Principal) middleware.Responder { policyInfo, err := getPolicyInfoResponse(session, params) if err != nil { return policyApi.NewPolicyInfoDefault(err.Code).WithPayload(err.APIError) } return policyApi.NewPolicyInfoOK().WithPayload(policyInfo) }) // Add Policy api.PolicyAddPolicyHandler = policyApi.AddPolicyHandlerFunc(func(params policyApi.AddPolicyParams, session *models.Principal) middleware.Responder { policyResponse, err := getAddPolicyResponse(session, params) if err != nil { return policyApi.NewAddPolicyDefault(err.Code).WithPayload(err.APIError) } return policyApi.NewAddPolicyCreated().WithPayload(policyResponse) }) // Remove Policy api.PolicyRemovePolicyHandler = policyApi.RemovePolicyHandlerFunc(func(params policyApi.RemovePolicyParams, session *models.Principal) middleware.Responder { if err := getRemovePolicyResponse(session, params); err != nil { return policyApi.NewRemovePolicyDefault(err.Code).WithPayload(err.APIError) } return policyApi.NewRemovePolicyNoContent() }) // Set Policy api.PolicySetPolicyHandler = policyApi.SetPolicyHandlerFunc(func(params policyApi.SetPolicyParams, session *models.Principal) middleware.Responder { if err := getSetPolicyResponse(session, params); err != nil { return policyApi.NewSetPolicyDefault(err.Code).WithPayload(err.APIError) } return policyApi.NewSetPolicyNoContent() }) // Set Policy Multiple User/Groups api.PolicySetPolicyMultipleHandler = policyApi.SetPolicyMultipleHandlerFunc(func(params policyApi.SetPolicyMultipleParams, session *models.Principal) middleware.Responder { if err := getSetPolicyMultipleResponse(session, params); err != nil { return policyApi.NewSetPolicyMultipleDefault(err.Code).WithPayload(err.APIError) } return policyApi.NewSetPolicyMultipleNoContent() }) api.BucketListPoliciesWithBucketHandler = bucketApi.ListPoliciesWithBucketHandlerFunc(func(params bucketApi.ListPoliciesWithBucketParams, session *models.Principal) middleware.Responder { policyResponse, err := getListPoliciesWithBucketResponse(session, params) if err != nil { return bucketApi.NewListPoliciesWithBucketDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewListPoliciesWithBucketOK().WithPayload(policyResponse) }) api.BucketListAccessRulesWithBucketHandler = bucketApi.ListAccessRulesWithBucketHandlerFunc(func(params bucketApi.ListAccessRulesWithBucketParams, session *models.Principal) middleware.Responder { policyResponse, err := getListAccessRulesWithBucketResponse(session, params) if err != nil { return bucketApi.NewListAccessRulesWithBucketDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewListAccessRulesWithBucketOK().WithPayload(policyResponse) }) api.BucketSetAccessRuleWithBucketHandler = bucketApi.SetAccessRuleWithBucketHandlerFunc(func(params bucketApi.SetAccessRuleWithBucketParams, session *models.Principal) middleware.Responder { policyResponse, err := getSetAccessRuleWithBucketResponse(session, params) if err != nil { return bucketApi.NewSetAccessRuleWithBucketDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewSetAccessRuleWithBucketOK().WithPayload(policyResponse) }) api.BucketDeleteAccessRuleWithBucketHandler = bucketApi.DeleteAccessRuleWithBucketHandlerFunc(func(params bucketApi.DeleteAccessRuleWithBucketParams, session *models.Principal) middleware.Responder { policyResponse, err := getDeleteAccessRuleWithBucketResponse(session, params) if err != nil { return bucketApi.NewDeleteAccessRuleWithBucketDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewDeleteAccessRuleWithBucketOK().WithPayload(policyResponse) }) api.PolicyListUsersForPolicyHandler = policyApi.ListUsersForPolicyHandlerFunc(func(params policyApi.ListUsersForPolicyParams, session *models.Principal) middleware.Responder { policyUsersResponse, err := getListUsersForPolicyResponse(session, params) if err != nil { return policyApi.NewListUsersForPolicyDefault(err.Code).WithPayload(err.APIError) } return policyApi.NewListUsersForPolicyOK().WithPayload(policyUsersResponse) }) api.PolicyListGroupsForPolicyHandler = policyApi.ListGroupsForPolicyHandlerFunc(func(params policyApi.ListGroupsForPolicyParams, session *models.Principal) middleware.Responder { policyGroupsResponse, err := getListGroupsForPolicyResponse(session, params) if err != nil { return policyApi.NewListGroupsForPolicyDefault(err.Code).WithPayload(err.APIError) } return policyApi.NewListGroupsForPolicyOK().WithPayload(policyGroupsResponse) }) // Gets policies for currently logged in user api.PolicyGetUserPolicyHandler = policyApi.GetUserPolicyHandlerFunc(func(params policyApi.GetUserPolicyParams, session *models.Principal) middleware.Responder { userPolicyResponse, err := getUserPolicyResponse(params.HTTPRequest.Context(), session) if err != nil { return policyApi.NewGetUserPolicyDefault(err.Code).WithPayload(err.APIError) } return policyApi.NewGetUserPolicyOK().WithPayload(userPolicyResponse) }) // Gets policies for specified user api.PolicyGetSAUserPolicyHandler = policyApi.GetSAUserPolicyHandlerFunc(func(params policyApi.GetSAUserPolicyParams, session *models.Principal) middleware.Responder { userPolicyResponse, err := getSAUserPolicyResponse(session, params) if err != nil { return policyApi.NewGetSAUserPolicyDefault(err.Code).WithPayload(err.APIError) } return policyApi.NewGetSAUserPolicyOK().WithPayload(userPolicyResponse) }) } func getListAccessRulesWithBucketResponse(session *models.Principal, params bucketApi.ListAccessRulesWithBucketParams) (*models.ListAccessRulesResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() bucket := params.Bucket client, err := newS3BucketClient(session, bucket, "", getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } accessRules, _ := client.GetAccessRules(ctx) var accessRuleList []*models.AccessRule for k, v := range accessRules { accessRuleList = append(accessRuleList, &models.AccessRule{Prefix: k[len(bucket)+1 : len(k)-1], Access: v}) } return &models.ListAccessRulesResponse{AccessRules: accessRuleList}, nil } func getSetAccessRuleWithBucketResponse(session *models.Principal, params bucketApi.SetAccessRuleWithBucketParams) (bool, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() prefixAccess := params.Prefixaccess client, err := newS3BucketClient(session, params.Bucket, prefixAccess.Prefix, getClientIP(params.HTTPRequest)) if err != nil { return false, ErrorWithContext(ctx, err) } errorVal := client.SetAccess(ctx, prefixAccess.Access, false) if errorVal != nil { returnError := ErrorWithContext(ctx, errorVal.Cause) minioError := s3.ToErrorResponse(errorVal.Cause) if minioError.Code == "NoSuchBucket" { returnError.Code = 404 } return false, returnError } return true, nil } func getDeleteAccessRuleWithBucketResponse(session *models.Principal, params bucketApi.DeleteAccessRuleWithBucketParams) (bool, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() bucket := params.Bucket prefix := params.Prefix client, err := newS3BucketClient(session, bucket, prefix.Prefix, getClientIP(params.HTTPRequest)) if err != nil { return false, ErrorWithContext(ctx, err) } errorVal := client.SetAccess(ctx, "none", false) if errorVal != nil { return false, ErrorWithContext(ctx, errorVal.Cause) } return true, nil } func getListPoliciesWithBucketResponse(session *models.Principal, params bucketApi.ListPoliciesWithBucketParams) (*models.ListPoliciesResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} policies, err := listPoliciesWithBucket(ctx, params.Bucket, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } // serialize output listPoliciesResponse := &models.ListPoliciesResponse{ Policies: policies, Total: int64(len(policies)), } return listPoliciesResponse, nil } // listPoliciesWithBucket calls MinIO server to list all policy names present on the server that apply to a particular bucket. // listPoliciesWithBucket() converts the map[string][]byte returned by client.listPolicies() // to []*models.Policy by iterating over each key in policyRawMap and // then using Unmarshal on the raw bytes to create a *models.Policy func listPoliciesWithBucket(ctx context.Context, bucket string, client MinioAdmin) ([]*models.Policy, error) { policyMap, err := client.listPolicies(ctx) var policies []*models.Policy if err != nil { return nil, err } for name, policy := range policyMap { policy, err := parsePolicy(name, policy) if err != nil { return nil, err } if policyMatchesBucket(ctx, policy, bucket) { policies = append(policies, policy) } } return policies, nil } func policyMatchesBucket(ctx context.Context, policy *models.Policy, bucket string) bool { policyData := &iampolicy.Policy{} err := json.Unmarshal([]byte(policy.Policy), policyData) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error parsing policy: %v", err)) return false } policyStatements := policyData.Statements for i := 0; i < len(policyStatements); i++ { resources := policyStatements[i].Resources if resources.Match(bucket, map[string][]string{}) { return true } if resources.Match(fmt.Sprintf("%s/*", bucket), map[string][]string{}) { return true } } return false } // listPolicies calls MinIO server to list all policy names present on the server. // listPolicies() converts the map[string][]byte returned by client.listPolicies() // to []*models.Policy by iterating over each key in policyRawMap and // then using Unmarshal on the raw bytes to create a *models.Policy func listPolicies(ctx context.Context, client MinioAdmin) ([]*models.Policy, error) { policyMap, err := client.listPolicies(ctx) var policies []*models.Policy if err != nil { return nil, err } for name, policy := range policyMap { policy, err := parsePolicy(name, policy) if err != nil { return nil, err } policies = append(policies, policy) } return policies, nil } // getListPoliciesResponse performs listPolicies() and serializes it to the handler's output func getListPoliciesResponse(session *models.Principal, params policyApi.ListPoliciesParams) (*models.ListPoliciesResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} policies, err := listPolicies(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } // serialize output listPoliciesResponse := &models.ListPoliciesResponse{ Policies: policies, Total: int64(len(policies)), } return listPoliciesResponse, nil } // getListUsersForPoliciesResponse performs lists users affected by a given policy. func getListUsersForPolicyResponse(session *models.Principal, params policyApi.ListUsersForPolicyParams) ([]string, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} policies, err := listPolicies(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } found := false for i := range policies { if policies[i].Name == params.Policy { found = true } } if !found { return nil, ErrorWithContext(ctx, ErrPolicyNotFound, fmt.Errorf("the policy %s does not exist", params.Policy)) } users, err := listUsers(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } var filteredUsers []string for _, user := range users { for _, upolicy := range user.Policy { if upolicy == params.Policy { filteredUsers = append(filteredUsers, user.AccessKey) break } } } sort.Strings(filteredUsers) return filteredUsers, nil } func getUserPolicyResponse(ctx context.Context, session *models.Principal) (string, *CodedAPIError) { ctx, cancel := context.WithCancel(ctx) defer cancel() // serialize output if session == nil { return "nil", ErrorWithContext(ctx, ErrPolicyNotFound) } tokenClaims, _ := getClaimsFromToken(session.STSSessionToken) // initialize admin client mAdminClient, err := NewMinioAdminClient(ctx, &models.Principal{ STSAccessKeyID: session.STSAccessKeyID, STSSecretAccessKey: session.STSSecretAccessKey, STSSessionToken: session.STSSessionToken, }) if err != nil { return "nil", ErrorWithContext(ctx, err) } userAdminClient := AdminClient{Client: mAdminClient} // Obtain the current policy assigned to this user // necessary for generating the list of allowed endpoints accountInfo, err := getAccountInfo(ctx, userAdminClient) if err != nil { return "nil", ErrorWithContext(ctx, err) } rawPolicy := policies.ReplacePolicyVariables(tokenClaims, accountInfo) return string(rawPolicy), nil } func getSAUserPolicyResponse(session *models.Principal, params policyApi.GetSAUserPolicyParams) (*models.AUserPolicyResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() // serialize output if session == nil { return nil, ErrorWithContext(ctx, ErrPolicyNotFound) } // initialize admin client mAdminClient, err := NewMinioAdminClient(params.HTTPRequest.Context(), &models.Principal{ STSAccessKeyID: session.STSAccessKeyID, STSSecretAccessKey: session.STSSecretAccessKey, STSSessionToken: session.STSSessionToken, }) if err != nil { return nil, ErrorWithContext(ctx, err) } userAdminClient := AdminClient{Client: mAdminClient} user, err := getUserInfo(ctx, userAdminClient, params.Name) if err != nil { return nil, ErrorWithContext(ctx, err) } var userPolicies []string if len(user.PolicyName) > 0 { userPolicies = strings.Split(user.PolicyName, ",") } for _, group := range user.MemberOf { groupDesc, err := groupInfo(ctx, userAdminClient, group) if err != nil { return nil, ErrorWithContext(ctx, err) } if groupDesc.Policy != "" { userPolicies = append(userPolicies, strings.Split(groupDesc.Policy, ",")...) } } allKeys := make(map[string]bool) var userPolicyList []string for _, item := range userPolicies { if _, value := allKeys[item]; !value { allKeys[item] = true userPolicyList = append(userPolicyList, item) } } var userStatements []iampolicy.Statement for _, pol := range userPolicyList { policy, err := getPolicyStatements(ctx, userAdminClient, pol) if err != nil { return nil, ErrorWithContext(ctx, err) } userStatements = append(userStatements, policy...) } combinedPolicy := iampolicy.Policy{ Version: "2012-10-17", Statements: userStatements, } stringPolicy, err := json.Marshal(combinedPolicy) if err != nil { return nil, ErrorWithContext(ctx, err) } parsedPolicy := string(stringPolicy) getUserPoliciesResponse := &models.AUserPolicyResponse{ Policy: parsedPolicy, } return getUserPoliciesResponse, nil } func getListGroupsForPolicyResponse(session *models.Principal, params policyApi.ListGroupsForPolicyParams) ([]string, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} policies, err := listPolicies(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } found := false for i := range policies { if policies[i].Name == params.Policy { found = true } } if !found { return nil, ErrorWithContext(ctx, ErrPolicyNotFound, fmt.Errorf("the policy %s does not exist", params.Policy)) } groups, err := adminClient.listGroups(ctx) if err != nil { return nil, ErrorWithContext(ctx, err) } var filteredGroups []string for _, group := range groups { info, err := groupInfo(ctx, adminClient, group) if err != nil { return nil, ErrorWithContext(ctx, err) } groupPolicies := strings.Split(info.Policy, ",") for _, groupPolicy := range groupPolicies { if groupPolicy == params.Policy { filteredGroups = append(filteredGroups, group) } } } sort.Strings(filteredGroups) return filteredGroups, nil } // removePolicy() calls MinIO server to remove a policy based on name. func removePolicy(ctx context.Context, client MinioAdmin, name string) error { err := client.removePolicy(ctx, name) if err != nil { return err } return nil } // getRemovePolicyResponse() performs removePolicy() and serializes it to the handler's output func getRemovePolicyResponse(session *models.Principal, params policyApi.RemovePolicyParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() if params.Name == "" { return ErrorWithContext(ctx, ErrPolicyNameNotInRequest) } mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} if err := removePolicy(ctx, adminClient, params.Name); err != nil { return ErrorWithContext(ctx, err) } return nil } // addPolicy calls MinIO server to add a canned policy. // addPolicy() takes name and policy in string format, policy // policy must be string in json format, in the future this will change // to a Policy struct{} - https://github.com/minio/minio/issues/9171 func addPolicy(ctx context.Context, client MinioAdmin, name, policy string) (*models.Policy, error) { iamp, err := iampolicy.ParseConfig(bytes.NewReader([]byte(policy))) if err != nil { return nil, err } if err := client.addPolicy(ctx, name, iamp); err != nil { return nil, err } policyObject, err := policyInfo(ctx, client, name) if err != nil { return nil, err } return policyObject, nil } // getAddPolicyResponse performs addPolicy() and serializes it to the handler's output func getAddPolicyResponse(session *models.Principal, params policyApi.AddPolicyParams) (*models.Policy, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() if params.Body == nil { return nil, ErrorWithContext(ctx, ErrPolicyBodyNotInRequest) } mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} policy, err := addPolicy(ctx, adminClient, *params.Body.Name, *params.Body.Policy) if err != nil { return nil, ErrorWithContext(ctx, err) } return policy, nil } // policyInfo calls MinIO server to retrieve information of a canned policy. // policyInfo() takes a policy name, obtains the []byte (represents a string in JSON format) // and return it as *models.Policy , in the future this will change // to a Policy struct{} - https://github.com/minio/minio/issues/9171 func policyInfo(ctx context.Context, client MinioAdmin, name string) (*models.Policy, error) { policyRaw, err := client.getPolicy(ctx, name) if err != nil { return nil, err } policy, err := parsePolicy(name, policyRaw) if err != nil { return nil, err } return policy, nil } // getPolicy Statements calls MinIO server to retrieve information of a canned policy. // and returns the associated Statements func getPolicyStatements(ctx context.Context, client MinioAdmin, name string) ([]iampolicy.Statement, error) { policyRaw, err := client.getPolicy(ctx, name) if err != nil { return nil, err } return policyRaw.Statements, nil } // getPolicyInfoResponse performs policyInfo() and serializes it to the handler's output func getPolicyInfoResponse(session *models.Principal, params policyApi.PolicyInfoParams) (*models.Policy, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} policy, err := policyInfo(ctx, adminClient, params.Name) if err != nil { return nil, ErrorWithContext(ctx, err) } return policy, nil } // SetPolicy calls MinIO server to assign policy to a group or user. func SetPolicy(ctx context.Context, client MinioAdmin, name, entityName string, entityType models.PolicyEntity) error { isGroup := entityType == models.PolicyEntityGroup return client.setPolicy(ctx, name, entityName, isGroup) } // getSetPolicyResponse() performs SetPolicy() and serializes it to the handler's output func getSetPolicyResponse(session *models.Principal, params policyApi.SetPolicyParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() // Removing this section mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} if err := SetPolicy(ctx, adminClient, strings.Join(params.Body.Name, ","), *params.Body.EntityName, *params.Body.EntityType); err != nil { return ErrorWithContext(ctx, err) } return nil } func getSetPolicyMultipleResponse(session *models.Principal, params policyApi.SetPolicyMultipleParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} if err := setPolicyMultipleEntities(ctx, adminClient, strings.Join(params.Body.Name, ","), params.Body.Users, params.Body.Groups); err != nil { return ErrorWithContext(ctx, err) } return nil } // setPolicyMultipleEntities sets a policy to multiple users/groups func setPolicyMultipleEntities(ctx context.Context, client MinioAdmin, policyName string, users, groups []models.IamEntity) error { for _, user := range users { if err := client.setPolicy(ctx, policyName, string(user), false); err != nil { return err } } for _, group := range groups { groupDesc, err := groupInfo(ctx, client, string(group)) if err != nil { return err } allGroupPolicies := "" if len(groups) > 1 { allGroupPolicies = groupDesc.Policy + "," + policyName s := strings.Split(allGroupPolicies, ",") allGroupPolicies = strings.Join(UniqueKeys(s), ",") } else { allGroupPolicies = policyName } if err := client.setPolicy(ctx, allGroupPolicies, string(group), true); err != nil { return err } } return nil } // parsePolicy() converts from *rawPolicy to *models.Policy func parsePolicy(name string, rawPolicy *iampolicy.Policy) (*models.Policy, error) { stringPolicy, err := json.Marshal(rawPolicy) if err != nil { return nil, err } policy := &models.Policy{ Name: name, Policy: string(stringPolicy), } return policy, nil } ================================================ FILE: api/admin_policies_test.go ================================================ // 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 api import ( "bytes" "context" "encoding/json" "errors" "fmt" "testing" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" iampolicy "github.com/minio/pkg/v3/policy" "github.com/stretchr/testify/assert" ) func TestListPolicies(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() funcAssert := assert.New(t) adminClient := AdminClientMock{} // mock function response from listPolicies() minioListPoliciesMock = func() (map[string]*iampolicy.Policy, error) { var readonly iampolicy.Policy var readwrite iampolicy.Policy var diagnostis iampolicy.Policy for _, p := range iampolicy.DefaultPolicies { switch p.Name { case "readonly": readonly = p.Definition case "readwrite": readwrite = p.Definition case "diagnostics": diagnostis = p.Definition } } return map[string]*iampolicy.Policy{ "readonly": &readonly, "readwrite": &readwrite, "diagnostics": &diagnostis, }, nil } // Test-1 : listPolicies() Get response from minio client with three Canned Policies and return the same number on listPolicies() function := "listPolicies()" policiesList, err := listPolicies(ctx, adminClient) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of Policies is correct funcAssert.Equal(3, len(policiesList), fmt.Sprintf("Failed on %s: length of Policies's lists is not the same", function)) // Test-2 : listPolicies() Return error and see that the error is handled correctly and returned minioListPoliciesMock = func() (map[string]*iampolicy.Policy, error) { return nil, errors.New("error") } _, err = listPolicies(ctx, adminClient) if funcAssert.Error(err) { funcAssert.Equal("error", err.Error()) } } func TestRemovePolicy(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() funcAssert := assert.New(t) adminClient := AdminClientMock{} // Test-1 : removePolicy() remove an existing policy policyToRemove := "console-policy" minioRemovePolicyMock = func(_ string) error { return nil } function := "removePolicy()" if err := removePolicy(ctx, adminClient, policyToRemove); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2 : removePolicy() Return error and see that the error is handled correctly and returned minioRemovePolicyMock = func(_ string) error { return errors.New("error") } if err := removePolicy(ctx, adminClient, policyToRemove); funcAssert.Error(err) { funcAssert.Equal("error", err.Error()) } } func TestAddPolicy(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() funcAssert := assert.New(t) adminClient := AdminClientMock{} policyName := "new-policy" policyDefinition := "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:GetBucketLocation\",\"s3:GetObject\",\"s3:ListAllMyBuckets\"],\"Resource\":[\"arn:aws:s3:::*\"]}]}" minioAddPolicyMock = func(_ string, _ *iampolicy.Policy) error { return nil } minioGetPolicyMock = func(_ string) (*iampolicy.Policy, error) { policy := "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:GetBucketLocation\",\"s3:GetObject\",\"s3:ListAllMyBuckets\"],\"Resource\":[\"arn:aws:s3:::*\"]}]}" iamp, err := iampolicy.ParseConfig(bytes.NewReader([]byte(policy))) if err != nil { return nil, err } return iamp, nil } assertPolicy := models.Policy{ Name: "new-policy", Policy: "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:GetBucketLocation\",\"s3:GetObject\",\"s3:ListAllMyBuckets\"],\"Resource\":[\"arn:aws:s3:::*\"]}]}", } // Test-1 : addPolicy() adds a new policy function := "addPolicy()" policy, err := addPolicy(ctx, adminClient, policyName, policyDefinition) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } else { funcAssert.Equal(policy.Name, assertPolicy.Name) var expectedPolicy iampolicy.Policy var actualPolicy iampolicy.Policy err1 := json.Unmarshal([]byte(policy.Policy), &expectedPolicy) funcAssert.NoError(err1) err2 := json.Unmarshal([]byte(assertPolicy.Policy), &actualPolicy) funcAssert.NoError(err2) funcAssert.Equal(expectedPolicy, actualPolicy) } // Test-2 : addPolicy() got an error while adding policy minioAddPolicyMock = func(_ string, _ *iampolicy.Policy) error { return errors.New("error") } if _, err := addPolicy(ctx, adminClient, policyName, policyDefinition); funcAssert.Error(err) { funcAssert.Equal("error", err.Error()) } // Test-3 : addPolicy() got an error while retrieving policy minioAddPolicyMock = func(_ string, _ *iampolicy.Policy) error { return nil } minioGetPolicyMock = func(_ string) (*iampolicy.Policy, error) { return nil, errors.New("error") } if _, err := addPolicy(ctx, adminClient, policyName, policyDefinition); funcAssert.Error(err) { funcAssert.Equal("error", err.Error()) } } func TestSetPolicy(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() funcAssert := assert.New(t) adminClient := AdminClientMock{} policyName := "readOnly" entityName := "alevsk" entityObject := models.PolicyEntityUser minioSetPolicyMock = func(_, _ string, _ bool) error { return nil } // Test-1 : SetPolicy() set policy to user function := "SetPolicy()" err := SetPolicy(ctx, adminClient, policyName, entityName, entityObject) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2 : SetPolicy() set policy to group entityObject = models.PolicyEntityGroup err = SetPolicy(ctx, adminClient, policyName, entityName, entityObject) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-3 : SetPolicy() set policy to user and get error entityObject = models.PolicyEntityUser minioSetPolicyMock = func(_, _ string, _ bool) error { return errors.New("error") } if err := SetPolicy(ctx, adminClient, policyName, entityName, entityObject); funcAssert.Error(err) { funcAssert.Equal("error", err.Error()) } // Test-4 : SetPolicy() set policy to group and get error entityObject = models.PolicyEntityGroup minioSetPolicyMock = func(_, _ string, _ bool) error { return errors.New("error") } if err := SetPolicy(ctx, adminClient, policyName, entityName, entityObject); funcAssert.Error(err) { funcAssert.Equal("error", err.Error()) } } func Test_SetPolicyMultiple(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() adminClient := AdminClientMock{} minioGetGroupDescriptionMock = func(_ string) (*madmin.GroupDesc, error) { return &madmin.GroupDesc{}, nil } type args struct { policyName string users []models.IamEntity groups []models.IamEntity setPolicyFunc func(policyName, entityName string, isGroup bool) error } tests := []struct { name string args args errorExpected error }{ { name: "Set policy to multiple users and groups", args: args{ policyName: "readonly", users: []models.IamEntity{"user1", "user2"}, groups: []models.IamEntity{"group1", "group2"}, setPolicyFunc: func(_, _ string, _ bool) error { return nil }, }, errorExpected: nil, }, { name: "Return error on set policy function", args: args{ policyName: "readonly", users: []models.IamEntity{"user1", "user2"}, groups: []models.IamEntity{"group1", "group2"}, setPolicyFunc: func(_, _ string, _ bool) error { return errors.New("error set") }, }, errorExpected: errors.New("error set"), }, { // Description: Empty lists of users and groups are acceptable name: "Empty lists of users and groups", args: args{ policyName: "readonly", users: []models.IamEntity{}, groups: []models.IamEntity{}, setPolicyFunc: func(_, _ string, _ bool) error { return nil }, }, errorExpected: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { minioSetPolicyMock = tt.args.setPolicyFunc got := setPolicyMultipleEntities(ctx, adminClient, tt.args.policyName, tt.args.users, tt.args.groups) if (got == nil) != (tt.errorExpected == nil) || (got != nil && tt.errorExpected != nil && got.Error() != tt.errorExpected.Error()) { t.Errorf("got error %v, want %v", got, tt.errorExpected) } }) } } func Test_policyMatchesBucket(t *testing.T) { type args struct { ctx context.Context policy *models.Policy bucket string } tests := []struct { name string args args want bool }{ { name: "Test1", args: args{ctx: context.Background(), policy: &models.Policy{Name: "consoleAdmin", Policy: `{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "admin:*" ] }, { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`}, bucket: "test1"}, want: true, }, { name: "Test2", args: args{ctx: context.Background(), policy: &models.Policy{Name: "consoleAdmin", Policy: `{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::bucket1" ] } ] }`}, bucket: "test1"}, want: false, }, { name: "Test3", args: args{ctx: context.Background(), policy: &models.Policy{Name: "consoleAdmin", Policy: `{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "s3:ListStorageLensConfigurations", "s3:GetAccessPoint", "s3:PutAccountPublicAccessBlock", "s3:GetAccountPublicAccessBlock", "s3:ListAllMyBuckets", "s3:ListAccessPoints", "s3:ListJobs", "s3:PutStorageLensConfiguration", "s3:CreateJob" ], "Resource": "*" }, { "Sid": "VisualEditor1", "Effect": "Allow", "Action": "s3:*", "Resource": [ "arn:aws:s3:::test", "arn:aws:s3:::test/*", "arn:aws:s3:::lkasdkljasd090901", "arn:aws:s3:::lkasdkljasd090901/*" ] } ] }`}, bucket: "test1"}, want: true, }, { name: "Test4", args: args{ctx: context.Background(), policy: &models.Policy{Name: "consoleAdmin", Policy: `{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::bucket1" ] } ] }`}, bucket: "bucket1"}, want: true, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if got := policyMatchesBucket(tt.args.ctx, tt.args.policy, tt.args.bucket); got != tt.want { t.Errorf("policyMatchesBucket() = %v, want %v", got, tt.want) } }) } } ================================================ FILE: api/admin_profiling.go ================================================ // 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 api import ( "context" "io" "net/http" "time" "github.com/minio/madmin-go/v3" "github.com/minio/websocket" ) type profileOptions struct { Types string Duration time.Duration } func getProfileOptionsFromReq(req *http.Request) (*profileOptions, error) { pOptions := profileOptions{} pOptions.Types = req.FormValue("types") pOptions.Duration = 10 * time.Second // TODO: make this configurable return &pOptions, nil } func startProfiling(ctx context.Context, conn WSConn, client MinioAdmin, pOpts *profileOptions) error { data, err := client.startProfiling(ctx, madmin.ProfilerType(pOpts.Types), pOpts.Duration) if err != nil { return err } message, err := io.ReadAll(data) if err != nil { return err } return conn.writeMessage(websocket.BinaryMessage, message) } ================================================ FILE: api/admin_profiling_test.go ================================================ // 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 api import ( "bytes" "context" "errors" "io" "net/http" "net/url" "testing" "time" "github.com/minio/madmin-go/v3" "github.com/stretchr/testify/assert" ) // Implementing fake closingBuffer to mock stopProfiling() (io.ReadCloser, error) type ClosingBuffer struct { *bytes.Buffer } // Implementing a fake Close function for io.ReadCloser func (cb *ClosingBuffer) Close() error { return nil } func TestStartProfiling(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() assert := assert.New(t) adminClient := AdminClientMock{} mockWSConn := mockConn{} function := "startProfiling()" testOptions := &profileOptions{ Types: "cpu", } // Test-1 : startProfiling() Get response from MinIO server with one profiling object without errors // mock function response from startProfiling() minioStartProfiling = func(_ madmin.ProfilerType, _ time.Duration) (io.ReadCloser, error) { return &ClosingBuffer{bytes.NewBufferString("In memory string eaeae")}, nil } // mock function response from mockConn.writeMessage() connWriteMessageMock = func(_ int, _ []byte) error { return nil } err := startProfiling(ctx, mockWSConn, adminClient, testOptions) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } assert.Equal(err, nil) // Test-2 : startProfiling() Correctly handles errors returned by MinIO // mock function response from startProfiling() minioStartProfiling = func(_ madmin.ProfilerType, _ time.Duration) (io.ReadCloser, error) { return nil, errors.New("error") } err = startProfiling(ctx, mockWSConn, adminClient, testOptions) if assert.Error(err) { assert.Equal("error", err.Error()) } // Test-3: getProfileOptionsFromReq() correctly returns profile options from request u, _ := url.Parse("ws://localhost/ws/profile?types=cpu,mem,block,mutex,trace,threads,goroutines") req := &http.Request{ URL: u, } opts, err := getProfileOptionsFromReq(req) if assert.NoError(err) { expectedOptions := profileOptions{ Types: "cpu,mem,block,mutex,trace,threads,goroutines", } assert.Equal(expectedOptions.Types, opts.Types) } } ================================================ FILE: api/admin_releases.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package api import ( "context" "encoding/json" "fmt" "net/http" "net/url" "time" "github.com/minio/console/pkg/utils" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" release "github.com/minio/console/api/operations/release" "github.com/minio/console/models" "github.com/minio/pkg/v3/env" ) var ( releaseServiceHostEnvVar = "RELEASE_SERVICE_HOST" defaultReleaseServiceHost = "https://enterprise-updates.ic.min.dev" ) func registerReleasesHandlers(api *operations.ConsoleAPI) { api.ReleaseListReleasesHandler = release.ListReleasesHandlerFunc(func(params release.ListReleasesParams, session *models.Principal) middleware.Responder { resp, err := GetReleaseListResponse(session, params) if err != nil { return release.NewListReleasesDefault(err.Code).WithPayload(err.APIError) } return release.NewListReleasesOK().WithPayload(resp) }) } func GetReleaseListResponse(_ *models.Principal, params release.ListReleasesParams) (*models.ReleaseListResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() repo := params.Repo currentRelease := "" if params.Current != nil { currentRelease = *params.Current } search := "" if params.Search != nil { search = *params.Search } filter := "" if params.Filter != nil { filter = *params.Filter } ctx = context.WithValue(ctx, utils.ContextClientIP, getClientIP(params.HTTPRequest)) return releaseList(ctx, repo, currentRelease, search, filter) } func releaseList(ctx context.Context, repo, currentRelease, search, filter string) (*models.ReleaseListResponse, *CodedAPIError) { serviceURL := getReleaseServiceURL() clientIP := utils.ClientIPFromContext(ctx) releases, err := getReleases(serviceURL, repo, currentRelease, search, filter, clientIP) if err != nil { return nil, ErrorWithContext(ctx, err) } return releases, nil } func getReleaseServiceURL() string { host := env.Get(releaseServiceHostEnvVar, defaultReleaseServiceHost) return fmt.Sprintf("%s/releases", host) } func getReleases(endpoint, repo, currentRelease, search, filter, clientIP string) (*models.ReleaseListResponse, error) { rl := &models.ReleaseListResponse{} req, err := http.NewRequest(http.MethodGet, endpoint, nil) if err != nil { return nil, err } q := &url.Values{} q.Add("repo", repo) q.Add("search", search) q.Add("filter", filter) q.Add("current", currentRelease) req.URL.RawQuery = q.Encode() req.Header.Set("Content-Type", "application/json") client := GetConsoleHTTPClient(clientIP) client.Timeout = time.Second * 5 resp, err := client.Do(req) if err != nil { return nil, err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return nil, fmt.Errorf("error getting releases: %s", resp.Status) } err = json.NewDecoder(resp.Body).Decode(&rl) if err != nil { return nil, err } return rl, nil } ================================================ FILE: api/admin_releases_test.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package api import ( "encoding/json" "fmt" "net/http" "net/http/httptest" "os" "testing" "github.com/minio/console/api/operations" release "github.com/minio/console/api/operations/release" "github.com/minio/console/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) type ReleasesTestSuite struct { suite.Suite assert *assert.Assertions currentServer string isServerSet bool getServer *httptest.Server withError bool } func (suite *ReleasesTestSuite) SetupSuite() { suite.assert = assert.New(suite.T()) suite.getServer = httptest.NewServer(http.HandlerFunc(suite.getHandler)) suite.currentServer, suite.isServerSet = os.LookupEnv(releaseServiceHostEnvVar) os.Setenv(releaseServiceHostEnvVar, suite.getServer.URL) } func (suite *ReleasesTestSuite) TearDownSuite() { if suite.isServerSet { os.Setenv(releaseServiceHostEnvVar, suite.currentServer) } else { os.Unsetenv(releaseServiceHostEnvVar) } } func (suite *ReleasesTestSuite) getHandler( w http.ResponseWriter, _ *http.Request, ) { if suite.withError { w.WriteHeader(400) } else { w.WriteHeader(200) response := &models.ReleaseListResponse{} bytes, _ := json.Marshal(response) fmt.Fprint(w, string(bytes)) } } func (suite *ReleasesTestSuite) TestRegisterReleasesHandlers() { api := &operations.ConsoleAPI{} suite.assert.Nil(api.ReleaseListReleasesHandler) registerReleasesHandlers(api) suite.assert.NotNil(api.ReleaseListReleasesHandler) } func (suite *ReleasesTestSuite) TestGetReleasesWithError() { api := &operations.ConsoleAPI{} current := "mock" registerReleasesHandlers(api) params := release.NewListReleasesParams() params.Current = ¤t params.HTTPRequest = &http.Request{} suite.withError = true response := api.ReleaseListReleasesHandler.Handle(params, &models.Principal{}) _, ok := response.(*release.ListReleasesDefault) suite.assert.True(ok) } func (suite *ReleasesTestSuite) TestGetReleasesWithoutError() { api := &operations.ConsoleAPI{} registerReleasesHandlers(api) params := release.NewListReleasesParams() params.HTTPRequest = &http.Request{} suite.withError = false response := api.ReleaseListReleasesHandler.Handle(params, &models.Principal{}) _, ok := response.(*release.ListReleasesOK) suite.assert.True(ok) } func TestReleases(t *testing.T) { suite.Run(t, new(ReleasesTestSuite)) } ================================================ FILE: api/admin_remote_buckets.go ================================================ // 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 api import ( "context" "errors" "fmt" "net/url" "strconv" "time" "github.com/minio/console/pkg/utils" "github.com/minio/madmin-go/v3" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/swag" "github.com/minio/console/api/operations" bucketApi "github.com/minio/console/api/operations/bucket" "github.com/minio/console/models" "github.com/minio/minio-go/v7/pkg/replication" ) type RemoteBucketResult struct { OriginBucket string TargetBucket string Error string } func registerAdminBucketRemoteHandlers(api *operations.ConsoleAPI) { // return list of remote buckets api.BucketListRemoteBucketsHandler = bucketApi.ListRemoteBucketsHandlerFunc(func(params bucketApi.ListRemoteBucketsParams, session *models.Principal) middleware.Responder { listResp, err := getListRemoteBucketsResponse(session, params) if err != nil { return bucketApi.NewListRemoteBucketsDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewListRemoteBucketsOK().WithPayload(listResp) }) // return information about a specific bucket api.BucketRemoteBucketDetailsHandler = bucketApi.RemoteBucketDetailsHandlerFunc(func(params bucketApi.RemoteBucketDetailsParams, session *models.Principal) middleware.Responder { response, err := getRemoteBucketDetailsResponse(session, params) if err != nil { return bucketApi.NewRemoteBucketDetailsDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewRemoteBucketDetailsOK().WithPayload(response) }) // delete remote bucket api.BucketDeleteRemoteBucketHandler = bucketApi.DeleteRemoteBucketHandlerFunc(func(params bucketApi.DeleteRemoteBucketParams, session *models.Principal) middleware.Responder { err := getDeleteRemoteBucketResponse(session, params) if err != nil { return bucketApi.NewDeleteRemoteBucketDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewDeleteRemoteBucketNoContent() }) // set remote bucket api.BucketAddRemoteBucketHandler = bucketApi.AddRemoteBucketHandlerFunc(func(params bucketApi.AddRemoteBucketParams, session *models.Principal) middleware.Responder { err := getAddRemoteBucketResponse(session, params) if err != nil { return bucketApi.NewAddRemoteBucketDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewAddRemoteBucketCreated() }) // set multi-bucket replication api.BucketSetMultiBucketReplicationHandler = bucketApi.SetMultiBucketReplicationHandlerFunc(func(params bucketApi.SetMultiBucketReplicationParams, session *models.Principal) middleware.Responder { response, err := setMultiBucketReplicationResponse(session, params) if err != nil { return bucketApi.NewSetMultiBucketReplicationDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewSetMultiBucketReplicationOK().WithPayload(response) }) // list external buckets api.BucketListExternalBucketsHandler = bucketApi.ListExternalBucketsHandlerFunc(func(params bucketApi.ListExternalBucketsParams, _ *models.Principal) middleware.Responder { response, err := listExternalBucketsResponse(params) if err != nil { return bucketApi.NewListExternalBucketsDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewListExternalBucketsOK().WithPayload(response) }) // delete replication rule api.BucketDeleteBucketReplicationRuleHandler = bucketApi.DeleteBucketReplicationRuleHandlerFunc(func(params bucketApi.DeleteBucketReplicationRuleParams, session *models.Principal) middleware.Responder { err := deleteReplicationRuleResponse(session, params) if err != nil { return bucketApi.NewDeleteBucketReplicationRuleDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewDeleteBucketReplicationRuleNoContent() }) // delete all replication rules for a bucket api.BucketDeleteAllReplicationRulesHandler = bucketApi.DeleteAllReplicationRulesHandlerFunc(func(params bucketApi.DeleteAllReplicationRulesParams, session *models.Principal) middleware.Responder { err := deleteBucketReplicationRulesResponse(session, params) if err != nil { if err.Code == 500 && err.APIError.DetailedMessage == "The remote target does not exist" { // We should ignore this MinIO error when deleting all replication rules return bucketApi.NewDeleteAllReplicationRulesNoContent() // This will return 204 as per swagger spec } // If there is a different error, then we should handle it // This will return a generic error with err.Code (likely a 500 or 404) and its *err.DetailedMessage return bucketApi.NewDeleteAllReplicationRulesDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewDeleteAllReplicationRulesNoContent() }) // delete selected replication rules for a bucket api.BucketDeleteSelectedReplicationRulesHandler = bucketApi.DeleteSelectedReplicationRulesHandlerFunc(func(params bucketApi.DeleteSelectedReplicationRulesParams, session *models.Principal) middleware.Responder { err := deleteSelectedReplicationRulesResponse(session, params) if err != nil { return bucketApi.NewDeleteSelectedReplicationRulesDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewDeleteSelectedReplicationRulesNoContent() }) // update local bucket replication config item api.BucketUpdateMultiBucketReplicationHandler = bucketApi.UpdateMultiBucketReplicationHandlerFunc(func(params bucketApi.UpdateMultiBucketReplicationParams, session *models.Principal) middleware.Responder { err := updateBucketReplicationResponse(session, params) if err != nil { return bucketApi.NewUpdateMultiBucketReplicationDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewUpdateMultiBucketReplicationCreated() }) } func getListRemoteBucketsResponse(session *models.Principal, params bucketApi.ListRemoteBucketsParams) (*models.ListRemoteBucketsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, fmt.Errorf("error creating Madmin Client: %v", err)) } adminClient := AdminClient{Client: mAdmin} return listRemoteBuckets(ctx, adminClient) } func getRemoteBucketDetailsResponse(session *models.Principal, params bucketApi.RemoteBucketDetailsParams) (*models.RemoteBucket, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, fmt.Errorf("error creating Madmin Client: %v", err)) } adminClient := AdminClient{Client: mAdmin} return getRemoteBucket(ctx, adminClient, params.Name) } func getDeleteRemoteBucketResponse(session *models.Principal, params bucketApi.DeleteRemoteBucketParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, fmt.Errorf("error creating Madmin Client: %v", err)) } adminClient := AdminClient{Client: mAdmin} err = deleteRemoteBucket(ctx, adminClient, params.SourceBucketName, params.Arn) if err != nil { return ErrorWithContext(ctx, fmt.Errorf("error deleting remote bucket: %v", err)) } return nil } func getAddRemoteBucketResponse(session *models.Principal, params bucketApi.AddRemoteBucketParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, fmt.Errorf("error creating Madmin Client: %v", err)) } adminClient := AdminClient{Client: mAdmin} _, err = addRemoteBucket(ctx, adminClient, *params.Body) if err != nil { return ErrorWithContext(ctx, fmt.Errorf("error adding remote bucket: %v", err)) } return nil } func listRemoteBuckets(ctx context.Context, client MinioAdmin) (*models.ListRemoteBucketsResponse, *CodedAPIError) { var remoteBuckets []*models.RemoteBucket buckets, err := client.listRemoteBuckets(ctx, "", "") if err != nil { return nil, ErrorWithContext(ctx, fmt.Errorf("error listing remote buckets: %v", err)) } for _, bucket := range buckets { remoteBucket := &models.RemoteBucket{ AccessKey: swag.String(bucket.Credentials.AccessKey), RemoteARN: swag.String(bucket.Arn), SecretKey: bucket.Credentials.SecretKey, Service: "replication", SourceBucket: swag.String(bucket.SourceBucket), Status: "", TargetBucket: bucket.TargetBucket, TargetURL: bucket.Endpoint, SyncMode: "async", Bandwidth: bucket.BandwidthLimit, HealthCheckPeriod: int64(bucket.HealthCheckDuration.Seconds()), } if bucket.ReplicationSync { remoteBucket.SyncMode = "sync" } remoteBuckets = append(remoteBuckets, remoteBucket) } return &models.ListRemoteBucketsResponse{ Buckets: remoteBuckets, Total: int64(len(remoteBuckets)), }, nil } func getRemoteBucket(ctx context.Context, client MinioAdmin, name string) (*models.RemoteBucket, *CodedAPIError) { remoteBucket, err := client.getRemoteBucket(ctx, name, "") if err != nil { return nil, ErrorWithContext(ctx, fmt.Errorf("error getting remote bucket details: %v", err)) } if remoteBucket == nil { return nil, ErrorWithContext(ctx, "error getting remote bucket details: bucket not found") } return &models.RemoteBucket{ AccessKey: &remoteBucket.Credentials.AccessKey, RemoteARN: &remoteBucket.Arn, SecretKey: remoteBucket.Credentials.SecretKey, Service: "replication", SourceBucket: &remoteBucket.SourceBucket, Status: "", TargetBucket: remoteBucket.TargetBucket, TargetURL: remoteBucket.Endpoint, }, nil } func deleteRemoteBucket(ctx context.Context, client MinioAdmin, sourceBucketName, arn string) error { return client.removeRemoteBucket(ctx, sourceBucketName, arn) } func addRemoteBucket(ctx context.Context, client MinioAdmin, params models.CreateRemoteBucket) (string, error) { TargetURL := *params.TargetURL accessKey := *params.AccessKey secretKey := *params.SecretKey u, err := url.Parse(TargetURL) if err != nil { return "", errors.New("malformed Remote target URL") } secure := u.Scheme == "https" host := u.Host if u.Port() == "" { port := 80 if secure { port = 443 } host = host + ":" + strconv.Itoa(port) } creds := &madmin.Credentials{AccessKey: accessKey, SecretKey: secretKey} remoteBucket := &madmin.BucketTarget{ TargetBucket: *params.TargetBucket, Secure: secure, Credentials: creds, Endpoint: host, Path: "", API: "s3v4", Type: "replication", Region: params.Region, ReplicationSync: *params.SyncMode == "sync", } if *params.SyncMode == "async" { remoteBucket.BandwidthLimit = params.Bandwidth } if params.HealthCheckPeriod > 0 { remoteBucket.HealthCheckDuration = time.Duration(params.HealthCheckPeriod) * time.Second } bucketARN, err := client.addRemoteBucket(ctx, *params.SourceBucket, remoteBucket) return bucketARN, err } func addBucketReplicationItem(ctx context.Context, session *models.Principal, minClient minioClient, bucketName, prefix, destinationARN string, repExistingObj, repDelMark, repDels, repMeta bool, tags string, priority int32, storageClass string) error { // we will tolerate this call failing cfg, err := minClient.getBucketReplication(ctx, bucketName) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error fetching replication configuration for bucket %s: %v", bucketName, err)) } // add rule maxPrio := 0 if priority <= 0 { // We pick next priority by default for _, r := range cfg.Rules { if r.Priority > maxPrio { maxPrio = r.Priority } } maxPrio++ } else { // User picked priority, we try to set this manually maxPrio = int(priority) } clientIP := utils.ClientIPFromContext(ctx) s3Client, err := newS3BucketClient(session, bucketName, prefix, clientIP) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error creating S3Client: %v", err)) return err } // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} repDelMarkStatus := "disable" if repDelMark { repDelMarkStatus = "enable" } repDelsStatus := "disable" if repDels { repDelsStatus = "enable" } repMetaStatus := "disable" if repMeta { repMetaStatus = "enable" } existingRepStatus := "disable" if repExistingObj { existingRepStatus = "enable" } opts := replication.Options{ Priority: fmt.Sprintf("%d", maxPrio), RuleStatus: "enable", DestBucket: destinationARN, Op: replication.AddOption, TagString: tags, ExistingObjectReplicate: existingRepStatus, ReplicateDeleteMarkers: repDelMarkStatus, ReplicateDeletes: repDelsStatus, ReplicaSync: repMetaStatus, StorageClass: storageClass, } err2 := mcClient.setReplication(ctx, &cfg, opts) if err2 != nil { ErrorWithContext(ctx, fmt.Errorf("error creating replication for bucket: %v", err2.Cause)) return err2.Cause } return nil } func editBucketReplicationItem(ctx context.Context, session *models.Principal, minClient minioClient, ruleID, bucketName, prefix, destinationARN string, ruleStatus, repDelMark, repDels, repMeta, existingObjectRep bool, tags string, priority int32, storageClass string) error { // we will tolerate this call failing cfg, err := minClient.getBucketReplication(ctx, bucketName) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error fetching replication configuration for bucket %s: %v", bucketName, err)) } maxPrio := int(priority) clientIP := utils.ClientIPFromContext(ctx) s3Client, err := newS3BucketClient(session, bucketName, prefix, clientIP) if err != nil { return fmt.Errorf("error creating S3Client: %v", err) } // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} ruleState := "disable" if ruleStatus { ruleState = "enable" } repDelMarkStatus := "disable" if repDelMark { repDelMarkStatus = "enable" } repDelsStatus := "disable" if repDels { repDelsStatus = "enable" } repMetaStatus := "disable" if repMeta { repMetaStatus = "enable" } existingRepStatus := "disable" if existingObjectRep { existingRepStatus = "enable" } opts := replication.Options{ ID: ruleID, Priority: fmt.Sprintf("%d", maxPrio), RuleStatus: ruleState, DestBucket: destinationARN, Op: replication.SetOption, TagString: tags, IsTagSet: true, ExistingObjectReplicate: existingRepStatus, ReplicateDeleteMarkers: repDelMarkStatus, ReplicateDeletes: repDelsStatus, ReplicaSync: repMetaStatus, StorageClass: storageClass, IsSCSet: true, } err2 := mcClient.setReplication(ctx, &cfg, opts) if err2 != nil { return fmt.Errorf("error modifying replication for bucket: %v", err2.Cause) } return nil } func setMultiBucketReplication(ctx context.Context, session *models.Principal, client MinioAdmin, minClient minioClient, params bucketApi.SetMultiBucketReplicationParams) []RemoteBucketResult { bucketsRelation := params.Body.BucketsRelation // Parallel remote bucket adding parallelRemoteBucket := func(bucketRelationData *models.MultiBucketsRelation) chan RemoteBucketResult { remoteProc := make(chan RemoteBucketResult) sourceBucket := bucketRelationData.OriginBucket targetBucket := bucketRelationData.DestinationBucket go func() { defer close(remoteProc) createRemoteBucketParams := models.CreateRemoteBucket{ AccessKey: params.Body.AccessKey, SecretKey: params.Body.SecretKey, SourceBucket: &sourceBucket, TargetBucket: &targetBucket, Region: params.Body.Region, TargetURL: params.Body.TargetURL, SyncMode: params.Body.SyncMode, Bandwidth: params.Body.Bandwidth, HealthCheckPeriod: params.Body.HealthCheckPeriod, } // We add the remote bucket reference & store the arn or errors returned arn, err := addRemoteBucket(ctx, client, createRemoteBucketParams) if err == nil { err = addBucketReplicationItem( ctx, session, minClient, sourceBucket, params.Body.Prefix, arn, params.Body.ReplicateExistingObjects, params.Body.ReplicateDeleteMarkers, params.Body.ReplicateDeletes, params.Body.ReplicateMetadata, params.Body.Tags, params.Body.Priority, params.Body.StorageClass) } errorReturn := "" if err != nil { deleteRemoteBucket(ctx, client, sourceBucket, arn) errorReturn = err.Error() } retParams := RemoteBucketResult{ OriginBucket: sourceBucket, TargetBucket: targetBucket, Error: errorReturn, } remoteProc <- retParams }() return remoteProc } var bucketsManagement []chan RemoteBucketResult for _, bucketName := range bucketsRelation { // We generate the ARNs for each bucket rBucket := parallelRemoteBucket(bucketName) bucketsManagement = append(bucketsManagement, rBucket) } resultsList := []RemoteBucketResult{} for _, result := range bucketsManagement { res := <-result resultsList = append(resultsList, res) } return resultsList } func setMultiBucketReplicationResponse(session *models.Principal, params bucketApi.SetMultiBucketReplicationParams) (*models.MultiBucketResponseState, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, fmt.Errorf("error creating Madmin Client: %v", err)) } adminClient := AdminClient{Client: mAdmin} mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, fmt.Errorf("error creating MinIO Client: %v", err)) } // create a minioClient interface implementation // defining the client to be used mnClient := minioClient{client: mClient} replicationResults := setMultiBucketReplication(ctx, session, adminClient, mnClient, params) if replicationResults == nil { return nil, ErrorWithContext(ctx, errors.New("error setting buckets replication")) } resParsed := []*models.MultiBucketResponseItem{} for _, repResult := range replicationResults { responseItem := models.MultiBucketResponseItem{ ErrorString: repResult.Error, OriginBucket: repResult.OriginBucket, TargetBucket: repResult.TargetBucket, } resParsed = append(resParsed, &responseItem) } resultsParsed := models.MultiBucketResponseState{ ReplicationState: resParsed, } return &resultsParsed, nil } func listExternalBucketsResponse(params bucketApi.ListExternalBucketsParams) (*models.ListBucketsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() remoteAdmin, err := newAdminFromCreds(*params.Body.AccessKey, *params.Body.SecretKey, *params.Body.TargetURL, *params.Body.UseTLS) if err != nil { return nil, ErrorWithContext(ctx, err) } return listExternalBuckets(ctx, AdminClient{Client: remoteAdmin}) } func listExternalBuckets(ctx context.Context, client MinioAdmin) (*models.ListBucketsResponse, *CodedAPIError) { buckets, err := getAccountBuckets(ctx, client) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.ListBucketsResponse{ Buckets: buckets, Total: int64(len(buckets)), }, nil } func getARNFromID(conf *replication.Config, rule string) string { for i := range conf.Rules { if conf.Rules[i].ID == rule { return conf.Rules[i].Destination.Bucket } } return "" } func getARNsFromIDs(conf *replication.Config, rules []string) []string { temp := make(map[string]string) for i := range conf.Rules { temp[conf.Rules[i].ID] = conf.Rules[i].Destination.Bucket } var retval []string for i := range rules { if val, ok := temp[rules[i]]; ok { retval = append(retval, val) } } return retval } func deleteReplicationRule(ctx context.Context, session *models.Principal, bucketName, ruleID string) error { clientIP := utils.ClientIPFromContext(ctx) mClient, err := newMinioClient(session, clientIP) if err != nil { return fmt.Errorf("error creating MinIO Client: %v", err) } // create a minioClient interface implementation // defining the client to be used minClient := minioClient{client: mClient} cfg, err := minClient.getBucketReplication(ctx, bucketName) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error versioning bucket: %v", err)) } s3Client, err := newS3BucketClient(session, bucketName, "", clientIP) if err != nil { return fmt.Errorf("error creating S3Client: %v", err) } mAdmin, err := NewMinioAdminClient(ctx, session) if err != nil { return fmt.Errorf("error creating Admin Client: %v", err) } admClient := AdminClient{Client: mAdmin} // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} opts := replication.Options{ ID: ruleID, Op: replication.RemoveOption, } err2 := mcClient.setReplication(ctx, &cfg, opts) if err2 != nil { return err2.Cause } // Replication rule was successfully deleted. We remove remote bucket err3 := deleteRemoteBucket(ctx, admClient, bucketName, getARNFromID(&cfg, ruleID)) if err3 != nil { return err3 } return nil } func deleteAllReplicationRules(ctx context.Context, session *models.Principal, bucketName string) error { clientIP := utils.ClientIPFromContext(ctx) s3Client, err := newS3BucketClient(session, bucketName, "", clientIP) if err != nil { return fmt.Errorf("error creating S3Client: %v", err) } // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} mClient, err := newMinioClient(session, clientIP) if err != nil { return fmt.Errorf("error creating MinIO Client: %v", err) } // create a minioClient interface implementation // defining the client to be used minClient := minioClient{client: mClient} cfg, err := minClient.getBucketReplication(ctx, bucketName) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error versioning bucket: %v", err)) } mAdmin, err := NewMinioAdminClient(ctx, session) if err != nil { return fmt.Errorf("error creating Admin Client: %v", err) } admClient := AdminClient{Client: mAdmin} err2 := mcClient.deleteAllReplicationRules(ctx) if err2 != nil { return err2.ToGoError() } for i := range cfg.Rules { err3 := deleteRemoteBucket(ctx, admClient, bucketName, cfg.Rules[i].Destination.Bucket) if err3 != nil { return err3 } } return nil } func deleteSelectedReplicationRules(ctx context.Context, session *models.Principal, bucketName string, rules []string) error { clientIP := utils.ClientIPFromContext(ctx) mClient, err := newMinioClient(session, clientIP) if err != nil { return fmt.Errorf("error creating MinIO Client: %v", err) } // create a minioClient interface implementation // defining the client to be used minClient := minioClient{client: mClient} cfg, err := minClient.getBucketReplication(ctx, bucketName) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error versioning bucket: %v", err)) } s3Client, err := newS3BucketClient(session, bucketName, "", clientIP) if err != nil { return fmt.Errorf("error creating S3Client: %v", err) } // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} mAdmin, err := NewMinioAdminClient(ctx, session) if err != nil { return fmt.Errorf("error creating Admin Client: %v", err) } admClient := AdminClient{Client: mAdmin} ARNs := getARNsFromIDs(&cfg, rules) for i := range rules { opts := replication.Options{ ID: rules[i], Op: replication.RemoveOption, } err2 := mcClient.setReplication(ctx, &cfg, opts) if err2 != nil { return err2.Cause } // In case replication rule was deleted successfully, we remove the remote bucket ARN err3 := deleteRemoteBucket(ctx, admClient, bucketName, ARNs[i]) if err3 != nil { return err3 } } return nil } func deleteReplicationRuleResponse(session *models.Principal, params bucketApi.DeleteBucketReplicationRuleParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() ctx = context.WithValue(ctx, utils.ContextClientIP, getClientIP(params.HTTPRequest)) err := deleteReplicationRule(ctx, session, params.BucketName, params.RuleID) if err != nil { return ErrorWithContext(ctx, err) } return nil } func deleteBucketReplicationRulesResponse(session *models.Principal, params bucketApi.DeleteAllReplicationRulesParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() ctx = context.WithValue(ctx, utils.ContextClientIP, getClientIP(params.HTTPRequest)) err := deleteAllReplicationRules(ctx, session, params.BucketName) if err != nil { return ErrorWithContext(ctx, err) } return nil } func deleteSelectedReplicationRulesResponse(session *models.Principal, params bucketApi.DeleteSelectedReplicationRulesParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() ctx = context.WithValue(ctx, utils.ContextClientIP, getClientIP(params.HTTPRequest)) err := deleteSelectedReplicationRules(ctx, session, params.BucketName, params.Rules.Rules) if err != nil { return ErrorWithContext(ctx, err) } return nil } func updateBucketReplicationResponse(session *models.Principal, params bucketApi.UpdateMultiBucketReplicationParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minClient := minioClient{client: mClient} err = editBucketReplicationItem( ctx, session, minClient, params.RuleID, params.BucketName, params.Body.Prefix, params.Body.Arn, params.Body.RuleState, params.Body.ReplicateDeleteMarkers, params.Body.ReplicateDeletes, params.Body.ReplicateMetadata, params.Body.ReplicateExistingObjects, params.Body.Tags, params.Body.Priority, params.Body.StorageClass) if err != nil { return ErrorWithContext(ctx, err) } return nil } ================================================ FILE: api/admin_remote_buckets_test.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package api import ( "context" "errors" "net/http" "net/http/httptest" "os" "testing" "github.com/minio/console/pkg/utils" "github.com/go-openapi/swag" "github.com/minio/console/api/operations" bucketApi "github.com/minio/console/api/operations/bucket" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) type RemoteBucketsTestSuite struct { suite.Suite assert *assert.Assertions currentServer string isServerSet bool server *httptest.Server adminClient AdminClientMock minioClient minioClientMock mockRemoteBucket *models.RemoteBucket mockBucketTarget *madmin.BucketTarget mockListBuckets *models.ListBucketsResponse } func (suite *RemoteBucketsTestSuite) SetupSuite() { suite.assert = assert.New(suite.T()) suite.adminClient = AdminClientMock{} suite.minioClient = minioClientMock{} suite.mockObjects() } func (suite *RemoteBucketsTestSuite) mockObjects() { suite.mockListBuckets = &models.ListBucketsResponse{ Buckets: []*models.Bucket{}, Total: 0, } suite.mockRemoteBucket = &models.RemoteBucket{ AccessKey: swag.String("accessKey"), SecretKey: "secretKey", RemoteARN: swag.String("remoteARN"), Service: "replication", SourceBucket: swag.String("sourceBucket"), TargetBucket: "targetBucket", TargetURL: "targetURL", Status: "", } suite.mockBucketTarget = &madmin.BucketTarget{ Credentials: &madmin.Credentials{ AccessKey: *suite.mockRemoteBucket.AccessKey, SecretKey: suite.mockRemoteBucket.SecretKey, }, Arn: *suite.mockRemoteBucket.RemoteARN, SourceBucket: *suite.mockRemoteBucket.SourceBucket, TargetBucket: suite.mockRemoteBucket.TargetBucket, Endpoint: suite.mockRemoteBucket.TargetURL, } } func (suite *RemoteBucketsTestSuite) SetupTest() { suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler)) suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer) os.Setenv(ConsoleMinIOServer, suite.server.URL) } func (suite *RemoteBucketsTestSuite) serverHandler(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(400) } func (suite *RemoteBucketsTestSuite) TearDownSuite() { } func (suite *RemoteBucketsTestSuite) TearDownTest() { if suite.isServerSet { os.Setenv(ConsoleMinIOServer, suite.currentServer) } else { os.Unsetenv(ConsoleMinIOServer) } } func (suite *RemoteBucketsTestSuite) TestRegisterRemoteBucketsHandlers() { api := &operations.ConsoleAPI{} suite.assertHandlersAreNil(api) registerAdminBucketRemoteHandlers(api) suite.assertHandlersAreNotNil(api) } func (suite *RemoteBucketsTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) { suite.assert.Nil(api.BucketListRemoteBucketsHandler) suite.assert.Nil(api.BucketRemoteBucketDetailsHandler) suite.assert.Nil(api.BucketDeleteRemoteBucketHandler) suite.assert.Nil(api.BucketAddRemoteBucketHandler) suite.assert.Nil(api.BucketSetMultiBucketReplicationHandler) suite.assert.Nil(api.BucketListExternalBucketsHandler) suite.assert.Nil(api.BucketDeleteBucketReplicationRuleHandler) suite.assert.Nil(api.BucketDeleteAllReplicationRulesHandler) suite.assert.Nil(api.BucketDeleteSelectedReplicationRulesHandler) suite.assert.Nil(api.BucketUpdateMultiBucketReplicationHandler) } func (suite *RemoteBucketsTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) { suite.assert.NotNil(api.BucketListRemoteBucketsHandler) suite.assert.NotNil(api.BucketRemoteBucketDetailsHandler) suite.assert.NotNil(api.BucketDeleteRemoteBucketHandler) suite.assert.NotNil(api.BucketAddRemoteBucketHandler) suite.assert.NotNil(api.BucketSetMultiBucketReplicationHandler) suite.assert.NotNil(api.BucketListExternalBucketsHandler) suite.assert.NotNil(api.BucketDeleteBucketReplicationRuleHandler) suite.assert.NotNil(api.BucketDeleteAllReplicationRulesHandler) suite.assert.NotNil(api.BucketDeleteSelectedReplicationRulesHandler) suite.assert.NotNil(api.BucketUpdateMultiBucketReplicationHandler) } func (suite *RemoteBucketsTestSuite) TestListRemoteBucketsHandlerWithError() { params, api := suite.initListRemoteBucketsRequest() response := api.BucketListRemoteBucketsHandler.Handle(params, &models.Principal{}) _, ok := response.(*bucketApi.ListRemoteBucketsDefault) suite.assert.True(ok) } func (suite *RemoteBucketsTestSuite) initListRemoteBucketsRequest() (params bucketApi.ListRemoteBucketsParams, api operations.ConsoleAPI) { registerAdminBucketRemoteHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *RemoteBucketsTestSuite) TestListRemoteBucketsWithoutError() { ctx := context.Background() minioListRemoteBucketsMock = func(_ context.Context, _, _ string) (targets []madmin.BucketTarget, err error) { return []madmin.BucketTarget{{ Credentials: &madmin.Credentials{ AccessKey: "accessKey", SecretKey: "secretKey", }, }}, nil } res, err := listRemoteBuckets(ctx, &suite.adminClient) suite.assert.NotNil(res) suite.assert.Nil(err) } func (suite *RemoteBucketsTestSuite) TestRemoteBucketDetailsHandlerWithError() { params, api := suite.initRemoteBucketDetailsRequest() response := api.BucketRemoteBucketDetailsHandler.Handle(params, &models.Principal{}) _, ok := response.(*bucketApi.RemoteBucketDetailsDefault) suite.assert.True(ok) } func (suite *RemoteBucketsTestSuite) initRemoteBucketDetailsRequest() (params bucketApi.RemoteBucketDetailsParams, api operations.ConsoleAPI) { registerAdminBucketRemoteHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *RemoteBucketsTestSuite) TestGetRemoteBucketWithoutError() { ctx := context.Background() minioGetRemoteBucketMock = func(_ context.Context, _, _ string) (targets *madmin.BucketTarget, err error) { return suite.mockBucketTarget, nil } res, err := getRemoteBucket(ctx, &suite.adminClient, "bucketName") suite.assert.Nil(err) suite.assert.NotNil(res) suite.assert.Equal(suite.mockRemoteBucket, res) } func (suite *RemoteBucketsTestSuite) TestDeleteRemoteBucketHandlerWithError() { params, api := suite.initDeleteRemoteBucketRequest() response := api.BucketDeleteRemoteBucketHandler.Handle(params, &models.Principal{}) _, ok := response.(*bucketApi.DeleteRemoteBucketDefault) suite.assert.True(ok) } func (suite *RemoteBucketsTestSuite) initDeleteRemoteBucketRequest() (params bucketApi.DeleteRemoteBucketParams, api operations.ConsoleAPI) { registerAdminBucketRemoteHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *RemoteBucketsTestSuite) TestAddRemoteBucketHandlerWithError() { params, api := suite.initAddRemoteBucketRequest() response := api.BucketAddRemoteBucketHandler.Handle(params, &models.Principal{}) _, ok := response.(*bucketApi.AddRemoteBucketDefault) suite.assert.True(ok) } func (suite *RemoteBucketsTestSuite) initAddRemoteBucketRequest() (params bucketApi.AddRemoteBucketParams, api operations.ConsoleAPI) { registerAdminBucketRemoteHandlers(&api) url := "^&*&^%^" accessKey := "accessKey" secretKey := "secretKey" params.HTTPRequest = &http.Request{} params.Body = &models.CreateRemoteBucket{ TargetURL: &url, AccessKey: &accessKey, SecretKey: &secretKey, } return params, api } func (suite *RemoteBucketsTestSuite) TestAddRemoteBucketWithoutError() { ctx := context.Background() minioAddRemoteBucketMock = func(_ context.Context, _ string, _ *madmin.BucketTarget) (string, error) { return "bucketName", nil } url := "https://localhost" accessKey := "accessKey" secretKey := "secretKey" targetBucket := "targetBucket" syncMode := "async" sourceBucket := "sourceBucket" data := models.CreateRemoteBucket{ TargetURL: &url, TargetBucket: &targetBucket, AccessKey: &accessKey, SecretKey: &secretKey, SyncMode: &syncMode, HealthCheckPeriod: 10, SourceBucket: &sourceBucket, } res, err := addRemoteBucket(ctx, &suite.adminClient, data) suite.assert.NotNil(res) suite.assert.Nil(err) } func (suite *RemoteBucketsTestSuite) TestSetMultiBucketReplicationHandlerWithError() { params, api := suite.initSetMultiBucketReplicationRequest() response := api.BucketSetMultiBucketReplicationHandler.Handle(params, &models.Principal{}) _, ok := response.(*bucketApi.SetMultiBucketReplicationOK) suite.assert.True(ok) } func (suite *RemoteBucketsTestSuite) initSetMultiBucketReplicationRequest() (params bucketApi.SetMultiBucketReplicationParams, api operations.ConsoleAPI) { registerAdminBucketRemoteHandlers(&api) accessKey := "accessKey" secretKey := "secretKey" targetURL := "https://localhost" syncMode := "async" params.HTTPRequest = &http.Request{} params.Body = &models.MultiBucketReplication{ BucketsRelation: []*models.MultiBucketsRelation{{}}, AccessKey: &accessKey, SecretKey: &secretKey, Region: "region", TargetURL: &targetURL, SyncMode: &syncMode, Bandwidth: 10, HealthCheckPeriod: 10, } return params, api } func (suite *RemoteBucketsTestSuite) TestListExternalBucketsHandlerWithError() { params, api := suite.initListExternalBucketsRequest() response := api.BucketListExternalBucketsHandler.Handle(params, &models.Principal{}) _, ok := response.(*bucketApi.ListExternalBucketsDefault) suite.assert.True(ok) } func (suite *RemoteBucketsTestSuite) initListExternalBucketsRequest() (params bucketApi.ListExternalBucketsParams, api operations.ConsoleAPI) { registerAdminBucketRemoteHandlers(&api) url := "http://localhost:9000" accessKey := "accessKey" secretKey := "secretKey" tls := false params.HTTPRequest = &http.Request{} params.Body = &models.ListExternalBucketsParams{ TargetURL: &url, AccessKey: &accessKey, SecretKey: &secretKey, UseTLS: &tls, } return params, api } func (suite *RemoteBucketsTestSuite) TestListExternalBucketsWithError() { ctx := context.Background() minioAccountInfoMock = func(_ context.Context) (madmin.AccountInfo, error) { return madmin.AccountInfo{}, errors.New("error") } res, err := listExternalBuckets(ctx, &suite.adminClient) suite.assert.NotNil(err) suite.assert.Nil(res) } func (suite *RemoteBucketsTestSuite) TestListExternalBucketsWithoutError() { ctx := context.Background() minioAccountInfoMock = func(_ context.Context) (madmin.AccountInfo, error) { return madmin.AccountInfo{ Buckets: []madmin.BucketAccessInfo{}, }, nil } res, err := listExternalBuckets(ctx, &suite.adminClient) suite.assert.Nil(err) suite.assert.NotNil(res) suite.assert.Equal(suite.mockListBuckets, res) } func (suite *RemoteBucketsTestSuite) TestDeleteBucketReplicationRuleHandlerWithError() { params, api := suite.initDeleteBucketReplicationRuleRequest() response := api.BucketDeleteBucketReplicationRuleHandler.Handle(params, &models.Principal{}) _, ok := response.(*bucketApi.DeleteBucketReplicationRuleDefault) suite.assert.True(ok) } func (suite *RemoteBucketsTestSuite) initDeleteBucketReplicationRuleRequest() (params bucketApi.DeleteBucketReplicationRuleParams, api operations.ConsoleAPI) { registerAdminBucketRemoteHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *RemoteBucketsTestSuite) TestDeleteAllReplicationRulesHandlerWithError() { params, api := suite.initDeleteAllReplicationRulesRequest() response := api.BucketDeleteAllReplicationRulesHandler.Handle(params, &models.Principal{}) _, ok := response.(*bucketApi.DeleteAllReplicationRulesDefault) suite.assert.True(ok) } func (suite *RemoteBucketsTestSuite) initDeleteAllReplicationRulesRequest() (params bucketApi.DeleteAllReplicationRulesParams, api operations.ConsoleAPI) { registerAdminBucketRemoteHandlers(&api) params.HTTPRequest = &http.Request{} return params, api } func (suite *RemoteBucketsTestSuite) TestDeleteSelectedReplicationRulesHandlerWithError() { params, api := suite.initDeleteSelectedReplicationRulesRequest() response := api.BucketDeleteSelectedReplicationRulesHandler.Handle(params, &models.Principal{}) _, ok := response.(*bucketApi.DeleteSelectedReplicationRulesDefault) suite.assert.True(ok) } func (suite *RemoteBucketsTestSuite) initDeleteSelectedReplicationRulesRequest() (params bucketApi.DeleteSelectedReplicationRulesParams, api operations.ConsoleAPI) { registerAdminBucketRemoteHandlers(&api) params.HTTPRequest = &http.Request{} params.BucketName = "bucketName" params.Rules = &models.BucketReplicationRuleList{ Rules: []string{"rule1", "rule2"}, } return params, api } func (suite *RemoteBucketsTestSuite) TestUpdateMultiBucketReplicationHandlerWithError() { params, api := suite.initUpdateMultiBucketReplicationRequest() response := api.BucketUpdateMultiBucketReplicationHandler.Handle(params, &models.Principal{}) _, ok := response.(*bucketApi.UpdateMultiBucketReplicationDefault) suite.assert.True(ok) } func (suite *RemoteBucketsTestSuite) initUpdateMultiBucketReplicationRequest() (params bucketApi.UpdateMultiBucketReplicationParams, api operations.ConsoleAPI) { registerAdminBucketRemoteHandlers(&api) r := &http.Request{} ctx := context.WithValue(context.Background(), utils.ContextClientIP, "127.0.0.1") rc := r.WithContext(ctx) params.HTTPRequest = rc params.Body = &models.MultiBucketReplicationEdit{} return params, api } func TestRemoteBuckets(t *testing.T) { suite.Run(t, new(RemoteBucketsTestSuite)) } ================================================ FILE: api/admin_replication_status.go ================================================ // 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 api import ( "context" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" siteRepApi "github.com/minio/console/api/operations/site_replication" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" ) func registerSiteReplicationStatusHandler(api *operations.ConsoleAPI) { api.SiteReplicationGetSiteReplicationStatusHandler = siteRepApi.GetSiteReplicationStatusHandlerFunc(func(params siteRepApi.GetSiteReplicationStatusParams, session *models.Principal) middleware.Responder { rInfo, err := getSRStatusResponse(session, params) if err != nil { return siteRepApi.NewGetSiteReplicationStatusDefault(err.Code).WithPayload(err.APIError) } return siteRepApi.NewGetSiteReplicationStatusOK().WithPayload(rInfo) }) } func getSRStatusResponse(session *models.Principal, params siteRepApi.GetSiteReplicationStatusParams) (*models.SiteReplicationStatusResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } adminClient := AdminClient{Client: mAdmin} res, err := getSRStats(ctx, adminClient, params) if err != nil { return nil, ErrorWithContext(ctx, err) } return res, nil } func getSRStats(ctx context.Context, client MinioAdmin, params siteRepApi.GetSiteReplicationStatusParams) (info *models.SiteReplicationStatusResponse, err error) { srParams := madmin.SRStatusOptions{ Buckets: *params.Buckets, Policies: *params.Policies, Users: *params.Users, Groups: *params.Groups, } if params.EntityType != nil && params.EntityValue != nil { srParams.Entity = madmin.GetSREntityType(*params.EntityType) srParams.EntityValue = *params.EntityValue } srInfo, err := client.getSiteReplicationStatus(ctx, srParams) retInfo := models.SiteReplicationStatusResponse{ BucketStats: &srInfo.BucketStats, Enabled: srInfo.Enabled, GroupStats: srInfo.GroupStats, MaxBuckets: int64(srInfo.MaxBuckets), MaxGroups: int64(srInfo.MaxGroups), MaxPolicies: int64(srInfo.MaxPolicies), MaxUsers: int64(srInfo.MaxUsers), PolicyStats: &srInfo.PolicyStats, Sites: &srInfo.Sites, StatsSummary: srInfo.StatsSummary, UserStats: &srInfo.UserStats, } if err != nil { return nil, err } return &retInfo, nil } ================================================ FILE: api/admin_service.go ================================================ // 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 api import ( "context" "time" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" "github.com/minio/console/models" svcApi "github.com/minio/console/api/operations/service" ) func registerServiceHandlers(api *operations.ConsoleAPI) { // Restart Service api.ServiceRestartServiceHandler = svcApi.RestartServiceHandlerFunc(func(params svcApi.RestartServiceParams, session *models.Principal) middleware.Responder { if err := getRestartServiceResponse(session, params); err != nil { return svcApi.NewRestartServiceDefault(err.Code).WithPayload(err.APIError) } return svcApi.NewRestartServiceNoContent() }) } // serviceRestart - restarts the MinIO cluster func serviceRestart(ctx context.Context, client MinioAdmin) error { if err := client.serviceRestart(ctx); err != nil { return err } // copy behavior from minio/mc mainAdminServiceRestart() // // Max. time taken by the server to shutdown is 5 seconds. // This can happen when there are lot of s3 requests pending when the server // receives a restart command. // Sleep for 6 seconds and then check if the server is online. time.Sleep(6 * time.Second) // Fetch the service status of the specified MinIO server _, err := client.serverInfo(ctx) if err != nil { return err } return nil } // getRestartServiceResponse performs serviceRestart() func getRestartServiceResponse(session *models.Principal, params svcApi.RestartServiceParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} if err := serviceRestart(ctx, adminClient); err != nil { return ErrorWithContext(ctx, err) } return nil } ================================================ FILE: api/admin_service_test.go ================================================ // 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 api import ( "context" "errors" "testing" "github.com/minio/madmin-go/v3" "github.com/stretchr/testify/assert" ) func TestServiceRestart(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} ctx := context.Background() function := "serviceRestart()" // Test-1 : serviceRestart() restart services no errors // mock function response from listGroups() minioServiceRestartMock = func(_ context.Context) error { return nil } MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { return madmin.InfoMessage{}, nil } if err := serviceRestart(ctx, adminClient); err != nil { t.Errorf("Failed on %s:, errors occurred: %s", function, err.Error()) } // Test-2 : serviceRestart() returns errors on client.serviceRestart call // and see that the errors is handled correctly and returned minioServiceRestartMock = func(_ context.Context) error { return errors.New("error") } MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { return madmin.InfoMessage{}, nil } if err := serviceRestart(ctx, adminClient); assert.Error(err) { assert.Equal("error", err.Error()) } // Test-3 : serviceRestart() returns errors on client.serverInfo() call // and see that the errors is handled correctly and returned minioServiceRestartMock = func(_ context.Context) error { return nil } MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { return madmin.InfoMessage{}, errors.New("error on server info") } if err := serviceRestart(ctx, adminClient); assert.Error(err) { assert.Equal("error on server info", err.Error()) } } ================================================ FILE: api/admin_site_replication.go ================================================ // 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 api import ( "context" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" siteRepApi "github.com/minio/console/api/operations/site_replication" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" ) func registerSiteReplicationHandler(api *operations.ConsoleAPI) { api.SiteReplicationGetSiteReplicationInfoHandler = siteRepApi.GetSiteReplicationInfoHandlerFunc(func(params siteRepApi.GetSiteReplicationInfoParams, session *models.Principal) middleware.Responder { rInfo, err := getSRInfoResponse(session, params) if err != nil { return siteRepApi.NewGetSiteReplicationInfoDefault(err.Code).WithPayload(err.APIError) } return siteRepApi.NewGetSiteReplicationInfoOK().WithPayload(rInfo) }) api.SiteReplicationSiteReplicationInfoAddHandler = siteRepApi.SiteReplicationInfoAddHandlerFunc(func(params siteRepApi.SiteReplicationInfoAddParams, session *models.Principal) middleware.Responder { eInfo, err := getSRAddResponse(session, params) if err != nil { return siteRepApi.NewSiteReplicationInfoAddDefault(err.Code).WithPayload(err.APIError) } return siteRepApi.NewSiteReplicationInfoAddOK().WithPayload(eInfo) }) api.SiteReplicationSiteReplicationRemoveHandler = siteRepApi.SiteReplicationRemoveHandlerFunc(func(params siteRepApi.SiteReplicationRemoveParams, session *models.Principal) middleware.Responder { remRes, err := getSRRemoveResponse(session, params) if err != nil { return siteRepApi.NewSiteReplicationRemoveDefault(err.Code).WithPayload(err.APIError) } return siteRepApi.NewSiteReplicationRemoveNoContent().WithPayload(remRes) }) api.SiteReplicationSiteReplicationEditHandler = siteRepApi.SiteReplicationEditHandlerFunc(func(params siteRepApi.SiteReplicationEditParams, session *models.Principal) middleware.Responder { eInfo, err := getSREditResponse(session, params) if err != nil { return siteRepApi.NewSiteReplicationRemoveDefault(err.Code).WithPayload(err.APIError) } return siteRepApi.NewSiteReplicationEditOK().WithPayload(eInfo) }) } func getSRInfoResponse(session *models.Principal, params siteRepApi.GetSiteReplicationInfoParams) (*models.SiteReplicationInfoResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } adminClient := AdminClient{Client: mAdmin} res, err := getSRConfig(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } return res, nil } func getSRAddResponse(session *models.Principal, params siteRepApi.SiteReplicationInfoAddParams) (*models.SiteReplicationAddResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } adminClient := AdminClient{Client: mAdmin} res, err := addSiteReplication(ctx, adminClient, ¶ms) if err != nil { return nil, ErrorWithContext(ctx, err) } return res, nil } func getSREditResponse(session *models.Principal, params siteRepApi.SiteReplicationEditParams) (*models.PeerSiteEditResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } adminClient := AdminClient{Client: mAdmin} eRes, err := editSiteReplication(ctx, adminClient, ¶ms) if err != nil { return nil, ErrorWithContext(ctx, err) } return eRes, nil } func getSRRemoveResponse(session *models.Principal, params siteRepApi.SiteReplicationRemoveParams) (*models.PeerSiteRemoveResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } adminClient := AdminClient{Client: mAdmin} rRes, err := removeSiteReplication(ctx, adminClient, ¶ms) if err != nil { return nil, ErrorWithContext(ctx, err) } return rRes, nil } func getSRConfig(ctx context.Context, client MinioAdmin) (info *models.SiteReplicationInfoResponse, err error) { srInfo, err := client.getSiteReplicationInfo(ctx) if err != nil { return nil, err } var sites []*models.PeerInfo if len(srInfo.Sites) > 0 { for _, s := range srInfo.Sites { pInfo := &models.PeerInfo{ DeploymentID: s.DeploymentID, Endpoint: s.Endpoint, Name: s.Name, } sites = append(sites, pInfo) } } res := &models.SiteReplicationInfoResponse{ Enabled: srInfo.Enabled, Name: srInfo.Name, ServiceAccountAccessKey: srInfo.ServiceAccountAccessKey, Sites: sites, } return res, nil } func addSiteReplication(ctx context.Context, client MinioAdmin, params *siteRepApi.SiteReplicationInfoAddParams) (info *models.SiteReplicationAddResponse, err error) { var rSites []madmin.PeerSite if len(params.Body) > 0 { for _, aSite := range params.Body { pInfo := &madmin.PeerSite{ AccessKey: aSite.AccessKey, Name: aSite.Name, SecretKey: aSite.SecretKey, Endpoint: aSite.Endpoint, } rSites = append(rSites, *pInfo) } } qs := runtime.Values(params.HTTPRequest.URL.Query()) _, qhkReplicateILMExpiry, _ := qs.GetOK("replicate-ilm-expiry") var opts madmin.SRAddOptions if qhkReplicateILMExpiry { opts.ReplicateILMExpiry = true } cc, err := client.addSiteReplicationInfo(ctx, rSites, opts) if err != nil { return nil, err } res := &models.SiteReplicationAddResponse{ ErrorDetail: cc.ErrDetail, InitialSyncErrorMessage: cc.InitialSyncErrorMessage, Status: cc.Status, Success: cc.Success, } return res, nil } func editSiteReplication(ctx context.Context, client MinioAdmin, params *siteRepApi.SiteReplicationEditParams) (info *models.PeerSiteEditResponse, err error) { peerSiteInfo := &madmin.PeerInfo{ Endpoint: params.Body.Endpoint, // only endpoint can be edited. Name: params.Body.Name, // does not get updated. DeploymentID: params.Body.DeploymentID, // readonly } qs := runtime.Values(params.HTTPRequest.URL.Query()) _, qhkDisableILMExpiryReplication, _ := qs.GetOK("disable-ilm-expiry-replication") _, qhkEnableILMExpiryReplication, _ := qs.GetOK("enable-ilm-expiry-replication") var opts madmin.SREditOptions if qhkDisableILMExpiryReplication { opts.DisableILMExpiryReplication = true } if qhkEnableILMExpiryReplication { opts.EnableILMExpiryReplication = true } eRes, err := client.editSiteReplicationInfo(ctx, *peerSiteInfo, opts) if err != nil { return nil, err } editRes := &models.PeerSiteEditResponse{ ErrorDetail: eRes.ErrDetail, Status: eRes.Status, Success: eRes.Success, } return editRes, nil } func removeSiteReplication(ctx context.Context, client MinioAdmin, params *siteRepApi.SiteReplicationRemoveParams) (info *models.PeerSiteRemoveResponse, err error) { delAll := params.Body.All siteNames := params.Body.Sites var req *madmin.SRRemoveReq if delAll { req = &madmin.SRRemoveReq{ RemoveAll: delAll, } } else { req = &madmin.SRRemoveReq{ SiteNames: siteNames, RemoveAll: delAll, } } rRes, err := client.deleteSiteReplicationInfo(ctx, *req) if err != nil { return nil, err } removeRes := &models.PeerSiteRemoveResponse{ ErrorDetail: rRes.ErrDetail, Status: rRes.Status, } return removeRes, nil } ================================================ FILE: api/admin_site_replication_test.go ================================================ // 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 . // These tests are for AdminAPI Tag based on swagger-console.yml package api import ( "context" "fmt" "testing" "github.com/minio/madmin-go/v3" "github.com/stretchr/testify/assert" ) func TestGetSiteReplicationInfo(t *testing.T) { assert := assert.New(t) // mock minIO client adminClient := AdminClientMock{} function := "getSiteReplicationInfo()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() retValueMock := madmin.SiteReplicationInfo{ Enabled: true, Name: "site1", Sites: []madmin.PeerInfo{ { Endpoint: "http://localhost:9000", Name: "site1", DeploymentID: "12345", }, { Endpoint: "http://localhost:9001", Name: "site2", DeploymentID: "123456", }, }, ServiceAccountAccessKey: "test-key", } expValueMock := &madmin.SiteReplicationInfo{ Enabled: true, Name: "site1", Sites: []madmin.PeerInfo{ { Endpoint: "http://localhost:9000", Name: "site1", DeploymentID: "12345", }, { Endpoint: "http://localhost:9001", Name: "site2", DeploymentID: "123456", }, }, ServiceAccountAccessKey: "test-key", } getSiteReplicationInfo = func(_ context.Context) (info *madmin.SiteReplicationInfo, err error) { return &retValueMock, nil } srInfo, err := adminClient.getSiteReplicationInfo(ctx) assert.Nil(err) assert.Equal(expValueMock, srInfo, fmt.Sprintf("Failed on %s: length of lists is not the same", function)) } func TestAddSiteReplicationInfo(t *testing.T) { assert := assert.New(t) // mock minIO client adminClient := AdminClientMock{} function := "addSiteReplicationInfo()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() retValueMock := &madmin.ReplicateAddStatus{ Success: true, Status: "success", ErrDetail: "", InitialSyncErrorMessage: "", } expValueMock := &madmin.ReplicateAddStatus{ Success: true, Status: "success", ErrDetail: "", InitialSyncErrorMessage: "", } addSiteReplicationInfo = func(_ context.Context, _ []madmin.PeerSite) (res *madmin.ReplicateAddStatus, err error) { return retValueMock, nil } sites := []madmin.PeerSite{ { Name: "site1", Endpoint: "http://localhost:9000", AccessKey: "test", SecretKey: "test", }, { Name: "site2", Endpoint: "http://localhost:9001", AccessKey: "test", SecretKey: "test", }, } srInfo, err := adminClient.addSiteReplicationInfo(ctx, sites, madmin.SRAddOptions{}) assert.Nil(err) assert.Equal(expValueMock, srInfo, fmt.Sprintf("Failed on %s: length of lists is not the same", function)) } func TestEditSiteReplicationInfo(t *testing.T) { assert := assert.New(t) // mock minIO client adminClient := AdminClientMock{} function := "editSiteReplicationInfo()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() retValueMock := &madmin.ReplicateEditStatus{ Success: true, Status: "success", ErrDetail: "", } expValueMock := &madmin.ReplicateEditStatus{ Success: true, Status: "success", ErrDetail: "", } editSiteReplicationInfo = func(_ context.Context, _ madmin.PeerInfo) (res *madmin.ReplicateEditStatus, err error) { return retValueMock, nil } site := madmin.PeerInfo{ Name: "", Endpoint: "", DeploymentID: "12345", } srInfo, err := adminClient.editSiteReplicationInfo(ctx, site, madmin.SREditOptions{}) assert.Nil(err) assert.Equal(expValueMock, srInfo, fmt.Sprintf("Failed on %s: length of lists is not the same", function)) } func TestDeleteSiteReplicationInfo(t *testing.T) { assert := assert.New(t) // mock minIO client adminClient := AdminClientMock{} function := "deleteSiteReplicationInfo()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() retValueMock := &madmin.ReplicateRemoveStatus{ Status: "success", ErrDetail: "", } expValueMock := &madmin.ReplicateRemoveStatus{ Status: "success", ErrDetail: "", } deleteSiteReplicationInfoMock = func(_ context.Context, _ madmin.SRRemoveReq) (res *madmin.ReplicateRemoveStatus, err error) { return retValueMock, nil } remReq := madmin.SRRemoveReq{ SiteNames: []string{ "test1", }, RemoveAll: false, } srInfo, err := adminClient.deleteSiteReplicationInfo(ctx, remReq) assert.Nil(err) assert.Equal(expValueMock, srInfo, fmt.Sprintf("Failed on %s: length of lists is not the same", function)) } func TestSiteReplicationStatus(t *testing.T) { assert := assert.New(t) // mock minIO client adminClient := AdminClientMock{} function := "getSiteReplicationStatus()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() retValueMock := madmin.SRStatusInfo{ Enabled: true, MaxBuckets: 0, MaxUsers: 0, MaxGroups: 0, MaxPolicies: 0, Sites: nil, StatsSummary: nil, BucketStats: nil, PolicyStats: nil, UserStats: nil, GroupStats: nil, } expValueMock := &madmin.SRStatusInfo{ Enabled: true, MaxBuckets: 0, MaxUsers: 0, MaxGroups: 0, MaxPolicies: 0, Sites: nil, StatsSummary: nil, BucketStats: nil, PolicyStats: nil, UserStats: nil, GroupStats: nil, } getSiteReplicationStatus = func(_ context.Context, _ madmin.SRStatusOptions) (info *madmin.SRStatusInfo, err error) { return &retValueMock, nil } reqValues := madmin.SRStatusOptions{ Buckets: true, Policies: true, Users: true, Groups: true, } srInfo, err := adminClient.getSiteReplicationStatus(ctx, reqValues) if err != nil { assert.Error(err) } assert.Equal(expValueMock, srInfo, fmt.Sprintf("Failed on %s: expected result is not same", function)) } ================================================ FILE: api/admin_speedtest.go ================================================ // 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 api import ( "context" "encoding/json" "fmt" "net/http" "strconv" "time" "github.com/dustin/go-humanize" "github.com/minio/madmin-go/v3" "github.com/minio/websocket" ) // getSpeedtesthOptionsFromReq gets duration, size & concurrent requests from a websocket // path come as : `/speedtest?duration=2h&size=12MiB&concurrent=10` func getSpeedtestOptionsFromReq(req *http.Request) (*madmin.SpeedtestOpts, error) { optionsSet := madmin.SpeedtestOpts{} queryPairs := req.URL.Query() paramDuration := queryPairs.Get("duration") if paramDuration == "" { paramDuration = "10s" } duration, err := time.ParseDuration(paramDuration) if err != nil { return nil, fmt.Errorf("unable to parse duration: %s", paramDuration) } if duration <= 0 { return nil, fmt.Errorf("duration cannot be 0 or negative") } optionsSet.Duration = duration paramSize := queryPairs.Get("size") if paramSize == "" { paramSize = "64MiB" } size, err := humanize.ParseBytes(paramSize) if err != nil { return nil, fmt.Errorf("unable to parse object size") } optionsSet.Size = int(size) paramConcurrent := queryPairs.Get("concurrent") if paramConcurrent == "" { paramConcurrent = "32" } concurrent, err := strconv.Atoi(paramConcurrent) if err != nil { return nil, fmt.Errorf("invalid concurrent value: %s", paramConcurrent) } if concurrent <= 0 { return nil, fmt.Errorf("concurrency cannot be '0' or negative") } optionsSet.Concurrency = concurrent autotune := queryPairs.Get("autotune") if autotune == "true" { optionsSet.Autotune = true } return &optionsSet, nil } func startSpeedtest(ctx context.Context, conn WSConn, client MinioAdmin, speedtestOpts *madmin.SpeedtestOpts) error { speedtestRes, err := client.speedtest(ctx, *speedtestOpts) if err != nil { LogError("error initializing speedtest: %v", err) return err } for result := range speedtestRes { // Serializing message bytes, err := json.Marshal(result) if err != nil { LogError("error serializing json: %v", err) return err } // Send Message through websocket connection err = conn.writeMessage(websocket.TextMessage, bytes) if err != nil { LogError("error writing speedtest response: %v", err) return err } } return nil } ================================================ FILE: api/admin_tiers.go ================================================ // 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 api import ( "context" "encoding/base64" "strconv" "github.com/dustin/go-humanize" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" tieringApi "github.com/minio/console/api/operations/tiering" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" ) func registerAdminTiersHandlers(api *operations.ConsoleAPI) { // return a list of notification endpoints api.TieringTiersListHandler = tieringApi.TiersListHandlerFunc(func(params tieringApi.TiersListParams, session *models.Principal) middleware.Responder { tierList, err := getTiersResponse(session, params) if err != nil { return tieringApi.NewTiersListDefault(err.Code).WithPayload(err.APIError) } return tieringApi.NewTiersListOK().WithPayload(tierList) }) api.TieringTiersListNamesHandler = tieringApi.TiersListNamesHandlerFunc(func(params tieringApi.TiersListNamesParams, session *models.Principal) middleware.Responder { tierList, err := getTiersNameResponse(session, params) if err != nil { return tieringApi.NewTiersListDefault(err.Code).WithPayload(err.APIError) } return tieringApi.NewTiersListNamesOK().WithPayload(tierList) }) // add a new tiers api.TieringAddTierHandler = tieringApi.AddTierHandlerFunc(func(params tieringApi.AddTierParams, session *models.Principal) middleware.Responder { err := getAddTierResponse(session, params) if err != nil { return tieringApi.NewAddTierDefault(err.Code).WithPayload(err.APIError) } return tieringApi.NewAddTierCreated() }) // get a tier api.TieringGetTierHandler = tieringApi.GetTierHandlerFunc(func(params tieringApi.GetTierParams, session *models.Principal) middleware.Responder { notifEndpoints, err := getGetTierResponse(session, params) if err != nil { return tieringApi.NewGetTierDefault(err.Code).WithPayload(err.APIError) } return tieringApi.NewGetTierOK().WithPayload(notifEndpoints) }) // edit credentials for a tier api.TieringEditTierCredentialsHandler = tieringApi.EditTierCredentialsHandlerFunc(func(params tieringApi.EditTierCredentialsParams, session *models.Principal) middleware.Responder { err := getEditTierCredentialsResponse(session, params) if err != nil { return tieringApi.NewEditTierCredentialsDefault(err.Code).WithPayload(err.APIError) } return tieringApi.NewEditTierCredentialsOK() }) // remove an empty tier api.TieringRemoveTierHandler = tieringApi.RemoveTierHandlerFunc(func(params tieringApi.RemoveTierParams, session *models.Principal) middleware.Responder { err := getRemoveTierResponse(session, params) if err != nil { return tieringApi.NewRemoveTierDefault(err.Code).WithPayload(err.APIError) } return tieringApi.NewRemoveTierNoContent() }) } // getTiers returns a list of tiers with their stats func getTiers(ctx context.Context, client MinioAdmin) (*models.TierListResponse, error) { tiers, err := client.listTiers(ctx) if err != nil { return nil, err } tierStatsInfo, err := client.tierStats(ctx) if err != nil { return nil, err } tiersStatsMap := make(map[string]madmin.TierStats, len(tierStatsInfo)) for _, stat := range tierStatsInfo { tiersStatsMap[stat.Name] = stat.Stats } var tiersList []*models.Tier for _, tierData := range tiers { // Default Tier Stats tierStats := madmin.TierStats{ NumObjects: 0, NumVersions: 0, TotalSize: 0, } if stats, ok := tiersStatsMap[tierData.Name]; ok { tierStats = stats } status := client.verifyTierStatus(ctx, tierData.Name) == nil switch tierData.Type { case madmin.S3: tiersList = append(tiersList, &models.Tier{ Type: models.TierTypeS3, S3: &models.TierS3{ Accesskey: tierData.S3.AccessKey, Bucket: tierData.S3.Bucket, Endpoint: tierData.S3.Endpoint, Name: tierData.Name, Prefix: tierData.S3.Prefix, Region: tierData.S3.Region, Secretkey: tierData.S3.SecretKey, Storageclass: tierData.S3.StorageClass, Usage: humanize.IBytes(tierStats.TotalSize), Objects: strconv.Itoa(tierStats.NumObjects), Versions: strconv.Itoa(tierStats.NumVersions), }, Status: status, }) case madmin.MinIO: tiersList = append(tiersList, &models.Tier{ Type: models.TierTypeMinio, Minio: &models.TierMinio{ Accesskey: tierData.MinIO.AccessKey, Bucket: tierData.MinIO.Bucket, Endpoint: tierData.MinIO.Endpoint, Name: tierData.Name, Prefix: tierData.MinIO.Prefix, Region: tierData.MinIO.Region, Secretkey: tierData.MinIO.SecretKey, Usage: humanize.IBytes(tierStats.TotalSize), Objects: strconv.Itoa(tierStats.NumObjects), Versions: strconv.Itoa(tierStats.NumVersions), }, Status: status, }) case madmin.GCS: tiersList = append(tiersList, &models.Tier{ Type: models.TierTypeGcs, Gcs: &models.TierGcs{ Bucket: tierData.GCS.Bucket, Creds: tierData.GCS.Creds, Endpoint: tierData.GCS.Endpoint, Name: tierData.Name, Prefix: tierData.GCS.Prefix, Region: tierData.GCS.Region, Usage: humanize.IBytes(tierStats.TotalSize), Objects: strconv.Itoa(tierStats.NumObjects), Versions: strconv.Itoa(tierStats.NumVersions), }, Status: status, }) case madmin.Azure: tiersList = append(tiersList, &models.Tier{ Type: models.TierTypeAzure, Azure: &models.TierAzure{ Accountkey: tierData.Azure.AccountKey, Accountname: tierData.Azure.AccountName, Bucket: tierData.Azure.Bucket, Endpoint: tierData.Azure.Endpoint, Name: tierData.Name, Prefix: tierData.Azure.Prefix, Region: tierData.Azure.Region, Usage: humanize.IBytes(tierStats.TotalSize), Objects: strconv.Itoa(tierStats.NumObjects), Versions: strconv.Itoa(tierStats.NumVersions), }, Status: status, }) case madmin.Unsupported: tiersList = append(tiersList, &models.Tier{ Type: models.TierTypeUnsupported, Status: status, }) } } // build response return &models.TierListResponse{ Items: tiersList, }, nil } // getTiersResponse returns a response with a list of tiers func getTiersResponse(session *models.Principal, params tieringApi.TiersListParams) (*models.TierListResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // serialize output tiersResp, err := getTiers(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } return tiersResp, nil } // getTiersNameResponse returns a response with a list of tiers' names func getTiersNameResponse(session *models.Principal, params tieringApi.TiersListNamesParams) (*models.TiersNameListResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // serialize output tiersResp, err := getTiersName(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } return tiersResp, nil } // getTiersName fetches listTiers and returns a list of the tiers' names func getTiersName(ctx context.Context, client MinioAdmin) (*models.TiersNameListResponse, error) { tiers, err := client.listTiers(ctx) if err != nil { return nil, err } tiersNameList := make([]string, len(tiers)) for i, tierData := range tiers { tiersNameList[i] = tierData.Name } return &models.TiersNameListResponse{ Items: tiersNameList, }, nil } func addTier(ctx context.Context, client MinioAdmin, params *tieringApi.AddTierParams) error { var cfg *madmin.TierConfig var err error switch params.Body.Type { case models.TierTypeS3: cfg, err = madmin.NewTierS3( params.Body.S3.Name, params.Body.S3.Accesskey, params.Body.S3.Secretkey, params.Body.S3.Bucket, madmin.S3Region(params.Body.S3.Region), madmin.S3Prefix(params.Body.S3.Prefix), madmin.S3Endpoint(params.Body.S3.Endpoint), madmin.S3StorageClass(params.Body.S3.Storageclass), ) if err != nil { return err } case models.TierTypeMinio: cfg, err = madmin.NewTierMinIO( params.Body.Minio.Name, params.Body.Minio.Endpoint, params.Body.Minio.Accesskey, params.Body.Minio.Secretkey, params.Body.Minio.Bucket, madmin.MinIORegion(params.Body.Minio.Region), madmin.MinIOPrefix(params.Body.Minio.Prefix), ) if err != nil { return err } case models.TierTypeGcs: gcsOpts := []madmin.GCSOptions{} prefix := params.Body.Gcs.Prefix if prefix != "" { gcsOpts = append(gcsOpts, madmin.GCSPrefix(prefix)) } region := params.Body.Gcs.Region if region != "" { gcsOpts = append(gcsOpts, madmin.GCSRegion(region)) } base64Text := make([]byte, base64.StdEncoding.EncodedLen(len(params.Body.Gcs.Creds))) l, _ := base64.StdEncoding.Decode(base64Text, []byte(params.Body.Gcs.Creds)) cfg, err = madmin.NewTierGCS( params.Body.Gcs.Name, base64Text[:l], params.Body.Gcs.Bucket, gcsOpts..., ) if err != nil { return err } case models.TierTypeAzure: cfg, err = madmin.NewTierAzure( params.Body.Azure.Name, params.Body.Azure.Accountname, params.Body.Azure.Accountkey, params.Body.Azure.Bucket, madmin.AzurePrefix(params.Body.Azure.Prefix), madmin.AzureEndpoint(params.Body.Azure.Endpoint), madmin.AzureRegion(params.Body.Azure.Region), ) if err != nil { return err } case models.TierTypeUnsupported: cfg = &madmin.TierConfig{ Type: madmin.Unsupported, } } err = client.addTier(ctx, cfg) if err != nil { return err } return nil } // getAddTierResponse returns the response of admin tier func getAddTierResponse(session *models.Principal, params tieringApi.AddTierParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // serialize output errTier := addTier(ctx, adminClient, ¶ms) if errTier != nil { return ErrorWithContext(ctx, errTier) } return nil } func getTier(ctx context.Context, client MinioAdmin, params *tieringApi.GetTierParams) (*models.Tier, error) { tiers, err := client.listTiers(ctx) if err != nil { return nil, err } for i := range tiers { switch tiers[i].Type { case madmin.S3: if params.Type != models.TierTypeS3 || tiers[i].Name != params.Name { continue } return &models.Tier{ Type: models.TierTypeS3, S3: &models.TierS3{ Accesskey: tiers[i].S3.AccessKey, Bucket: tiers[i].S3.Bucket, Endpoint: tiers[i].S3.Endpoint, Name: tiers[i].Name, Prefix: tiers[i].S3.Prefix, Region: tiers[i].S3.Region, Secretkey: tiers[i].S3.SecretKey, Storageclass: tiers[i].S3.StorageClass, }, }, err case madmin.GCS: if params.Type != models.TierTypeGcs || tiers[i].Name != params.Name { continue } return &models.Tier{ Type: models.TierTypeGcs, Gcs: &models.TierGcs{ Bucket: tiers[i].GCS.Bucket, Creds: tiers[i].GCS.Creds, Endpoint: tiers[i].GCS.Endpoint, Name: tiers[i].Name, Prefix: tiers[i].GCS.Prefix, Region: tiers[i].GCS.Region, }, }, nil case madmin.Azure: if params.Type != models.TierTypeAzure || tiers[i].Name != params.Name { continue } return &models.Tier{ Type: models.TierTypeAzure, Azure: &models.TierAzure{ Accountkey: tiers[i].Azure.AccountKey, Accountname: tiers[i].Azure.AccountName, Bucket: tiers[i].Azure.Bucket, Endpoint: tiers[i].Azure.Endpoint, Name: tiers[i].Name, Prefix: tiers[i].Azure.Prefix, Region: tiers[i].Azure.Region, }, }, nil } } // build response return nil, ErrNotFound } // getGetTierResponse returns a tier func getGetTierResponse(session *models.Principal, params tieringApi.GetTierParams) (*models.Tier, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // serialize output addTierResp, err := getTier(ctx, adminClient, ¶ms) if err != nil { return nil, ErrorWithContext(ctx, err) } return addTierResp, nil } func editTierCredentials(ctx context.Context, client MinioAdmin, params *tieringApi.EditTierCredentialsParams) error { base64Text := make([]byte, base64.StdEncoding.EncodedLen(len(params.Body.Creds))) l, err := base64.StdEncoding.Decode(base64Text, []byte(params.Body.Creds)) if err != nil { return err } creds := madmin.TierCreds{ AccessKey: params.Body.AccessKey, SecretKey: params.Body.SecretKey, CredsJSON: base64Text[:l], } return client.editTierCreds(ctx, params.Name, creds) } // getEditTierCredentialsResponse returns the result of editing credentials for a tier func getEditTierCredentialsResponse(session *models.Principal, params tieringApi.EditTierCredentialsParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // serialize output err = editTierCredentials(ctx, adminClient, ¶ms) if err != nil { return ErrorWithContext(ctx, err) } return nil } func removeTier(ctx context.Context, client MinioAdmin, params *tieringApi.RemoveTierParams) error { return client.removeTier(ctx, params.Name) } func getRemoveTierResponse(session *models.Principal, params tieringApi.RemoveTierParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // serialize output err = removeTier(ctx, adminClient, ¶ms) if err != nil { return ErrorWithContext(ctx, err) } return nil } ================================================ FILE: api/admin_tiers_test.go ================================================ // 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 api import ( "context" "errors" "fmt" "testing" tieringApi "github.com/minio/console/api/operations/tiering" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" "github.com/stretchr/testify/assert" ) func TestGetTiers(t *testing.T) { assert := assert.New(t) // mock minIO client adminClient := AdminClientMock{} function := "getTiers()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : getTiers() get list of tiers // mock lifecycle response from MinIO returnListMock := []*madmin.TierConfig{ { Version: "V1", Type: madmin.S3, Name: "S3 Tier", S3: &madmin.TierS3{ Endpoint: "https://s3tier.test.com/", AccessKey: "Access Key", SecretKey: "Secret Key", Bucket: "buckets3", Prefix: "pref1", Region: "us-west-1", StorageClass: "TT1", }, }, { Version: "V1", Type: madmin.MinIO, Name: "MinIO Tier", MinIO: &madmin.TierMinIO{ Endpoint: "https://minio-endpoint.test.com/", AccessKey: "access", SecretKey: "secret", Bucket: "somebucket", Prefix: "p1", Region: "us-east-2", }, }, } returnStatsMock := []madmin.TierInfo{ { Name: "STANDARD", Type: "internal", Stats: madmin.TierStats{NumObjects: 2, NumVersions: 2, TotalSize: 228915}, }, { Name: "MinIO Tier", Type: "internal", Stats: madmin.TierStats{NumObjects: 10, NumVersions: 3, TotalSize: 132788}, }, { Name: "S3 Tier", Type: "s3", Stats: madmin.TierStats{NumObjects: 0, NumVersions: 0, TotalSize: 0}, }, } expectedOutput := &models.TierListResponse{ Items: []*models.Tier{ { Type: models.TierTypeS3, S3: &models.TierS3{ Accesskey: "Access Key", Secretkey: "Secret Key", Bucket: "buckets3", Endpoint: "https://s3tier.test.com/", Name: "S3 Tier", Prefix: "pref1", Region: "us-west-1", Storageclass: "TT1", Usage: "0 B", Objects: "0", Versions: "0", }, Status: false, }, { Type: models.TierTypeMinio, Minio: &models.TierMinio{ Accesskey: "access", Secretkey: "secret", Bucket: "somebucket", Endpoint: "https://minio-endpoint.test.com/", Name: "MinIO Tier", Prefix: "p1", Region: "us-east-2", Usage: "130 KiB", Objects: "10", Versions: "3", }, Status: false, }, }, } minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) { return returnListMock, nil } minioTierStatsMock = func(_ context.Context) ([]madmin.TierInfo, error) { return returnStatsMock, nil } minioVerifyTierStatusMock = func(_ context.Context, _ string) error { return fmt.Errorf("someerror") } tiersList, err := getTiers(ctx, adminClient) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of tiers list is correct assert.Equal(len(tiersList.Items), len(returnListMock), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) assert.Equal(expectedOutput, tiersList) // Test-2 : getTiers() list is empty returnListMockT2 := []*madmin.TierConfig{} minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) { return returnListMockT2, nil } tiersListT2, err := getTiers(ctx, adminClient) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } if len(tiersListT2.Items) != 0 { t.Errorf("Failed on %s:, returned list was not empty", function) } } func TestGetTiersName(t *testing.T) { assert := assert.New(t) // mock minIO client adminClient := AdminClientMock{} function := "getTiersName()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : getTiersName() get list tiers' names // mock lifecycle response from MinIO returnListMock := []*madmin.TierConfig{ { Version: "V1", Type: madmin.S3, Name: "S3 Tier", S3: &madmin.TierS3{ Endpoint: "https://s3tier.test.com/", AccessKey: "Access Key", SecretKey: "Secret Key", Bucket: "buckets3", Prefix: "pref1", Region: "us-west-1", StorageClass: "TT1", }, }, { Version: "V1", Type: madmin.MinIO, Name: "MinIO Tier", MinIO: &madmin.TierMinIO{ Endpoint: "https://minio-endpoint.test.com/", AccessKey: "access", SecretKey: "secret", Bucket: "somebucket", Prefix: "p1", Region: "us-east-2", }, }, } expectedOutput := &models.TiersNameListResponse{ Items: []string{"S3 Tier", "MinIO Tier"}, } minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) { return returnListMock, nil } tiersList, err := getTiersName(ctx, adminClient) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of tiers list is correct assert.Equal(len(tiersList.Items), len(returnListMock), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) assert.Equal(expectedOutput, tiersList) // Test-2 : getTiersName() list is empty returnListMockT2 := []*madmin.TierConfig{} minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) { return returnListMockT2, nil } emptyTierList, err := getTiersName(ctx, adminClient) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } if len(emptyTierList.Items) != 0 { t.Errorf("Failed on %s:, returned list was not empty", function) } } func TestAddTier(t *testing.T) { assert := assert.New(t) // mock minIO client adminClient := AdminClientMock{} function := "addTier()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1: addTier() add new Tier minioAddTiersMock = func(_ context.Context, _ *madmin.TierConfig) error { return nil } paramsToAdd := tieringApi.AddTierParams{ Body: &models.Tier{ Type: "S3", S3: &models.TierS3{ Accesskey: "TestAK", Bucket: "bucket1", Endpoint: "https://test.com/", Name: "TIERS3", Prefix: "Pr1", Region: "us-west-1", Secretkey: "SecretK", Storageclass: "STCLASS", }, }, } err := addTier(ctx, adminClient, ¶msToAdd) assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) // Test-2: addTier() error adding Tier minioAddTiersMock = func(_ context.Context, _ *madmin.TierConfig) error { return errors.New("error setting new tier") } err2 := addTier(ctx, adminClient, ¶msToAdd) assert.Equal(errors.New("error setting new tier"), err2, fmt.Sprintf("Failed on %s: Error returned", function)) } func TestUpdateTierCreds(t *testing.T) { assert := assert.New(t) // mock minIO client adminClient := AdminClientMock{} function := "editTierCredentials()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1: editTierCredentials() update Tier configuration minioEditTiersMock = func(_ context.Context, _ string, _ madmin.TierCreds) error { return nil } params := &tieringApi.EditTierCredentialsParams{ Name: "TESTTIER", Body: &models.TierCredentialsRequest{ AccessKey: "New Key", SecretKey: "Secret Key", }, } err := editTierCredentials(ctx, adminClient, params) assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) // Test-2: editTierCredentials() update Tier configuration failure minioEditTiersMock = func(_ context.Context, _ string, _ madmin.TierCreds) error { return errors.New("error message") } errT2 := editTierCredentials(ctx, adminClient, params) assert.Equal(errors.New("error message"), errT2, fmt.Sprintf("Failed on %s: Error returned", function)) } ================================================ FILE: api/admin_trace.go ================================================ // 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 api import ( "context" "encoding/json" "net/http" "strings" "time" "github.com/minio/madmin-go/v3" "github.com/minio/websocket" ) // shortTraceMsg Short trace record type shortTraceMsg struct { Host string `json:"host"` Time string `json:"time"` Client string `json:"client"` CallStats callStats `json:"callStats"` FuncName string `json:"api"` Path string `json:"path"` Query string `json:"query"` StatusCode int `json:"statusCode"` StatusMsg string `json:"statusMsg"` } type callStats struct { Rx int `json:"rx"` Tx int `json:"tx"` Duration string `json:"duration"` Ttfb string `json:"timeToFirstByte"` } // trace filters func matchTrace(opts TraceRequest, traceInfo madmin.ServiceTraceInfo) bool { statusCode := int(opts.statusCode) method := opts.method funcName := opts.funcName apiPath := opts.path if statusCode == 0 && method == "" && funcName == "" && apiPath == "" { // no specific filtering found trace all the requests return true } // Filter request path if passed by the user if apiPath != "" { pathToLookup := strings.ToLower(apiPath) pathFromTrace := strings.ToLower(traceInfo.Trace.Path) return strings.Contains(pathFromTrace, pathToLookup) } // Filter response status codes if passed by the user if statusCode > 0 && traceInfo.Trace.HTTP != nil { statusCodeFromTrace := traceInfo.Trace.HTTP.RespInfo.StatusCode return statusCodeFromTrace == statusCode } // Filter request method if passed by the user if method != "" && traceInfo.Trace.HTTP != nil { methodFromTrace := traceInfo.Trace.HTTP.ReqInfo.Method return methodFromTrace == method } if funcName != "" { funcToLookup := strings.ToLower(funcName) funcFromTrace := strings.ToLower(traceInfo.Trace.FuncName) return strings.Contains(funcFromTrace, funcToLookup) } return true } // startTraceInfo starts trace of the servers func startTraceInfo(ctx context.Context, conn WSConn, client MinioAdmin, opts TraceRequest) error { // Start listening on all trace activity. traceCh := client.serviceTrace(ctx, opts.threshold, opts.s3, opts.internal, opts.storage, opts.os, opts.onlyErrors) for { select { case <-ctx.Done(): return nil case traceInfo, ok := <-traceCh: // zero value returned because the channel is closed and empty if !ok { return nil } if traceInfo.Err != nil { LogError("error on serviceTrace: %v", traceInfo.Err) return traceInfo.Err } if matchTrace(opts, traceInfo) { // Serialize message to be sent traceInfoBytes, err := json.Marshal(shortTrace(&traceInfo)) if err != nil { LogError("error on json.Marshal: %v", err) return err } // Send Message through websocket connection err = conn.writeMessage(websocket.TextMessage, traceInfoBytes) if err != nil { LogError("error writeMessage: %v", err) return err } } } } } // shortTrace creates a shorter Trace Info message. // Same implementation as github/minio/mc/cmd/admin-trace.go func shortTrace(info *madmin.ServiceTraceInfo) shortTraceMsg { t := info.Trace s := shortTraceMsg{} s.Time = t.Time.Format(time.RFC3339) s.Path = t.Path s.FuncName = t.FuncName s.CallStats.Duration = t.Duration.String() if info.Trace.HTTP != nil { s.Query = t.HTTP.ReqInfo.RawQuery s.StatusCode = t.HTTP.RespInfo.StatusCode s.StatusMsg = http.StatusText(t.HTTP.RespInfo.StatusCode) s.CallStats.Rx = t.HTTP.CallStats.InputBytes s.CallStats.Tx = t.HTTP.CallStats.OutputBytes s.CallStats.Ttfb = t.HTTP.CallStats.TimeToFirstByte.String() if host, ok := t.HTTP.ReqInfo.Headers["Host"]; ok { s.Host = strings.Join(host, "") } s.Client = t.HTTP.ReqInfo.Client } return s } ================================================ FILE: api/admin_trace_test.go ================================================ // 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 api import ( "context" "encoding/json" "fmt" "testing" "github.com/minio/madmin-go/v3" "github.com/stretchr/testify/assert" ) func TestAdminTrace(t *testing.T) { assert := assert.New(t) adminClient := AdminClientMock{} mockWSConn := mockConn{} function := "startTraceInfo(ctx, )" ctx, cancel := context.WithCancel(context.Background()) defer cancel() testReceiver := make(chan shortTraceMsg, 5) textToReceive := "test" testStreamSize := 5 isClosed := false // testReceiver is closed? // Test-1: Serve Trace with no errors until trace finishes sending // define mock function behavior for minio server Trace minioServiceTraceMock = func(_ context.Context, _ int64, _, _, _, _, _ bool) <-chan madmin.ServiceTraceInfo { ch := make(chan madmin.ServiceTraceInfo) // Only success, start a routine to start reading line by line. go func(ch chan<- madmin.ServiceTraceInfo) { defer close(ch) lines := make([]int, testStreamSize) // mocking sending 5 lines of info for range lines { info := madmin.TraceInfo{ FuncName: textToReceive, } ch <- madmin.ServiceTraceInfo{Trace: info} } }(ch) return ch } writesCount := 1 // mock connection WriteMessage() no error connWriteMessageMock = func(_ int, data []byte) error { // emulate that receiver gets the message written var t shortTraceMsg _ = json.Unmarshal(data, &t) if writesCount == testStreamSize { // for testing we need to close the receiver channel if !isClosed { close(testReceiver) isClosed = true } return nil } testReceiver <- t writesCount++ return nil } if err := startTraceInfo(ctx, mockWSConn, adminClient, TraceRequest{s3: true, internal: true, storage: true, os: true, onlyErrors: false}); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // check that the TestReceiver got the same number of data from trace. for i := range testReceiver { assert.Equal(textToReceive, i.FuncName) } // Test-2: if error happens while writing, return error connWriteMessageMock = func(_ int, _ []byte) error { return fmt.Errorf("error on write") } if err := startTraceInfo(ctx, mockWSConn, adminClient, TraceRequest{}); assert.Error(err) { assert.Equal("error on write", err.Error()) } // Test-3: error happens on serviceTrace Minio, trace should stop // and error shall be returned. minioServiceTraceMock = func(_ context.Context, _ int64, _, _, _, _, _ bool) <-chan madmin.ServiceTraceInfo { ch := make(chan madmin.ServiceTraceInfo) // Only success, start a routine to start reading line by line. go func(ch chan<- madmin.ServiceTraceInfo) { defer close(ch) lines := make([]int, 2) // mocking sending 5 lines of info for range lines { info := madmin.TraceInfo{ NodeName: "test", } ch <- madmin.ServiceTraceInfo{Trace: info} } ch <- madmin.ServiceTraceInfo{Err: fmt.Errorf("error on trace")} }(ch) return ch } connWriteMessageMock = func(_ int, _ []byte) error { return nil } if err := startTraceInfo(ctx, mockWSConn, adminClient, TraceRequest{}); assert.Error(err) { assert.Equal("error on trace", err.Error()) } } ================================================ FILE: api/admin_users.go ================================================ // 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 api import ( "context" "fmt" "sort" "strings" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" accountApi "github.com/minio/console/api/operations/account" bucketApi "github.com/minio/console/api/operations/bucket" userApi "github.com/minio/console/api/operations/user" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" iampolicy "github.com/minio/pkg/v3/policy" ) // Policy evaluated constants const ( Unknown = 0 Allow = 1 Deny = -1 ) func registerUsersHandlers(api *operations.ConsoleAPI) { // List Users api.UserListUsersHandler = userApi.ListUsersHandlerFunc(func(params userApi.ListUsersParams, session *models.Principal) middleware.Responder { listUsersResponse, err := getListUsersResponse(session, params) if err != nil { return userApi.NewListUsersDefault(err.Code).WithPayload(err.APIError) } return userApi.NewListUsersOK().WithPayload(listUsersResponse) }) // Add User api.UserAddUserHandler = userApi.AddUserHandlerFunc(func(params userApi.AddUserParams, session *models.Principal) middleware.Responder { userResponse, err := getUserAddResponse(session, params) if err != nil { return userApi.NewAddUserDefault(err.Code).WithPayload(err.APIError) } return userApi.NewAddUserCreated().WithPayload(userResponse) }) // Remove User api.UserRemoveUserHandler = userApi.RemoveUserHandlerFunc(func(params userApi.RemoveUserParams, session *models.Principal) middleware.Responder { err := getRemoveUserResponse(session, params) if err != nil { return userApi.NewRemoveUserDefault(err.Code).WithPayload(err.APIError) } return userApi.NewRemoveUserNoContent() }) // Update User-Groups api.UserUpdateUserGroupsHandler = userApi.UpdateUserGroupsHandlerFunc(func(params userApi.UpdateUserGroupsParams, session *models.Principal) middleware.Responder { userUpdateResponse, err := getUpdateUserGroupsResponse(session, params) if err != nil { return userApi.NewUpdateUserGroupsDefault(err.Code).WithPayload(err.APIError) } return userApi.NewUpdateUserGroupsOK().WithPayload(userUpdateResponse) }) // Get User api.UserGetUserInfoHandler = userApi.GetUserInfoHandlerFunc(func(params userApi.GetUserInfoParams, session *models.Principal) middleware.Responder { userInfoResponse, err := getUserInfoResponse(session, params) if err != nil { return userApi.NewGetUserInfoDefault(err.Code).WithPayload(err.APIError) } return userApi.NewGetUserInfoOK().WithPayload(userInfoResponse) }) // Update User api.UserUpdateUserInfoHandler = userApi.UpdateUserInfoHandlerFunc(func(params userApi.UpdateUserInfoParams, session *models.Principal) middleware.Responder { userUpdateResponse, err := getUpdateUserResponse(session, params) if err != nil { return userApi.NewUpdateUserInfoDefault(err.Code).WithPayload(err.APIError) } return userApi.NewUpdateUserInfoOK().WithPayload(userUpdateResponse) }) // Update User-Groups Bulk api.UserBulkUpdateUsersGroupsHandler = userApi.BulkUpdateUsersGroupsHandlerFunc(func(params userApi.BulkUpdateUsersGroupsParams, session *models.Principal) middleware.Responder { err := getAddUsersListToGroupsResponse(session, params) if err != nil { return userApi.NewBulkUpdateUsersGroupsDefault(err.Code).WithPayload(err.APIError) } return userApi.NewBulkUpdateUsersGroupsOK() }) api.BucketListUsersWithAccessToBucketHandler = bucketApi.ListUsersWithAccessToBucketHandlerFunc(func(params bucketApi.ListUsersWithAccessToBucketParams, session *models.Principal) middleware.Responder { response, err := getListUsersWithAccessToBucketResponse(session, params) if err != nil { return bucketApi.NewListUsersWithAccessToBucketDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewListUsersWithAccessToBucketOK().WithPayload(response) }) // Change User Password api.AccountChangeUserPasswordHandler = accountApi.ChangeUserPasswordHandlerFunc(func(params accountApi.ChangeUserPasswordParams, session *models.Principal) middleware.Responder { err := getChangeUserPasswordResponse(session, params) if err != nil { return accountApi.NewChangeUserPasswordDefault(err.Code).WithPayload(err.APIError) } return accountApi.NewChangeUserPasswordCreated() }) // Check number of Service Accounts for listed users api.UserCheckUserServiceAccountsHandler = userApi.CheckUserServiceAccountsHandlerFunc(func(params userApi.CheckUserServiceAccountsParams, session *models.Principal) middleware.Responder { userSAList, err := getCheckUserSAResponse(session, params) if err != nil { return userApi.NewCheckUserServiceAccountsDefault(err.Code).WithPayload(err.APIError) } return userApi.NewCheckUserServiceAccountsOK().WithPayload(userSAList) }) } func listUsers(ctx context.Context, client MinioAdmin) ([]*models.User, error) { // Get list of all users in the MinIO // This call requires explicit authentication, no anonymous requests are // allowed for listing users. userMap, err := client.listUsers(ctx) if err != nil { return []*models.User{}, err } var users []*models.User for accessKey, user := range userMap { userElem := &models.User{ AccessKey: accessKey, Status: string(user.Status), Policy: strings.Split(user.PolicyName, ","), MemberOf: user.MemberOf, } users = append(users, userElem) } return users, nil } // getListUsersResponse performs listUsers() and serializes it to the handler's output func getListUsersResponse(session *models.Principal, params userApi.ListUsersParams) (*models.ListUsersResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} users, err := listUsers(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } // serialize output listUsersResponse := &models.ListUsersResponse{ Users: users, } return listUsersResponse, nil } // addUser invokes adding a users on `MinioAdmin` and builds the response `models.User` func addUser(ctx context.Context, client MinioAdmin, accessKey, secretKey *string, groups []string, policies []string) (*models.User, error) { // Calls into MinIO to add a new user if there's an errors return it if err := client.addUser(ctx, *accessKey, *secretKey); err != nil { return nil, err } // set groups for the newly created user var userWithGroups *models.User if len(groups) > 0 { var errUG error userWithGroups, errUG = updateUserGroups(ctx, client, *accessKey, groups) if errUG != nil { return nil, errUG } } // set policies for the newly created user if len(policies) > 0 { policyString := strings.Join(policies, ",") if err := SetPolicy(ctx, client, policyString, *accessKey, "user"); err != nil { return nil, err } } memberOf := []string{} status := "enabled" if userWithGroups != nil { memberOf = userWithGroups.MemberOf status = userWithGroups.Status } userRet := &models.User{ AccessKey: *accessKey, MemberOf: memberOf, Policy: policies, Status: status, } return userRet, nil } func getUserAddResponse(session *models.Principal, params userApi.AddUserParams) (*models.User, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} var userExists bool _, err = adminClient.getUserInfo(ctx, *params.Body.AccessKey) userExists = err == nil if userExists { return nil, ErrorWithContext(ctx, ErrNonUniqueAccessKey) } user, err := addUser( ctx, adminClient, params.Body.AccessKey, params.Body.SecretKey, params.Body.Groups, params.Body.Policies, ) if err != nil { return nil, ErrorWithContext(ctx, err) } return user, nil } // removeUser invokes removing an user on `MinioAdmin`, then we return the response from API func removeUser(ctx context.Context, client MinioAdmin, accessKey string) error { return client.removeUser(ctx, accessKey) } func getRemoveUserResponse(session *models.Principal, params userApi.RemoveUserParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } if session.AccountAccessKey == params.Name { return ErrorWithContext(ctx, ErrAvoidSelfAccountDelete) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} if err := removeUser(ctx, adminClient, params.Name); err != nil { return ErrorWithContext(ctx, err) } return nil } // getUserInfo calls MinIO server get the User Information func getUserInfo(ctx context.Context, client MinioAdmin, accessKey string) (*madmin.UserInfo, error) { userInfo, err := client.getUserInfo(ctx, accessKey) if err != nil { return nil, err } return &userInfo, nil } func getUserInfoResponse(session *models.Principal, params userApi.GetUserInfoParams) (*models.User, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} user, err := getUserInfo(ctx, adminClient, params.Name) if err != nil { // User doesn't exist, return 404 if madmin.ToErrorResponse(err).Code == "XMinioAdminNoSuchUser" { errorCode := 404 errorMessage := "User doesn't exist" return nil, &CodedAPIError{Code: errorCode, APIError: &models.APIError{Message: errorMessage, DetailedMessage: err.Error()}} } return nil, ErrorWithContext(ctx, err) } var policies []string if user.PolicyName == "" { policies = []string{} } else { policies = strings.Split(user.PolicyName, ",") } hasPolicy := true if len(policies) == 0 { hasPolicy = false for i := 0; i < len(user.MemberOf); i++ { group, err := adminClient.getGroupDescription(ctx, user.MemberOf[i]) if err != nil { continue } if group.Policy != "" { hasPolicy = true break } } } userInformation := &models.User{ AccessKey: params.Name, MemberOf: user.MemberOf, Policy: policies, Status: string(user.Status), HasPolicy: hasPolicy, } return userInformation, nil } // updateUserGroups invokes getUserInfo() to get the old groups from the user, // then we merge the list with the new groups list to have a shorter iteration between groups and we do a comparison between the current and old groups. // We delete or update the groups according the location in each list and send the user with the new groups from `MinioAdmin` to the client func updateUserGroups(ctx context.Context, client MinioAdmin, user string, groupsToAssign []string) (*models.User, error) { parallelUserUpdate := func(groupName string, originGroups []string) chan error { chProcess := make(chan error) go func() error { defer close(chProcess) // Compare if groupName is in the arrays isGroupPersistent := IsElementInArray(groupsToAssign, groupName) isInOriginGroups := IsElementInArray(originGroups, groupName) if isGroupPersistent && isInOriginGroups { // Group is already assigned and doesn't need to be updated chProcess <- nil return nil } isRemove := !isGroupPersistent userToAddRemove := []string{user} updateReturn := updateGroupMembers(ctx, client, groupName, userToAddRemove, isRemove) chProcess <- updateReturn return updateReturn }() return chProcess } userInfoOr, err := getUserInfo(ctx, client, user) if err != nil { return nil, err } memberOf := userInfoOr.MemberOf mergedGroupArray := UniqueKeys(append(memberOf, groupsToAssign...)) var listOfUpdates []chan error // Each group must be updated individually because there is no way to update all the groups at once for a user, // we are using the same logic as 'mc admin group add' command for _, groupN := range mergedGroupArray { proc := parallelUserUpdate(groupN, memberOf) listOfUpdates = append(listOfUpdates, proc) } channelHasError := false for _, chanRet := range listOfUpdates { locError := <-chanRet if locError != nil { channelHasError = true } } if channelHasError { errRt := errors.New(500, "there was an error updating the groups") return nil, errRt } userInfo, err := getUserInfo(ctx, client, user) if err != nil { return nil, err } policies := strings.Split(userInfo.PolicyName, ",") userReturn := &models.User{ AccessKey: user, MemberOf: userInfo.MemberOf, Policy: policies, Status: string(userInfo.Status), } return userReturn, nil } func getUpdateUserGroupsResponse(session *models.Principal, params userApi.UpdateUserGroupsParams) (*models.User, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} user, err := updateUserGroups(ctx, adminClient, params.Name, params.Body.Groups) if err != nil { return nil, ErrorWithContext(ctx, err) } return user, nil } // setUserStatus invokes setUserStatus from madmin to update user status func setUserStatus(ctx context.Context, client MinioAdmin, user string, status string) error { var setStatus madmin.AccountStatus switch status { case "enabled": setStatus = madmin.AccountEnabled case "disabled": setStatus = madmin.AccountDisabled default: return errors.New(500, "status not valid") } return client.setUserStatus(ctx, user, setStatus) } func getUpdateUserResponse(session *models.Principal, params userApi.UpdateUserInfoParams) (*models.User, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} status := *params.Body.Status groups := params.Body.Groups if err := setUserStatus(ctx, adminClient, params.Name, status); err != nil { return nil, ErrorWithContext(ctx, err) } userElem, errUG := updateUserGroups(ctx, adminClient, params.Name, groups) if errUG != nil { return nil, ErrorWithContext(ctx, errUG) } return userElem, nil } // addUsersListToGroups iterates over the user list & assigns the requested groups to each user. func addUsersListToGroups(ctx context.Context, client MinioAdmin, usersToUpdate []string, groupsToAssign []string) error { // We update each group with the complete usersList parallelGroupsUpdate := func(groupToAssign string) chan error { groupProcess := make(chan error) go func() { defer close(groupProcess) // We add the users array to the group. err := updateGroupMembers(ctx, client, groupToAssign, usersToUpdate, false) groupProcess <- err }() return groupProcess } var groupsUpdateList []chan error // We get each group name & add users accordingly for _, groupName := range groupsToAssign { // We update the group proc := parallelGroupsUpdate(groupName) groupsUpdateList = append(groupsUpdateList, proc) } errorsList := []string{} // We get the errors list because we want to have all errors at once. for _, err := range groupsUpdateList { errorFromUpdate := <-err // We store the errors to avoid Data Race if errorFromUpdate != nil { // If there is an errors, we store the errors strings so we can join them after we receive all errors errorsList = append(errorsList, errorFromUpdate.Error()) // We wait until all the channels have been closed. } } // If there are errors, we throw the final errors with the errors inside if len(errorsList) > 0 { errGen := fmt.Errorf("error in users-groups assignation: %q", strings.Join(errorsList, ",")) return errGen } return nil } func getAddUsersListToGroupsResponse(session *models.Principal, params userApi.BulkUpdateUsersGroupsParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} usersList := params.Body.Users groupsList := params.Body.Groups if err := addUsersListToGroups(ctx, adminClient, usersList, groupsList); err != nil { return ErrorWithContext(ctx, err) } return nil } func getListUsersWithAccessToBucketResponse(session *models.Principal, params bucketApi.ListUsersWithAccessToBucketParams) ([]string, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} list, err := listUsersWithAccessToBucket(ctx, adminClient, params.Bucket) if err != nil { return nil, ErrorWithContext(ctx, err) } return list, nil } func policyAllowsAndMatchesBucket(policy *iampolicy.Policy, bucket string) int { policyStatements := policy.Statements for i := 0; i < len(policyStatements); i++ { resources := policyStatements[i].Resources effect := policyStatements[i].Effect if resources.Match(bucket, map[string][]string{}) { if effect.IsValid() { if effect.IsAllowed(true) { return Allow } return Deny } } } return Unknown } func listUsersWithAccessToBucket(ctx context.Context, adminClient MinioAdmin, bucket string) ([]string, error) { users, err := adminClient.listUsers(ctx) if err != nil { return nil, err } var retval []string akHasAccess := make(map[string]struct{}) akIsDenied := make(map[string]struct{}) for k, v := range users { for _, policyName := range strings.Split(v.PolicyName, ",") { policyName = strings.TrimSpace(policyName) if policyName == "" { continue } policy, err := adminClient.getPolicy(ctx, policyName) if err != nil { ErrorWithContext(ctx, fmt.Errorf("unable to fetch policy %s: %v", policyName, err)) continue } if _, ok := akIsDenied[k]; !ok { switch policyAllowsAndMatchesBucket(policy, bucket) { case Allow: if _, ok := akHasAccess[k]; !ok { akHasAccess[k] = struct{}{} } case Deny: akIsDenied[k] = struct{}{} delete(akHasAccess, k) } } } } groups, err := adminClient.listGroups(ctx) if err != nil { ErrorWithContext(ctx, fmt.Errorf("unable to list groups: %v", err)) return retval, nil } for _, groupName := range groups { info, err := groupInfo(ctx, adminClient, groupName) if err != nil { ErrorWithContext(ctx, fmt.Errorf("unable to fetch group info %s: %v", groupName, err)) continue } policy, err := adminClient.getPolicy(ctx, info.Policy) if err != nil { ErrorWithContext(ctx, fmt.Errorf("unable to fetch group policy %s: %v", info.Policy, err)) continue } for _, member := range info.Members { if _, ok := akIsDenied[member]; !ok { switch policyAllowsAndMatchesBucket(policy, bucket) { case Allow: if _, ok := akHasAccess[member]; !ok { akHasAccess[member] = struct{}{} } case Deny: akIsDenied[member] = struct{}{} delete(akHasAccess, member) } } } } for k := range akHasAccess { retval = append(retval, k) } sort.Strings(retval) return retval, nil } // changeUserPassword changes password of selectedUser to newSecretKey func changeUserPassword(ctx context.Context, client MinioAdmin, selectedUser string, newSecretKey string) error { return client.changePassword(ctx, selectedUser, newSecretKey) } // getChangeUserPasswordResponse will change the password of selctedUser to newSecretKey func getChangeUserPasswordResponse(session *models.Principal, params accountApi.ChangeUserPasswordParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // params will contain selectedUser and newSecretKey credentials for the user user := *params.Body.SelectedUser newSecretKey := *params.Body.NewSecretKey // changes password of user to newSecretKey if err := changeUserPassword(ctx, adminClient, user, newSecretKey); err != nil { return ErrorWithContext(ctx, err) } return nil } func getCheckUserSAResponse(session *models.Principal, params userApi.CheckUserServiceAccountsParams) (*models.UserServiceAccountSummary, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} var userServiceAccountList []*models.UserServiceAccountItem hasSA := false for _, user := range params.SelectedUsers { listServAccs, err := adminClient.listServiceAccounts(ctx, user) if err != nil { return nil, ErrorWithContext(ctx, err) } numSAs := int64(len(listServAccs.Accounts)) if numSAs > 0 { hasSA = true } userAccountItem := &models.UserServiceAccountItem{ UserName: user, NumSAs: numSAs, } userServiceAccountList = append(userServiceAccountList, userAccountItem) } userAccountList := &models.UserServiceAccountSummary{ UserServiceAccountList: userServiceAccountList, HasSA: hasSA, } return userAccountList, nil } ================================================ FILE: api/admin_users_test.go ================================================ // 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 api import ( "bytes" "context" "errors" "fmt" "strings" "testing" "github.com/minio/madmin-go/v3" iampolicy "github.com/minio/pkg/v3/policy" asrt "github.com/stretchr/testify/assert" ) func TestListUsers(t *testing.T) { assert := asrt.New(t) adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : listUsers() Get response from minio client with two users and return the same number on listUsers() // mock minIO client mockUserMap := map[string]madmin.UserInfo{ "ABCDEFGHI": { SecretKey: "", PolicyName: "ABCDEFGHI-policy", Status: "enabled", MemberOf: []string{"group1", "group2"}, }, "ZBCDEFGHI": { SecretKey: "", PolicyName: "ZBCDEFGHI-policy", Status: "enabled", MemberOf: []string{"group1", "group2"}, }, } // mock function response from listUsersWithContext(ctx) minioListUsersMock = func() (map[string]madmin.UserInfo, error) { return mockUserMap, nil } // get list users response this response should have Name, CreationDate, Size and Access // as part of of each user function := "listUsers()" userMap, err := listUsers(ctx, adminClient) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of users is correct assert.Equal(len(mockUserMap), len(userMap), fmt.Sprintf("Failed on %s: length of user's lists is not the same", function)) for _, b := range userMap { assert.Contains(mockUserMap, b.AccessKey) assert.Equal(string(mockUserMap[b.AccessKey].Status), b.Status) assert.Equal(mockUserMap[b.AccessKey].PolicyName, strings.Join(b.Policy, ",")) assert.ElementsMatch(mockUserMap[b.AccessKey].MemberOf, []string{"group1", "group2"}) } // Test-2 : listUsers() Return and see that the error is handled correctly and returned minioListUsersMock = func() (map[string]madmin.UserInfo, error) { return nil, errors.New("error") } _, err = listUsers(ctx, adminClient) if assert.Error(err) { assert.Equal("error", err.Error()) } } func TestAddUser(t *testing.T) { assert := asrt.New(t) adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1: valid case of adding a user with a proper access key accessKey := "ABCDEFGHI" secretKey := "ABCDEFGHIABCDEFGHI" groups := []string{"group1", "group2", "group3"} policies := []string{} emptyGroupTest := []string{} mockResponse := &madmin.UserInfo{ MemberOf: []string{"group1", "group2", "gropup3"}, PolicyName: "", Status: "enabled", SecretKey: "", } // mock function response from addUser() return no error minioAddUserMock = func(_, _ string) error { return nil } minioGetUserInfoMock = func(_ string) (madmin.UserInfo, error) { return *mockResponse, nil } minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { return nil } // Test-1: Add a user function := "addUser()" user, err := addUser(ctx, adminClient, &accessKey, &secretKey, groups, policies) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // no error should have been returned assert.Nil(err, "Error is not null") // the same access key should be in the model users assert.Equal(user.AccessKey, accessKey) // Test-2 Add a user with empty groups list user, err = addUser(ctx, adminClient, &accessKey, &secretKey, emptyGroupTest, policies) // no error should have been returned assert.Nil(err, "Error is not null") // the same access key should be in the model users assert.Equal(user.AccessKey, accessKey) // Test-3: valid case accessKey = "AB" secretKey = "ABCDEFGHIABCDEFGHI" // mock function response from addUser() return no error minioAddUserMock = func(_, _ string) error { return errors.New("error") } user, err = addUser(ctx, adminClient, &accessKey, &secretKey, groups, policies) // no error should have been returned assert.Nil(user, "User is not null") assert.NotNil(err, "An error should have been returned") if assert.Error(err) { assert.Equal("error", err.Error()) } // Test-4: add groups function returns an error minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { return errors.New("error") } user, err = addUser(ctx, adminClient, &accessKey, &secretKey, groups, policies) // no error should have been returned assert.Nil(user, "User is not null") assert.NotNil(err, "An error should have been returned") if assert.Error(err) { assert.Equal("error", err.Error()) } } func TestRemoveUser(t *testing.T) { assert := asrt.New(t) // mock minIO client adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() function := "removeUser()" // Test-1: removeUser() delete a user // mock function response from removeUser(accessKey) minioRemoveUserMock = func(_ string) error { return nil } if err := removeUser(ctx, adminClient, "ABCDEFGHI"); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2: removeUser() make sure errors are handled correctly when error on DeleteUser() // mock function response from removeUser(accessKey) minioRemoveUserMock = func(_ string) error { return errors.New("error") } if err := removeUser(ctx, adminClient, "notexistentuser"); assert.Error(err) { assert.Equal("error", err.Error()) } } func TestUserGroups(t *testing.T) { assert := asrt.New(t) // mock minIO client adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() function := "updateUserGroups()" mockUserGroups := []string{"group1", "group2", "group3"} mockUserName := "testUser" mockResponse := &madmin.UserInfo{ MemberOf: []string{"group1", "group2", "gropup3"}, PolicyName: "", Status: "enabled", SecretKey: mockUserName, } mockEmptyResponse := &madmin.UserInfo{ MemberOf: nil, PolicyName: "", Status: "", SecretKey: "", } // Test-1: updateUserGroups() updates the groups for a user // mock function response from updateUserGroups(accessKey, groupsToAssign) minioGetUserInfoMock = func(_ string) (madmin.UserInfo, error) { return *mockResponse, nil } minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { return nil } if _, err := updateUserGroups(ctx, adminClient, mockUserName, mockUserGroups); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2: updateUserGroups() make sure errors are handled correctly when error on UpdateGroupMembersMock() // mock function response from removeUser(accessKey) minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { return errors.New("error") } if _, err := updateUserGroups(ctx, adminClient, mockUserName, mockUserGroups); assert.Error(err) { assert.Equal("there was an error updating the groups", err.Error()) } // Test-3: updateUserGroups() make sure we return the correct error when getUserInfo returns error minioGetUserInfoMock = func(_ string) (madmin.UserInfo, error) { return *mockEmptyResponse, errors.New("error getting user ") } minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { return nil } if _, err := updateUserGroups(ctx, adminClient, mockUserName, mockUserGroups); assert.Error(err) { assert.Equal("error getting user ", err.Error()) } } func TestGetUserInfo(t *testing.T) { assert := asrt.New(t) adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : getUserInfo() get user info userName := "userNameTest" mockResponse := &madmin.UserInfo{ SecretKey: userName, PolicyName: "", MemberOf: []string{"group1", "group2", "group3"}, Status: "enabled", } emptyMockResponse := &madmin.UserInfo{ SecretKey: "", PolicyName: "", Status: "", MemberOf: nil, } // mock function response from getUserInfo() minioGetUserInfoMock = func(_ string) (madmin.UserInfo, error) { return *mockResponse, nil } function := "getUserInfo()" info, err := getUserInfo(ctx, adminClient, userName) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } assert.Equal(userName, info.SecretKey) assert.Equal("", info.PolicyName) assert.ElementsMatch([]string{"group1", "group2", "group3"}, info.MemberOf) assert.Equal(mockResponse.Status, info.Status) // Test-2 : getUserInfo() Return error and see that the error is handled correctly and returned minioGetUserInfoMock = func(_ string) (madmin.UserInfo, error) { return *emptyMockResponse, errors.New("error") } _, err = getUserInfo(ctx, adminClient, userName) if assert.Error(err) { assert.Equal("error", err.Error()) } } func TestSetUserStatus(t *testing.T) { assert := asrt.New(t) adminClient := AdminClientMock{} function := "setUserStatus()" userName := "userName123" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1: setUserStatus() update valid disabled status expectedStatus := "disabled" minioSetUserStatusMock = func(_ string, _ madmin.AccountStatus) error { return nil } if err := setUserStatus(ctx, adminClient, userName, expectedStatus); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2: setUserStatus() update valid enabled status expectedStatus = "enabled" minioSetUserStatusMock = func(_ string, _ madmin.AccountStatus) error { return nil } if err := setUserStatus(ctx, adminClient, userName, expectedStatus); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-3: setUserStatus() update invalid status, should send error expectedStatus = "invalid" minioSetUserStatusMock = func(_ string, _ madmin.AccountStatus) error { return nil } if err := setUserStatus(ctx, adminClient, userName, expectedStatus); assert.Error(err) { assert.Equal("status not valid", err.Error()) } // Test-4: setUserStatus() handler error correctly expectedStatus = "enabled" minioSetUserStatusMock = func(_ string, _ madmin.AccountStatus) error { return errors.New("error") } if err := setUserStatus(ctx, adminClient, userName, expectedStatus); assert.Error(err) { assert.Equal("error", err.Error()) } } func TestUserGroupsBulk(t *testing.T) { assert := asrt.New(t) // mock minIO client adminClient := AdminClientMock{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() function := "updateUserGroups()" mockUserGroups := []string{"group1", "group2", "group3"} mockUsers := []string{"testUser", "testUser2"} // Test-1: addUsersListToGroups() updates the groups for a users list // mock function response from updateUserGroups(accessKey, groupsToAssign) minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { return nil } if err := addUsersListToGroups(ctx, adminClient, mockUsers, mockUserGroups); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2: addUsersListToGroups() make sure errors are handled correctly when error on updateGroupMembers() // mock function response from removeUser(accessKey) minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { return errors.New("error") } if err := addUsersListToGroups(ctx, adminClient, mockUsers, mockUserGroups); assert.Error(err) { assert.Equal("error in users-groups assignation: \"error,error,error\"", err.Error()) } } func TestListUsersWithAccessToBucket(t *testing.T) { assert := asrt.New(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() adminClient := AdminClientMock{} user1 := madmin.UserInfo{ SecretKey: "testtest", PolicyName: "consoleAdmin,testPolicy,redundantPolicy", Status: "enabled", MemberOf: []string{"group1"}, } user2 := madmin.UserInfo{ SecretKey: "testtest", PolicyName: "testPolicy, otherPolicy", Status: "enabled", MemberOf: []string{"group1"}, } mockUsers := map[string]madmin.UserInfo{"testuser1": user1, "testuser2": user2} minioListUsersMock = func() (map[string]madmin.UserInfo, error) { return mockUsers, nil } policyMap := map[string]string{ "consoleAdmin": `{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "admin:*" ] }, { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`, "testPolicy": `{ "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::bucket1" ] } ] }`, "otherPolicy": `{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::bucket2" ] } ] }`, "thirdPolicy": `{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::bucket3" ] } ] }`, "RedundantPolicy": `{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::bucket1" ] } ] }`, } minioGetPolicyMock = func(name string) (*iampolicy.Policy, error) { iamp, err := iampolicy.ParseConfig(bytes.NewReader([]byte(policyMap[name]))) if err != nil { return nil, err } return iamp, nil } minioListGroupsMock = func() ([]string, error) { return []string{"group1"}, nil } minioGetGroupDescriptionMock = func(name string) (*madmin.GroupDesc, error) { if name == "group1" { mockResponse := &madmin.GroupDesc{ Name: "group1", Policy: "thirdPolicy", Members: []string{"testuser1", "testuser2"}, Status: "enabled", } return mockResponse, nil } return nil, ErrDefault } type args struct { bucket string } tests := []struct { name string args args want []string }{ { name: "Test1", args: args{bucket: "bucket0"}, want: []string{"testuser1"}, }, { name: "Test2", args: args{bucket: "bucket1"}, want: []string(nil), }, { name: "Test3", args: args{bucket: "bucket2"}, want: []string{"testuser1", "testuser2"}, }, { name: "Test4", args: args{bucket: "bucket3"}, want: []string{"testuser1", "testuser2"}, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { got, _ := listUsersWithAccessToBucket(ctx, adminClient, tt.args.bucket) assert.Equal(got, tt.want) }) } } ================================================ FILE: api/client-admin.go ================================================ // 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 api import ( "bytes" "context" "encoding/json" "io" "net" "net/http" "net/url" "regexp" "strings" "time" "github.com/minio/console/pkg" "github.com/minio/console/pkg/utils" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" "github.com/minio/minio-go/v7/pkg/credentials" iampolicy "github.com/minio/pkg/v3/policy" ) const globalAppName = "MinIO Console" // MinioAdmin interface with all functions to be implemented // by mock when testing, it should include all MinioAdmin respective api calls // that are used within this project. type MinioAdmin interface { listUsers(ctx context.Context) (map[string]madmin.UserInfo, error) addUser(ctx context.Context, acessKey, SecretKey string) error removeUser(ctx context.Context, accessKey string) error getUserInfo(ctx context.Context, accessKey string) (madmin.UserInfo, error) setUserStatus(ctx context.Context, accessKey string, status madmin.AccountStatus) error listGroups(ctx context.Context) ([]string, error) updateGroupMembers(ctx context.Context, greq madmin.GroupAddRemove) error getGroupDescription(ctx context.Context, group string) (*madmin.GroupDesc, error) setGroupStatus(ctx context.Context, group string, status madmin.GroupStatus) error listPolicies(ctx context.Context) (map[string]*iampolicy.Policy, error) getPolicy(ctx context.Context, name string) (*iampolicy.Policy, error) removePolicy(ctx context.Context, name string) error addPolicy(ctx context.Context, name string, policy *iampolicy.Policy) error setPolicy(ctx context.Context, policyName, entityName string, isGroup bool) error getConfigKV(ctx context.Context, key string) ([]byte, error) helpConfigKV(ctx context.Context, subSys, key string, envOnly bool) (madmin.Help, error) helpConfigKVGlobal(ctx context.Context, envOnly bool) (madmin.Help, error) setConfigKV(ctx context.Context, kv string) (restart bool, err error) delConfigKV(ctx context.Context, kv string) (err error) serviceRestart(ctx context.Context) error serverInfo(ctx context.Context) (madmin.InfoMessage, error) startProfiling(ctx context.Context, profiler madmin.ProfilerType, duration time.Duration) (io.ReadCloser, error) serviceTrace(ctx context.Context, threshold int64, s3, internal, storage, os, errTrace bool) <-chan madmin.ServiceTraceInfo getLogs(ctx context.Context, node string, lineCnt int, logKind string) <-chan madmin.LogInfo AccountInfo(ctx context.Context) (madmin.AccountInfo, error) heal(ctx context.Context, bucket, prefix string, healOpts madmin.HealOpts, clientToken string, forceStart, forceStop bool) (healStart madmin.HealStartSuccess, healTaskStatus madmin.HealTaskStatus, err error) // Service Accounts addServiceAccount(ctx context.Context, policy string, user string, accessKey string, secretKey string, name string, description string, expiry *time.Time, comment string) (madmin.Credentials, error) listServiceAccounts(ctx context.Context, user string) (madmin.ListServiceAccountsResp, error) deleteServiceAccount(ctx context.Context, serviceAccount string) error infoServiceAccount(ctx context.Context, serviceAccount string) (madmin.InfoServiceAccountResp, error) updateServiceAccount(ctx context.Context, serviceAccount string, opts madmin.UpdateServiceAccountReq) error // Remote Buckets listRemoteBuckets(ctx context.Context, bucket, arnType string) (targets []madmin.BucketTarget, err error) getRemoteBucket(ctx context.Context, bucket, arnType string) (targets *madmin.BucketTarget, err error) removeRemoteBucket(ctx context.Context, bucket, arn string) error addRemoteBucket(ctx context.Context, bucket string, target *madmin.BucketTarget) (string, error) // Account password management changePassword(ctx context.Context, accessKey, secretKey string) error serverHealthInfo(ctx context.Context, deadline time.Duration) (interface{}, string, error) // List Tiers listTiers(ctx context.Context) ([]*madmin.TierConfig, error) // Tier Info tierStats(ctx context.Context) ([]madmin.TierInfo, error) // Add Tier addTier(ctx context.Context, tier *madmin.TierConfig) error // Edit Tier Credentials editTierCreds(ctx context.Context, tierName string, creds madmin.TierCreds) error // verify Tier status verifyTierStatus(ctx context.Context, tierName string) error // remove empty Tier removeTier(ctx context.Context, tierName string) error // Speedtest speedtest(ctx context.Context, opts madmin.SpeedtestOpts) (chan madmin.SpeedTestResult, error) // Site Relication getSiteReplicationInfo(ctx context.Context) (*madmin.SiteReplicationInfo, error) addSiteReplicationInfo(ctx context.Context, sites []madmin.PeerSite, opts madmin.SRAddOptions) (*madmin.ReplicateAddStatus, error) editSiteReplicationInfo(ctx context.Context, site madmin.PeerInfo, opts madmin.SREditOptions) (*madmin.ReplicateEditStatus, error) deleteSiteReplicationInfo(ctx context.Context, removeReq madmin.SRRemoveReq) (*madmin.ReplicateRemoveStatus, error) // Replication status getSiteReplicationStatus(ctx context.Context, params madmin.SRStatusOptions) (*madmin.SRStatusInfo, error) // KMS kmsStatus(ctx context.Context) (madmin.KMSStatus, error) kmsMetrics(ctx context.Context) (*madmin.KMSMetrics, error) kmsAPIs(ctx context.Context) ([]madmin.KMSAPI, error) kmsVersion(ctx context.Context) (*madmin.KMSVersion, error) createKey(ctx context.Context, key string) error listKeys(ctx context.Context, pattern string) ([]madmin.KMSKeyInfo, error) keyStatus(ctx context.Context, key string) (*madmin.KMSKeyStatus, error) // IDP addOrUpdateIDPConfig(ctx context.Context, idpType, cfgName, cfgData string, update bool) (restart bool, err error) listIDPConfig(ctx context.Context, idpType string) ([]madmin.IDPListItem, error) deleteIDPConfig(ctx context.Context, idpType, cfgName string) (restart bool, err error) getIDPConfig(ctx context.Context, cfgType, cfgName string) (c madmin.IDPConfig, err error) // LDAP getLDAPPolicyEntities(ctx context.Context, query madmin.PolicyEntitiesQuery) (madmin.PolicyEntitiesResult, error) } // Interface implementation // // Define the structure of a minIO Client and define the functions that are actually used // from minIO api. type AdminClient struct { Client *madmin.AdminClient } func (ac AdminClient) changePassword(ctx context.Context, accessKey, secretKey string) error { return ac.Client.SetUser(ctx, accessKey, secretKey, madmin.AccountEnabled) } // implements madmin.ListUsers() func (ac AdminClient) listUsers(ctx context.Context) (map[string]madmin.UserInfo, error) { return ac.Client.ListUsers(ctx) } // implements madmin.AddUser() func (ac AdminClient) addUser(ctx context.Context, accessKey, secretKey string) error { return ac.Client.AddUser(ctx, accessKey, secretKey) } // implements madmin.RemoveUser() func (ac AdminClient) removeUser(ctx context.Context, accessKey string) error { return ac.Client.RemoveUser(ctx, accessKey) } // implements madmin.GetUserInfo() func (ac AdminClient) getUserInfo(ctx context.Context, accessKey string) (madmin.UserInfo, error) { return ac.Client.GetUserInfo(ctx, accessKey) } // implements madmin.SetUserStatus() func (ac AdminClient) setUserStatus(ctx context.Context, accessKey string, status madmin.AccountStatus) error { return ac.Client.SetUserStatus(ctx, accessKey, status) } // implements madmin.ListGroups() func (ac AdminClient) listGroups(ctx context.Context) ([]string, error) { return ac.Client.ListGroups(ctx) } // implements madmin.UpdateGroupMembers() func (ac AdminClient) updateGroupMembers(ctx context.Context, greq madmin.GroupAddRemove) error { return ac.Client.UpdateGroupMembers(ctx, greq) } // implements madmin.GetGroupDescription(group) func (ac AdminClient) getGroupDescription(ctx context.Context, group string) (*madmin.GroupDesc, error) { return ac.Client.GetGroupDescription(ctx, group) } // implements madmin.SetGroupStatus(group, status) func (ac AdminClient) setGroupStatus(ctx context.Context, group string, status madmin.GroupStatus) error { return ac.Client.SetGroupStatus(ctx, group, status) } // implements madmin.ListCannedPolicies() func (ac AdminClient) listPolicies(ctx context.Context) (map[string]*iampolicy.Policy, error) { policyMap, err := ac.Client.ListCannedPolicies(ctx) if err != nil { return nil, err } policies := make(map[string]*iampolicy.Policy, len(policyMap)) for k, v := range policyMap { p, err := iampolicy.ParseConfig(bytes.NewReader(v)) if err != nil { return nil, err } policies[k] = p } return policies, nil } // implements madmin.ListCannedPolicies() func (ac AdminClient) getPolicy(ctx context.Context, name string) (*iampolicy.Policy, error) { info, err := ac.Client.InfoCannedPolicyV2(ctx, name) if err != nil { return nil, err } return iampolicy.ParseConfig(bytes.NewReader(info.Policy)) } // implements madmin.RemoveCannedPolicy() func (ac AdminClient) removePolicy(ctx context.Context, name string) error { return ac.Client.RemoveCannedPolicy(ctx, name) } // implements madmin.AddCannedPolicy() func (ac AdminClient) addPolicy(ctx context.Context, name string, policy *iampolicy.Policy) error { buf, err := json.Marshal(policy) if err != nil { return err } return ac.Client.AddCannedPolicy(ctx, name, buf) } // implements madmin.SetPolicy() func (ac AdminClient) setPolicy(ctx context.Context, policyName, entityName string, isGroup bool) error { // nolint:staticcheck // ignore SA1019 // todo deprecated SetPolicy return ac.Client.SetPolicy(ctx, policyName, entityName, isGroup) } // implements madmin.GetConfigKV() func (ac AdminClient) getConfigKV(ctx context.Context, key string) ([]byte, error) { return ac.Client.GetConfigKV(ctx, key) } // implements madmin.HelpConfigKV() func (ac AdminClient) helpConfigKV(ctx context.Context, subSys, key string, envOnly bool) (madmin.Help, error) { return ac.Client.HelpConfigKV(ctx, subSys, key, envOnly) } // implements madmin.helpConfigKVGlobal() func (ac AdminClient) helpConfigKVGlobal(ctx context.Context, envOnly bool) (madmin.Help, error) { return ac.Client.HelpConfigKV(ctx, "", "", envOnly) } // implements madmin.SetConfigKV() func (ac AdminClient) setConfigKV(ctx context.Context, kv string) (restart bool, err error) { return ac.Client.SetConfigKV(ctx, kv) } // implements madmin.DelConfigKV() func (ac AdminClient) delConfigKV(ctx context.Context, kv string) (err error) { _, err = ac.Client.DelConfigKV(ctx, kv) return err } // implements madmin.ServiceRestart() func (ac AdminClient) serviceRestart(ctx context.Context) (err error) { return ac.Client.ServiceRestartV2(ctx) } // implements madmin.ServerInfo() func (ac AdminClient) serverInfo(ctx context.Context) (madmin.InfoMessage, error) { return ac.Client.ServerInfo(ctx) } // implements madmin.StartProfiling() func (ac AdminClient) startProfiling(ctx context.Context, profiler madmin.ProfilerType, duration time.Duration) (io.ReadCloser, error) { return ac.Client.Profile(ctx, profiler, duration) } // implements madmin.ServiceTrace() func (ac AdminClient) serviceTrace(ctx context.Context, threshold int64, _, internal, storage, os, errTrace bool) <-chan madmin.ServiceTraceInfo { thresholdT := time.Duration(threshold) tracingOptions := madmin.ServiceTraceOpts{ S3: true, OnlyErrors: errTrace, Internal: internal, Storage: storage, OS: os, Threshold: thresholdT, } return ac.Client.ServiceTrace(ctx, tracingOptions) } // implements madmin.GetLogs() func (ac AdminClient) getLogs(ctx context.Context, node string, lineCnt int, logKind string) <-chan madmin.LogInfo { return ac.Client.GetLogs(ctx, node, lineCnt, logKind) } // implements madmin.AddServiceAccount() func (ac AdminClient) addServiceAccount(ctx context.Context, policy string, user string, accessKey string, secretKey string, name string, description string, expiry *time.Time, comment string) (madmin.Credentials, error) { return ac.Client.AddServiceAccount(ctx, madmin.AddServiceAccountReq{ Policy: []byte(policy), TargetUser: user, AccessKey: accessKey, SecretKey: secretKey, Name: name, Description: description, Expiration: expiry, Comment: comment, }) } // implements madmin.ListServiceAccounts() func (ac AdminClient) listServiceAccounts(ctx context.Context, user string) (madmin.ListServiceAccountsResp, error) { return ac.Client.ListServiceAccounts(ctx, user) } // implements madmin.DeleteServiceAccount() func (ac AdminClient) deleteServiceAccount(ctx context.Context, serviceAccount string) error { return ac.Client.DeleteServiceAccount(ctx, serviceAccount) } // implements madmin.InfoServiceAccount() func (ac AdminClient) infoServiceAccount(ctx context.Context, serviceAccount string) (madmin.InfoServiceAccountResp, error) { return ac.Client.InfoServiceAccount(ctx, serviceAccount) } // implements madmin.UpdateServiceAccount() func (ac AdminClient) updateServiceAccount(ctx context.Context, serviceAccount string, opts madmin.UpdateServiceAccountReq) error { return ac.Client.UpdateServiceAccount(ctx, serviceAccount, opts) } // AccountInfo implements madmin.AccountInfo() func (ac AdminClient) AccountInfo(ctx context.Context) (madmin.AccountInfo, error) { return ac.Client.AccountInfo(ctx, madmin.AccountOpts{}) } func (ac AdminClient) heal(ctx context.Context, bucket, prefix string, healOpts madmin.HealOpts, clientToken string, forceStart, forceStop bool, ) (healStart madmin.HealStartSuccess, healTaskStatus madmin.HealTaskStatus, err error) { return ac.Client.Heal(ctx, bucket, prefix, healOpts, clientToken, forceStart, forceStop) } // listRemoteBuckets - return a list of remote buckets func (ac AdminClient) listRemoteBuckets(ctx context.Context, bucket, arnType string) (targets []madmin.BucketTarget, err error) { return ac.Client.ListRemoteTargets(ctx, bucket, arnType) } // getRemoteBucket - gets remote bucked based on a given bucket name func (ac AdminClient) getRemoteBucket(ctx context.Context, bucket, arnType string) (*madmin.BucketTarget, error) { targets, err := ac.Client.ListRemoteTargets(ctx, bucket, arnType) if err != nil { return nil, err } if len(targets) > 0 { return &targets[0], nil } return nil, err } // removeRemoteBucket removes a remote target associated with particular ARN for this bucket func (ac AdminClient) removeRemoteBucket(ctx context.Context, bucket, arn string) error { return ac.Client.RemoveRemoteTarget(ctx, bucket, arn) } // addRemoteBucket sets up a remote target for this bucket func (ac AdminClient) addRemoteBucket(ctx context.Context, bucket string, target *madmin.BucketTarget) (string, error) { return ac.Client.SetRemoteTarget(ctx, bucket, target) } func (ac AdminClient) setBucketQuota(ctx context.Context, bucket string, quota *madmin.BucketQuota) error { return ac.Client.SetBucketQuota(ctx, bucket, quota) } func (ac AdminClient) getBucketQuota(ctx context.Context, bucket string) (madmin.BucketQuota, error) { return ac.Client.GetBucketQuota(ctx, bucket) } // serverHealthInfo implements mc.ServerHealthInfo - Connect to a minio server and call Health Info Management API func (ac AdminClient) serverHealthInfo(ctx context.Context, deadline time.Duration) (interface{}, string, error) { info := madmin.HealthInfo{} var healthInfo interface{} var version string var resp *http.Response var err error resp, version, err = ac.Client.ServerHealthInfo(ctx, madmin.HealthDataTypesList, deadline, "") if err != nil { return nil, version, err } decoder := json.NewDecoder(resp.Body) for { if err = decoder.Decode(&info); err != nil { break } } if info.Version == "" { return nil, "", ErrHealthReportFail } healthInfo = info return healthInfo, version, nil } // implements madmin.listTiers() func (ac AdminClient) listTiers(ctx context.Context) ([]*madmin.TierConfig, error) { return ac.Client.ListTiers(ctx) } // implements madmin.tierStats() func (ac AdminClient) tierStats(ctx context.Context) ([]madmin.TierInfo, error) { return ac.Client.TierStats(ctx) } // implements madmin.AddTier() func (ac AdminClient) addTier(ctx context.Context, cfg *madmin.TierConfig) error { return ac.Client.AddTier(ctx, cfg) } // implements madmin.Inspect() func (ac AdminClient) inspect(ctx context.Context, insOpts madmin.InspectOptions) ([]byte, io.ReadCloser, error) { return ac.Client.Inspect(ctx, insOpts) } // implements madmin.EditTier() func (ac AdminClient) editTierCreds(ctx context.Context, tierName string, creds madmin.TierCreds) error { return ac.Client.EditTier(ctx, tierName, creds) } // implements madmin.VerifyTier() func (ac AdminClient) verifyTierStatus(ctx context.Context, tierName string) error { return ac.Client.VerifyTier(ctx, tierName) } // implements madmin.RemoveTier() func (ac AdminClient) removeTier(ctx context.Context, tierName string) error { return ac.Client.RemoveTier(ctx, tierName) } func NewMinioAdminClient(ctx context.Context, sessionClaims *models.Principal) (*madmin.AdminClient, error) { clientIP := utils.ClientIPFromContext(ctx) adminClient, err := newAdminFromClaims(sessionClaims, clientIP) if err != nil { return nil, err } adminClient.SetAppInfo(globalAppName, pkg.Version) return adminClient, nil } // newAdminFromClaims creates a minio admin from Decrypted claims using Assume role credentials func newAdminFromClaims(claims *models.Principal, clientIP string) (*madmin.AdminClient, error) { tlsEnabled := getMinIOEndpointIsSecure() endpoint := getMinIOEndpoint() adminClient, err := madmin.NewWithOptions(endpoint, &madmin.Options{ Creds: credentials.NewStaticV4(claims.STSAccessKeyID, claims.STSSecretAccessKey, claims.STSSessionToken), Secure: tlsEnabled, }) if err != nil { return nil, err } adminClient.SetAppInfo(globalAppName, pkg.Version) adminClient.SetCustomTransport(PrepareSTSClientTransport(clientIP)) return adminClient, nil } // newAdminFromCreds Creates a minio client using custom credentials for connecting to a remote host func newAdminFromCreds(accessKey, secretKey, endpoint string, tlsEnabled bool) (*madmin.AdminClient, error) { minioClient, err := madmin.NewWithOptions(endpoint, &madmin.Options{ Creds: credentials.NewStaticV4(accessKey, secretKey, ""), Secure: tlsEnabled, }) if err != nil { return nil, err } minioClient.SetAppInfo(globalAppName, pkg.Version) return minioClient, nil } // isLocalAddress returns true if the url contains an IPv4/IPv6 hostname // that points to the local machine - FQDN are not supported func isLocalIPEndpoint(endpoint string) bool { u, err := url.Parse(endpoint) if err != nil { return false } return isLocalIPAddress(u.Hostname()) } // isLocalAddress returns true if the url contains an IPv4/IPv6 hostname // that points to the local machine - FQDN are not supported func isLocalIPAddress(ipAddr string) bool { if ipAddr == "" { return false } if ipAddr == "localhost" { return true } ip := net.ParseIP(ipAddr) return ip != nil && ip.IsLoopback() } // GetConsoleHTTPClient caches different http clients depending on the target endpoint while taking // in consideration CA certs stored in ${HOME}/.console/certs/CAs and ${HOME}/.minio/certs/CAs // If the target endpoint points to a loopback device, skip the TLS verification. func GetConsoleHTTPClient(clientIP string) *http.Client { return PrepareConsoleHTTPClient(clientIP) } var ( // De-facto standard header keys. xForwardedFor = http.CanonicalHeaderKey("X-Forwarded-For") xRealIP = http.CanonicalHeaderKey("X-Real-IP") ) var ( // RFC7239 defines a new "Forwarded: " header designed to replace the // existing use of X-Forwarded-* headers. // e.g. Forwarded: for=192.0.2.60;proto=https;by=203.0.113.43 forwarded = http.CanonicalHeaderKey("Forwarded") // Allows for a sub-match of the first value after 'for=' to the next // comma, semi-colon or space. The match is case-insensitive. forRegex = regexp.MustCompile(`(?i)(?:for=)([^(;|,| )]+)(.*)`) ) // getSourceIPFromHeaders retrieves the IP from the X-Forwarded-For, X-Real-IP // and RFC7239 Forwarded headers (in that order) func getSourceIPFromHeaders(r *http.Request) string { var addr string if fwd := r.Header.Get(xForwardedFor); fwd != "" { // Only grab the first (client) address. Note that '192.168.0.1, // 10.1.1.1' is a valid key for X-Forwarded-For where addresses after // the first may represent forwarding proxies earlier in the chain. s := strings.Index(fwd, ", ") if s == -1 { s = len(fwd) } addr = fwd[:s] } else if fwd := r.Header.Get(xRealIP); fwd != "" { // X-Real-IP should only contain one IP address (the client making the // request). addr = fwd } else if fwd := r.Header.Get(forwarded); fwd != "" { // match should contain at least two elements if the protocol was // specified in the Forwarded header. The first element will always be // the 'for=' capture, which we ignore. In the case of multiple IP // addresses (for=8.8.8.8, 8.8.4.4, 172.16.1.20 is valid) we only // extract the first, which should be the client IP. if match := forRegex.FindStringSubmatch(fwd); len(match) > 1 { // IPv6 addresses in Forwarded headers are quoted-strings. We strip // these quotes. addr = strings.Trim(match[1], `"`) } } return addr } // getClientIP retrieves the IP from the request headers // and falls back to r.RemoteAddr when necessary. // however returns without bracketing. func getClientIP(r *http.Request) string { addr := getSourceIPFromHeaders(r) if addr == "" { addr = r.RemoteAddr } // Default to remote address if headers not set. raddr, _, _ := net.SplitHostPort(addr) if raddr == "" { return addr } return raddr } func (ac AdminClient) speedtest(ctx context.Context, opts madmin.SpeedtestOpts) (chan madmin.SpeedTestResult, error) { return ac.Client.Speedtest(ctx, opts) } // Site Replication func (ac AdminClient) getSiteReplicationInfo(ctx context.Context) (*madmin.SiteReplicationInfo, error) { res, err := ac.Client.SiteReplicationInfo(ctx) if err != nil { return nil, err } return &madmin.SiteReplicationInfo{ Enabled: res.Enabled, Name: res.Name, Sites: res.Sites, ServiceAccountAccessKey: res.ServiceAccountAccessKey, }, nil } func (ac AdminClient) addSiteReplicationInfo(ctx context.Context, sites []madmin.PeerSite, opts madmin.SRAddOptions) (*madmin.ReplicateAddStatus, error) { res, err := ac.Client.SiteReplicationAdd(ctx, sites, opts) if err != nil { return nil, err } return &madmin.ReplicateAddStatus{ Success: res.Success, Status: res.Status, ErrDetail: res.ErrDetail, InitialSyncErrorMessage: res.InitialSyncErrorMessage, }, nil } func (ac AdminClient) editSiteReplicationInfo(ctx context.Context, site madmin.PeerInfo, opts madmin.SREditOptions) (*madmin.ReplicateEditStatus, error) { res, err := ac.Client.SiteReplicationEdit(ctx, site, opts) if err != nil { return nil, err } return &madmin.ReplicateEditStatus{ Success: res.Success, Status: res.Status, ErrDetail: res.ErrDetail, }, nil } func (ac AdminClient) deleteSiteReplicationInfo(ctx context.Context, removeReq madmin.SRRemoveReq) (*madmin.ReplicateRemoveStatus, error) { res, err := ac.Client.SiteReplicationRemove(ctx, removeReq) if err != nil { return nil, err } return &madmin.ReplicateRemoveStatus{ Status: res.Status, ErrDetail: res.ErrDetail, }, nil } func (ac AdminClient) getSiteReplicationStatus(ctx context.Context, params madmin.SRStatusOptions) (*madmin.SRStatusInfo, error) { res, err := ac.Client.SRStatusInfo(ctx, params) if err != nil { return nil, err } return &res, nil } func (ac AdminClient) kmsStatus(ctx context.Context) (madmin.KMSStatus, error) { return ac.Client.KMSStatus(ctx) } func (ac AdminClient) kmsMetrics(ctx context.Context) (*madmin.KMSMetrics, error) { return ac.Client.KMSMetrics(ctx) } func (ac AdminClient) kmsAPIs(ctx context.Context) ([]madmin.KMSAPI, error) { return ac.Client.KMSAPIs(ctx) } func (ac AdminClient) kmsVersion(ctx context.Context) (*madmin.KMSVersion, error) { return ac.Client.KMSVersion(ctx) } func (ac AdminClient) createKey(ctx context.Context, key string) error { return ac.Client.CreateKey(ctx, key) } func (ac AdminClient) listKeys(ctx context.Context, pattern string) ([]madmin.KMSKeyInfo, error) { return ac.Client.ListKeys(ctx, pattern) } func (ac AdminClient) keyStatus(ctx context.Context, key string) (*madmin.KMSKeyStatus, error) { return ac.Client.GetKeyStatus(ctx, key) } func (ac AdminClient) addOrUpdateIDPConfig(ctx context.Context, idpType, cfgName, cfgData string, update bool) (restart bool, err error) { return ac.Client.AddOrUpdateIDPConfig(ctx, idpType, cfgName, cfgData, update) } func (ac AdminClient) listIDPConfig(ctx context.Context, idpType string) ([]madmin.IDPListItem, error) { return ac.Client.ListIDPConfig(ctx, idpType) } func (ac AdminClient) deleteIDPConfig(ctx context.Context, idpType, cfgName string) (restart bool, err error) { return ac.Client.DeleteIDPConfig(ctx, idpType, cfgName) } func (ac AdminClient) getIDPConfig(ctx context.Context, idpType, cfgName string) (c madmin.IDPConfig, err error) { return ac.Client.GetIDPConfig(ctx, idpType, cfgName) } func (ac AdminClient) getLDAPPolicyEntities(ctx context.Context, query madmin.PolicyEntitiesQuery) (madmin.PolicyEntitiesResult, error) { return ac.Client.GetLDAPPolicyEntities(ctx, query) } ================================================ FILE: api/client.go ================================================ // 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 api import ( "context" "errors" "fmt" "io" "net/http" "path" "strings" "time" "github.com/minio/minio-go/v7/pkg/replication" "github.com/minio/minio-go/v7/pkg/sse" xnet "github.com/minio/pkg/v3/net" "github.com/minio/console/models" "github.com/minio/console/pkg" "github.com/minio/console/pkg/auth" "github.com/minio/console/pkg/auth/ldap" xjwt "github.com/minio/console/pkg/auth/token" mc "github.com/minio/mc/cmd" "github.com/minio/mc/pkg/probe" "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/lifecycle" "github.com/minio/minio-go/v7/pkg/notification" "github.com/minio/minio-go/v7/pkg/tags" ) func init() { // All minio-go API operations shall be performed only once, // another way to look at this is we are turning off retries. minio.MaxRetry = 1 } // MinioClient interface with all functions to be implemented // by mock when testing, it should include all MinioClient respective api calls // that are used within this project. type MinioClient interface { listBucketsWithContext(ctx context.Context) ([]minio.BucketInfo, error) makeBucketWithContext(ctx context.Context, bucketName, location string, objectLocking bool) error setBucketPolicyWithContext(ctx context.Context, bucketName, policy string) error removeBucket(ctx context.Context, bucketName string) error getBucketNotification(ctx context.Context, bucketName string) (config notification.Configuration, err error) getBucketPolicy(ctx context.Context, bucketName string) (string, error) listObjects(ctx context.Context, bucket string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo getObjectRetention(ctx context.Context, bucketName, objectName, versionID string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) getObjectLegalHold(ctx context.Context, bucketName, objectName string, opts minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) putObject(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (info minio.UploadInfo, err error) putObjectLegalHold(ctx context.Context, bucketName, objectName string, opts minio.PutObjectLegalHoldOptions) error putObjectRetention(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error statObject(ctx context.Context, bucketName, prefix string, opts minio.GetObjectOptions) (objectInfo minio.ObjectInfo, err error) setBucketEncryption(ctx context.Context, bucketName string, config *sse.Configuration) error removeBucketEncryption(ctx context.Context, bucketName string) error getBucketEncryption(ctx context.Context, bucketName string) (*sse.Configuration, error) putObjectTagging(ctx context.Context, bucketName, objectName string, otags *tags.Tags, opts minio.PutObjectTaggingOptions) error getObjectTagging(ctx context.Context, bucketName, objectName string, opts minio.GetObjectTaggingOptions) (*tags.Tags, error) setObjectLockConfig(ctx context.Context, bucketName string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit) error getBucketObjectLockConfig(ctx context.Context, bucketName string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) getObjectLockConfig(ctx context.Context, bucketName string) (lock string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) getLifecycleRules(ctx context.Context, bucketName string) (lifecycle *lifecycle.Configuration, err error) setBucketLifecycle(ctx context.Context, bucketName string, config *lifecycle.Configuration) error copyObject(ctx context.Context, dst minio.CopyDestOptions, src minio.CopySrcOptions) (minio.UploadInfo, error) GetBucketTagging(ctx context.Context, bucketName string) (*tags.Tags, error) SetBucketTagging(ctx context.Context, bucketName string, tags *tags.Tags) error RemoveBucketTagging(ctx context.Context, bucketName string) error } // Interface implementation // // Define the structure of a minIO Client and define the functions that are actually used // from minIO api. type minioClient struct { client *minio.Client } func (c minioClient) GetBucketTagging(ctx context.Context, bucketName string) (*tags.Tags, error) { return c.client.GetBucketTagging(ctx, bucketName) } func (c minioClient) SetBucketTagging(ctx context.Context, bucketName string, tags *tags.Tags) error { return c.client.SetBucketTagging(ctx, bucketName, tags) } func (c minioClient) RemoveBucketTagging(ctx context.Context, bucketName string) error { return c.client.RemoveBucketTagging(ctx, bucketName) } // implements minio.ListBuckets(ctx) func (c minioClient) listBucketsWithContext(ctx context.Context) ([]minio.BucketInfo, error) { return c.client.ListBuckets(ctx) } // implements minio.MakeBucketWithContext(ctx, bucketName, location, objectLocking) func (c minioClient) makeBucketWithContext(ctx context.Context, bucketName, location string, objectLocking bool) error { return c.client.MakeBucket(ctx, bucketName, minio.MakeBucketOptions{ Region: location, ObjectLocking: objectLocking, }) } // implements minio.SetBucketPolicyWithContext(ctx, bucketName, policy) func (c minioClient) setBucketPolicyWithContext(ctx context.Context, bucketName, policy string) error { return c.client.SetBucketPolicy(ctx, bucketName, policy) } // implements minio.RemoveBucket(bucketName) func (c minioClient) removeBucket(ctx context.Context, bucketName string) error { return c.client.RemoveBucket(ctx, bucketName) } // implements minio.GetBucketNotification(bucketName) func (c minioClient) getBucketNotification(ctx context.Context, bucketName string) (config notification.Configuration, err error) { return c.client.GetBucketNotification(ctx, bucketName) } // implements minio.GetBucketPolicy(bucketName) func (c minioClient) getBucketPolicy(ctx context.Context, bucketName string) (string, error) { return c.client.GetBucketPolicy(ctx, bucketName) } // implements minio.getBucketVersioning(ctx, bucketName) func (c minioClient) getBucketVersioning(ctx context.Context, bucketName string) (minio.BucketVersioningConfiguration, error) { return c.client.GetBucketVersioning(ctx, bucketName) } // implements minio.getBucketVersioning(ctx, bucketName) func (c minioClient) getBucketReplication(ctx context.Context, bucketName string) (replication.Config, error) { return c.client.GetBucketReplication(ctx, bucketName) } // implements minio.listObjects(ctx) func (c minioClient) listObjects(ctx context.Context, bucket string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo { return c.client.ListObjects(ctx, bucket, opts) } func (c minioClient) getObjectRetention(ctx context.Context, bucketName, objectName, versionID string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { return c.client.GetObjectRetention(ctx, bucketName, objectName, versionID) } func (c minioClient) getObjectLegalHold(ctx context.Context, bucketName, objectName string, opts minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { return c.client.GetObjectLegalHold(ctx, bucketName, objectName, opts) } func (c minioClient) putObject(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (info minio.UploadInfo, err error) { return c.client.PutObject(ctx, bucketName, objectName, reader, objectSize, opts) } func (c minioClient) putObjectLegalHold(ctx context.Context, bucketName, objectName string, opts minio.PutObjectLegalHoldOptions) error { return c.client.PutObjectLegalHold(ctx, bucketName, objectName, opts) } func (c minioClient) putObjectRetention(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error { return c.client.PutObjectRetention(ctx, bucketName, objectName, opts) } func (c minioClient) statObject(ctx context.Context, bucketName, prefix string, opts minio.GetObjectOptions) (objectInfo minio.ObjectInfo, err error) { return c.client.StatObject(ctx, bucketName, prefix, opts) } // implements minio.SetBucketEncryption(ctx, bucketName, config) func (c minioClient) setBucketEncryption(ctx context.Context, bucketName string, config *sse.Configuration) error { return c.client.SetBucketEncryption(ctx, bucketName, config) } // implements minio.RemoveBucketEncryption(ctx, bucketName) func (c minioClient) removeBucketEncryption(ctx context.Context, bucketName string) error { return c.client.RemoveBucketEncryption(ctx, bucketName) } // implements minio.GetBucketEncryption(ctx, bucketName, config) func (c minioClient) getBucketEncryption(ctx context.Context, bucketName string) (*sse.Configuration, error) { return c.client.GetBucketEncryption(ctx, bucketName) } func (c minioClient) putObjectTagging(ctx context.Context, bucketName, objectName string, otags *tags.Tags, opts minio.PutObjectTaggingOptions) error { return c.client.PutObjectTagging(ctx, bucketName, objectName, otags, opts) } func (c minioClient) getObjectTagging(ctx context.Context, bucketName, objectName string, opts minio.GetObjectTaggingOptions) (*tags.Tags, error) { return c.client.GetObjectTagging(ctx, bucketName, objectName, opts) } func (c minioClient) setObjectLockConfig(ctx context.Context, bucketName string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit) error { return c.client.SetObjectLockConfig(ctx, bucketName, mode, validity, unit) } func (c minioClient) getBucketObjectLockConfig(ctx context.Context, bucketName string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) { return c.client.GetBucketObjectLockConfig(ctx, bucketName) } func (c minioClient) getObjectLockConfig(ctx context.Context, bucketName string) (lock string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) { return c.client.GetObjectLockConfig(ctx, bucketName) } func (c minioClient) getLifecycleRules(ctx context.Context, bucketName string) (lifecycle *lifecycle.Configuration, err error) { return c.client.GetBucketLifecycle(ctx, bucketName) } func (c minioClient) setBucketLifecycle(ctx context.Context, bucketName string, config *lifecycle.Configuration) error { return c.client.SetBucketLifecycle(ctx, bucketName, config) } func (c minioClient) copyObject(ctx context.Context, dst minio.CopyDestOptions, src minio.CopySrcOptions) (minio.UploadInfo, error) { return c.client.CopyObject(ctx, dst, src) } // MCClient interface with all functions to be implemented // by mock when testing, it should include all mc/S3Client respective api calls // that are used within this project. type MCClient interface { addNotificationConfig(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error removeNotificationConfig(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error watch(ctx context.Context, options mc.WatchOptions) (*mc.WatchObject, *probe.Error) remove(ctx context.Context, isIncomplete, isRemoveBucket, isBypass, forceDelete bool, contentCh <-chan *mc.ClientContent) <-chan mc.RemoveResult list(ctx context.Context, opts mc.ListOptions) <-chan *mc.ClientContent get(ctx context.Context, opts mc.GetOptions) (io.ReadCloser, *probe.Error) shareDownload(ctx context.Context, versionID string, expires time.Duration) (string, *probe.Error) setVersioning(ctx context.Context, status string, excludePrefix []string, excludeFolders bool) *probe.Error } // Interface implementation // // Define the structure of a mc S3Client and define the functions that are actually used // from mcS3client api. type mcClient struct { client *mc.S3Client } // implements S3Client.AddNotificationConfig() func (c mcClient) addNotificationConfig(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error { return c.client.AddNotificationConfig(ctx, arn, events, prefix, suffix, ignoreExisting) } // implements S3Client.RemoveNotificationConfig() func (c mcClient) removeNotificationConfig(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error { return c.client.RemoveNotificationConfig(ctx, arn, event, prefix, suffix) } func (c mcClient) watch(ctx context.Context, options mc.WatchOptions) (*mc.WatchObject, *probe.Error) { return c.client.Watch(ctx, options) } func (c mcClient) setReplication(ctx context.Context, cfg *replication.Config, opts replication.Options) *probe.Error { return c.client.SetReplication(ctx, cfg, opts) } func (c mcClient) deleteAllReplicationRules(ctx context.Context) *probe.Error { return c.client.RemoveReplication(ctx) } func (c mcClient) setVersioning(ctx context.Context, status string, excludePrefix []string, excludeFolders bool) *probe.Error { return c.client.SetVersion(ctx, status, excludePrefix, excludeFolders) } func (c mcClient) remove(ctx context.Context, isIncomplete, isRemoveBucket, isBypass, forceDelete bool, contentCh <-chan *mc.ClientContent) <-chan mc.RemoveResult { return c.client.Remove(ctx, isIncomplete, isRemoveBucket, isBypass, forceDelete, contentCh) } func (c mcClient) list(ctx context.Context, opts mc.ListOptions) <-chan *mc.ClientContent { return c.client.List(ctx, opts) } func (c mcClient) get(ctx context.Context, opts mc.GetOptions) (io.ReadCloser, *probe.Error) { rd, _, err := c.client.Get(ctx, opts) return rd, err } func (c mcClient) shareDownload(ctx context.Context, versionID string, expires time.Duration) (string, *probe.Error) { return c.client.ShareDownload(ctx, versionID, expires) } // ConsoleCredentialsI interface with all functions to be implemented // by mock when testing, it should include all needed consoleCredentials.Login api calls // that are used within this project. type ConsoleCredentialsI interface { Get() (credentials.Value, error) Expire() GetAccountAccessKey() string } // Interface implementation type ConsoleCredentials struct { ConsoleCredentials *credentials.Credentials AccountAccessKey string CredContext *credentials.CredContext } func (c ConsoleCredentials) GetAccountAccessKey() string { return c.AccountAccessKey } // Get implements *Login.Get() func (c ConsoleCredentials) Get() (credentials.Value, error) { return c.ConsoleCredentials.GetWithContext(c.CredContext) } // Expire implements *Login.Expire() func (c ConsoleCredentials) Expire() { c.ConsoleCredentials.Expire() } // consoleSTSAssumeRole it's a STSAssumeRole wrapper, in general // there's no need to use this struct anywhere else in the project, it's only required // for passing a custom *http.Client to *credentials.STSAssumeRole type consoleSTSAssumeRole struct { stsAssumeRole *credentials.STSAssumeRole } func (s consoleSTSAssumeRole) RetrieveWithCredContext(cc *credentials.CredContext) (credentials.Value, error) { return s.stsAssumeRole.RetrieveWithCredContext(cc) } func (s consoleSTSAssumeRole) Retrieve() (credentials.Value, error) { return s.stsAssumeRole.Retrieve() } func (s consoleSTSAssumeRole) IsExpired() bool { return s.stsAssumeRole.IsExpired() } func stsCredentials(minioURL, accessKey, secretKey, location string, client *http.Client) (*credentials.Credentials, error) { if accessKey == "" || secretKey == "" { return nil, errors.New("credentials endpoint, access and secret key are mandatory for AssumeRoleSTS") } opts := credentials.STSAssumeRoleOptions{ AccessKey: accessKey, SecretKey: secretKey, Location: location, DurationSeconds: int(xjwt.GetConsoleSTSDuration().Seconds()), } stsAssumeRole := &credentials.STSAssumeRole{ Client: client, STSEndpoint: minioURL, Options: opts, } consoleSTSWrapper := consoleSTSAssumeRole{stsAssumeRole: stsAssumeRole} return credentials.New(consoleSTSWrapper), nil } func NewConsoleCredentials(accessKey, secretKey, location string, client *http.Client) (*credentials.Credentials, error) { minioURL := getMinIOServer() // LDAP authentication for Console if ldap.GetLDAPEnabled() { creds, err := auth.GetCredentialsFromLDAP(client, minioURL, accessKey, secretKey) if err != nil { return nil, err } credContext := &credentials.CredContext{ Client: client, } // We verify if LDAP credentials are correct and no error is returned _, err = creds.GetWithContext(credContext) if err != nil && strings.Contains(strings.ToLower(err.Error()), "not found") { // We try to use STS Credentials in case LDAP credentials are incorrect. stsCreds, errSTS := stsCredentials(minioURL, accessKey, secretKey, location, client) // If there is an error with STS too, then we return the original LDAP error if errSTS != nil { LogError("error in STS credentials for LDAP case: %v ", errSTS) // We return LDAP result return creds, nil } _, err := stsCreds.GetWithContext(credContext) // There is an error with STS credentials, We return the result of LDAP as STS is not a priority in this case. if err != nil { return creds, nil } return stsCreds, nil } return creds, nil } return stsCredentials(minioURL, accessKey, secretKey, location, client) } // getConsoleCredentialsFromSession returns the *consoleCredentials.Login associated to the // provided session token, this is useful for running the Expire() or IsExpired() operations func getConsoleCredentialsFromSession(claims *models.Principal) *credentials.Credentials { if claims == nil { return credentials.NewStaticV4("", "", "") } return credentials.NewStaticV4(claims.STSAccessKeyID, claims.STSSecretAccessKey, claims.STSSessionToken) } // newMinioClient creates a new MinIO client based on the ConsoleCredentials extracted // from the provided session token func newMinioClient(claims *models.Principal, clientIP string) (*minio.Client, error) { creds := getConsoleCredentialsFromSession(claims) endpoint := getMinIOEndpoint() secure := getMinIOEndpointIsSecure() minioClient, err := minio.New(endpoint, &minio.Options{ Creds: creds, Secure: secure, Transport: GetConsoleHTTPClient(clientIP).Transport, }) if err != nil { return nil, err } // set user-agent to differentiate Console UI requests for auditing. minioClient.SetAppInfo("MinIO Console", pkg.Version) return minioClient, nil } // computeObjectURLWithoutEncode returns a MinIO url containing the object filename without encoding func computeObjectURLWithoutEncode(bucketName, prefix string) (string, error) { u, err := xnet.ParseHTTPURL(getMinIOServer()) if err != nil { return "", fmt.Errorf("the provided endpoint: '%s' is invalid", getMinIOServer()) } var p string if strings.TrimSpace(bucketName) != "" { p = path.Join(p, bucketName) } if strings.TrimSpace(prefix) != "" { p = pathJoinFinalSlash(p, prefix) } return u.String() + "/" + p, nil } // newS3BucketClient creates a new mc S3Client to talk to the server based on a bucket func newS3BucketClient(claims *models.Principal, bucketName string, prefix string, clientIP string) (*mc.S3Client, error) { if claims == nil { return nil, fmt.Errorf("the provided credentials are invalid") } // It's very important to avoid encoding the prefix since the minio client will encode the path itself objectURL, err := computeObjectURLWithoutEncode(bucketName, prefix) if err != nil { return nil, fmt.Errorf("the provided endpoint is invalid") } s3Config := newS3Config(objectURL, claims.STSAccessKeyID, claims.STSSecretAccessKey, claims.STSSessionToken, clientIP) client, pErr := mc.S3New(s3Config) if pErr != nil { return nil, pErr.Cause } s3Client, ok := client.(*mc.S3Client) if !ok { return nil, fmt.Errorf("the provided url doesn't point to a S3 server") } return s3Client, nil } // pathJoinFinalSlash - like path.Join() but retains trailing slashSeparator of the last element func pathJoinFinalSlash(elem ...string) string { if len(elem) > 0 { if strings.HasSuffix(elem[len(elem)-1], SlashSeparator) { return path.Join(elem...) + SlashSeparator } } return path.Join(elem...) } // Deprecated // newS3Config simply creates a new Config struct using the passed // parameters. func newS3Config(endpoint, accessKey, secretKey, sessionToken string, clientIP string) *mc.Config { // We have a valid alias and hostConfig. We populate the/ // consoleCredentials from the match found in the config file. return &mc.Config{ HostURL: endpoint, AccessKey: accessKey, SecretKey: secretKey, SessionToken: sessionToken, Signature: "S3v4", AppName: globalAppName, AppVersion: pkg.Version, Insecure: isLocalIPEndpoint(endpoint), Transport: &ConsoleTransport{ ClientIP: clientIP, Transport: GlobalTransport, }, } } ================================================ FILE: api/client_test.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2024 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package api import "testing" func Test_computeObjectURLWithoutEncode(t *testing.T) { type args struct { bucketName string prefix string } tests := []struct { name string args args want string wantErr bool }{ { name: "http://localhost:9000/bucket-1/小飼弾小飼弾小飼弾.jp", args: args{ bucketName: "bucket-1", prefix: "小飼弾小飼弾小飼弾.jpg", }, want: "http://localhost:9000/bucket-1/小飼弾小飼弾小飼弾.jpg", wantErr: false, }, { name: "http://localhost:9000/bucket-1/a a - a a & a a - a a a.jpg", args: args{ bucketName: "bucket-1", prefix: "a a - a a & a a - a a a.jpg", }, want: "http://localhost:9000/bucket-1/a a - a a & a a - a a a.jpg", wantErr: false, }, { name: "http://localhost:9000/bucket-1/02%20-%20FLY%20ME%20TO%20THE%20MOON%20.jpg", args: args{ bucketName: "bucket-1", prefix: "02%20-%20FLY%20ME%20TO%20THE%20MOON%20.jpg", }, want: "http://localhost:9000/bucket-1/02%20-%20FLY%20ME%20TO%20THE%20MOON%20.jpg", wantErr: false, }, { name: "http://localhost:9000/bucket-1/!@#$%^&*()_+.jpg", args: args{ bucketName: "bucket-1", prefix: "!@#$%^&*()_+.jpg", }, want: "http://localhost:9000/bucket-1/!@#$%^&*()_+.jpg", wantErr: false, }, { name: "http://localhost:9000/bucket-1/test/test2/小飼弾小飼弾小飼弾.jpg", args: args{ bucketName: "bucket-1", prefix: "test/test2/小飼弾小飼弾小飼弾.jpg", }, want: "http://localhost:9000/bucket-1/test/test2/小飼弾小飼弾小飼弾.jpg", wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { got, err := computeObjectURLWithoutEncode(tt.args.bucketName, tt.args.prefix) if (err != nil) != tt.wantErr { t.Errorf("computeObjectURLWithoutEncode() errors = %v, wantErr %v", err, tt.wantErr) } if err == nil { if got != tt.want { t.Errorf("computeObjectURLWithoutEncode() got = %v, want %v", got, tt.want) } } }) } } ================================================ FILE: api/config.go ================================================ // 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 api import ( "crypto/tls" "crypto/x509" "net" "net/http" "strconv" "strings" "time" "github.com/minio/console/pkg/auth/idp/oauth2" xcerts "github.com/minio/pkg/v3/certs" "github.com/minio/pkg/v3/env" xnet "github.com/minio/pkg/v3/net" ) 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" ConsoleResourceName = "console-ui" ) var ( // 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 // GlobalTransport is common transport used for all HTTP calls, this is set via // MinIO server to be the correct transport, however we still define some defaults // here just in case. GlobalTransport = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 10 * time.Second, KeepAlive: 15 * time.Second, }).DialContext, MaxIdleConns: 1024, MaxIdleConnsPerHost: 1024, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 10 * time.Second, DisableCompression: true, // Set to avoid auto-decompression TLSClientConfig: &tls.Config{ // Can't use SSLv3 because of POODLE and BEAST // Can't use TLSv1.0 because of POODLE and BEAST using CBC cipher // Can't use TLSv1.1 because of RC4 cipher usage MinVersion: tls.VersionTLS12, // Console runs in the same pod/node as MinIO this is acceptable. InsecureSkipVerify: true, RootCAs: GlobalRootCAs, }, } ) // MinIOConfig represents application configuration passed in from the MinIO // server to the console. type MinIOConfig struct { OpenIDProviders oauth2.OpenIDPCfg } // GlobalMinIOConfig is the global application configuration passed in from the // MinIO server. var GlobalMinIOConfig MinIOConfig func getMinIOServer() string { return strings.TrimSpace(env.Get(ConsoleMinIOServer, "http://localhost:9000")) } func GetMinIORegion() string { return strings.TrimSpace(env.Get(ConsoleMinIORegion, "")) } func getMinIOEndpoint() string { u, err := xnet.ParseHTTPURL(getMinIOServer()) if err != nil { panic(err) } return u.Host } func getMinIOEndpointIsSecure() bool { u, err := xnet.ParseHTTPURL(getMinIOServer()) if err != nil { panic(err) } return u.Scheme == "https" } // GetHostname gets console hostname set on env variable, // default one or defined on run command func GetHostname() string { return strings.ToLower(env.Get(ConsoleHostname, Hostname)) } // GetPort gets console por set on env variable // or default one func GetPort() int { port, err := strconv.Atoi(env.Get(ConsolePort, Port)) if err != nil { port = 9090 } return port } // GetTLSPort gets console tls port set on env variable // or default one func GetTLSPort() int { port, err := strconv.Atoi(env.Get(ConsoleTLSPort, TLSPort)) if err != nil { port = 9443 } return port } // If GetTLSRedirect is set to true, then only allow HTTPS requests. Default is true. func GetTLSRedirect() string { return strings.ToLower(env.Get(ConsoleSecureTLSRedirect, TLSRedirect)) } // Get secure middleware env variable configurations func GetSecureAllowedHosts() []string { allowedHosts := env.Get(ConsoleSecureAllowedHosts, "") if allowedHosts != "" { return strings.Split(allowedHosts, ",") } return []string{} } // AllowedHostsAreRegex determines, if the provided AllowedHosts slice contains valid regular expressions. Default is false. func GetSecureAllowedHostsAreRegex() bool { return strings.ToLower(env.Get(ConsoleSecureAllowedHostsAreRegex, "off")) == "on" } // If FrameDeny is set to true, adds the X-Frame-Options header with the value of `DENY`. Default is true. func GetSecureFrameDeny() bool { return strings.ToLower(env.Get(ConsoleSecureFrameDeny, "on")) == "on" } // If ContentTypeNosniff is true, adds the X-Content-Type-Options header with the value `nosniff`. Default is true. func GetSecureContentTypeNonSniff() bool { return strings.ToLower(env.Get(ConsoleSecureContentTypeNoSniff, "on")) == "on" } // If BrowserXssFilter is true, adds the X-XSS-Protection header with the value `1; mode=block`. Default is true. func GetSecureBrowserXSSFilter() bool { return strings.ToLower(env.Get(ConsoleSecureBrowserXSSFilter, "on")) == "on" } // ContentSecurityPolicy allows the Content-Security-Policy header value to be set with a custom value. Default is "". // Passing a template string will replace `$NONCE` with a dynamic nonce value of 16 bytes for each request which can be // later retrieved using the Nonce function. func GetSecureContentSecurityPolicy() string { return env.Get(ConsoleSecureContentSecurityPolicy, "") } // ContentSecurityPolicyReportOnly allows the Content-Security-Policy-Report-Only header value to be set with a custom value. Default is "". func GetSecureContentSecurityPolicyReportOnly() string { return env.Get(ConsoleSecureContentSecurityPolicyReportOnly, "") } // HostsProxyHeaders is a set of header keys that may hold a proxied hostname value for the request. func GetSecureHostsProxyHeaders() []string { allowedHosts := env.Get(ConsoleSecureHostsProxyHeaders, "") if allowedHosts != "" { return strings.Split(allowedHosts, ",") } return []string{} } // TLSHost is the host name that is used to redirect HTTP requests to HTTPS. Default is "", which indicates to use the same host. func GetSecureTLSHost() string { tlsHost := env.Get(ConsoleSecureTLSHost, "") if tlsHost == "" && Hostname != "" { return net.JoinHostPort(Hostname, TLSPort) } return "" } // STSSeconds is the max-age of the Strict-Transport-Security header. Default is 0, which would NOT include the header. func GetSecureSTSSeconds() int64 { seconds, err := strconv.Atoi(env.Get(ConsoleSecureSTSSeconds, "0")) if err != nil { seconds = 0 } return int64(seconds) } // If STSIncludeSubdomains is set to true, the `includeSubdomains` will be appended to the Strict-Transport-Security header. Default is false. func GetSecureSTSIncludeSubdomains() bool { return strings.ToLower(env.Get(ConsoleSecureSTSIncludeSubdomains, "off")) == "on" } // If STSPreload is set to true, the `preload` flag will be appended to the Strict-Transport-Security header. Default is false. func GetSecureSTSPreload() bool { return strings.ToLower(env.Get(ConsoleSecureSTSPreload, "off")) == "on" } // If TLSTemporaryRedirect is true, the a 302 will be used while redirecting. Default is false (301). func GetSecureTLSTemporaryRedirect() bool { return strings.ToLower(env.Get(ConsoleSecureTLSTemporaryRedirect, "off")) == "on" } // STS header is only included when the connection is HTTPS. func GetSecureForceSTSHeader() bool { return strings.ToLower(env.Get(ConsoleSecureForceSTSHeader, "off")) == "on" } // ReferrerPolicy allows the Referrer-Policy header with the value to be set with a custom value. Default is "". func GetSecureReferrerPolicy() string { return env.Get(ConsoleSecureReferrerPolicy, "") } // FeaturePolicy allows the Feature-Policy header with the value to be set with a custom value. Default is "". func GetSecureFeaturePolicy() string { return env.Get(ConsoleSecureFeaturePolicy, "") } func getLogSearchAPIToken() string { if v := env.Get(ConsoleLogQueryAuthToken, ""); v != "" { return v } return env.Get(LogSearchQueryAuthToken, "") } func getLogSearchURL() string { return env.Get(ConsoleLogQueryURL, "") } func getPrometheusURL() string { return env.Get(PrometheusURL, "") } func getPrometheusAuthToken() string { return env.Get(PrometheusAuthToken, "") } func getPrometheusAuthUserPass() (string, string, bool) { username := env.Get(PrometheusAuthUsername, "") password := env.Get(PrometheusAuthPassword, "") if username == "" && password == "" { return "", "", false } return username, password, true } func getPrometheusJobID() string { return env.Get(PrometheusJobID, "minio-job") } func getPrometheusExtraLabels() string { return env.Get(PrometheusExtraLabels, "") } func getMaxConcurrentUploadsLimit() int64 { cu, err := strconv.ParseInt(env.Get(ConsoleMaxConcurrentUploads, "10"), 10, 64) if err != nil { return 10 } return cu } func getMaxConcurrentDownloadsLimit() int64 { cu, err := strconv.ParseInt(env.Get(ConsoleMaxConcurrentDownloads, "20"), 10, 64) if err != nil { return 20 } return cu } func getConsoleDevMode() bool { return strings.ToLower(env.Get(ConsoleDevMode, "off")) == "on" } func getConsoleBrowserRedirectURL() string { return env.Get(ConsoleBrowserRedirectURL, "") } func getConsoleShareMinIOURL() bool { return strings.ToLower(env.Get(ConsoleShareMinIOURL, "off")) == "on" } func BuildOpenIDConsoleConfig() oauth2.OpenIDPCfg { pcfg := map[string]oauth2.ProviderConfig{} url := env.Get(ConsoleIDPURL, env.Get(MinioIdentifyOpenIDConfigURL, "")) clientID := env.Get(ConsoleIDPClientID, env.Get(MinioIdentifyOpenIDClientID, "")) clientSecret := env.Get(ConsoleIDPSecret, env.Get(MinioIdentifyOpenIDClientSecret, "")) redirectCallback := env.Get(ConsoleIDPCallbackURL, env.Get(MinioBrowserRedirectURL, "")) // Only set config if url, clientID, clientSecret and redirectCallback are provided if url != "" && clientID != "" && clientSecret != "" && redirectCallback != "" { pcfg = map[string]oauth2.ProviderConfig{ "OIDC": { URL: url, ClientID: clientID, ClientSecret: clientSecret, RedirectCallback: redirectCallback + "/oauth_callback", DisplayName: env.Get(ConsoleIDPDisplayName, env.Get(MinioIdentifyOpenIDDisplayName, "")), Scopes: env.Get(ConsoleIDPScopes, env.Get(MinioIdentifyOpenIDScopes, "openid,profile,email")), Userinfo: env.Get(ConsoleIDPUserInfo, env.Get(MinioIdentifyOpenIDClaimUserinfo, "")) == "on", RedirectCallbackDynamic: env.Get(ConsoleIDPCallbackURLDynamic, env.Get(MinioIdentifyOpenIDRedirectURIDynamic, "")) == "on", RoleArn: env.Get(ConsoleIDPRoleArn, ""), EndSessionEndpoint: env.Get(ConsoleIDPEndSessionEndpoint, ""), }, } } return pcfg } ================================================ FILE: api/config_test.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package api import ( "os" "testing" "github.com/stretchr/testify/assert" ) func TestGetHostname(t *testing.T) { os.Setenv(ConsoleHostname, "x") defer os.Unsetenv(ConsoleHostname) assert.Equalf(t, "x", GetHostname(), "GetHostname()") } func TestGetPort(t *testing.T) { type args struct { env string } tests := []struct { name string args args want int }{ { name: "valid port", args: args{ env: "9091", }, want: 9091, }, { name: "invalid port", args: args{ env: "duck", }, want: 9090, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(ConsolePort, tt.args.env) assert.Equalf(t, tt.want, GetPort(), "GetPort()") os.Unsetenv(ConsolePort) }) } } func TestGetTLSPort(t *testing.T) { type args struct { env string } tests := []struct { name string args args want int }{ { name: "valid port", args: args{ env: "9444", }, want: 9444, }, { name: "invalid port", args: args{ env: "duck", }, want: 9443, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(ConsoleTLSPort, tt.args.env) assert.Equalf(t, tt.want, GetTLSPort(), "GetTLSPort()") os.Unsetenv(ConsoleTLSPort) }) } } func TestGetSecureAllowedHosts(t *testing.T) { type args struct { env string } tests := []struct { name string args args want []string }{ { name: "valid hosts", args: args{ env: "host1,host2", }, want: []string{"host1", "host2"}, }, { name: "empty hosts", args: args{ env: "", }, want: []string{}, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(ConsoleSecureAllowedHosts, tt.args.env) assert.Equalf(t, tt.want, GetSecureAllowedHosts(), "GetSecureAllowedHosts()") os.Unsetenv(ConsoleSecureAllowedHosts) }) } } func TestGetSecureHostsProxyHeaders(t *testing.T) { type args struct { env string } tests := []struct { name string args args want []string }{ { name: "valid headers", args: args{ env: "header1,header2", }, want: []string{"header1", "header2"}, }, { name: "empty headers", args: args{ env: "", }, want: []string{}, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(ConsoleSecureHostsProxyHeaders, tt.args.env) assert.Equalf(t, tt.want, GetSecureHostsProxyHeaders(), "GetSecureHostsProxyHeaders()") os.Unsetenv(ConsoleSecureHostsProxyHeaders) }) } } func TestGetSecureSTSSeconds(t *testing.T) { type args struct { env string } tests := []struct { name string args args want int64 }{ { name: "valid", args: args{ env: "1", }, want: 1, }, { name: "invalid", args: args{ env: "duck", }, want: 0, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(ConsoleSecureSTSSeconds, tt.args.env) assert.Equalf(t, tt.want, GetSecureSTSSeconds(), "GetSecureSTSSeconds()") os.Unsetenv(ConsoleSecureSTSSeconds) }) } } func Test_getLogSearchAPIToken(t *testing.T) { type args struct { env string } tests := []struct { name string args args want string }{ { name: "env set", args: args{ env: "value", }, want: "value", }, { name: "env not set", args: args{ env: "", }, want: "", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(ConsoleLogQueryAuthToken, tt.args.env) assert.Equalf(t, tt.want, getLogSearchAPIToken(), "getLogSearchAPIToken()") os.Setenv(ConsoleLogQueryAuthToken, tt.args.env) }) } } func Test_getPrometheusURL(t *testing.T) { type args struct { env string } tests := []struct { name string args args want string }{ { name: "env set", args: args{ env: "value", }, want: "value", }, { name: "env not set", args: args{ env: "", }, want: "", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(PrometheusURL, tt.args.env) assert.Equalf(t, tt.want, getPrometheusURL(), "getPrometheusURL()") os.Setenv(PrometheusURL, tt.args.env) }) } } func Test_getPrometheusJobID(t *testing.T) { type args struct { env string } tests := []struct { name string args args want string }{ { name: "env set", args: args{ env: "value", }, want: "value", }, { name: "env not set", args: args{ env: "", }, want: "minio-job", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(PrometheusJobID, tt.args.env) assert.Equalf(t, tt.want, getPrometheusJobID(), "getPrometheusJobID()") os.Setenv(PrometheusJobID, tt.args.env) }) } } func Test_getMaxConcurrentUploadsLimit(t *testing.T) { type args struct { env string } tests := []struct { name string args args want int64 }{ { name: "valid", args: args{ env: "1", }, want: 1, }, { name: "invalid", args: args{ env: "duck", }, want: 10, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(ConsoleMaxConcurrentUploads, tt.args.env) assert.Equalf(t, tt.want, getMaxConcurrentUploadsLimit(), "getMaxConcurrentUploadsLimit()") os.Unsetenv(ConsoleMaxConcurrentUploads) }) } } func Test_getMaxConcurrentDownloadsLimit(t *testing.T) { type args struct { env string } tests := []struct { name string args args want int64 }{ { name: "valid", args: args{ env: "1", }, want: 1, }, { name: "invalid", args: args{ env: "duck", }, want: 20, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(ConsoleMaxConcurrentDownloads, tt.args.env) assert.Equalf(t, tt.want, getMaxConcurrentDownloadsLimit(), "getMaxConcurrentDownloadsLimit()") os.Unsetenv(ConsoleMaxConcurrentDownloads) }) } } func Test_getConsoleDevMode(t *testing.T) { type args struct { env string } tests := []struct { name string args args want bool }{ { name: "value set", args: args{ env: "on", }, want: true, }, { name: "value not set", args: args{ env: "", }, want: false, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { os.Setenv(ConsoleDevMode, tt.args.env) assert.Equalf(t, tt.want, getConsoleDevMode(), "getConsoleDevMode()") os.Unsetenv(ConsoleDevMode) }) } } ================================================ FILE: api/configure_console.go ================================================ // 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 . // This file is safe to edit. Once it exists it will not be overwritten package api import ( "bytes" "context" "crypto/tls" "fmt" "io" "io/fs" "log" "net" "net/http" "path" "path/filepath" "regexp" "sort" "strconv" "strings" "sync" "time" "github.com/google/uuid" "github.com/minio/console/pkg/logger" "github.com/minio/console/pkg/utils" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/klauspost/compress/gzhttp" portal_ui "github.com/minio/console/web-app" "github.com/minio/pkg/v3/env" "github.com/minio/pkg/v3/mimedb" xnet "github.com/minio/pkg/v3/net" "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/minio/console/api/operations" "github.com/minio/console/models" "github.com/minio/console/pkg/auth" "github.com/unrolled/secure" ) //go:generate swagger generate server --target ../../console --name Console --spec ../swagger.yml var additionalServerFlags = struct { CertsDir string `long:"certs-dir" description:"path to certs directory" env:"CONSOLE_CERTS_DIR"` }{} const ( SubPath = "CONSOLE_SUBPATH" ) var ( cfgSubPath = "/" subPathOnce sync.Once ) func configureFlags(api *operations.ConsoleAPI) { api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ { ShortDescription: "additional server flags", Options: &additionalServerFlags, }, } } func configureAPI(api *operations.ConsoleAPI) http.Handler { // Applies when the "x-token" header is set api.KeyAuth = func(token string, _ []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 if token == "Anonymous" { return &models.Principal{}, nil } 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, Hm: claims.HideMenu, Ob: claims.ObjectBrowser, CustomStyleOb: claims.CustomStyleOB, }, nil } api.AnonymousAuth = func(_ string) (*models.Principal, error) { return &models.Principal{}, nil } // Register login handlers registerLoginHandlers(api) // Register logout handlers registerLogoutHandlers(api) // Register bucket handlers registerBucketsHandlers(api) // Register all users handlers registerUsersHandlers(api) // Register groups handlers registerGroupsHandlers(api) // Register policies handlers registersPoliciesHandler(api) // Register configurations handlers registerConfigHandlers(api) // Register bucket events handlers registerBucketEventsHandlers(api) // Register bucket lifecycle handlers registerBucketsLifecycleHandlers(api) // Register service handlers registerServiceHandlers(api) // Register session handlers registerSessionHandlers(api) // Register admin info handlers registerAdminInfoHandlers(api) // Register admin arns handlers registerAdminArnsHandlers(api) // Register admin notification endpoints handlers registerAdminNotificationEndpointsHandlers(api) // Register admin Service Account Handlers registerServiceAccountsHandlers(api) // Register admin remote buckets registerAdminBucketRemoteHandlers(api) // Register admin log search registerLogSearchHandlers(api) // Register admin KMS handlers registerKMSHandlers(api) // Register admin IDP handlers registerIDPHandlers(api) // Register Account handlers registerAdminTiersHandlers(api) // Register Inspect Handler registerInspectHandler(api) // Register nodes handlers registerNodesHandler(api) registerSiteReplicationHandler(api) registerSiteReplicationStatusHandler(api) // Operator Console // Register Object's Handlers registerObjectsHandlers(api) // Register Bucket Quota's Handlers registerBucketQuotaHandlers(api) // Register Account handlers registerAccountHandlers(api) registerReleasesHandlers(api) registerPublicObjectsHandlers(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 = GlobalRootCAs tlsConfig.GetCertificate = GlobalTLSCertsManager.GetCertificate } // 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 } func ContextMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { requestID := uuid.NewString() ctx := context.WithValue(r.Context(), utils.ContextRequestID, requestID) ctx = context.WithValue(ctx, utils.ContextRequestUserAgent, r.UserAgent()) ctx = context.WithValue(ctx, utils.ContextRequestHost, r.Host) ctx = context.WithValue(ctx, utils.ContextRequestRemoteAddr, r.RemoteAddr) ctx = context.WithValue(ctx, utils.ContextClientIP, getClientIP(r)) next.ServeHTTP(w, r.WithContext(ctx)) }) } func AuditLogMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { rw := logger.NewResponseWriter(w) next.ServeHTTP(rw, r) if strings.HasPrefix(r.URL.Path, "/ws") || strings.HasPrefix(r.URL.Path, "/api") { logger.AuditLog(r.Context(), rw, r, map[string]interface{}{}, "Authorization", "Cookie", "Set-Cookie") } }) } func DebugLogMiddleware(next http.Handler) http.Handler { debugLogLevel, _ := env.GetInt("CONSOLE_DEBUG_LOGLEVEL", 0) if debugLogLevel == 0 { return next } return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { rw := logger.NewResponseWriter(w) next.ServeHTTP(rw, r) debugLog(debugLogLevel, r, rw) }) } func debugLog(debugLogLevel int, r *http.Request, rw *logger.ResponseWriter) { switch debugLogLevel { case 1: // Log server errors only (summary) if rw.StatusCode >= 500 { debugLogSummary(r, rw) } case 2: // Log server and client errors (summary) if rw.StatusCode >= 400 { debugLogSummary(r, rw) } case 3: // Log all requests (summary) debugLogSummary(r, rw) case 4: // Log server errors only (including headers) if rw.StatusCode >= 500 { debugLogDetails(r, rw) } case 5: // Log server and client errors (including headers) if rw.StatusCode >= 400 { debugLogDetails(r, rw) } case 6: // Log all requests (including headers) debugLogDetails(r, rw) } } func debugLogSummary(r *http.Request, rw *logger.ResponseWriter) { statusCode := strconv.Itoa(rw.StatusCode) if rw.Hijacked { statusCode = "hijacked" } logger.Info(fmt.Sprintf("%s %s %s %s %dms", r.RemoteAddr, r.Method, r.URL, statusCode, time.Since(rw.StartTime).Milliseconds())) } func debugLogDetails(r *http.Request, rw *logger.ResponseWriter) { var sb strings.Builder sb.WriteString(fmt.Sprintf("- Method/URL: %s %s\n", r.Method, r.URL)) sb.WriteString(fmt.Sprintf(" Remote endpoint: %s\n", r.RemoteAddr)) if rw.Hijacked { sb.WriteString(" Status code: \n") } else { sb.WriteString(fmt.Sprintf(" Status code: %d\n", rw.StatusCode)) } sb.WriteString(fmt.Sprintf(" Duration (ms): %d\n", time.Since(rw.StartTime).Milliseconds())) sb.WriteString(" Request headers: ") debugLogHeaders(&sb, r.Header) sb.WriteString(" Response headers: ") debugLogHeaders(&sb, rw.Header()) logger.Info(sb.String()) } func debugLogHeaders(sb *strings.Builder, h http.Header) { keys := make([]string, 0, len(h)) for key := range h { keys = append(keys, key) } sort.Strings(keys) first := true for _, key := range keys { values := h[key] for _, value := range values { if !first { sb.WriteString(" ") } else { first = false } sb.WriteString(fmt.Sprintf("%s: %s\n", key, value)) } } if first { sb.WriteRune('\n') } } // 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, logger and metrics func setupGlobalMiddleware(handler http.Handler) http.Handler { gnext := gzhttp.GzipHandler(handler) // if audit-log is enabled console will log all incoming request next := AuditLogMiddleware(gnext) // serve static files next = FileServerMiddleware(next) // add information to request context next = ContextMiddleware(next) // handle cookie or authorization header for session next = AuthenticationMiddleware(next) // handle debug logging next = DebugLogMiddleware(next) sslHostFn := secure.SSLHostFunc(func(host string) string { xhost, err := xnet.ParseHost(host) if err != nil { return host } return net.JoinHostPort(xhost.Name, TLSPort) }) // Secure middleware, this middleware wrap all the previous handlers and add // HTTP security headers secureOptions := secure.Options{ AllowedHosts: GetSecureAllowedHosts(), AllowedHostsAreRegex: GetSecureAllowedHostsAreRegex(), HostsProxyHeaders: GetSecureHostsProxyHeaders(), SSLRedirect: GetTLSRedirect() == "on" && len(GlobalPublicCerts) > 0, SSLHostFunc: &sslHostFn, SSLHost: GetSecureTLSHost(), STSSeconds: GetSecureSTSSeconds(), STSIncludeSubdomains: GetSecureSTSIncludeSubdomains(), STSPreload: GetSecureSTSPreload(), SSLTemporaryRedirect: false, ForceSTSHeader: GetSecureForceSTSHeader(), FrameDeny: GetSecureFrameDeny(), ContentTypeNosniff: GetSecureContentTypeNonSniff(), BrowserXssFilter: GetSecureBrowserXSSFilter(), ContentSecurityPolicy: GetSecureContentSecurityPolicy(), ContentSecurityPolicyReportOnly: GetSecureContentSecurityPolicyReportOnly(), ReferrerPolicy: GetSecureReferrerPolicy(), FeaturePolicy: GetSecureFeaturePolicy(), IsDevelopment: false, } secureMiddleware := secure.New(secureOptions) next = secureMiddleware.Handler(next) return RejectS3Middleware(next) } const apiRequestErr = `InvalidArgumentS3 API Requests must be made to API port.0` // RejectS3Middleware will reject requests that have AWS S3 specific headers. func RejectS3Middleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if len(r.Header.Get("X-Amz-Content-Sha256")) > 0 || len(r.Header.Get("X-Amz-Date")) > 0 || strings.HasPrefix(r.Header.Get("Authorization"), "AWS4-HMAC-SHA256") || r.URL.Query().Get("AWSAccessKeyId") != "" { w.Header().Set("Location", getMinIOServer()) w.WriteHeader(http.StatusBadRequest) w.Write([]byte(apiRequestErr)) return } next.ServeHTTP(w, r) }) } func AuthenticationMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { token, err := auth.GetTokenFromRequest(r) if err != nil && err != auth.ErrNoAuthToken { http.Error(w, err.Error(), http.StatusUnauthorized) return } sessionToken, _ := auth.DecryptToken(token) // All handlers handle appropriately to return errors // based on their swagger rules, we do not need to // additionally return error here, let the next ServeHTTPs // handle it appropriately. if len(sessionToken) > 0 { r.Header.Add("Authorization", fmt.Sprintf("Bearer %s", string(sessionToken))) } else { r.Header.Add("Authorization", fmt.Sprintf("Bearer %s", "Anonymous")) } ctx := r.Context() claims, _ := auth.ParseClaimsFromToken(string(sessionToken)) if claims != nil { // save user session id context ctx = context.WithValue(r.Context(), utils.ContextRequestUserID, claims.STSSessionToken) } next.ServeHTTP(w, r.WithContext(ctx)) }) } // FileServerMiddleware serves files from the static folder func FileServerMiddleware(next http.Handler) http.Handler { buildFs, err := fs.Sub(portal_ui.GetStaticAssets(), "build") if err != nil { panic(err) } spaFileHandler := wrapHandlerSinglePageApplication(requestBounce(http.FileServer(http.FS(buildFs)))) return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Server", globalAppName) // do not add version information switch { case strings.HasPrefix(r.URL.Path, "/ws"): serveWS(w, r) case strings.HasPrefix(r.URL.Path, "/api"): next.ServeHTTP(w, r) default: spaFileHandler.ServeHTTP(w, r) } }) } type notFoundRedirectRespWr struct { http.ResponseWriter // We embed http.ResponseWriter status int } func (w *notFoundRedirectRespWr) WriteHeader(status int) { w.status = status // Store the status for our own use if status != http.StatusNotFound { w.ResponseWriter.WriteHeader(status) } } func (w *notFoundRedirectRespWr) Write(p []byte) (int, error) { if w.status != http.StatusNotFound { return w.ResponseWriter.Write(p) } return len(p), nil // Lie that we successfully wrote it } // handleSPA handles the serving of the React Single Page Application func handleSPA(w http.ResponseWriter, r *http.Request) { basePath := "/" // For SPA mode we will replace root base with a sub path if configured unless we received cp=y and cpb=/NEW/BASE if v := r.URL.Query().Get("cp"); v == "y" { if base := r.URL.Query().Get("cpb"); base != "" { // make sure the subpath has a trailing slash if !strings.HasSuffix(base, "/") { base = fmt.Sprintf("%s/", base) } basePath = base } } indexPage, err := portal_ui.GetStaticAssets().Open("build/index.html") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } sts := r.URL.Query().Get("sts") stsAccessKey := r.URL.Query().Get("sts_a") stsSecretKey := r.URL.Query().Get("sts_s") overridenStyles := r.URL.Query().Get("ov_st") // if these three parameters are present we are being asked to issue a session with these values if sts != "" && stsAccessKey != "" && stsSecretKey != "" { creds := credentials.NewStaticV4(stsAccessKey, stsSecretKey, sts) consoleCreds := &ConsoleCredentials{ ConsoleCredentials: creds, AccountAccessKey: stsAccessKey, } sf := &auth.SessionFeatures{} sf.HideMenu = true sf.ObjectBrowser = true if overridenStyles != "" { err := ValidateEncodedStyles(overridenStyles) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } sf.CustomStyleOB = overridenStyles } sessionID, err := login(consoleCreds, sf) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } cookie := NewSessionCookieForConsole(*sessionID) http.SetCookie(w, &cookie) // Allow us to be iframed w.Header().Del("X-Frame-Options") } indexPageBytes, err := io.ReadAll(indexPage) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } // if we have a seeded basePath. This should override CONSOLE_SUBPATH every time, thus the `if else` if basePath != "/" { indexPageBytes = replaceBaseInIndex(indexPageBytes, basePath) // if we have a custom subpath replace it in } else if getSubPath() != "/" { indexPageBytes = replaceBaseInIndex(indexPageBytes, getSubPath()) } indexPageBytes = replaceLicense(indexPageBytes) // it's important to force "Content-Type: text/html", because a previous // handler may have already set the content-type to a different value. // (i.e. the FileServer when it detected that it couldn't find the file) w.Header().Set("Content-Type", "text/html") http.ServeContent(w, r, "index.html", time.Now(), bytes.NewReader(indexPageBytes)) } // wrapHandlerSinglePageApplication handles a http.FileServer returning a 404 and overrides it with index.html func wrapHandlerSinglePageApplication(h http.Handler) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/" { handleSPA(w, r) return } w.Header().Set("Content-Type", mimedb.TypeByExtension(filepath.Ext(r.URL.Path))) nfw := ¬FoundRedirectRespWr{ResponseWriter: w} h.ServeHTTP(nfw, r) if nfw.status == http.StatusNotFound { handleSPA(w, r) } } } type nullWriter struct{} func (lw nullWriter) Write(b []byte) (int, error) { return len(b), nil } // 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, _, _ string) { // Turn-off random logger by Go net/http s.ErrorLog = log.New(&nullWriter{}, "", 0) } func getSubPath() string { subPathOnce.Do(func() { cfgSubPath = parseSubPath(env.Get(SubPath, "")) }) return cfgSubPath } func parseSubPath(v string) string { v = strings.TrimSpace(v) if v == "" { return SlashSeparator } // Replace all unnecessary `\` to `/` // also add pro-actively at the end. subPath := path.Clean(filepath.ToSlash(v)) if !strings.HasPrefix(subPath, SlashSeparator) { subPath = SlashSeparator + subPath } if !strings.HasSuffix(subPath, SlashSeparator) { subPath += SlashSeparator } return subPath } func replaceBaseInIndex(indexPageBytes []byte, basePath string) []byte { if basePath != "" { validBasePath := regexp.MustCompile(`^[0-9a-zA-Z\/-]+$`) if !validBasePath.MatchString(basePath) { return indexPageBytes } indexPageStr := string(indexPageBytes) newBase := fmt.Sprintf("", basePath) indexPageStr = strings.Replace(indexPageStr, "", newBase, 1) indexPageBytes = []byte(indexPageStr) } return indexPageBytes } func replaceLicense(indexPageBytes []byte) []byte { indexPageStr := string(indexPageBytes) indexPageBytes = []byte(indexPageStr) return indexPageBytes } func requestBounce(handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if strings.HasSuffix(r.URL.Path, "/") { http.NotFound(w, r) return } handler.ServeHTTP(w, r) }) } ================================================ FILE: api/configure_console_test.go ================================================ // 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 api import ( "os" "sync" "testing" "github.com/stretchr/testify/assert" ) func Test_parseSubPath(t *testing.T) { type args struct { v string } tests := []struct { name string args args want string }{ { name: "Empty", args: args{ v: "", }, want: "/", }, { name: "Slash", args: args{ v: "/", }, want: "/", }, { name: "Double Slash", args: args{ v: "//", }, want: "/", }, { name: "No slashes", args: args{ v: "route", }, want: "/route/", }, { name: "No trailing slashes", args: args{ v: "/route", }, want: "/route/", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { assert.Equalf(t, tt.want, parseSubPath(tt.args.v), "parseSubPath(%v)", tt.args.v) }) } } func Test_getSubPath(t *testing.T) { type args struct { envValue string } tests := []struct { name string args args want string }{ { name: "Empty", args: args{ envValue: "", }, want: "/", }, { name: "Slash", args: args{ envValue: "/", }, want: "/", }, { name: "Valid Value", args: args{ envValue: "/subpath/", }, want: "/subpath/", }, { name: "No starting slash", args: args{ envValue: "subpath/", }, want: "/subpath/", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { t.Setenv(SubPath, tt.args.envValue) defer os.Unsetenv(SubPath) subPathOnce = sync.Once{} assert.Equalf(t, tt.want, getSubPath(), "getSubPath()") }) } } ================================================ FILE: api/consts.go ================================================ // 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 api // list of all console environment constants const ( // Constants for common configuration ConsoleMinIOServer = "CONSOLE_MINIO_SERVER" ConsoleSubnetProxy = "CONSOLE_SUBNET_PROXY" ConsoleMinIORegion = "CONSOLE_MINIO_REGION" ConsoleHostname = "CONSOLE_HOSTNAME" ConsolePort = "CONSOLE_PORT" ConsoleTLSPort = "CONSOLE_TLS_PORT" // Constants for Secure middleware ConsoleSecureAllowedHosts = "CONSOLE_SECURE_ALLOWED_HOSTS" ConsoleSecureAllowedHostsAreRegex = "CONSOLE_SECURE_ALLOWED_HOSTS_ARE_REGEX" ConsoleSecureFrameDeny = "CONSOLE_SECURE_FRAME_DENY" ConsoleSecureContentTypeNoSniff = "CONSOLE_SECURE_CONTENT_TYPE_NO_SNIFF" ConsoleSecureBrowserXSSFilter = "CONSOLE_SECURE_BROWSER_XSS_FILTER" ConsoleSecureContentSecurityPolicy = "CONSOLE_SECURE_CONTENT_SECURITY_POLICY" ConsoleSecureContentSecurityPolicyReportOnly = "CONSOLE_SECURE_CONTENT_SECURITY_POLICY_REPORT_ONLY" ConsoleSecureHostsProxyHeaders = "CONSOLE_SECURE_HOSTS_PROXY_HEADERS" ConsoleSecureSTSSeconds = "CONSOLE_SECURE_STS_SECONDS" ConsoleSecureSTSIncludeSubdomains = "CONSOLE_SECURE_STS_INCLUDE_SUB_DOMAINS" ConsoleSecureSTSPreload = "CONSOLE_SECURE_STS_PRELOAD" ConsoleSecureTLSRedirect = "CONSOLE_SECURE_TLS_REDIRECT" ConsoleSecureTLSHost = "CONSOLE_SECURE_TLS_HOST" ConsoleSecureTLSTemporaryRedirect = "CONSOLE_SECURE_TLS_TEMPORARY_REDIRECT" ConsoleSecureForceSTSHeader = "CONSOLE_SECURE_FORCE_STS_HEADER" ConsoleSecurePublicKey = "CONSOLE_SECURE_PUBLIC_KEY" ConsoleSecureReferrerPolicy = "CONSOLE_SECURE_REFERRER_POLICY" ConsoleSecureFeaturePolicy = "CONSOLE_SECURE_FEATURE_POLICY" ConsoleSecureExpectCTHeader = "CONSOLE_SECURE_EXPECT_CT_HEADER" PrometheusURL = "CONSOLE_PROMETHEUS_URL" PrometheusAuthToken = "CONSOLE_PROMETHEUS_AUTH_TOKEN" PrometheusAuthUsername = "CONSOLE_PROMETHEUS_AUTH_USERNAME" PrometheusAuthPassword = "CONSOLE_PROMETHEUS_AUTH_PASSWORD" PrometheusJobID = "CONSOLE_PROMETHEUS_JOB_ID" PrometheusExtraLabels = "CONSOLE_PROMETHEUS_EXTRA_LABELS" ConsoleLogQueryURL = "CONSOLE_LOG_QUERY_URL" ConsoleLogQueryAuthToken = "CONSOLE_LOG_QUERY_AUTH_TOKEN" ConsoleMaxConcurrentUploads = "CONSOLE_MAX_CONCURRENT_UPLOADS" ConsoleMaxConcurrentDownloads = "CONSOLE_MAX_CONCURRENT_DOWNLOADS" ConsoleDevMode = "CONSOLE_DEV_MODE" ConsoleBrowserRedirectURL = "CONSOLE_BROWSER_REDIRECT_URL" ConsoleShareMinIOURL = "CONSOLE_SHARE_MINIO_URL" LogSearchQueryAuthToken = "LOGSEARCH_QUERY_AUTH_TOKEN" SlashSeparator = "/" LocalAddress = "127.0.0.1" // Parts of Environment constants for console OIDC/ IDP/SSO as defined in pkg/auth/idp/oath2 ConsoleIDPDisplayName = "CONSOLE_IDP_DISPLAY_NAME" ConsoleIDPURL = "CONSOLE_IDP_URL" ConsoleIDPClientID = "CONSOLE_IDP_CLIENT_ID" ConsoleIDPSecret = "CONSOLE_IDP_SECRET" ConsoleIDPCallbackURL = "CONSOLE_IDP_CALLBACK" ConsoleIDPCallbackURLDynamic = "CONSOLE_IDP_CALLBACK_DYNAMIC" ConsoleIDPScopes = "CONSOLE_IDP_SCOPES" ConsoleIDPUserInfo = "CONSOLE_IDP_USERINFO" ConsoleIDPRoleArn = "CONSOLE_IDP_ROLE_ARN" ConsoleIDPEndSessionEndpoint = "CONSOLE_IDP_END_SESSION_ENDPOINT" // MinIO Server constants for OIDC MinioIdentifyOpenIDDisplayName = "MINIO_IDENTITY_OPENID_DISPLAY_NAME" MinioIdentifyOpenIDConfigURL = "MINIO_IDENTITY_OPENID_CONFIG_URL" MinioIdentifyOpenIDClientID = "MINIO_IDENTITY_OPENID_CLIENT_ID" MinioIdentifyOpenIDClientSecret = "MINIO_IDENTITY_OPENID_CLIENT_SECRET" MinioBrowserRedirectURL = "MINIO_BROWSER_REDIRECT_URL" MinioIdentifyOpenIDRedirectURIDynamic = "MINIO_IDENTITY_OPENID_REDIRECT_URI_DYNAMIC" MinioIdentifyOpenIDScopes = "MINIO_IDENTITY_OPENID_SCOPES" MinioIdentifyOpenIDClaimUserinfo = "MINIO_IDENTITY_OPENID_CLAIM_USERINFO" ) ================================================ FILE: api/custom-server.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package api 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/api/operations" ) const ( schemeHTTP = "http" schemeHTTPS = "https" schemeUnix = "unix" ) var defaultSchemes []string func init() { defaultSchemes = []string{ schemeHTTP, } } // NewServer creates a new api console server but does not configure it func NewServer(api *operations.ConsoleAPI) *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 console 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/console.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.ConsoleAPI 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) } log.Fatalf(f, args...) } // SetAPI configures the server with the specified API. Needs to be called before Serve func (s *Server) SetAPI(api *operations.ConsoleAPI) { 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 console 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 console 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 { for i := range s.httpServerL { s.httpServerL[i] = netutil.LimitListener(s.httpServerL[i], s.ListenLimit) } } if int64(s.CleanupTimeout) > 0 { httpServer.IdleTimeout = s.CleanupTimeout } httpServer.Handler = s.handler configureServer(httpServer, "http", s.httpServerL[0].Addr().String()) servers = append(servers, httpServer) s.Logf("Serving console at http://%s", s.httpServerL[0].Addr()) for i := range s.httpServerL { wg.Add(1) 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 console at http://%s", l.Addr()) }(s.httpServerL[i]) } } 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 { for i := range s.httpsServerL { s.httpsServerL[i] = netutil.LimitListener(s.httpsServerL[i], 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[0].Addr().String()) servers = append(servers, httpsServer) s.Logf("Serving console at https://%s", s.httpsServerL[0].Addr()) for i := range s.httpsServerL { wg.Add(1) 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 console at https://%s", l.Addr()) }(tls.NewListener(s.httpsServerL[i], 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 } lookup := func(addr string) []net.IP { ips, err := net.LookupIP(addr) if err == nil { return ips } return []net.IP{net.ParseIP(addr)} } convert := func(ip net.IP) (string, string) { if ip == nil { return "", "tcp" } proto := "tcp4" if ip.To4() == nil { proto = "tcp6" } return ip.String(), proto } if s.hasScheme(schemeHTTP) { for _, ip := range lookup(s.Host) { host, proto := convert(ip) listener, err := net.Listen(proto, net.JoinHostPort(host, strconv.Itoa(s.Port))) if err != nil { return err } if s.Host == "" || s.Port == 0 { h, p, err := swag.SplitHostPort(listener.Addr().String()) if err != nil { return err } s.Host = h s.Port = p } s.httpServerL = append(s.httpServerL, listener) } } if s.hasScheme(schemeHTTPS) { for _, ip := range lookup(s.TLSHost) { host, proto := convert(ip) tlsListener, err := net.Listen(proto, net.JoinHostPort(host, strconv.Itoa(s.TLSPort))) if err != nil { return err } if s.TLSHost == "" || s.TLSPort == 0 { sh, sp, err := swag.SplitHostPort(tlsListener.Addr().String()) if err != nil { return err } s.TLSHost = sh s.TLSPort = sp } s.httpsServerL = append(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 behavior) 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) } ================================================ FILE: api/doc.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // // Package api Console Server // // Schemes: // http // ws // Host: localhost // BasePath: /api/v1 // Version: 0.1.0 // // Consumes: // - application/json // - multipart/form-data // // Produces: // - application/zip // - application/octet-stream // - application/json // // swagger:meta package api ================================================ FILE: api/embedded_spec.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package api 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": "Console Server", "version": "0.1.0" }, "basePath": "/api/v1", "paths": { "/account/change-password": { "post": { "tags": [ "Account" ], "summary": "Change password of currently logged in user.", "operationId": "AccountChangePassword", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/accountChangePasswordRequest" } } ], "responses": { "204": { "description": "A successful login." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/account/change-user-password": { "post": { "tags": [ "Account" ], "summary": "Change password of currently logged in user.", "operationId": "ChangeUserPassword", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/changeUserPasswordRequest" } } ], "responses": { "201": { "description": "Password successfully changed." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/arns": { "get": { "tags": [ "System" ], "summary": "Returns a list of active ARNs in the instance", "operationId": "ArnList", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/arnsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/info": { "get": { "tags": [ "System" ], "summary": "Returns information about the deployment", "operationId": "AdminInfo", "parameters": [ { "type": "boolean", "default": false, "name": "defaultOnly", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/adminInfoResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/info/widgets/{widgetId}": { "get": { "tags": [ "System" ], "summary": "Returns information about the deployment", "operationId": "DashboardWidgetDetails", "parameters": [ { "type": "integer", "format": "int32", "name": "widgetId", "in": "path", "required": true }, { "type": "integer", "name": "start", "in": "query" }, { "type": "integer", "name": "end", "in": "query" }, { "type": "integer", "format": "int32", "name": "step", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/widgetDetails" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/inspect": { "get": { "produces": [ "application/octet-stream" ], "tags": [ "Inspect" ], "summary": "Inspect Files on Drive", "operationId": "Inspect", "parameters": [ { "type": "string", "name": "file", "in": "query", "required": true }, { "type": "string", "name": "volume", "in": "query", "required": true }, { "type": "boolean", "name": "encrypt", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "file" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/notification_endpoints": { "get": { "tags": [ "Configuration" ], "summary": "Returns a list of active notification endpoints", "operationId": "NotificationEndpointList", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/notifEndpointResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Configuration" ], "summary": "Allows to configure a new notification endpoint", "operationId": "AddNotificationEndpoint", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/notificationEndpoint" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setNotificationEndpointResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/site-replication": { "get": { "tags": [ "SiteReplication" ], "summary": "Get list of Replication Sites", "operationId": "GetSiteReplicationInfo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/siteReplicationInfoResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "SiteReplication" ], "summary": "Edit a Replication Site", "operationId": "SiteReplicationEdit", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/peerInfo" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/peerSiteEditResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "SiteReplication" ], "summary": "Add a Replication Site", "operationId": "SiteReplicationInfoAdd", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/siteReplicationAddRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/siteReplicationAddResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "SiteReplication" ], "summary": "Remove a Replication Site", "operationId": "SiteReplicationRemove", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/peerInfoRemove" } } ], "responses": { "204": { "description": "A successful response.", "schema": { "$ref": "#/definitions/peerSiteRemoveResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/site-replication/status": { "get": { "tags": [ "SiteReplication" ], "summary": "Display overall site replication status", "operationId": "GetSiteReplicationStatus", "parameters": [ { "type": "boolean", "default": true, "description": "Include Bucket stats", "name": "buckets", "in": "query" }, { "type": "boolean", "default": true, "description": "Include Group stats", "name": "groups", "in": "query" }, { "type": "boolean", "default": true, "description": "Include Policies stats", "name": "policies", "in": "query" }, { "type": "boolean", "default": true, "description": "Include Policies stats", "name": "users", "in": "query" }, { "type": "string", "description": "Entity Type to lookup", "name": "entityType", "in": "query" }, { "type": "string", "description": "Entity Value to lookup", "name": "entityValue", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/siteReplicationStatusResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/tiers": { "get": { "tags": [ "Tiering" ], "summary": "Returns a list of tiers for ilm", "operationId": "TiersList", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/tierListResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Tiering" ], "summary": "Allows to configure a new tier", "operationId": "AddTier", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/tier" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/tiers/names": { "get": { "tags": [ "Tiering" ], "summary": "Returns a list of tiers' names for ilm", "operationId": "TiersListNames", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/tiersNameListResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/tiers/{name}/remove": { "delete": { "tags": [ "Tiering" ], "summary": "Remove Tier", "operationId": "RemoveTier", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/tiers/{type}/{name}": { "get": { "tags": [ "Tiering" ], "summary": "Get Tier", "operationId": "GetTier", "parameters": [ { "enum": [ "s3", "gcs", "azure", "minio" ], "type": "string", "name": "type", "in": "path", "required": true }, { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/tier" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/tiers/{type}/{name}/credentials": { "put": { "tags": [ "Tiering" ], "summary": "Edit Tier Credentials", "operationId": "EditTierCredentials", "parameters": [ { "enum": [ "s3", "gcs", "azure", "minio" ], "type": "string", "name": "type", "in": "path", "required": true }, { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/tierCredentialsRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/bucket-policy/{bucket}": { "get": { "tags": [ "Bucket" ], "summary": "List Policies With Given Bucket", "operationId": "ListPoliciesWithBucket", "parameters": [ { "type": "string", "name": "bucket", "in": "path", "required": true }, { "$ref": "#/parameters/offset" }, { "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listPoliciesResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/bucket-users/{bucket}": { "get": { "tags": [ "Bucket" ], "summary": "List Users With Access to a Given Bucket", "operationId": "ListUsersWithAccessToBucket", "parameters": [ { "type": "string", "name": "bucket", "in": "path", "required": true }, { "$ref": "#/parameters/offset" }, { "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "array", "items": { "type": "string" } } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/bucket/{bucket}/access-rules": { "get": { "tags": [ "Bucket" ], "summary": "List Access Rules With Given Bucket", "operationId": "ListAccessRulesWithBucket", "parameters": [ { "type": "string", "name": "bucket", "in": "path", "required": true }, { "$ref": "#/parameters/offset" }, { "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listAccessRulesResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Bucket" ], "summary": "Add Access Rule To Given Bucket", "operationId": "SetAccessRuleWithBucket", "parameters": [ { "type": "string", "name": "bucket", "in": "path", "required": true }, { "name": "prefixaccess", "in": "body", "required": true, "schema": { "$ref": "#/definitions/prefixAccessPair" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "boolean" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Bucket" ], "summary": "Delete Access Rule From Given Bucket", "operationId": "DeleteAccessRuleWithBucket", "parameters": [ { "type": "string", "name": "bucket", "in": "path", "required": true }, { "name": "prefix", "in": "body", "required": true, "schema": { "$ref": "#/definitions/prefixWrapper" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "boolean" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets": { "get": { "tags": [ "Bucket" ], "summary": "List Buckets", "operationId": "ListBuckets", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listBucketsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Bucket" ], "summary": "Make bucket", "operationId": "MakeBucket", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/makeBucketRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/makeBucketsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets-replication": { "post": { "tags": [ "Bucket" ], "summary": "Sets Multi Bucket Replication in multiple Buckets", "operationId": "SetMultiBucketReplication", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/multiBucketReplication" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/multiBucketResponseState" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/max-share-exp": { "get": { "tags": [ "Bucket" ], "summary": "Get max expiration time for share link in seconds", "operationId": "GetMaxShareLinkExp", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/maxShareLinkExpResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/multi-lifecycle": { "post": { "tags": [ "Bucket" ], "summary": "Add Multi Bucket Lifecycle", "operationId": "AddMultiBucketLifecycle", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/addMultiBucketLifecycle" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/multiLifecycleResult" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/delete-all-replication-rules": { "delete": { "tags": [ "Bucket" ], "summary": "Deletes all replication rules from a bucket", "operationId": "DeleteAllReplicationRules", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/delete-objects": { "post": { "tags": [ "Object" ], "summary": "Delete Multiple Objects", "operationId": "DeleteMultipleObjects", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "boolean", "name": "all_versions", "in": "query" }, { "type": "boolean", "name": "bypass", "in": "query" }, { "name": "files", "in": "body", "required": true, "schema": { "type": "array", "items": { "$ref": "#/definitions/deleteFile" } } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/delete-selected-replication-rules": { "delete": { "tags": [ "Bucket" ], "summary": "Deletes selected replication rules from a bucket", "operationId": "DeleteSelectedReplicationRules", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "rules", "in": "body", "required": true, "schema": { "$ref": "#/definitions/bucketReplicationRuleList" } } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/encryption/disable": { "post": { "tags": [ "Bucket" ], "summary": "Disable bucket encryption.", "operationId": "DisableBucketEncryption", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/encryption/enable": { "post": { "tags": [ "Bucket" ], "summary": "Enable bucket encryption.", "operationId": "EnableBucketEncryption", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/bucketEncryptionRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/encryption/info": { "get": { "tags": [ "Bucket" ], "summary": "Get bucket encryption information.", "operationId": "GetBucketEncryptionInfo", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketEncryptionInfo" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/events": { "get": { "tags": [ "Bucket" ], "summary": "List Bucket Events", "operationId": "ListBucketEvents", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "$ref": "#/parameters/offset" }, { "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listBucketEventsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Bucket" ], "summary": "Create Bucket Event", "operationId": "CreateBucketEvent", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/bucketEventRequest" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/events/{arn}": { "delete": { "tags": [ "Bucket" ], "summary": "Delete Bucket Event", "operationId": "DeleteBucketEvent", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "arn", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/notificationDeleteRequest" } } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/lifecycle": { "get": { "tags": [ "Bucket" ], "summary": "Bucket Lifecycle", "operationId": "GetBucketLifecycle", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketLifecycleResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Bucket" ], "summary": "Add Bucket Lifecycle", "operationId": "AddBucketLifecycle", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/addBucketLifecycle" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/lifecycle/{lifecycle_id}": { "put": { "tags": [ "Bucket" ], "summary": "Update Lifecycle rule", "operationId": "UpdateBucketLifecycle", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "lifecycle_id", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/updateBucketLifecycle" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Bucket" ], "summary": "Delete Lifecycle rule", "operationId": "DeleteBucketLifecycleRule", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "lifecycle_id", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/object-locking": { "get": { "tags": [ "Bucket" ], "summary": "Returns the status of object locking support on the bucket", "operationId": "GetBucketObjectLockingStatus", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketObLockingResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects": { "get": { "tags": [ "Object" ], "summary": "List Objects", "operationId": "ListObjects", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query" }, { "type": "boolean", "name": "recursive", "in": "query" }, { "type": "boolean", "name": "with_versions", "in": "query" }, { "type": "boolean", "name": "with_metadata", "in": "query" }, { "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listObjectsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [ { "key": [] }, { "anonymous": [] } ] }, "delete": { "tags": [ "Object" ], "summary": "Delete Object", "operationId": "DeleteObject", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query" }, { "type": "boolean", "name": "recursive", "in": "query" }, { "type": "boolean", "name": "all_versions", "in": "query" }, { "type": "boolean", "name": "non_current_versions", "in": "query" }, { "type": "boolean", "name": "bypass", "in": "query" } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/download": { "get": { "produces": [ "application/octet-stream" ], "tags": [ "Object" ], "summary": "Download Object", "operationId": "Download Object", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query" }, { "type": "boolean", "default": false, "name": "preview", "in": "query" }, { "type": "string", "default": "", "name": "override_file_name", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "file" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [ { "key": [] }, { "anonymous": [] } ] } }, "/buckets/{bucket_name}/objects/download-multiple": { "post": { "produces": [ "application/octet-stream" ], "tags": [ "Object" ], "summary": "Download Multiple Objects", "operationId": "DownloadMultipleObjects", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "objectList", "in": "body", "required": true, "schema": { "type": "array", "items": { "type": "string" } } } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "file" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [ { "key": [] }, { "anonymous": [] } ] } }, "/buckets/{bucket_name}/objects/legalhold": { "put": { "tags": [ "Object" ], "summary": "Put Object's legalhold status", "operationId": "PutObjectLegalHold", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/putObjectLegalHoldRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/metadata": { "get": { "tags": [ "Object" ], "summary": "Gets the metadata of an object", "operationId": "GetObjectMetadata", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "versionID", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/metadata" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/restore": { "put": { "tags": [ "Object" ], "summary": "Restore Object to a selected version", "operationId": "PutObjectRestore", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/retention": { "put": { "tags": [ "Object" ], "summary": "Put Object's retention status", "operationId": "PutObjectRetention", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/putObjectRetentionRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Object" ], "summary": "Delete Object retention from an object", "operationId": "DeleteObjectRetention", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/share": { "get": { "tags": [ "Object" ], "summary": "Shares an Object on a url", "operationId": "ShareObject", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true }, { "type": "string", "name": "expires", "in": "query" }, { "type": "boolean", "name": "toggle_url", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "string" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/tags": { "put": { "tags": [ "Object" ], "summary": "Put Object's tags", "operationId": "PutObjectTags", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/putObjectTagsRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/upload": { "post": { "consumes": [ "multipart/form-data" ], "tags": [ "Object" ], "summary": "Uploads an Object.", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query" } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [ { "key": [] }, { "anonymous": [] } ] } }, "/buckets/{bucket_name}/replication": { "get": { "tags": [ "Bucket" ], "summary": "Bucket Replication", "operationId": "GetBucketReplication", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketReplicationResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/replication/{rule_id}": { "get": { "tags": [ "Bucket" ], "summary": "Bucket Replication", "operationId": "GetBucketReplicationRule", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "rule_id", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketReplicationRule" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Bucket" ], "summary": "Update Replication rule", "operationId": "UpdateMultiBucketReplication", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "rule_id", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/multiBucketReplicationEdit" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Bucket" ], "summary": "Bucket Replication Rule Delete", "operationId": "DeleteBucketReplicationRule", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "rule_id", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/retention": { "get": { "tags": [ "Bucket" ], "summary": "Get Bucket's retention config", "operationId": "GetBucketRetentionConfig", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/getBucketRetentionConfig" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Bucket" ], "summary": "Set Bucket's retention config", "operationId": "SetBucketRetentionConfig", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/putBucketRetentionRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/rewind/{date}": { "get": { "tags": [ "Bucket" ], "summary": "Get objects in a bucket for a rewind date", "operationId": "GetBucketRewind", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "date", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/rewindResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/tags": { "put": { "tags": [ "Bucket" ], "summary": "Put Bucket's tags", "operationId": "PutBucketTags", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/putBucketTagsRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/versioning": { "get": { "tags": [ "Bucket" ], "summary": "Bucket Versioning", "operationId": "GetBucketVersioning", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketVersioningResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Bucket" ], "summary": "Set Bucket Versioning", "operationId": "SetBucketVersioning", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setBucketVersioning" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{name}": { "get": { "tags": [ "Bucket" ], "summary": "Bucket Info", "operationId": "BucketInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucket" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Bucket" ], "summary": "Delete Bucket", "operationId": "DeleteBucket", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{name}/quota": { "get": { "tags": [ "Bucket" ], "summary": "Get Bucket Quota", "operationId": "GetBucketQuota", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketQuota" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Bucket" ], "summary": "Bucket Quota", "operationId": "SetBucketQuota", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setBucketQuota" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucket" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{name}/set-policy": { "put": { "tags": [ "Bucket" ], "summary": "Bucket Set Policy", "operationId": "BucketSetPolicy", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setBucketPolicyRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucket" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/configs": { "get": { "tags": [ "Configuration" ], "summary": "List Configurations", "operationId": "ListConfig", "parameters": [ { "$ref": "#/parameters/offset" }, { "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listConfigResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/configs/export": { "get": { "tags": [ "Configuration" ], "summary": "Export the current config from MinIO server", "operationId": "ExportConfig", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/configExportResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/configs/import": { "post": { "consumes": [ "multipart/form-data" ], "tags": [ "Configuration" ], "summary": "Uploads a file to import MinIO server config.", "parameters": [ { "type": "file", "name": "file", "in": "formData", "required": true } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/configs/{name}": { "get": { "tags": [ "Configuration" ], "summary": "Configuration info", "operationId": "ConfigInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "array", "items": { "$ref": "#/definitions/configuration" } } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Configuration" ], "summary": "Set Configuration", "operationId": "SetConfig", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setConfigRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setConfigResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/configs/{name}/reset": { "post": { "tags": [ "Configuration" ], "summary": "Configuration reset", "operationId": "ResetConfig", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setConfigResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/download-shared-object/{url}": { "get": { "produces": [ "application/octet-stream" ], "tags": [ "Public" ], "summary": "Downloads an object from a presigned url", "operationId": "DownloadSharedObject", "parameters": [ { "type": "string", "name": "url", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "file" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [] } }, "/group/{name}": { "get": { "tags": [ "Group" ], "summary": "Group info", "operationId": "GroupInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/group" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Group" ], "summary": "Update Group Members or Status", "operationId": "UpdateGroup", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/updateGroupRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/group" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Group" ], "summary": "Remove group", "operationId": "RemoveGroup", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/groups": { "get": { "tags": [ "Group" ], "summary": "List Groups", "operationId": "ListGroups", "parameters": [ { "$ref": "#/parameters/offset" }, { "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listGroupsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Group" ], "summary": "Add Group", "operationId": "AddGroup", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/addGroupRequest" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/idp/{type}": { "get": { "tags": [ "idp" ], "summary": "List IDP Configurations", "operationId": "ListConfigurations", "parameters": [ { "type": "string", "description": "IDP Configuration Type", "name": "type", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/idpListConfigurationsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "consumes": [ "application/json" ], "tags": [ "idp" ], "summary": "Create IDP Configuration", "operationId": "CreateConfiguration", "parameters": [ { "type": "string", "description": "IDP Configuration Type", "name": "type", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/idpServerConfiguration" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setIDPResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/idp/{type}/{name}": { "get": { "tags": [ "idp" ], "summary": "Get IDP Configuration", "operationId": "GetConfiguration", "parameters": [ { "type": "string", "description": "IDP Configuration Name", "name": "name", "in": "path", "required": true }, { "type": "string", "description": "IDP Configuration Type", "name": "type", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/idpServerConfiguration" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "consumes": [ "application/json" ], "tags": [ "idp" ], "summary": "Update IDP Configuration", "operationId": "UpdateConfiguration", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/idpServerConfiguration" } }, { "type": "string", "description": "IDP Configuration Name", "name": "name", "in": "path", "required": true }, { "type": "string", "description": "IDP Configuration Type", "name": "type", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setIDPResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "idp" ], "summary": "Delete IDP Configuration", "operationId": "DeleteConfiguration", "parameters": [ { "type": "string", "description": "IDP Configuration Name", "name": "name", "in": "path", "required": true }, { "type": "string", "description": "IDP Configuration Type", "name": "type", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setIDPResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/apis": { "get": { "tags": [ "KMS" ], "summary": "KMS apis", "operationId": "KMSAPIs", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsAPIsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/keys": { "get": { "tags": [ "KMS" ], "summary": "KMS list keys", "operationId": "KMSListKeys", "parameters": [ { "type": "string", "description": "pattern to retrieve keys", "name": "pattern", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsListKeysResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "KMS" ], "summary": "KMS create key", "operationId": "KMSCreateKey", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/kmsCreateKeyRequest" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/keys/{name}": { "get": { "tags": [ "KMS" ], "summary": "KMS key status", "operationId": "KMSKeyStatus", "parameters": [ { "type": "string", "description": "KMS key name", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsKeyStatusResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/metrics": { "get": { "tags": [ "KMS" ], "summary": "KMS metrics", "operationId": "KMSMetrics", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsMetricsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/status": { "get": { "tags": [ "KMS" ], "summary": "KMS status", "operationId": "KMSStatus", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsStatusResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/version": { "get": { "tags": [ "KMS" ], "summary": "KMS version", "operationId": "KMSVersion", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsVersionResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/ldap-entities": { "post": { "tags": [ "idp" ], "summary": "Get LDAP Entities", "operationId": "GetLDAPEntities", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ldapEntitiesRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/ldapEntities" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/list-external-buckets": { "post": { "tags": [ "Bucket" ], "summary": "Lists an External list of buckets using custom credentials", "operationId": "ListExternalBuckets", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/listExternalBucketsParams" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listBucketsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/login": { "get": { "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/ApiError" } } }, "security": [] }, "post": { "tags": [ "Auth" ], "summary": "Login to Console", "operationId": "Login", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/loginRequest" } } ], "responses": { "204": { "description": "A successful login." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [] } }, "/login/oauth2/auth": { "post": { "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/ApiError" } } }, "security": [] } }, "/logout": { "post": { "tags": [ "Auth" ], "summary": "Logout from Console.", "operationId": "Logout", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/logoutRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/logs/search": { "get": { "tags": [ "Logging" ], "summary": "Search the logs", "operationId": "LogSearch", "parameters": [ { "type": "array", "items": { "type": "string" }, "collectionFormat": "multi", "description": "Filter Parameters", "name": "fp", "in": "query" }, { "type": "number", "format": "int32", "default": 10, "name": "pageSize", "in": "query" }, { "type": "number", "format": "int32", "default": 0, "name": "pageNo", "in": "query" }, { "enum": [ "timeDesc", "timeAsc" ], "type": "string", "default": "timeDesc", "name": "order", "in": "query" }, { "type": "string", "name": "timeStart", "in": "query" }, { "type": "string", "name": "timeEnd", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/logSearchResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/nodes": { "get": { "tags": [ "System" ], "summary": "Lists Nodes", "operationId": "ListNodes", "responses": { "200": { "description": "A successful response.", "schema": { "type": "array", "items": { "type": "string" } } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/policies": { "get": { "tags": [ "Policy" ], "summary": "List Policies", "operationId": "ListPolicies", "parameters": [ { "$ref": "#/parameters/offset" }, { "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listPoliciesResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Policy" ], "summary": "Add Policy", "operationId": "AddPolicy", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/addPolicyRequest" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/policy" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/policies/{policy}/groups": { "get": { "tags": [ "Policy" ], "summary": "List Groups for a Policy", "operationId": "ListGroupsForPolicy", "parameters": [ { "type": "string", "name": "policy", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "array", "items": { "type": "string" } } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/policies/{policy}/users": { "get": { "tags": [ "Policy" ], "summary": "List Users for a Policy", "operationId": "ListUsersForPolicy", "parameters": [ { "type": "string", "name": "policy", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "array", "items": { "type": "string" } } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/policy/{name}": { "get": { "tags": [ "Policy" ], "summary": "Policy info", "operationId": "PolicyInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/policy" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Policy" ], "summary": "Remove policy", "operationId": "RemovePolicy", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/profiling/start": { "post": { "tags": [ "Profile" ], "summary": "Start recording profile data", "operationId": "ProfilingStart", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/profilingStartRequest" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/startProfilingList" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/profiling/stop": { "post": { "produces": [ "application/zip" ], "tags": [ "Profile" ], "summary": "Stop and download profile data", "operationId": "ProfilingStop", "responses": { "201": { "description": "A successful response.", "schema": { "type": "file" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/releases": { "get": { "tags": [ "release" ], "summary": "Get repo releases for a given version", "operationId": "ListReleases", "parameters": [ { "type": "string", "description": "repo name", "name": "repo", "in": "query", "required": true }, { "type": "string", "description": "Current Release", "name": "current", "in": "query" }, { "type": "string", "description": "search content", "name": "search", "in": "query" }, { "type": "string", "description": "filter releases", "name": "filter", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/releaseListResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/remote-buckets": { "get": { "tags": [ "Bucket" ], "summary": "List Remote Buckets", "operationId": "ListRemoteBuckets", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listRemoteBucketsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Bucket" ], "summary": "Add Remote Bucket", "operationId": "AddRemoteBucket", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/createRemoteBucket" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/remote-buckets/{name}": { "get": { "tags": [ "Bucket" ], "summary": "Remote Bucket Details", "operationId": "RemoteBucketDetails", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/remoteBucket" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/remote-buckets/{source_bucket_name}/{arn}": { "delete": { "tags": [ "Bucket" ], "summary": "Delete Remote Bucket", "operationId": "DeleteRemoteBucket", "parameters": [ { "type": "string", "name": "source_bucket_name", "in": "path", "required": true }, { "type": "string", "name": "arn", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/service-account-credentials": { "post": { "tags": [ "ServiceAccount" ], "summary": "Create Service Account With Credentials", "operationId": "CreateServiceAccountCreds", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/serviceAccountRequestCreds" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccountCreds" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/service-accounts": { "get": { "tags": [ "ServiceAccount" ], "summary": "List User's Service Accounts", "operationId": "ListUserServiceAccounts", "parameters": [ { "$ref": "#/parameters/offset" }, { "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccounts" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "ServiceAccount" ], "summary": "Create Service Account", "operationId": "CreateServiceAccount", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/serviceAccountRequest" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccountCreds" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/service-accounts/delete-multi": { "delete": { "tags": [ "ServiceAccount" ], "summary": "Delete Multiple Service Accounts", "operationId": "DeleteMultipleServiceAccounts", "parameters": [ { "name": "selectedSA", "in": "body", "required": true, "schema": { "$ref": "#/definitions/selectedSAs" } } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/service-accounts/{access_key}": { "get": { "tags": [ "ServiceAccount" ], "summary": "Get Service Account", "operationId": "GetServiceAccount", "parameters": [ { "type": "string", "name": "access_key", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccount" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "ServiceAccount" ], "summary": "Set Service Account Policy", "operationId": "UpdateServiceAccount", "parameters": [ { "type": "string", "name": "access_key", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/updateServiceAccountRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "ServiceAccount" ], "summary": "Delete Service Account", "operationId": "DeleteServiceAccount", "parameters": [ { "type": "string", "name": "access_key", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/service/restart": { "post": { "tags": [ "Service" ], "summary": "Restart Service", "operationId": "RestartService", "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/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/sessionResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/set-policy": { "put": { "tags": [ "Policy" ], "summary": "Set policy", "operationId": "SetPolicy", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setPolicyNameRequest" } } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/set-policy-multi": { "put": { "tags": [ "Policy" ], "summary": "Set policy to multiple users/groups", "operationId": "SetPolicyMultiple", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setPolicyMultipleNameRequest" } } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/policy": { "get": { "tags": [ "Policy" ], "summary": "returns policies for logged in user", "operationId": "GetUserPolicy", "responses": { "200": { "description": "A successful response.", "schema": { "type": "string" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/{name}": { "get": { "tags": [ "User" ], "summary": "Get User Info", "operationId": "GetUserInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/user" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "User" ], "summary": "Update User Info", "operationId": "UpdateUserInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/updateUser" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/user" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "User" ], "summary": "Remove user", "operationId": "RemoveUser", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/{name}/groups": { "put": { "tags": [ "User" ], "summary": "Update Groups for a user", "operationId": "UpdateUserGroups", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/updateUserGroups" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/user" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/{name}/policies": { "get": { "tags": [ "Policy" ], "summary": "returns policies assigned for a specified user", "operationId": "GetSAUserPolicy", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/aUserPolicyResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/{name}/service-account-credentials": { "post": { "tags": [ "User" ], "summary": "Create Service Account for User With Credentials", "operationId": "CreateServiceAccountCredentials", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/serviceAccountRequestCreds" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccountCreds" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/{name}/service-accounts": { "get": { "tags": [ "User" ], "summary": "returns a list of service accounts for a user", "operationId": "ListAUserServiceAccounts", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccounts" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "User" ], "summary": "Create Service Account for User", "operationId": "CreateAUserServiceAccount", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/serviceAccountRequest" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccountCreds" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/users": { "get": { "tags": [ "User" ], "summary": "List Users", "operationId": "ListUsers", "parameters": [ { "$ref": "#/parameters/offset" }, { "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listUsersResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "User" ], "summary": "Add User", "operationId": "AddUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/addUserRequest" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/user" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/users-groups-bulk": { "put": { "tags": [ "User" ], "summary": "Bulk functionality to Add Users to Groups", "operationId": "BulkUpdateUsersGroups", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/bulkUserGroups" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/users/service-accounts": { "post": { "tags": [ "User" ], "summary": "Check number of service accounts for each user specified", "operationId": "CheckUserServiceAccounts", "parameters": [ { "name": "selectedUsers", "in": "body", "required": true, "schema": { "$ref": "#/definitions/selectedUsers" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/userServiceAccountSummary" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } } }, "definitions": { "ApiError": { "type": "object", "properties": { "detailedMessage": { "type": "string" }, "message": { "type": "string" } } }, "BackendProperties": { "type": "object", "properties": { "backendType": { "type": "string" }, "offlineDrives": { "type": "integer" }, "onlineDrives": { "type": "integer" }, "rrSCParity": { "type": "integer" }, "standardSCParity": { "type": "integer" } } }, "aUserPolicyResponse": { "type": "object", "properties": { "policy": { "type": "string" } } }, "accessRule": { "type": "object", "properties": { "access": { "type": "string" }, "prefix": { "type": "string" } } }, "accountChangePasswordRequest": { "type": "object", "required": [ "current_secret_key", "new_secret_key" ], "properties": { "current_secret_key": { "type": "string" }, "new_secret_key": { "type": "string" } } }, "addBucketLifecycle": { "type": "object", "properties": { "disable": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expired_object_delete_all": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expired_object_delete_marker": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expiry_days": { "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", "type": "integer", "format": "int32", "default": 0 }, "newer_noncurrentversion_expiration_versions": { "description": "Non required, can be set in case of expiration is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_expiration_days": { "description": "Non required, can be set in case of expiration is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_days": { "description": "Non required, can be set in case of transition is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_storage_class": { "description": "Non required, can be set in case of transition is enabled", "type": "string" }, "prefix": { "description": "Non required field, it matches a prefix to perform ILM operations on it", "type": "string" }, "storage_class": { "description": "Required only in case of transition is set. it refers to a tier", "type": "string" }, "tags": { "description": "Non required field, tags to match ILM files", "type": "string" }, "transition_days": { "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", "type": "integer", "format": "int32", "default": 0 }, "type": { "description": "ILM Rule type (Expiry or transition)", "type": "string", "enum": [ "expiry", "transition" ] } } }, "addBucketReplication": { "type": "object", "properties": { "arn": { "type": "string" }, "destination_bucket": { "type": "string" } } }, "addGroupRequest": { "type": "object", "required": [ "group", "members" ], "properties": { "group": { "type": "string" }, "members": { "type": "array", "items": { "type": "string" } } } }, "addMultiBucketLifecycle": { "type": "object", "required": [ "buckets", "type" ], "properties": { "buckets": { "type": "array", "items": { "type": "string" } }, "expired_object_delete_all": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expired_object_delete_marker": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expiry_days": { "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_expiration_days": { "description": "Non required, can be set in case of expiration is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_days": { "description": "Non required, can be set in case of transition is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_storage_class": { "description": "Non required, can be set in case of transition is enabled", "type": "string" }, "prefix": { "description": "Non required field, it matches a prefix to perform ILM operations on it", "type": "string" }, "storage_class": { "description": "Required only in case of transition is set. it refers to a tier", "type": "string" }, "tags": { "description": "Non required field, tags to match ILM files", "type": "string" }, "transition_days": { "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", "type": "integer", "format": "int32", "default": 0 }, "type": { "description": "ILM Rule type (Expiry or transition)", "type": "string", "enum": [ "expiry", "transition" ] } } }, "addPolicyRequest": { "type": "object", "required": [ "name", "policy" ], "properties": { "name": { "type": "string" }, "policy": { "type": "string" } } }, "addUserRequest": { "type": "object", "required": [ "accessKey", "secretKey", "groups", "policies" ], "properties": { "accessKey": { "type": "string" }, "groups": { "type": "array", "items": { "type": "string" } }, "policies": { "type": "array", "items": { "type": "string" } }, "secretKey": { "type": "string" } } }, "adminInfoResponse": { "type": "object", "properties": { "advancedMetricsStatus": { "type": "string", "enum": [ "not configured", "available", "unavailable" ] }, "backend": { "$ref": "#/definitions/BackendProperties" }, "buckets": { "type": "integer" }, "objects": { "type": "integer" }, "servers": { "type": "array", "items": { "$ref": "#/definitions/serverProperties" } }, "usage": { "type": "integer" }, "widgets": { "type": "array", "items": { "$ref": "#/definitions/widget" } } } }, "apiKey": { "type": "object", "properties": { "apiKey": { "type": "string" } } }, "arnsResponse": { "type": "object", "properties": { "arns": { "type": "array", "items": { "type": "string" } } } }, "bucket": { "type": "object", "required": [ "name" ], "properties": { "access": { "$ref": "#/definitions/bucketAccess" }, "creation_date": { "type": "string" }, "definition": { "type": "string" }, "details": { "type": "object", "properties": { "locking": { "type": "boolean" }, "quota": { "type": "object", "properties": { "quota": { "type": "integer", "format": "int64" }, "type": { "type": "string", "enum": [ "hard" ] } } }, "replication": { "type": "boolean" }, "tags": { "type": "object", "additionalProperties": { "type": "string" } }, "versioning": { "type": "boolean" }, "versioningSuspended": { "type": "boolean" } } }, "name": { "type": "string", "minLength": 3 }, "objects": { "type": "integer", "format": "int64" }, "rw_access": { "type": "object", "properties": { "read": { "type": "boolean" }, "write": { "type": "boolean" } } }, "size": { "type": "integer", "format": "int64" } } }, "bucketAccess": { "type": "string", "default": "PRIVATE", "enum": [ "PRIVATE", "PUBLIC", "CUSTOM" ] }, "bucketEncryptionInfo": { "type": "object", "properties": { "algorithm": { "type": "string" }, "kmsMasterKeyID": { "type": "string" } } }, "bucketEncryptionRequest": { "type": "object", "properties": { "encType": { "$ref": "#/definitions/bucketEncryptionType" }, "kmsKeyID": { "type": "string" } } }, "bucketEncryptionType": { "type": "string", "default": "sse-s3", "enum": [ "sse-s3", "sse-kms" ] }, "bucketEventRequest": { "type": "object", "required": [ "configuration" ], "properties": { "configuration": { "$ref": "#/definitions/notificationConfig" }, "ignoreExisting": { "type": "boolean" } } }, "bucketLifecycleResponse": { "type": "object", "properties": { "lifecycle": { "type": "array", "items": { "$ref": "#/definitions/objectBucketLifecycle" } } } }, "bucketObLockingResponse": { "type": "object", "properties": { "object_locking_enabled": { "type": "boolean" } } }, "bucketObject": { "type": "object", "properties": { "content_type": { "type": "string" }, "etag": { "type": "string" }, "expiration": { "type": "string" }, "expiration_rule_id": { "type": "string" }, "is_delete_marker": { "type": "boolean" }, "is_latest": { "type": "boolean" }, "last_modified": { "type": "string" }, "legal_hold_status": { "type": "string" }, "metadata": { "type": "object", "additionalProperties": { "type": "string" } }, "name": { "type": "string" }, "retention_mode": { "type": "string" }, "retention_until_date": { "type": "string" }, "size": { "type": "integer", "format": "int64" }, "tags": { "type": "object", "additionalProperties": { "type": "string" } }, "user_metadata": { "type": "object", "additionalProperties": { "type": "string" } }, "user_tags": { "type": "object", "additionalProperties": { "type": "string" } }, "version_id": { "type": "string" } } }, "bucketQuota": { "type": "object", "properties": { "quota": { "type": "integer" }, "type": { "type": "string", "enum": [ "hard" ] } } }, "bucketReplicationDestination": { "type": "object", "properties": { "bucket": { "type": "string" } } }, "bucketReplicationResponse": { "type": "object", "properties": { "rules": { "type": "array", "items": { "$ref": "#/definitions/bucketReplicationRule" } } } }, "bucketReplicationRule": { "type": "object", "properties": { "bandwidth": { "type": "string" }, "delete_marker_replication": { "type": "boolean" }, "deletes_replication": { "type": "boolean" }, "destination": { "$ref": "#/definitions/bucketReplicationDestination" }, "existingObjects": { "type": "boolean" }, "healthCheckPeriod": { "type": "integer" }, "id": { "type": "string" }, "metadata_replication": { "type": "boolean" }, "prefix": { "type": "string" }, "priority": { "type": "integer", "format": "int32" }, "status": { "type": "string", "enum": [ "Enabled", "Disabled" ] }, "storageClass": { "type": "string" }, "syncMode": { "type": "string", "default": "async", "enum": [ "async", "sync" ] }, "tags": { "type": "string" } } }, "bucketReplicationRuleList": { "type": "object", "properties": { "rules": { "type": "array", "items": { "type": "string" } } } }, "bucketVersioningResponse": { "type": "object", "properties": { "MFADelete": { "type": "string" }, "excludeFolders": { "type": "boolean" }, "excludedPrefixes": { "type": "array", "items": { "type": "object", "properties": { "prefix": { "type": "string" } } } }, "status": { "type": "string" } } }, "bulkUserGroups": { "type": "object", "required": [ "users", "groups" ], "properties": { "groups": { "type": "array", "items": { "type": "string" } }, "users": { "type": "array", "items": { "type": "string" } } } }, "changeUserPasswordRequest": { "type": "object", "required": [ "selectedUser", "newSecretKey" ], "properties": { "newSecretKey": { "type": "string" }, "selectedUser": { "type": "string" } } }, "configDescription": { "type": "object", "properties": { "description": { "type": "string" }, "key": { "type": "string" } } }, "configExportResponse": { "type": "object", "properties": { "status": { "type": "string" }, "value": { "description": "Returns base64 encoded value", "type": "string" } } }, "configuration": { "type": "object", "properties": { "key_values": { "type": "array", "items": { "$ref": "#/definitions/configurationKV" } }, "name": { "type": "string" } } }, "configurationKV": { "type": "object", "properties": { "env_override": { "$ref": "#/definitions/envOverride" }, "key": { "type": "string" }, "value": { "type": "string" } } }, "createRemoteBucket": { "required": [ "accessKey", "secretKey", "targetURL", "sourceBucket", "targetBucket" ], "properties": { "accessKey": { "type": "string", "minLength": 3 }, "bandwidth": { "type": "integer", "format": "int64" }, "healthCheckPeriod": { "type": "integer", "format": "int32" }, "region": { "type": "string" }, "secretKey": { "type": "string", "minLength": 8 }, "sourceBucket": { "type": "string" }, "syncMode": { "type": "string", "default": "async", "enum": [ "async", "sync" ] }, "targetBucket": { "type": "string" }, "targetURL": { "type": "string" } } }, "deleteFile": { "type": "object", "properties": { "path": { "type": "string" }, "recursive": { "type": "boolean" }, "versionID": { "type": "string" } } }, "envOverride": { "type": "object", "properties": { "name": { "type": "string" }, "value": { "type": "string" } } }, "environmentConstants": { "type": "object", "properties": { "maxConcurrentDownloads": { "type": "integer" }, "maxConcurrentUploads": { "type": "integer" } } }, "expirationResponse": { "type": "object", "properties": { "date": { "type": "string" }, "days": { "type": "integer", "format": "int64" }, "delete_all": { "type": "boolean" }, "delete_marker": { "type": "boolean" }, "newer_noncurrent_expiration_versions": { "type": "integer", "format": "int64" }, "noncurrent_expiration_days": { "type": "integer", "format": "int64" } } }, "getBucketRetentionConfig": { "type": "object", "properties": { "mode": { "$ref": "#/definitions/objectRetentionMode" }, "unit": { "$ref": "#/definitions/objectRetentionUnit" }, "validity": { "type": "integer", "format": "int32" } } }, "group": { "type": "object", "properties": { "members": { "type": "array", "items": { "type": "string" } }, "name": { "type": "string" }, "policy": { "type": "string" }, "status": { "type": "string" } } }, "iamEntity": { "type": "string" }, "iamPolicy": { "type": "object", "properties": { "statement": { "type": "array", "items": { "$ref": "#/definitions/iamPolicyStatement" } }, "version": { "type": "string" } } }, "iamPolicyStatement": { "type": "object", "properties": { "action": { "type": "array", "items": { "type": "string" } }, "condition": { "type": "object", "additionalProperties": { "type": "object" } }, "effect": { "type": "string" }, "resource": { "type": "array", "items": { "type": "string" } } } }, "idpListConfigurationsResponse": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/idpServerConfiguration" } } } }, "idpServerConfiguration": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "info": { "type": "array", "items": { "$ref": "#/definitions/idpServerConfigurationInfo" } }, "input": { "type": "string" }, "name": { "type": "string" }, "type": { "type": "string" } } }, "idpServerConfigurationInfo": { "type": "object", "properties": { "isCfg": { "type": "boolean" }, "isEnv": { "type": "boolean" }, "key": { "type": "string" }, "value": { "type": "string" } } }, "kmsAPI": { "type": "object", "properties": { "maxBody": { "type": "integer" }, "method": { "type": "string" }, "path": { "type": "string" }, "timeout": { "type": "integer" } } }, "kmsAPIsResponse": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/kmsAPI" } } } }, "kmsCreateKeyRequest": { "type": "object", "required": [ "key" ], "properties": { "key": { "type": "string" } } }, "kmsEndpoint": { "type": "object", "properties": { "status": { "type": "string" }, "url": { "type": "string" } } }, "kmsKeyInfo": { "type": "object", "properties": { "createdAt": { "type": "string" }, "createdBy": { "type": "string" }, "name": { "type": "string" } } }, "kmsKeyStatusResponse": { "type": "object", "properties": { "decryptionErr": { "type": "string" }, "encryptionErr": { "type": "string" }, "keyID": { "type": "string" } } }, "kmsLatencyHistogram": { "type": "object", "properties": { "duration": { "type": "integer" }, "total": { "type": "integer" } } }, "kmsListKeysResponse": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/kmsKeyInfo" } } } }, "kmsMetricsResponse": { "type": "object", "required": [ "requestOK", "requestErr", "requestFail", "requestActive", "auditEvents", "errorEvents", "latencyHistogram", "uptime", "cpus", "usableCPUs", "threads", "heapAlloc", "stackAlloc" ], "properties": { "auditEvents": { "type": "integer" }, "cpus": { "type": "integer" }, "errorEvents": { "type": "integer" }, "heapAlloc": { "type": "integer" }, "heapObjects": { "type": "integer" }, "latencyHistogram": { "type": "array", "items": { "$ref": "#/definitions/kmsLatencyHistogram" } }, "requestActive": { "type": "integer" }, "requestErr": { "type": "integer" }, "requestFail": { "type": "integer" }, "requestOK": { "type": "integer" }, "stackAlloc": { "type": "integer" }, "threads": { "type": "integer" }, "uptime": { "type": "integer" }, "usableCPUs": { "type": "integer" } } }, "kmsStatusResponse": { "type": "object", "properties": { "defaultKeyID": { "type": "string" }, "endpoints": { "type": "array", "items": { "$ref": "#/definitions/kmsEndpoint" } }, "name": { "type": "string" } } }, "kmsVersionResponse": { "type": "object", "properties": { "version": { "type": "string" } } }, "ldapEntities": { "type": "object", "properties": { "groups": { "type": "array", "items": { "$ref": "#/definitions/ldapGroupPolicyEntity" } }, "policies": { "type": "array", "items": { "$ref": "#/definitions/ldapPolicyEntity" } }, "timestamp": { "type": "string" }, "users": { "type": "array", "items": { "$ref": "#/definitions/ldapUserPolicyEntity" } } } }, "ldapEntitiesRequest": { "type": "object", "properties": { "groups": { "type": "array", "items": { "type": "string" } }, "policies": { "type": "array", "items": { "type": "string" } }, "users": { "type": "array", "items": { "type": "string" } } } }, "ldapGroupPolicyEntity": { "type": "object", "properties": { "group": { "type": "string" }, "policies": { "type": "array", "items": { "type": "string" } } } }, "ldapPolicyEntity": { "type": "object", "properties": { "groups": { "type": "array", "items": { "type": "string" } }, "policy": { "type": "string" }, "users": { "type": "array", "items": { "type": "string" } } } }, "ldapUserPolicyEntity": { "type": "object", "properties": { "policies": { "type": "array", "items": { "type": "string" } }, "user": { "type": "string" } } }, "lifecycleTag": { "type": "object", "properties": { "key": { "type": "string" }, "value": { "type": "string" } } }, "listAccessRulesResponse": { "type": "object", "properties": { "accessRules": { "type": "array", "title": "list of policies", "items": { "$ref": "#/definitions/accessRule" } }, "total": { "type": "integer", "format": "int64", "title": "total number of policies" } } }, "listBucketEventsResponse": { "type": "object", "properties": { "events": { "type": "array", "items": { "$ref": "#/definitions/notificationConfig" } }, "total": { "type": "integer", "format": "int64", "title": "total number of bucket events" } } }, "listBucketsResponse": { "type": "object", "properties": { "buckets": { "type": "array", "title": "list of resulting buckets", "items": { "$ref": "#/definitions/bucket" } }, "total": { "type": "integer", "format": "int64", "title": "number of buckets accessible to the user" } } }, "listConfigResponse": { "type": "object", "properties": { "configurations": { "type": "array", "items": { "$ref": "#/definitions/configDescription" } }, "total": { "type": "integer", "format": "int64", "title": "total number of configurations" } } }, "listExternalBucketsParams": { "required": [ "accessKey", "secretKey", "targetURL", "useTLS" ], "properties": { "accessKey": { "type": "string", "minLength": 3 }, "region": { "type": "string" }, "secretKey": { "type": "string", "minLength": 8 }, "targetURL": { "type": "string" }, "useTLS": { "type": "boolean" } } }, "listGroupsResponse": { "type": "object", "properties": { "groups": { "type": "array", "title": "list of groups", "items": { "type": "string" } }, "total": { "type": "integer", "format": "int64", "title": "total number of groups" } } }, "listObjectsResponse": { "type": "object", "properties": { "objects": { "type": "array", "title": "list of resulting objects", "items": { "$ref": "#/definitions/bucketObject" } }, "total": { "type": "integer", "format": "int64", "title": "number of objects" } } }, "listPoliciesResponse": { "type": "object", "properties": { "policies": { "type": "array", "title": "list of policies", "items": { "$ref": "#/definitions/policy" } }, "total": { "type": "integer", "format": "int64", "title": "total number of policies" } } }, "listRemoteBucketsResponse": { "type": "object", "properties": { "buckets": { "type": "array", "title": "list of remote buckets", "items": { "$ref": "#/definitions/remoteBucket" } }, "total": { "type": "integer", "format": "int64", "title": "number of remote buckets accessible to user" } } }, "listUsersResponse": { "type": "object", "properties": { "users": { "type": "array", "title": "list of resulting users", "items": { "$ref": "#/definitions/user" } } } }, "logSearchResponse": { "type": "object", "properties": { "results": { "type": "object", "title": "list of log search responses" } } }, "loginDetails": { "type": "object", "properties": { "isK8S": { "type": "boolean" }, "ldap_enabled": { "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" } } }, "loginRequest": { "type": "object", "properties": { "accessKey": { "type": "string" }, "features": { "type": "object", "properties": { "hide_menu": { "type": "boolean" } } }, "secretKey": { "type": "string" }, "sts": { "type": "string" } } }, "loginResponse": { "type": "object", "properties": { "IDPRefreshToken": { "type": "string" }, "sessionId": { "type": "string" } } }, "logoutRequest": { "type": "object", "properties": { "state": { "type": "string" } } }, "makeBucketRequest": { "type": "object", "required": [ "name" ], "properties": { "locking": { "type": "boolean" }, "name": { "type": "string" }, "quota": { "$ref": "#/definitions/setBucketQuota" }, "retention": { "$ref": "#/definitions/putBucketRetentionRequest" }, "versioning": { "$ref": "#/definitions/setBucketVersioning" } } }, "makeBucketsResponse": { "type": "object", "properties": { "bucketName": { "type": "string" } } }, "maxShareLinkExpResponse": { "type": "object", "required": [ "exp" ], "properties": { "exp": { "type": "number", "format": "int64" } } }, "metadata": { "type": "object", "properties": { "objectMetadata": { "type": "object", "additionalProperties": true } } }, "multiBucketReplication": { "required": [ "accessKey", "secretKey", "targetURL", "bucketsRelation" ], "properties": { "accessKey": { "type": "string", "minLength": 3 }, "bandwidth": { "type": "integer", "format": "int64" }, "bucketsRelation": { "type": "array", "minLength": 1, "items": { "$ref": "#/definitions/multiBucketsRelation" } }, "healthCheckPeriod": { "type": "integer", "format": "int32" }, "prefix": { "type": "string" }, "priority": { "type": "integer", "format": "int32", "default": 0 }, "region": { "type": "string" }, "replicateDeleteMarkers": { "type": "boolean" }, "replicateDeletes": { "type": "boolean" }, "replicateExistingObjects": { "type": "boolean" }, "replicateMetadata": { "type": "boolean" }, "secretKey": { "type": "string", "minLength": 8 }, "storageClass": { "type": "string", "default": "" }, "syncMode": { "type": "string", "default": "async", "enum": [ "async", "sync" ] }, "tags": { "type": "string" }, "targetURL": { "type": "string" } } }, "multiBucketReplicationEdit": { "properties": { "arn": { "type": "string" }, "prefix": { "type": "string" }, "priority": { "type": "integer", "format": "int32", "default": 0 }, "replicateDeleteMarkers": { "type": "boolean" }, "replicateDeletes": { "type": "boolean" }, "replicateExistingObjects": { "type": "boolean" }, "replicateMetadata": { "type": "boolean" }, "ruleState": { "type": "boolean" }, "storageClass": { "type": "string", "default": "" }, "tags": { "type": "string", "default": "" } } }, "multiBucketResponseItem": { "type": "object", "properties": { "errorString": { "type": "string" }, "originBucket": { "type": "string" }, "targetBucket": { "type": "string" } } }, "multiBucketResponseState": { "type": "object", "properties": { "replicationState": { "type": "array", "items": { "$ref": "#/definitions/multiBucketResponseItem" } } } }, "multiBucketsRelation": { "type": "object", "properties": { "destinationBucket": { "type": "string" }, "originBucket": { "type": "string" } } }, "multiLifecycleResult": { "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/multicycleResultItem" } } } }, "multicycleResultItem": { "type": "object", "properties": { "bucketName": { "type": "string" }, "error": { "type": "string" } } }, "nofiticationService": { "type": "string", "enum": [ "webhook", "amqp", "kafka", "mqtt", "nats", "nsq", "mysql", "postgres", "elasticsearch", "redis" ] }, "notifEndpointResponse": { "type": "object", "properties": { "notification_endpoints": { "type": "array", "items": { "$ref": "#/definitions/notificationEndpointItem" } } } }, "notificationConfig": { "type": "object", "required": [ "arn" ], "properties": { "arn": { "type": "string" }, "events": { "type": "array", "title": "filter specific type of event. Defaults to all event (default: '[put,delete,get]')", "items": { "$ref": "#/definitions/notificationEventType" } }, "id": { "type": "string" }, "prefix": { "type": "string", "title": "filter event associated to the specified prefix" }, "suffix": { "type": "string", "title": "filter event associated to the specified suffix" } } }, "notificationDeleteRequest": { "type": "object", "required": [ "events", "prefix", "suffix" ], "properties": { "events": { "type": "array", "title": "filter specific type of event. Defaults to all event (default: '[put,delete,get]')", "minLength": 1, "items": { "$ref": "#/definitions/notificationEventType" } }, "prefix": { "type": "string", "title": "filter event associated to the specified prefix" }, "suffix": { "type": "string", "title": "filter event associated to the specified suffix" } } }, "notificationEndpoint": { "type": "object", "required": [ "service", "account_id", "properties" ], "properties": { "account_id": { "type": "string" }, "properties": { "type": "object", "additionalProperties": { "type": "string" } }, "service": { "$ref": "#/definitions/nofiticationService" } } }, "notificationEndpointItem": { "type": "object", "properties": { "account_id": { "type": "string" }, "service": { "$ref": "#/definitions/nofiticationService" }, "status": { "type": "string" } } }, "notificationEventType": { "type": "string", "enum": [ "put", "delete", "get", "replica", "ilm", "scanner" ] }, "objectBucketLifecycle": { "type": "object", "properties": { "expiration": { "$ref": "#/definitions/expirationResponse" }, "id": { "type": "string" }, "prefix": { "type": "string" }, "status": { "type": "string" }, "tags": { "type": "array", "items": { "$ref": "#/definitions/lifecycleTag" } }, "transition": { "$ref": "#/definitions/transitionResponse" } } }, "objectLegalHoldStatus": { "type": "string", "enum": [ "enabled", "disabled" ] }, "objectRetentionMode": { "type": "string", "enum": [ "governance", "compliance" ] }, "objectRetentionUnit": { "type": "string", "enum": [ "days", "years" ] }, "peerInfo": { "type": "object", "properties": { "deploymentID": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" } } }, "peerInfoRemove": { "type": "object", "required": [ "sites" ], "properties": { "all": { "type": "boolean" }, "sites": { "type": "array", "items": { "type": "string" } } } }, "peerSite": { "type": "object", "properties": { "accessKey": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" }, "secretKey": { "type": "string" } } }, "peerSiteEditResponse": { "type": "object", "properties": { "errorDetail": { "type": "string" }, "status": { "type": "string" }, "success": { "type": "boolean" } } }, "peerSiteRemoveResponse": { "type": "object", "properties": { "errorDetail": { "type": "string" }, "status": { "type": "string" } } }, "permissionResource": { "type": "object", "properties": { "conditionOperator": { "type": "string" }, "prefixes": { "type": "array", "items": { "type": "string" } }, "resource": { "type": "string" } } }, "policy": { "type": "object", "properties": { "name": { "type": "string" }, "policy": { "type": "string" } } }, "policyArgs": { "type": "object", "properties": { "action": { "type": "string" }, "bucket_name": { "type": "string" }, "id": { "type": "string" } } }, "policyEntity": { "type": "string", "default": "user", "enum": [ "user", "group" ] }, "prefixAccessPair": { "type": "object", "properties": { "access": { "type": "string" }, "prefix": { "type": "string" } } }, "prefixWrapper": { "type": "object", "properties": { "prefix": { "type": "string" } } }, "principal": { "type": "object", "properties": { "STSAccessKeyID": { "type": "string" }, "STSSecretAccessKey": { "type": "string" }, "STSSessionToken": { "type": "string" }, "accountAccessKey": { "type": "string" }, "customStyleOb": { "type": "string" }, "hm": { "type": "boolean" }, "ob": { "type": "boolean" } } }, "profilingStartRequest": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string" } } }, "putBucketRetentionRequest": { "type": "object", "required": [ "mode", "unit", "validity" ], "properties": { "mode": { "$ref": "#/definitions/objectRetentionMode" }, "unit": { "$ref": "#/definitions/objectRetentionUnit" }, "validity": { "type": "integer", "format": "int32" } } }, "putBucketTagsRequest": { "type": "object", "properties": { "tags": { "additionalProperties": { "type": "string" } } } }, "putObjectLegalHoldRequest": { "type": "object", "required": [ "status" ], "properties": { "status": { "$ref": "#/definitions/objectLegalHoldStatus" } } }, "putObjectRetentionRequest": { "type": "object", "required": [ "mode", "expires" ], "properties": { "expires": { "type": "string" }, "governance_bypass": { "type": "boolean" }, "mode": { "$ref": "#/definitions/objectRetentionMode" } } }, "putObjectTagsRequest": { "type": "object", "properties": { "tags": { "additionalProperties": { "type": "string" } } } }, "redirectRule": { "type": "object", "properties": { "displayName": { "type": "string" }, "redirect": { "type": "string" }, "serviceType": { "type": "string" } } }, "releaseAuthor": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "events_url": { "type": "string" }, "followers_url": { "type": "string" }, "following_url": { "type": "string" }, "gists_url": { "type": "string" }, "gravatar_id": { "type": "string" }, "html_url": { "type": "string" }, "id": { "type": "integer" }, "login": { "type": "string" }, "node_id": { "type": "string" }, "organizations_url": { "type": "string" }, "receivedEvents_url": { "type": "string" }, "repos_url": { "type": "string" }, "site_admin": { "type": "boolean" }, "starred_url": { "type": "string" }, "subscriptions_url": { "type": "string" }, "type": { "type": "string" }, "url": { "type": "string" } } }, "releaseInfo": { "type": "object", "properties": { "breakingChangesContent": { "type": "string" }, "contextContent": { "type": "string" }, "metadata": { "$ref": "#/definitions/releaseMetadata" }, "newFeaturesContent": { "type": "string" }, "notesContent": { "type": "string" }, "securityContent": { "type": "string" } } }, "releaseListResponse": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/releaseInfo" } } } }, "releaseMetadata": { "type": "object", "properties": { "assets_url": { "type": "string" }, "author": { "$ref": "#/definitions/releaseAuthor" }, "created_at": { "type": "string" }, "draft": { "type": "boolean" }, "html_url": { "type": "string" }, "id": { "type": "integer" }, "name": { "type": "string" }, "node_id": { "type": "string" }, "prerelease": { "type": "boolean" }, "published_at": { "type": "string" }, "tag_name": { "type": "string" }, "tarball_url": { "type": "string" }, "target_commitish": { "type": "string" }, "upload_url": { "type": "string" }, "url": { "type": "string" }, "zipball_url": { "type": "string" } } }, "remoteBucket": { "type": "object", "required": [ "accessKey", "sourceBucket", "remoteARN" ], "properties": { "accessKey": { "type": "string", "minLength": 3 }, "bandwidth": { "type": "integer", "format": "int64" }, "healthCheckPeriod": { "type": "integer" }, "remoteARN": { "type": "string" }, "secretKey": { "type": "string", "minLength": 8 }, "service": { "type": "string", "enum": [ "replication" ] }, "sourceBucket": { "type": "string" }, "status": { "type": "string" }, "syncMode": { "type": "string" }, "targetBucket": { "type": "string" }, "targetURL": { "type": "string" } } }, "resultTarget": { "type": "object", "properties": { "legendFormat": { "type": "string" }, "result": { "type": "array", "items": { "$ref": "#/definitions/widgetResult" } }, "resultType": { "type": "string" } } }, "rewindItem": { "type": "object", "properties": { "action": { "type": "string" }, "delete_flag": { "type": "boolean" }, "is_latest": { "type": "boolean" }, "last_modified": { "type": "string" }, "name": { "type": "string" }, "size": { "type": "integer", "format": "int64" }, "version_id": { "type": "string" } } }, "rewindResponse": { "type": "object", "properties": { "objects": { "type": "array", "items": { "$ref": "#/definitions/rewindItem" } } } }, "selectedSAs": { "type": "array", "items": { "type": "string" } }, "selectedUsers": { "type": "array", "items": { "type": "string" } }, "serverDrives": { "type": "object", "properties": { "availableSpace": { "type": "integer" }, "drivePath": { "type": "string" }, "endpoint": { "type": "string" }, "healing": { "type": "boolean" }, "model": { "type": "string" }, "rootDisk": { "type": "boolean" }, "state": { "type": "string" }, "totalSpace": { "type": "integer" }, "usedSpace": { "type": "integer" }, "uuid": { "type": "string" } } }, "serverProperties": { "type": "object", "properties": { "commitID": { "type": "string" }, "drives": { "type": "array", "items": { "$ref": "#/definitions/serverDrives" } }, "endpoint": { "type": "string" }, "network": { "type": "object", "additionalProperties": { "type": "string" } }, "poolNumber": { "type": "integer" }, "state": { "type": "string" }, "uptime": { "type": "integer" }, "version": { "type": "string" } } }, "serviceAccount": { "type": "object", "properties": { "accountStatus": { "type": "string" }, "description": { "type": "string" }, "expiration": { "type": "string" }, "impliedPolicy": { "type": "boolean" }, "name": { "type": "string" }, "parentUser": { "type": "string" }, "policy": { "type": "string" } } }, "serviceAccountCreds": { "type": "object", "properties": { "accessKey": { "type": "string" }, "secretKey": { "type": "string" }, "url": { "type": "string" } } }, "serviceAccountRequest": { "type": "object", "properties": { "comment": { "type": "string" }, "description": { "type": "string" }, "expiry": { "type": "string" }, "name": { "type": "string" }, "policy": { "type": "string", "title": "policy to be applied to the Service Account if any" } } }, "serviceAccountRequestCreds": { "type": "object", "properties": { "accessKey": { "type": "string" }, "comment": { "type": "string" }, "description": { "type": "string" }, "expiry": { "type": "string" }, "name": { "type": "string" }, "policy": { "type": "string", "title": "policy to be applied to the Service Account if any" }, "secretKey": { "type": "string" } } }, "serviceAccounts": { "type": "array", "items": { "type": "object", "properties": { "accessKey": { "type": "string" }, "accountStatus": { "type": "string" }, "description": { "type": "string" }, "expiration": { "type": "string" }, "name": { "type": "string" } } } }, "sessionResponse": { "type": "object", "properties": { "allowResources": { "type": "array", "items": { "$ref": "#/definitions/permissionResource" } }, "customStyles": { "type": "string" }, "distributedMode": { "type": "boolean" }, "envConstants": { "$ref": "#/definitions/environmentConstants" }, "features": { "type": "array", "items": { "type": "string" } }, "operator": { "type": "boolean" }, "permissions": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "serverEndPoint": { "type": "string" }, "status": { "type": "string", "enum": [ "ok" ] } } }, "setBucketPolicyRequest": { "type": "object", "required": [ "access" ], "properties": { "access": { "$ref": "#/definitions/bucketAccess" }, "definition": { "type": "string" } } }, "setBucketQuota": { "type": "object", "required": [ "enabled" ], "properties": { "amount": { "type": "integer" }, "enabled": { "type": "boolean" }, "quota_type": { "type": "string", "enum": [ "hard" ] } } }, "setBucketVersioning": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "excludeFolders": { "type": "boolean" }, "excludePrefixes": { "type": "array", "maxLength": 10, "items": { "type": "string" } } } }, "setConfigRequest": { "type": "object", "required": [ "key_values" ], "properties": { "arn_resource_id": { "type": "string", "title": "Used if configuration is an event notification's target" }, "key_values": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/configurationKV" } } } }, "setConfigResponse": { "type": "object", "properties": { "restart": { "description": "Returns wheter server needs to restart to apply changes or not", "type": "boolean" } } }, "setIDPResponse": { "type": "object", "properties": { "restart": { "type": "boolean" } } }, "setNotificationEndpointResponse": { "type": "object", "required": [ "service", "account_id", "properties" ], "properties": { "account_id": { "type": "string" }, "properties": { "type": "object", "additionalProperties": { "type": "string" } }, "restart": { "type": "boolean" }, "service": { "$ref": "#/definitions/nofiticationService" } } }, "setPolicyMultipleNameRequest": { "type": "object", "properties": { "groups": { "type": "array", "items": { "$ref": "#/definitions/iamEntity" } }, "name": { "type": "array", "items": { "type": "string" } }, "users": { "type": "array", "items": { "$ref": "#/definitions/iamEntity" } } } }, "setPolicyNameRequest": { "type": "object", "required": [ "name", "entityType", "entityName" ], "properties": { "entityName": { "type": "string" }, "entityType": { "$ref": "#/definitions/policyEntity" }, "name": { "type": "array", "items": { "type": "string" } } } }, "setPolicyRequest": { "type": "object", "required": [ "entityType", "entityName" ], "properties": { "entityName": { "type": "string" }, "entityType": { "$ref": "#/definitions/policyEntity" } } }, "siteReplicationAddRequest": { "type": "array", "items": { "$ref": "#/definitions/peerSite" } }, "siteReplicationAddResponse": { "type": "object", "properties": { "errorDetail": { "type": "string" }, "initialSyncErrorMessage": { "type": "string" }, "status": { "type": "string" }, "success": { "type": "boolean" } } }, "siteReplicationInfoResponse": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "name": { "type": "string" }, "serviceAccountAccessKey": { "type": "string" }, "sites": { "type": "array", "items": { "$ref": "#/definitions/peerInfo" } } } }, "siteReplicationStatusResponse": { "type": "object", "properties": { "bucketStats": { "type": "object" }, "enabled": { "type": "boolean" }, "groupStats": { "type": "object" }, "maxBuckets": { "type": "integer" }, "maxGroups": { "type": "integer" }, "maxPolicies": { "type": "integer" }, "maxUsers": { "type": "integer" }, "policyStats": { "type": "object" }, "sites": { "type": "object" }, "statsSummary": { "type": "object" }, "userStats": { "type": "object" } } }, "startProfilingItem": { "type": "object", "properties": { "error": { "type": "string" }, "nodeName": { "type": "string" }, "success": { "type": "boolean" } } }, "startProfilingList": { "type": "object", "properties": { "startResults": { "type": "array", "items": { "$ref": "#/definitions/startProfilingItem" } }, "total": { "type": "integer", "format": "int64", "title": "number of start results" } } }, "tier": { "type": "object", "properties": { "azure": { "type": "object", "$ref": "#/definitions/tier_azure" }, "gcs": { "type": "object", "$ref": "#/definitions/tier_gcs" }, "minio": { "type": "object", "$ref": "#/definitions/tier_minio" }, "s3": { "type": "object", "$ref": "#/definitions/tier_s3" }, "status": { "type": "boolean" }, "type": { "type": "string", "enum": [ "s3", "gcs", "azure", "minio", "unsupported" ] } } }, "tierCredentialsRequest": { "type": "object", "properties": { "access_key": { "type": "string" }, "creds": { "description": "a base64 encoded value", "type": "string" }, "secret_key": { "type": "string" } } }, "tierListResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/definitions/tier" } } } }, "tier_azure": { "type": "object", "properties": { "accountkey": { "type": "string" }, "accountname": { "type": "string" }, "bucket": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" }, "objects": { "type": "string" }, "prefix": { "type": "string" }, "region": { "type": "string" }, "usage": { "type": "string" }, "versions": { "type": "string" } } }, "tier_gcs": { "type": "object", "properties": { "bucket": { "type": "string" }, "creds": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" }, "objects": { "type": "string" }, "prefix": { "type": "string" }, "region": { "type": "string" }, "usage": { "type": "string" }, "versions": { "type": "string" } } }, "tier_minio": { "type": "object", "properties": { "accesskey": { "type": "string" }, "bucket": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" }, "objects": { "type": "string" }, "prefix": { "type": "string" }, "region": { "type": "string" }, "secretkey": { "type": "string" }, "storageclass": { "type": "string" }, "usage": { "type": "string" }, "versions": { "type": "string" } } }, "tier_s3": { "type": "object", "properties": { "accesskey": { "type": "string" }, "bucket": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" }, "objects": { "type": "string" }, "prefix": { "type": "string" }, "region": { "type": "string" }, "secretkey": { "type": "string" }, "storageclass": { "type": "string" }, "usage": { "type": "string" }, "versions": { "type": "string" } } }, "tiersNameListResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "string" } } } }, "transitionResponse": { "type": "object", "properties": { "date": { "type": "string" }, "days": { "type": "integer", "format": "int64" }, "noncurrent_storage_class": { "type": "string" }, "noncurrent_transition_days": { "type": "integer", "format": "int64" }, "storage_class": { "type": "string" } } }, "updateBucketLifecycle": { "type": "object", "required": [ "type" ], "properties": { "disable": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expired_object_delete_all": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expired_object_delete_marker": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expiry_days": { "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_expiration_days": { "description": "Non required, can be set in case of expiration is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_days": { "description": "Non required, can be set in case of transition is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_storage_class": { "description": "Non required, can be set in case of transition is enabled", "type": "string" }, "prefix": { "description": "Non required field, it matches a prefix to perform ILM operations on it", "type": "string" }, "storage_class": { "description": "Required only in case of transition is set. it refers to a tier", "type": "string" }, "tags": { "description": "Non required field, tags to match ILM files", "type": "string" }, "transition_days": { "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", "type": "integer", "format": "int32", "default": 0 }, "type": { "description": "ILM Rule type (Expiry or transition)", "type": "string", "enum": [ "expiry", "transition" ] } } }, "updateGroupRequest": { "type": "object", "required": [ "members", "status" ], "properties": { "members": { "type": "array", "items": { "type": "string" } }, "status": { "type": "string" } } }, "updateServiceAccountRequest": { "type": "object", "required": [ "policy" ], "properties": { "description": { "type": "string" }, "expiry": { "type": "string" }, "name": { "type": "string" }, "policy": { "type": "string" }, "secretKey": { "type": "string" }, "status": { "type": "string" } } }, "updateUser": { "type": "object", "required": [ "status", "groups" ], "properties": { "groups": { "type": "array", "items": { "type": "string" } }, "status": { "type": "string" } } }, "updateUserGroups": { "type": "object", "required": [ "groups" ], "properties": { "groups": { "type": "array", "items": { "type": "string" } } } }, "user": { "type": "object", "properties": { "accessKey": { "type": "string" }, "hasPolicy": { "type": "boolean" }, "memberOf": { "type": "array", "items": { "type": "string" } }, "policy": { "type": "array", "items": { "type": "string" } }, "status": { "type": "string" } } }, "userSAs": { "type": "object", "properties": { "path": { "type": "string" }, "recursive": { "type": "boolean" }, "versionID": { "type": "string" } } }, "userServiceAccountItem": { "type": "object", "properties": { "numSAs": { "type": "integer", "format": "int64" }, "userName": { "type": "string" } } }, "userServiceAccountSummary": { "type": "object", "properties": { "hasSA": { "type": "boolean" }, "userServiceAccountList": { "type": "array", "title": "list of users with number of service accounts", "items": { "$ref": "#/definitions/userServiceAccountItem" } } } }, "widget": { "type": "object", "properties": { "id": { "type": "integer", "format": "int32" }, "options": { "type": "object", "properties": { "reduceOptions": { "type": "object", "properties": { "calcs": { "type": "array", "items": { "type": "string" } } } } } }, "targets": { "type": "array", "items": { "$ref": "#/definitions/resultTarget" } }, "title": { "type": "string" }, "type": { "type": "string" } } }, "widgetDetails": { "type": "object", "properties": { "id": { "type": "integer", "format": "int32" }, "options": { "type": "object", "properties": { "reduceOptions": { "type": "object", "properties": { "calcs": { "type": "array", "items": { "type": "string" } } } } } }, "targets": { "type": "array", "items": { "$ref": "#/definitions/resultTarget" } }, "title": { "type": "string" }, "type": { "type": "string" } } }, "widgetResult": { "type": "object", "properties": { "metric": { "type": "object", "additionalProperties": { "type": "string" } }, "values": { "type": "array", "items": {} } } } }, "parameters": { "limit": { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" }, "offset": { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" } }, "securityDefinitions": { "anonymous": { "type": "apiKey", "name": "X-Anonymous", "in": "header" }, "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": "Console Server", "version": "0.1.0" }, "basePath": "/api/v1", "paths": { "/account/change-password": { "post": { "tags": [ "Account" ], "summary": "Change password of currently logged in user.", "operationId": "AccountChangePassword", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/accountChangePasswordRequest" } } ], "responses": { "204": { "description": "A successful login." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/account/change-user-password": { "post": { "tags": [ "Account" ], "summary": "Change password of currently logged in user.", "operationId": "ChangeUserPassword", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/changeUserPasswordRequest" } } ], "responses": { "201": { "description": "Password successfully changed." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/arns": { "get": { "tags": [ "System" ], "summary": "Returns a list of active ARNs in the instance", "operationId": "ArnList", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/arnsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/info": { "get": { "tags": [ "System" ], "summary": "Returns information about the deployment", "operationId": "AdminInfo", "parameters": [ { "type": "boolean", "default": false, "name": "defaultOnly", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/adminInfoResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/info/widgets/{widgetId}": { "get": { "tags": [ "System" ], "summary": "Returns information about the deployment", "operationId": "DashboardWidgetDetails", "parameters": [ { "type": "integer", "format": "int32", "name": "widgetId", "in": "path", "required": true }, { "type": "integer", "name": "start", "in": "query" }, { "type": "integer", "name": "end", "in": "query" }, { "type": "integer", "format": "int32", "name": "step", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/widgetDetails" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/inspect": { "get": { "produces": [ "application/octet-stream" ], "tags": [ "Inspect" ], "summary": "Inspect Files on Drive", "operationId": "Inspect", "parameters": [ { "type": "string", "name": "file", "in": "query", "required": true }, { "type": "string", "name": "volume", "in": "query", "required": true }, { "type": "boolean", "name": "encrypt", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "file" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/notification_endpoints": { "get": { "tags": [ "Configuration" ], "summary": "Returns a list of active notification endpoints", "operationId": "NotificationEndpointList", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/notifEndpointResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Configuration" ], "summary": "Allows to configure a new notification endpoint", "operationId": "AddNotificationEndpoint", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/notificationEndpoint" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setNotificationEndpointResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/site-replication": { "get": { "tags": [ "SiteReplication" ], "summary": "Get list of Replication Sites", "operationId": "GetSiteReplicationInfo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/siteReplicationInfoResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "SiteReplication" ], "summary": "Edit a Replication Site", "operationId": "SiteReplicationEdit", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/peerInfo" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/peerSiteEditResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "SiteReplication" ], "summary": "Add a Replication Site", "operationId": "SiteReplicationInfoAdd", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/siteReplicationAddRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/siteReplicationAddResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "SiteReplication" ], "summary": "Remove a Replication Site", "operationId": "SiteReplicationRemove", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/peerInfoRemove" } } ], "responses": { "204": { "description": "A successful response.", "schema": { "$ref": "#/definitions/peerSiteRemoveResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/site-replication/status": { "get": { "tags": [ "SiteReplication" ], "summary": "Display overall site replication status", "operationId": "GetSiteReplicationStatus", "parameters": [ { "type": "boolean", "default": true, "description": "Include Bucket stats", "name": "buckets", "in": "query" }, { "type": "boolean", "default": true, "description": "Include Group stats", "name": "groups", "in": "query" }, { "type": "boolean", "default": true, "description": "Include Policies stats", "name": "policies", "in": "query" }, { "type": "boolean", "default": true, "description": "Include Policies stats", "name": "users", "in": "query" }, { "type": "string", "description": "Entity Type to lookup", "name": "entityType", "in": "query" }, { "type": "string", "description": "Entity Value to lookup", "name": "entityValue", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/siteReplicationStatusResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/tiers": { "get": { "tags": [ "Tiering" ], "summary": "Returns a list of tiers for ilm", "operationId": "TiersList", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/tierListResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Tiering" ], "summary": "Allows to configure a new tier", "operationId": "AddTier", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/tier" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/tiers/names": { "get": { "tags": [ "Tiering" ], "summary": "Returns a list of tiers' names for ilm", "operationId": "TiersListNames", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/tiersNameListResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/tiers/{name}/remove": { "delete": { "tags": [ "Tiering" ], "summary": "Remove Tier", "operationId": "RemoveTier", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/tiers/{type}/{name}": { "get": { "tags": [ "Tiering" ], "summary": "Get Tier", "operationId": "GetTier", "parameters": [ { "enum": [ "s3", "gcs", "azure", "minio" ], "type": "string", "name": "type", "in": "path", "required": true }, { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/tier" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/admin/tiers/{type}/{name}/credentials": { "put": { "tags": [ "Tiering" ], "summary": "Edit Tier Credentials", "operationId": "EditTierCredentials", "parameters": [ { "enum": [ "s3", "gcs", "azure", "minio" ], "type": "string", "name": "type", "in": "path", "required": true }, { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/tierCredentialsRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/bucket-policy/{bucket}": { "get": { "tags": [ "Bucket" ], "summary": "List Policies With Given Bucket", "operationId": "ListPoliciesWithBucket", "parameters": [ { "type": "string", "name": "bucket", "in": "path", "required": true }, { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" }, { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listPoliciesResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/bucket-users/{bucket}": { "get": { "tags": [ "Bucket" ], "summary": "List Users With Access to a Given Bucket", "operationId": "ListUsersWithAccessToBucket", "parameters": [ { "type": "string", "name": "bucket", "in": "path", "required": true }, { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" }, { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "array", "items": { "type": "string" } } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/bucket/{bucket}/access-rules": { "get": { "tags": [ "Bucket" ], "summary": "List Access Rules With Given Bucket", "operationId": "ListAccessRulesWithBucket", "parameters": [ { "type": "string", "name": "bucket", "in": "path", "required": true }, { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" }, { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listAccessRulesResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Bucket" ], "summary": "Add Access Rule To Given Bucket", "operationId": "SetAccessRuleWithBucket", "parameters": [ { "type": "string", "name": "bucket", "in": "path", "required": true }, { "name": "prefixaccess", "in": "body", "required": true, "schema": { "$ref": "#/definitions/prefixAccessPair" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "boolean" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Bucket" ], "summary": "Delete Access Rule From Given Bucket", "operationId": "DeleteAccessRuleWithBucket", "parameters": [ { "type": "string", "name": "bucket", "in": "path", "required": true }, { "name": "prefix", "in": "body", "required": true, "schema": { "$ref": "#/definitions/prefixWrapper" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "boolean" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets": { "get": { "tags": [ "Bucket" ], "summary": "List Buckets", "operationId": "ListBuckets", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listBucketsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Bucket" ], "summary": "Make bucket", "operationId": "MakeBucket", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/makeBucketRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/makeBucketsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets-replication": { "post": { "tags": [ "Bucket" ], "summary": "Sets Multi Bucket Replication in multiple Buckets", "operationId": "SetMultiBucketReplication", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/multiBucketReplication" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/multiBucketResponseState" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/max-share-exp": { "get": { "tags": [ "Bucket" ], "summary": "Get max expiration time for share link in seconds", "operationId": "GetMaxShareLinkExp", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/maxShareLinkExpResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/multi-lifecycle": { "post": { "tags": [ "Bucket" ], "summary": "Add Multi Bucket Lifecycle", "operationId": "AddMultiBucketLifecycle", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/addMultiBucketLifecycle" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/multiLifecycleResult" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/delete-all-replication-rules": { "delete": { "tags": [ "Bucket" ], "summary": "Deletes all replication rules from a bucket", "operationId": "DeleteAllReplicationRules", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/delete-objects": { "post": { "tags": [ "Object" ], "summary": "Delete Multiple Objects", "operationId": "DeleteMultipleObjects", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "boolean", "name": "all_versions", "in": "query" }, { "type": "boolean", "name": "bypass", "in": "query" }, { "name": "files", "in": "body", "required": true, "schema": { "type": "array", "items": { "$ref": "#/definitions/deleteFile" } } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/delete-selected-replication-rules": { "delete": { "tags": [ "Bucket" ], "summary": "Deletes selected replication rules from a bucket", "operationId": "DeleteSelectedReplicationRules", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "rules", "in": "body", "required": true, "schema": { "$ref": "#/definitions/bucketReplicationRuleList" } } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/encryption/disable": { "post": { "tags": [ "Bucket" ], "summary": "Disable bucket encryption.", "operationId": "DisableBucketEncryption", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/encryption/enable": { "post": { "tags": [ "Bucket" ], "summary": "Enable bucket encryption.", "operationId": "EnableBucketEncryption", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/bucketEncryptionRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/encryption/info": { "get": { "tags": [ "Bucket" ], "summary": "Get bucket encryption information.", "operationId": "GetBucketEncryptionInfo", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketEncryptionInfo" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/events": { "get": { "tags": [ "Bucket" ], "summary": "List Bucket Events", "operationId": "ListBucketEvents", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" }, { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listBucketEventsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Bucket" ], "summary": "Create Bucket Event", "operationId": "CreateBucketEvent", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/bucketEventRequest" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/events/{arn}": { "delete": { "tags": [ "Bucket" ], "summary": "Delete Bucket Event", "operationId": "DeleteBucketEvent", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "arn", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/notificationDeleteRequest" } } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/lifecycle": { "get": { "tags": [ "Bucket" ], "summary": "Bucket Lifecycle", "operationId": "GetBucketLifecycle", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketLifecycleResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Bucket" ], "summary": "Add Bucket Lifecycle", "operationId": "AddBucketLifecycle", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/addBucketLifecycle" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/lifecycle/{lifecycle_id}": { "put": { "tags": [ "Bucket" ], "summary": "Update Lifecycle rule", "operationId": "UpdateBucketLifecycle", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "lifecycle_id", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/updateBucketLifecycle" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Bucket" ], "summary": "Delete Lifecycle rule", "operationId": "DeleteBucketLifecycleRule", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "lifecycle_id", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/object-locking": { "get": { "tags": [ "Bucket" ], "summary": "Returns the status of object locking support on the bucket", "operationId": "GetBucketObjectLockingStatus", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketObLockingResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects": { "get": { "tags": [ "Object" ], "summary": "List Objects", "operationId": "ListObjects", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query" }, { "type": "boolean", "name": "recursive", "in": "query" }, { "type": "boolean", "name": "with_versions", "in": "query" }, { "type": "boolean", "name": "with_metadata", "in": "query" }, { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listObjectsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [ { "key": [] }, { "anonymous": [] } ] }, "delete": { "tags": [ "Object" ], "summary": "Delete Object", "operationId": "DeleteObject", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query" }, { "type": "boolean", "name": "recursive", "in": "query" }, { "type": "boolean", "name": "all_versions", "in": "query" }, { "type": "boolean", "name": "non_current_versions", "in": "query" }, { "type": "boolean", "name": "bypass", "in": "query" } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/download": { "get": { "produces": [ "application/octet-stream" ], "tags": [ "Object" ], "summary": "Download Object", "operationId": "Download Object", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query" }, { "type": "boolean", "default": false, "name": "preview", "in": "query" }, { "type": "string", "default": "", "name": "override_file_name", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "file" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [ { "key": [] }, { "anonymous": [] } ] } }, "/buckets/{bucket_name}/objects/download-multiple": { "post": { "produces": [ "application/octet-stream" ], "tags": [ "Object" ], "summary": "Download Multiple Objects", "operationId": "DownloadMultipleObjects", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "objectList", "in": "body", "required": true, "schema": { "type": "array", "items": { "type": "string" } } } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "file" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [ { "key": [] }, { "anonymous": [] } ] } }, "/buckets/{bucket_name}/objects/legalhold": { "put": { "tags": [ "Object" ], "summary": "Put Object's legalhold status", "operationId": "PutObjectLegalHold", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/putObjectLegalHoldRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/metadata": { "get": { "tags": [ "Object" ], "summary": "Gets the metadata of an object", "operationId": "GetObjectMetadata", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "versionID", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/metadata" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/restore": { "put": { "tags": [ "Object" ], "summary": "Restore Object to a selected version", "operationId": "PutObjectRestore", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/retention": { "put": { "tags": [ "Object" ], "summary": "Put Object's retention status", "operationId": "PutObjectRetention", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/putObjectRetentionRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Object" ], "summary": "Delete Object retention from an object", "operationId": "DeleteObjectRetention", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/share": { "get": { "tags": [ "Object" ], "summary": "Shares an Object on a url", "operationId": "ShareObject", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true }, { "type": "string", "name": "expires", "in": "query" }, { "type": "boolean", "name": "toggle_url", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "string" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/tags": { "put": { "tags": [ "Object" ], "summary": "Put Object's tags", "operationId": "PutObjectTags", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query", "required": true }, { "type": "string", "name": "version_id", "in": "query", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/putObjectTagsRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/objects/upload": { "post": { "consumes": [ "multipart/form-data" ], "tags": [ "Object" ], "summary": "Uploads an Object.", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query" } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [ { "key": [] }, { "anonymous": [] } ] } }, "/buckets/{bucket_name}/replication": { "get": { "tags": [ "Bucket" ], "summary": "Bucket Replication", "operationId": "GetBucketReplication", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketReplicationResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/replication/{rule_id}": { "get": { "tags": [ "Bucket" ], "summary": "Bucket Replication", "operationId": "GetBucketReplicationRule", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "rule_id", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketReplicationRule" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Bucket" ], "summary": "Update Replication rule", "operationId": "UpdateMultiBucketReplication", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "rule_id", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/multiBucketReplicationEdit" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Bucket" ], "summary": "Bucket Replication Rule Delete", "operationId": "DeleteBucketReplicationRule", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "rule_id", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/retention": { "get": { "tags": [ "Bucket" ], "summary": "Get Bucket's retention config", "operationId": "GetBucketRetentionConfig", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/getBucketRetentionConfig" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Bucket" ], "summary": "Set Bucket's retention config", "operationId": "SetBucketRetentionConfig", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/putBucketRetentionRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/rewind/{date}": { "get": { "tags": [ "Bucket" ], "summary": "Get objects in a bucket for a rewind date", "operationId": "GetBucketRewind", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "type": "string", "name": "date", "in": "path", "required": true }, { "type": "string", "name": "prefix", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/rewindResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/tags": { "put": { "tags": [ "Bucket" ], "summary": "Put Bucket's tags", "operationId": "PutBucketTags", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/putBucketTagsRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{bucket_name}/versioning": { "get": { "tags": [ "Bucket" ], "summary": "Bucket Versioning", "operationId": "GetBucketVersioning", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketVersioningResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Bucket" ], "summary": "Set Bucket Versioning", "operationId": "SetBucketVersioning", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setBucketVersioning" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{name}": { "get": { "tags": [ "Bucket" ], "summary": "Bucket Info", "operationId": "BucketInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucket" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Bucket" ], "summary": "Delete Bucket", "operationId": "DeleteBucket", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{name}/quota": { "get": { "tags": [ "Bucket" ], "summary": "Get Bucket Quota", "operationId": "GetBucketQuota", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucketQuota" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Bucket" ], "summary": "Bucket Quota", "operationId": "SetBucketQuota", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setBucketQuota" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucket" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/buckets/{name}/set-policy": { "put": { "tags": [ "Bucket" ], "summary": "Bucket Set Policy", "operationId": "BucketSetPolicy", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setBucketPolicyRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/bucket" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/configs": { "get": { "tags": [ "Configuration" ], "summary": "List Configurations", "operationId": "ListConfig", "parameters": [ { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" }, { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listConfigResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/configs/export": { "get": { "tags": [ "Configuration" ], "summary": "Export the current config from MinIO server", "operationId": "ExportConfig", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/configExportResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/configs/import": { "post": { "consumes": [ "multipart/form-data" ], "tags": [ "Configuration" ], "summary": "Uploads a file to import MinIO server config.", "parameters": [ { "type": "file", "name": "file", "in": "formData", "required": true } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/configs/{name}": { "get": { "tags": [ "Configuration" ], "summary": "Configuration info", "operationId": "ConfigInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "array", "items": { "$ref": "#/definitions/configuration" } } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Configuration" ], "summary": "Set Configuration", "operationId": "SetConfig", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setConfigRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setConfigResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/configs/{name}/reset": { "post": { "tags": [ "Configuration" ], "summary": "Configuration reset", "operationId": "ResetConfig", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setConfigResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/download-shared-object/{url}": { "get": { "produces": [ "application/octet-stream" ], "tags": [ "Public" ], "summary": "Downloads an object from a presigned url", "operationId": "DownloadSharedObject", "parameters": [ { "type": "string", "name": "url", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "file" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [] } }, "/group/{name}": { "get": { "tags": [ "Group" ], "summary": "Group info", "operationId": "GroupInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/group" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "Group" ], "summary": "Update Group Members or Status", "operationId": "UpdateGroup", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/updateGroupRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/group" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Group" ], "summary": "Remove group", "operationId": "RemoveGroup", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/groups": { "get": { "tags": [ "Group" ], "summary": "List Groups", "operationId": "ListGroups", "parameters": [ { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" }, { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listGroupsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Group" ], "summary": "Add Group", "operationId": "AddGroup", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/addGroupRequest" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/idp/{type}": { "get": { "tags": [ "idp" ], "summary": "List IDP Configurations", "operationId": "ListConfigurations", "parameters": [ { "type": "string", "description": "IDP Configuration Type", "name": "type", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/idpListConfigurationsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "consumes": [ "application/json" ], "tags": [ "idp" ], "summary": "Create IDP Configuration", "operationId": "CreateConfiguration", "parameters": [ { "type": "string", "description": "IDP Configuration Type", "name": "type", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/idpServerConfiguration" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setIDPResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/idp/{type}/{name}": { "get": { "tags": [ "idp" ], "summary": "Get IDP Configuration", "operationId": "GetConfiguration", "parameters": [ { "type": "string", "description": "IDP Configuration Name", "name": "name", "in": "path", "required": true }, { "type": "string", "description": "IDP Configuration Type", "name": "type", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/idpServerConfiguration" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "consumes": [ "application/json" ], "tags": [ "idp" ], "summary": "Update IDP Configuration", "operationId": "UpdateConfiguration", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/idpServerConfiguration" } }, { "type": "string", "description": "IDP Configuration Name", "name": "name", "in": "path", "required": true }, { "type": "string", "description": "IDP Configuration Type", "name": "type", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setIDPResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "idp" ], "summary": "Delete IDP Configuration", "operationId": "DeleteConfiguration", "parameters": [ { "type": "string", "description": "IDP Configuration Name", "name": "name", "in": "path", "required": true }, { "type": "string", "description": "IDP Configuration Type", "name": "type", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/setIDPResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/apis": { "get": { "tags": [ "KMS" ], "summary": "KMS apis", "operationId": "KMSAPIs", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsAPIsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/keys": { "get": { "tags": [ "KMS" ], "summary": "KMS list keys", "operationId": "KMSListKeys", "parameters": [ { "type": "string", "description": "pattern to retrieve keys", "name": "pattern", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsListKeysResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "KMS" ], "summary": "KMS create key", "operationId": "KMSCreateKey", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/kmsCreateKeyRequest" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/keys/{name}": { "get": { "tags": [ "KMS" ], "summary": "KMS key status", "operationId": "KMSKeyStatus", "parameters": [ { "type": "string", "description": "KMS key name", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsKeyStatusResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/metrics": { "get": { "tags": [ "KMS" ], "summary": "KMS metrics", "operationId": "KMSMetrics", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsMetricsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/status": { "get": { "tags": [ "KMS" ], "summary": "KMS status", "operationId": "KMSStatus", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsStatusResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/kms/version": { "get": { "tags": [ "KMS" ], "summary": "KMS version", "operationId": "KMSVersion", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/kmsVersionResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/ldap-entities": { "post": { "tags": [ "idp" ], "summary": "Get LDAP Entities", "operationId": "GetLDAPEntities", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ldapEntitiesRequest" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/ldapEntities" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/list-external-buckets": { "post": { "tags": [ "Bucket" ], "summary": "Lists an External list of buckets using custom credentials", "operationId": "ListExternalBuckets", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/listExternalBucketsParams" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listBucketsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/login": { "get": { "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/ApiError" } } }, "security": [] }, "post": { "tags": [ "Auth" ], "summary": "Login to Console", "operationId": "Login", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/loginRequest" } } ], "responses": { "204": { "description": "A successful login." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } }, "security": [] } }, "/login/oauth2/auth": { "post": { "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/ApiError" } } }, "security": [] } }, "/logout": { "post": { "tags": [ "Auth" ], "summary": "Logout from Console.", "operationId": "Logout", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/logoutRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/logs/search": { "get": { "tags": [ "Logging" ], "summary": "Search the logs", "operationId": "LogSearch", "parameters": [ { "type": "array", "items": { "type": "string" }, "collectionFormat": "multi", "description": "Filter Parameters", "name": "fp", "in": "query" }, { "type": "number", "format": "int32", "default": 10, "name": "pageSize", "in": "query" }, { "type": "number", "format": "int32", "default": 0, "name": "pageNo", "in": "query" }, { "enum": [ "timeDesc", "timeAsc" ], "type": "string", "default": "timeDesc", "name": "order", "in": "query" }, { "type": "string", "name": "timeStart", "in": "query" }, { "type": "string", "name": "timeEnd", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/logSearchResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/nodes": { "get": { "tags": [ "System" ], "summary": "Lists Nodes", "operationId": "ListNodes", "responses": { "200": { "description": "A successful response.", "schema": { "type": "array", "items": { "type": "string" } } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/policies": { "get": { "tags": [ "Policy" ], "summary": "List Policies", "operationId": "ListPolicies", "parameters": [ { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" }, { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listPoliciesResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Policy" ], "summary": "Add Policy", "operationId": "AddPolicy", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/addPolicyRequest" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/policy" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/policies/{policy}/groups": { "get": { "tags": [ "Policy" ], "summary": "List Groups for a Policy", "operationId": "ListGroupsForPolicy", "parameters": [ { "type": "string", "name": "policy", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "array", "items": { "type": "string" } } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/policies/{policy}/users": { "get": { "tags": [ "Policy" ], "summary": "List Users for a Policy", "operationId": "ListUsersForPolicy", "parameters": [ { "type": "string", "name": "policy", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "type": "array", "items": { "type": "string" } } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/policy/{name}": { "get": { "tags": [ "Policy" ], "summary": "Policy info", "operationId": "PolicyInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/policy" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "Policy" ], "summary": "Remove policy", "operationId": "RemovePolicy", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/profiling/start": { "post": { "tags": [ "Profile" ], "summary": "Start recording profile data", "operationId": "ProfilingStart", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/profilingStartRequest" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/startProfilingList" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/profiling/stop": { "post": { "produces": [ "application/zip" ], "tags": [ "Profile" ], "summary": "Stop and download profile data", "operationId": "ProfilingStop", "responses": { "201": { "description": "A successful response.", "schema": { "type": "file" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/releases": { "get": { "tags": [ "release" ], "summary": "Get repo releases for a given version", "operationId": "ListReleases", "parameters": [ { "type": "string", "description": "repo name", "name": "repo", "in": "query", "required": true }, { "type": "string", "description": "Current Release", "name": "current", "in": "query" }, { "type": "string", "description": "search content", "name": "search", "in": "query" }, { "type": "string", "description": "filter releases", "name": "filter", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/releaseListResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/remote-buckets": { "get": { "tags": [ "Bucket" ], "summary": "List Remote Buckets", "operationId": "ListRemoteBuckets", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listRemoteBucketsResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "Bucket" ], "summary": "Add Remote Bucket", "operationId": "AddRemoteBucket", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/createRemoteBucket" } } ], "responses": { "201": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/remote-buckets/{name}": { "get": { "tags": [ "Bucket" ], "summary": "Remote Bucket Details", "operationId": "RemoteBucketDetails", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/remoteBucket" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/remote-buckets/{source_bucket_name}/{arn}": { "delete": { "tags": [ "Bucket" ], "summary": "Delete Remote Bucket", "operationId": "DeleteRemoteBucket", "parameters": [ { "type": "string", "name": "source_bucket_name", "in": "path", "required": true }, { "type": "string", "name": "arn", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/service-account-credentials": { "post": { "tags": [ "ServiceAccount" ], "summary": "Create Service Account With Credentials", "operationId": "CreateServiceAccountCreds", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/serviceAccountRequestCreds" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccountCreds" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/service-accounts": { "get": { "tags": [ "ServiceAccount" ], "summary": "List User's Service Accounts", "operationId": "ListUserServiceAccounts", "parameters": [ { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" }, { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccounts" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "ServiceAccount" ], "summary": "Create Service Account", "operationId": "CreateServiceAccount", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/serviceAccountRequest" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccountCreds" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/service-accounts/delete-multi": { "delete": { "tags": [ "ServiceAccount" ], "summary": "Delete Multiple Service Accounts", "operationId": "DeleteMultipleServiceAccounts", "parameters": [ { "name": "selectedSA", "in": "body", "required": true, "schema": { "$ref": "#/definitions/selectedSAs" } } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/service-accounts/{access_key}": { "get": { "tags": [ "ServiceAccount" ], "summary": "Get Service Account", "operationId": "GetServiceAccount", "parameters": [ { "type": "string", "name": "access_key", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccount" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "ServiceAccount" ], "summary": "Set Service Account Policy", "operationId": "UpdateServiceAccount", "parameters": [ { "type": "string", "name": "access_key", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/updateServiceAccountRequest" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "ServiceAccount" ], "summary": "Delete Service Account", "operationId": "DeleteServiceAccount", "parameters": [ { "type": "string", "name": "access_key", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/service/restart": { "post": { "tags": [ "Service" ], "summary": "Restart Service", "operationId": "RestartService", "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/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/sessionResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/set-policy": { "put": { "tags": [ "Policy" ], "summary": "Set policy", "operationId": "SetPolicy", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setPolicyNameRequest" } } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/set-policy-multi": { "put": { "tags": [ "Policy" ], "summary": "Set policy to multiple users/groups", "operationId": "SetPolicyMultiple", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/setPolicyMultipleNameRequest" } } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/policy": { "get": { "tags": [ "Policy" ], "summary": "returns policies for logged in user", "operationId": "GetUserPolicy", "responses": { "200": { "description": "A successful response.", "schema": { "type": "string" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/{name}": { "get": { "tags": [ "User" ], "summary": "Get User Info", "operationId": "GetUserInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/user" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "put": { "tags": [ "User" ], "summary": "Update User Info", "operationId": "UpdateUserInfo", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/updateUser" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/user" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "delete": { "tags": [ "User" ], "summary": "Remove user", "operationId": "RemoveUser", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "204": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/{name}/groups": { "put": { "tags": [ "User" ], "summary": "Update Groups for a user", "operationId": "UpdateUserGroups", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/updateUserGroups" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/user" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/{name}/policies": { "get": { "tags": [ "Policy" ], "summary": "returns policies assigned for a specified user", "operationId": "GetSAUserPolicy", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/aUserPolicyResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/{name}/service-account-credentials": { "post": { "tags": [ "User" ], "summary": "Create Service Account for User With Credentials", "operationId": "CreateServiceAccountCredentials", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/serviceAccountRequestCreds" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccountCreds" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/user/{name}/service-accounts": { "get": { "tags": [ "User" ], "summary": "returns a list of service accounts for a user", "operationId": "ListAUserServiceAccounts", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccounts" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "User" ], "summary": "Create Service Account for User", "operationId": "CreateAUserServiceAccount", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/serviceAccountRequest" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/serviceAccountCreds" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/users": { "get": { "tags": [ "User" ], "summary": "List Users", "operationId": "ListUsers", "parameters": [ { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" }, { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/listUsersResponse" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } }, "post": { "tags": [ "User" ], "summary": "Add User", "operationId": "AddUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/addUserRequest" } } ], "responses": { "201": { "description": "A successful response.", "schema": { "$ref": "#/definitions/user" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/users-groups-bulk": { "put": { "tags": [ "User" ], "summary": "Bulk functionality to Add Users to Groups", "operationId": "BulkUpdateUsersGroups", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/bulkUserGroups" } } ], "responses": { "200": { "description": "A successful response." }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } }, "/users/service-accounts": { "post": { "tags": [ "User" ], "summary": "Check number of service accounts for each user specified", "operationId": "CheckUserServiceAccounts", "parameters": [ { "name": "selectedUsers", "in": "body", "required": true, "schema": { "$ref": "#/definitions/selectedUsers" } } ], "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/userServiceAccountSummary" } }, "default": { "description": "Generic error response.", "schema": { "$ref": "#/definitions/ApiError" } } } } } }, "definitions": { "ApiError": { "type": "object", "properties": { "detailedMessage": { "type": "string" }, "message": { "type": "string" } } }, "BackendProperties": { "type": "object", "properties": { "backendType": { "type": "string" }, "offlineDrives": { "type": "integer" }, "onlineDrives": { "type": "integer" }, "rrSCParity": { "type": "integer" }, "standardSCParity": { "type": "integer" } } }, "BucketDetails": { "type": "object", "properties": { "locking": { "type": "boolean" }, "quota": { "type": "object", "properties": { "quota": { "type": "integer", "format": "int64" }, "type": { "type": "string", "enum": [ "hard" ] } } }, "replication": { "type": "boolean" }, "tags": { "type": "object", "additionalProperties": { "type": "string" } }, "versioning": { "type": "boolean" }, "versioningSuspended": { "type": "boolean" } } }, "BucketDetailsQuota": { "type": "object", "properties": { "quota": { "type": "integer", "format": "int64" }, "type": { "type": "string", "enum": [ "hard" ] } } }, "BucketRwAccess": { "type": "object", "properties": { "read": { "type": "boolean" }, "write": { "type": "boolean" } } }, "BucketVersioningResponseExcludedPrefixesItems0": { "type": "object", "properties": { "prefix": { "type": "string" } } }, "LoginRequestFeatures": { "type": "object", "properties": { "hide_menu": { "type": "boolean" } } }, "ServiceAccountsItems0": { "type": "object", "properties": { "accessKey": { "type": "string" }, "accountStatus": { "type": "string" }, "description": { "type": "string" }, "expiration": { "type": "string" }, "name": { "type": "string" } } }, "WidgetDetailsOptions": { "type": "object", "properties": { "reduceOptions": { "type": "object", "properties": { "calcs": { "type": "array", "items": { "type": "string" } } } } } }, "WidgetDetailsOptionsReduceOptions": { "type": "object", "properties": { "calcs": { "type": "array", "items": { "type": "string" } } } }, "WidgetOptions": { "type": "object", "properties": { "reduceOptions": { "type": "object", "properties": { "calcs": { "type": "array", "items": { "type": "string" } } } } } }, "WidgetOptionsReduceOptions": { "type": "object", "properties": { "calcs": { "type": "array", "items": { "type": "string" } } } }, "aUserPolicyResponse": { "type": "object", "properties": { "policy": { "type": "string" } } }, "accessRule": { "type": "object", "properties": { "access": { "type": "string" }, "prefix": { "type": "string" } } }, "accountChangePasswordRequest": { "type": "object", "required": [ "current_secret_key", "new_secret_key" ], "properties": { "current_secret_key": { "type": "string" }, "new_secret_key": { "type": "string" } } }, "addBucketLifecycle": { "type": "object", "properties": { "disable": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expired_object_delete_all": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expired_object_delete_marker": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expiry_days": { "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", "type": "integer", "format": "int32", "default": 0 }, "newer_noncurrentversion_expiration_versions": { "description": "Non required, can be set in case of expiration is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_expiration_days": { "description": "Non required, can be set in case of expiration is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_days": { "description": "Non required, can be set in case of transition is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_storage_class": { "description": "Non required, can be set in case of transition is enabled", "type": "string" }, "prefix": { "description": "Non required field, it matches a prefix to perform ILM operations on it", "type": "string" }, "storage_class": { "description": "Required only in case of transition is set. it refers to a tier", "type": "string" }, "tags": { "description": "Non required field, tags to match ILM files", "type": "string" }, "transition_days": { "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", "type": "integer", "format": "int32", "default": 0 }, "type": { "description": "ILM Rule type (Expiry or transition)", "type": "string", "enum": [ "expiry", "transition" ] } } }, "addBucketReplication": { "type": "object", "properties": { "arn": { "type": "string" }, "destination_bucket": { "type": "string" } } }, "addGroupRequest": { "type": "object", "required": [ "group", "members" ], "properties": { "group": { "type": "string" }, "members": { "type": "array", "items": { "type": "string" } } } }, "addMultiBucketLifecycle": { "type": "object", "required": [ "buckets", "type" ], "properties": { "buckets": { "type": "array", "items": { "type": "string" } }, "expired_object_delete_all": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expired_object_delete_marker": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expiry_days": { "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_expiration_days": { "description": "Non required, can be set in case of expiration is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_days": { "description": "Non required, can be set in case of transition is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_storage_class": { "description": "Non required, can be set in case of transition is enabled", "type": "string" }, "prefix": { "description": "Non required field, it matches a prefix to perform ILM operations on it", "type": "string" }, "storage_class": { "description": "Required only in case of transition is set. it refers to a tier", "type": "string" }, "tags": { "description": "Non required field, tags to match ILM files", "type": "string" }, "transition_days": { "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", "type": "integer", "format": "int32", "default": 0 }, "type": { "description": "ILM Rule type (Expiry or transition)", "type": "string", "enum": [ "expiry", "transition" ] } } }, "addPolicyRequest": { "type": "object", "required": [ "name", "policy" ], "properties": { "name": { "type": "string" }, "policy": { "type": "string" } } }, "addUserRequest": { "type": "object", "required": [ "accessKey", "secretKey", "groups", "policies" ], "properties": { "accessKey": { "type": "string" }, "groups": { "type": "array", "items": { "type": "string" } }, "policies": { "type": "array", "items": { "type": "string" } }, "secretKey": { "type": "string" } } }, "adminInfoResponse": { "type": "object", "properties": { "advancedMetricsStatus": { "type": "string", "enum": [ "not configured", "available", "unavailable" ] }, "backend": { "$ref": "#/definitions/BackendProperties" }, "buckets": { "type": "integer" }, "objects": { "type": "integer" }, "servers": { "type": "array", "items": { "$ref": "#/definitions/serverProperties" } }, "usage": { "type": "integer" }, "widgets": { "type": "array", "items": { "$ref": "#/definitions/widget" } } } }, "apiKey": { "type": "object", "properties": { "apiKey": { "type": "string" } } }, "arnsResponse": { "type": "object", "properties": { "arns": { "type": "array", "items": { "type": "string" } } } }, "bucket": { "type": "object", "required": [ "name" ], "properties": { "access": { "$ref": "#/definitions/bucketAccess" }, "creation_date": { "type": "string" }, "definition": { "type": "string" }, "details": { "type": "object", "properties": { "locking": { "type": "boolean" }, "quota": { "type": "object", "properties": { "quota": { "type": "integer", "format": "int64" }, "type": { "type": "string", "enum": [ "hard" ] } } }, "replication": { "type": "boolean" }, "tags": { "type": "object", "additionalProperties": { "type": "string" } }, "versioning": { "type": "boolean" }, "versioningSuspended": { "type": "boolean" } } }, "name": { "type": "string", "minLength": 3 }, "objects": { "type": "integer", "format": "int64" }, "rw_access": { "type": "object", "properties": { "read": { "type": "boolean" }, "write": { "type": "boolean" } } }, "size": { "type": "integer", "format": "int64" } } }, "bucketAccess": { "type": "string", "default": "PRIVATE", "enum": [ "PRIVATE", "PUBLIC", "CUSTOM" ] }, "bucketEncryptionInfo": { "type": "object", "properties": { "algorithm": { "type": "string" }, "kmsMasterKeyID": { "type": "string" } } }, "bucketEncryptionRequest": { "type": "object", "properties": { "encType": { "$ref": "#/definitions/bucketEncryptionType" }, "kmsKeyID": { "type": "string" } } }, "bucketEncryptionType": { "type": "string", "default": "sse-s3", "enum": [ "sse-s3", "sse-kms" ] }, "bucketEventRequest": { "type": "object", "required": [ "configuration" ], "properties": { "configuration": { "$ref": "#/definitions/notificationConfig" }, "ignoreExisting": { "type": "boolean" } } }, "bucketLifecycleResponse": { "type": "object", "properties": { "lifecycle": { "type": "array", "items": { "$ref": "#/definitions/objectBucketLifecycle" } } } }, "bucketObLockingResponse": { "type": "object", "properties": { "object_locking_enabled": { "type": "boolean" } } }, "bucketObject": { "type": "object", "properties": { "content_type": { "type": "string" }, "etag": { "type": "string" }, "expiration": { "type": "string" }, "expiration_rule_id": { "type": "string" }, "is_delete_marker": { "type": "boolean" }, "is_latest": { "type": "boolean" }, "last_modified": { "type": "string" }, "legal_hold_status": { "type": "string" }, "metadata": { "type": "object", "additionalProperties": { "type": "string" } }, "name": { "type": "string" }, "retention_mode": { "type": "string" }, "retention_until_date": { "type": "string" }, "size": { "type": "integer", "format": "int64" }, "tags": { "type": "object", "additionalProperties": { "type": "string" } }, "user_metadata": { "type": "object", "additionalProperties": { "type": "string" } }, "user_tags": { "type": "object", "additionalProperties": { "type": "string" } }, "version_id": { "type": "string" } } }, "bucketQuota": { "type": "object", "properties": { "quota": { "type": "integer" }, "type": { "type": "string", "enum": [ "hard" ] } } }, "bucketReplicationDestination": { "type": "object", "properties": { "bucket": { "type": "string" } } }, "bucketReplicationResponse": { "type": "object", "properties": { "rules": { "type": "array", "items": { "$ref": "#/definitions/bucketReplicationRule" } } } }, "bucketReplicationRule": { "type": "object", "properties": { "bandwidth": { "type": "string" }, "delete_marker_replication": { "type": "boolean" }, "deletes_replication": { "type": "boolean" }, "destination": { "$ref": "#/definitions/bucketReplicationDestination" }, "existingObjects": { "type": "boolean" }, "healthCheckPeriod": { "type": "integer" }, "id": { "type": "string" }, "metadata_replication": { "type": "boolean" }, "prefix": { "type": "string" }, "priority": { "type": "integer", "format": "int32" }, "status": { "type": "string", "enum": [ "Enabled", "Disabled" ] }, "storageClass": { "type": "string" }, "syncMode": { "type": "string", "default": "async", "enum": [ "async", "sync" ] }, "tags": { "type": "string" } } }, "bucketReplicationRuleList": { "type": "object", "properties": { "rules": { "type": "array", "items": { "type": "string" } } } }, "bucketVersioningResponse": { "type": "object", "properties": { "MFADelete": { "type": "string" }, "excludeFolders": { "type": "boolean" }, "excludedPrefixes": { "type": "array", "items": { "$ref": "#/definitions/BucketVersioningResponseExcludedPrefixesItems0" } }, "status": { "type": "string" } } }, "bulkUserGroups": { "type": "object", "required": [ "users", "groups" ], "properties": { "groups": { "type": "array", "items": { "type": "string" } }, "users": { "type": "array", "items": { "type": "string" } } } }, "changeUserPasswordRequest": { "type": "object", "required": [ "selectedUser", "newSecretKey" ], "properties": { "newSecretKey": { "type": "string" }, "selectedUser": { "type": "string" } } }, "configDescription": { "type": "object", "properties": { "description": { "type": "string" }, "key": { "type": "string" } } }, "configExportResponse": { "type": "object", "properties": { "status": { "type": "string" }, "value": { "description": "Returns base64 encoded value", "type": "string" } } }, "configuration": { "type": "object", "properties": { "key_values": { "type": "array", "items": { "$ref": "#/definitions/configurationKV" } }, "name": { "type": "string" } } }, "configurationKV": { "type": "object", "properties": { "env_override": { "$ref": "#/definitions/envOverride" }, "key": { "type": "string" }, "value": { "type": "string" } } }, "createRemoteBucket": { "required": [ "accessKey", "secretKey", "targetURL", "sourceBucket", "targetBucket" ], "properties": { "accessKey": { "type": "string", "minLength": 3 }, "bandwidth": { "type": "integer", "format": "int64" }, "healthCheckPeriod": { "type": "integer", "format": "int32" }, "region": { "type": "string" }, "secretKey": { "type": "string", "minLength": 8 }, "sourceBucket": { "type": "string" }, "syncMode": { "type": "string", "default": "async", "enum": [ "async", "sync" ] }, "targetBucket": { "type": "string" }, "targetURL": { "type": "string" } } }, "deleteFile": { "type": "object", "properties": { "path": { "type": "string" }, "recursive": { "type": "boolean" }, "versionID": { "type": "string" } } }, "envOverride": { "type": "object", "properties": { "name": { "type": "string" }, "value": { "type": "string" } } }, "environmentConstants": { "type": "object", "properties": { "maxConcurrentDownloads": { "type": "integer" }, "maxConcurrentUploads": { "type": "integer" } } }, "expirationResponse": { "type": "object", "properties": { "date": { "type": "string" }, "days": { "type": "integer", "format": "int64" }, "delete_all": { "type": "boolean" }, "delete_marker": { "type": "boolean" }, "newer_noncurrent_expiration_versions": { "type": "integer", "format": "int64" }, "noncurrent_expiration_days": { "type": "integer", "format": "int64" } } }, "getBucketRetentionConfig": { "type": "object", "properties": { "mode": { "$ref": "#/definitions/objectRetentionMode" }, "unit": { "$ref": "#/definitions/objectRetentionUnit" }, "validity": { "type": "integer", "format": "int32" } } }, "group": { "type": "object", "properties": { "members": { "type": "array", "items": { "type": "string" } }, "name": { "type": "string" }, "policy": { "type": "string" }, "status": { "type": "string" } } }, "iamEntity": { "type": "string" }, "iamPolicy": { "type": "object", "properties": { "statement": { "type": "array", "items": { "$ref": "#/definitions/iamPolicyStatement" } }, "version": { "type": "string" } } }, "iamPolicyStatement": { "type": "object", "properties": { "action": { "type": "array", "items": { "type": "string" } }, "condition": { "type": "object", "additionalProperties": { "type": "object" } }, "effect": { "type": "string" }, "resource": { "type": "array", "items": { "type": "string" } } } }, "idpListConfigurationsResponse": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/idpServerConfiguration" } } } }, "idpServerConfiguration": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "info": { "type": "array", "items": { "$ref": "#/definitions/idpServerConfigurationInfo" } }, "input": { "type": "string" }, "name": { "type": "string" }, "type": { "type": "string" } } }, "idpServerConfigurationInfo": { "type": "object", "properties": { "isCfg": { "type": "boolean" }, "isEnv": { "type": "boolean" }, "key": { "type": "string" }, "value": { "type": "string" } } }, "kmsAPI": { "type": "object", "properties": { "maxBody": { "type": "integer" }, "method": { "type": "string" }, "path": { "type": "string" }, "timeout": { "type": "integer" } } }, "kmsAPIsResponse": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/kmsAPI" } } } }, "kmsCreateKeyRequest": { "type": "object", "required": [ "key" ], "properties": { "key": { "type": "string" } } }, "kmsEndpoint": { "type": "object", "properties": { "status": { "type": "string" }, "url": { "type": "string" } } }, "kmsKeyInfo": { "type": "object", "properties": { "createdAt": { "type": "string" }, "createdBy": { "type": "string" }, "name": { "type": "string" } } }, "kmsKeyStatusResponse": { "type": "object", "properties": { "decryptionErr": { "type": "string" }, "encryptionErr": { "type": "string" }, "keyID": { "type": "string" } } }, "kmsLatencyHistogram": { "type": "object", "properties": { "duration": { "type": "integer" }, "total": { "type": "integer" } } }, "kmsListKeysResponse": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/kmsKeyInfo" } } } }, "kmsMetricsResponse": { "type": "object", "required": [ "requestOK", "requestErr", "requestFail", "requestActive", "auditEvents", "errorEvents", "latencyHistogram", "uptime", "cpus", "usableCPUs", "threads", "heapAlloc", "stackAlloc" ], "properties": { "auditEvents": { "type": "integer" }, "cpus": { "type": "integer" }, "errorEvents": { "type": "integer" }, "heapAlloc": { "type": "integer" }, "heapObjects": { "type": "integer" }, "latencyHistogram": { "type": "array", "items": { "$ref": "#/definitions/kmsLatencyHistogram" } }, "requestActive": { "type": "integer" }, "requestErr": { "type": "integer" }, "requestFail": { "type": "integer" }, "requestOK": { "type": "integer" }, "stackAlloc": { "type": "integer" }, "threads": { "type": "integer" }, "uptime": { "type": "integer" }, "usableCPUs": { "type": "integer" } } }, "kmsStatusResponse": { "type": "object", "properties": { "defaultKeyID": { "type": "string" }, "endpoints": { "type": "array", "items": { "$ref": "#/definitions/kmsEndpoint" } }, "name": { "type": "string" } } }, "kmsVersionResponse": { "type": "object", "properties": { "version": { "type": "string" } } }, "ldapEntities": { "type": "object", "properties": { "groups": { "type": "array", "items": { "$ref": "#/definitions/ldapGroupPolicyEntity" } }, "policies": { "type": "array", "items": { "$ref": "#/definitions/ldapPolicyEntity" } }, "timestamp": { "type": "string" }, "users": { "type": "array", "items": { "$ref": "#/definitions/ldapUserPolicyEntity" } } } }, "ldapEntitiesRequest": { "type": "object", "properties": { "groups": { "type": "array", "items": { "type": "string" } }, "policies": { "type": "array", "items": { "type": "string" } }, "users": { "type": "array", "items": { "type": "string" } } } }, "ldapGroupPolicyEntity": { "type": "object", "properties": { "group": { "type": "string" }, "policies": { "type": "array", "items": { "type": "string" } } } }, "ldapPolicyEntity": { "type": "object", "properties": { "groups": { "type": "array", "items": { "type": "string" } }, "policy": { "type": "string" }, "users": { "type": "array", "items": { "type": "string" } } } }, "ldapUserPolicyEntity": { "type": "object", "properties": { "policies": { "type": "array", "items": { "type": "string" } }, "user": { "type": "string" } } }, "lifecycleTag": { "type": "object", "properties": { "key": { "type": "string" }, "value": { "type": "string" } } }, "listAccessRulesResponse": { "type": "object", "properties": { "accessRules": { "type": "array", "title": "list of policies", "items": { "$ref": "#/definitions/accessRule" } }, "total": { "type": "integer", "format": "int64", "title": "total number of policies" } } }, "listBucketEventsResponse": { "type": "object", "properties": { "events": { "type": "array", "items": { "$ref": "#/definitions/notificationConfig" } }, "total": { "type": "integer", "format": "int64", "title": "total number of bucket events" } } }, "listBucketsResponse": { "type": "object", "properties": { "buckets": { "type": "array", "title": "list of resulting buckets", "items": { "$ref": "#/definitions/bucket" } }, "total": { "type": "integer", "format": "int64", "title": "number of buckets accessible to the user" } } }, "listConfigResponse": { "type": "object", "properties": { "configurations": { "type": "array", "items": { "$ref": "#/definitions/configDescription" } }, "total": { "type": "integer", "format": "int64", "title": "total number of configurations" } } }, "listExternalBucketsParams": { "required": [ "accessKey", "secretKey", "targetURL", "useTLS" ], "properties": { "accessKey": { "type": "string", "minLength": 3 }, "region": { "type": "string" }, "secretKey": { "type": "string", "minLength": 8 }, "targetURL": { "type": "string" }, "useTLS": { "type": "boolean" } } }, "listGroupsResponse": { "type": "object", "properties": { "groups": { "type": "array", "title": "list of groups", "items": { "type": "string" } }, "total": { "type": "integer", "format": "int64", "title": "total number of groups" } } }, "listObjectsResponse": { "type": "object", "properties": { "objects": { "type": "array", "title": "list of resulting objects", "items": { "$ref": "#/definitions/bucketObject" } }, "total": { "type": "integer", "format": "int64", "title": "number of objects" } } }, "listPoliciesResponse": { "type": "object", "properties": { "policies": { "type": "array", "title": "list of policies", "items": { "$ref": "#/definitions/policy" } }, "total": { "type": "integer", "format": "int64", "title": "total number of policies" } } }, "listRemoteBucketsResponse": { "type": "object", "properties": { "buckets": { "type": "array", "title": "list of remote buckets", "items": { "$ref": "#/definitions/remoteBucket" } }, "total": { "type": "integer", "format": "int64", "title": "number of remote buckets accessible to user" } } }, "listUsersResponse": { "type": "object", "properties": { "users": { "type": "array", "title": "list of resulting users", "items": { "$ref": "#/definitions/user" } } } }, "logSearchResponse": { "type": "object", "properties": { "results": { "type": "object", "title": "list of log search responses" } } }, "loginDetails": { "type": "object", "properties": { "isK8S": { "type": "boolean" }, "ldap_enabled": { "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" } } }, "loginRequest": { "type": "object", "properties": { "accessKey": { "type": "string" }, "features": { "type": "object", "properties": { "hide_menu": { "type": "boolean" } } }, "secretKey": { "type": "string" }, "sts": { "type": "string" } } }, "loginResponse": { "type": "object", "properties": { "IDPRefreshToken": { "type": "string" }, "sessionId": { "type": "string" } } }, "logoutRequest": { "type": "object", "properties": { "state": { "type": "string" } } }, "makeBucketRequest": { "type": "object", "required": [ "name" ], "properties": { "locking": { "type": "boolean" }, "name": { "type": "string" }, "quota": { "$ref": "#/definitions/setBucketQuota" }, "retention": { "$ref": "#/definitions/putBucketRetentionRequest" }, "versioning": { "$ref": "#/definitions/setBucketVersioning" } } }, "makeBucketsResponse": { "type": "object", "properties": { "bucketName": { "type": "string" } } }, "maxShareLinkExpResponse": { "type": "object", "required": [ "exp" ], "properties": { "exp": { "type": "number", "format": "int64" } } }, "metadata": { "type": "object", "properties": { "objectMetadata": { "type": "object", "additionalProperties": true } } }, "multiBucketReplication": { "required": [ "accessKey", "secretKey", "targetURL", "bucketsRelation" ], "properties": { "accessKey": { "type": "string", "minLength": 3 }, "bandwidth": { "type": "integer", "format": "int64" }, "bucketsRelation": { "type": "array", "minLength": 1, "items": { "$ref": "#/definitions/multiBucketsRelation" } }, "healthCheckPeriod": { "type": "integer", "format": "int32" }, "prefix": { "type": "string" }, "priority": { "type": "integer", "format": "int32", "default": 0 }, "region": { "type": "string" }, "replicateDeleteMarkers": { "type": "boolean" }, "replicateDeletes": { "type": "boolean" }, "replicateExistingObjects": { "type": "boolean" }, "replicateMetadata": { "type": "boolean" }, "secretKey": { "type": "string", "minLength": 8 }, "storageClass": { "type": "string", "default": "" }, "syncMode": { "type": "string", "default": "async", "enum": [ "async", "sync" ] }, "tags": { "type": "string" }, "targetURL": { "type": "string" } } }, "multiBucketReplicationEdit": { "properties": { "arn": { "type": "string" }, "prefix": { "type": "string" }, "priority": { "type": "integer", "format": "int32", "default": 0 }, "replicateDeleteMarkers": { "type": "boolean" }, "replicateDeletes": { "type": "boolean" }, "replicateExistingObjects": { "type": "boolean" }, "replicateMetadata": { "type": "boolean" }, "ruleState": { "type": "boolean" }, "storageClass": { "type": "string", "default": "" }, "tags": { "type": "string", "default": "" } } }, "multiBucketResponseItem": { "type": "object", "properties": { "errorString": { "type": "string" }, "originBucket": { "type": "string" }, "targetBucket": { "type": "string" } } }, "multiBucketResponseState": { "type": "object", "properties": { "replicationState": { "type": "array", "items": { "$ref": "#/definitions/multiBucketResponseItem" } } } }, "multiBucketsRelation": { "type": "object", "properties": { "destinationBucket": { "type": "string" }, "originBucket": { "type": "string" } } }, "multiLifecycleResult": { "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/multicycleResultItem" } } } }, "multicycleResultItem": { "type": "object", "properties": { "bucketName": { "type": "string" }, "error": { "type": "string" } } }, "nofiticationService": { "type": "string", "enum": [ "webhook", "amqp", "kafka", "mqtt", "nats", "nsq", "mysql", "postgres", "elasticsearch", "redis" ] }, "notifEndpointResponse": { "type": "object", "properties": { "notification_endpoints": { "type": "array", "items": { "$ref": "#/definitions/notificationEndpointItem" } } } }, "notificationConfig": { "type": "object", "required": [ "arn" ], "properties": { "arn": { "type": "string" }, "events": { "type": "array", "title": "filter specific type of event. Defaults to all event (default: '[put,delete,get]')", "items": { "$ref": "#/definitions/notificationEventType" } }, "id": { "type": "string" }, "prefix": { "type": "string", "title": "filter event associated to the specified prefix" }, "suffix": { "type": "string", "title": "filter event associated to the specified suffix" } } }, "notificationDeleteRequest": { "type": "object", "required": [ "events", "prefix", "suffix" ], "properties": { "events": { "type": "array", "title": "filter specific type of event. Defaults to all event (default: '[put,delete,get]')", "minLength": 1, "items": { "$ref": "#/definitions/notificationEventType" } }, "prefix": { "type": "string", "title": "filter event associated to the specified prefix" }, "suffix": { "type": "string", "title": "filter event associated to the specified suffix" } } }, "notificationEndpoint": { "type": "object", "required": [ "service", "account_id", "properties" ], "properties": { "account_id": { "type": "string" }, "properties": { "type": "object", "additionalProperties": { "type": "string" } }, "service": { "$ref": "#/definitions/nofiticationService" } } }, "notificationEndpointItem": { "type": "object", "properties": { "account_id": { "type": "string" }, "service": { "$ref": "#/definitions/nofiticationService" }, "status": { "type": "string" } } }, "notificationEventType": { "type": "string", "enum": [ "put", "delete", "get", "replica", "ilm", "scanner" ] }, "objectBucketLifecycle": { "type": "object", "properties": { "expiration": { "$ref": "#/definitions/expirationResponse" }, "id": { "type": "string" }, "prefix": { "type": "string" }, "status": { "type": "string" }, "tags": { "type": "array", "items": { "$ref": "#/definitions/lifecycleTag" } }, "transition": { "$ref": "#/definitions/transitionResponse" } } }, "objectLegalHoldStatus": { "type": "string", "enum": [ "enabled", "disabled" ] }, "objectRetentionMode": { "type": "string", "enum": [ "governance", "compliance" ] }, "objectRetentionUnit": { "type": "string", "enum": [ "days", "years" ] }, "peerInfo": { "type": "object", "properties": { "deploymentID": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" } } }, "peerInfoRemove": { "type": "object", "required": [ "sites" ], "properties": { "all": { "type": "boolean" }, "sites": { "type": "array", "items": { "type": "string" } } } }, "peerSite": { "type": "object", "properties": { "accessKey": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" }, "secretKey": { "type": "string" } } }, "peerSiteEditResponse": { "type": "object", "properties": { "errorDetail": { "type": "string" }, "status": { "type": "string" }, "success": { "type": "boolean" } } }, "peerSiteRemoveResponse": { "type": "object", "properties": { "errorDetail": { "type": "string" }, "status": { "type": "string" } } }, "permissionResource": { "type": "object", "properties": { "conditionOperator": { "type": "string" }, "prefixes": { "type": "array", "items": { "type": "string" } }, "resource": { "type": "string" } } }, "policy": { "type": "object", "properties": { "name": { "type": "string" }, "policy": { "type": "string" } } }, "policyArgs": { "type": "object", "properties": { "action": { "type": "string" }, "bucket_name": { "type": "string" }, "id": { "type": "string" } } }, "policyEntity": { "type": "string", "default": "user", "enum": [ "user", "group" ] }, "prefixAccessPair": { "type": "object", "properties": { "access": { "type": "string" }, "prefix": { "type": "string" } } }, "prefixWrapper": { "type": "object", "properties": { "prefix": { "type": "string" } } }, "principal": { "type": "object", "properties": { "STSAccessKeyID": { "type": "string" }, "STSSecretAccessKey": { "type": "string" }, "STSSessionToken": { "type": "string" }, "accountAccessKey": { "type": "string" }, "customStyleOb": { "type": "string" }, "hm": { "type": "boolean" }, "ob": { "type": "boolean" } } }, "profilingStartRequest": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string" } } }, "putBucketRetentionRequest": { "type": "object", "required": [ "mode", "unit", "validity" ], "properties": { "mode": { "$ref": "#/definitions/objectRetentionMode" }, "unit": { "$ref": "#/definitions/objectRetentionUnit" }, "validity": { "type": "integer", "format": "int32" } } }, "putBucketTagsRequest": { "type": "object", "properties": { "tags": { "additionalProperties": { "type": "string" } } } }, "putObjectLegalHoldRequest": { "type": "object", "required": [ "status" ], "properties": { "status": { "$ref": "#/definitions/objectLegalHoldStatus" } } }, "putObjectRetentionRequest": { "type": "object", "required": [ "mode", "expires" ], "properties": { "expires": { "type": "string" }, "governance_bypass": { "type": "boolean" }, "mode": { "$ref": "#/definitions/objectRetentionMode" } } }, "putObjectTagsRequest": { "type": "object", "properties": { "tags": { "additionalProperties": { "type": "string" } } } }, "redirectRule": { "type": "object", "properties": { "displayName": { "type": "string" }, "redirect": { "type": "string" }, "serviceType": { "type": "string" } } }, "releaseAuthor": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "events_url": { "type": "string" }, "followers_url": { "type": "string" }, "following_url": { "type": "string" }, "gists_url": { "type": "string" }, "gravatar_id": { "type": "string" }, "html_url": { "type": "string" }, "id": { "type": "integer" }, "login": { "type": "string" }, "node_id": { "type": "string" }, "organizations_url": { "type": "string" }, "receivedEvents_url": { "type": "string" }, "repos_url": { "type": "string" }, "site_admin": { "type": "boolean" }, "starred_url": { "type": "string" }, "subscriptions_url": { "type": "string" }, "type": { "type": "string" }, "url": { "type": "string" } } }, "releaseInfo": { "type": "object", "properties": { "breakingChangesContent": { "type": "string" }, "contextContent": { "type": "string" }, "metadata": { "$ref": "#/definitions/releaseMetadata" }, "newFeaturesContent": { "type": "string" }, "notesContent": { "type": "string" }, "securityContent": { "type": "string" } } }, "releaseListResponse": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/releaseInfo" } } } }, "releaseMetadata": { "type": "object", "properties": { "assets_url": { "type": "string" }, "author": { "$ref": "#/definitions/releaseAuthor" }, "created_at": { "type": "string" }, "draft": { "type": "boolean" }, "html_url": { "type": "string" }, "id": { "type": "integer" }, "name": { "type": "string" }, "node_id": { "type": "string" }, "prerelease": { "type": "boolean" }, "published_at": { "type": "string" }, "tag_name": { "type": "string" }, "tarball_url": { "type": "string" }, "target_commitish": { "type": "string" }, "upload_url": { "type": "string" }, "url": { "type": "string" }, "zipball_url": { "type": "string" } } }, "remoteBucket": { "type": "object", "required": [ "accessKey", "sourceBucket", "remoteARN" ], "properties": { "accessKey": { "type": "string", "minLength": 3 }, "bandwidth": { "type": "integer", "format": "int64" }, "healthCheckPeriod": { "type": "integer" }, "remoteARN": { "type": "string" }, "secretKey": { "type": "string", "minLength": 8 }, "service": { "type": "string", "enum": [ "replication" ] }, "sourceBucket": { "type": "string" }, "status": { "type": "string" }, "syncMode": { "type": "string" }, "targetBucket": { "type": "string" }, "targetURL": { "type": "string" } } }, "resultTarget": { "type": "object", "properties": { "legendFormat": { "type": "string" }, "result": { "type": "array", "items": { "$ref": "#/definitions/widgetResult" } }, "resultType": { "type": "string" } } }, "rewindItem": { "type": "object", "properties": { "action": { "type": "string" }, "delete_flag": { "type": "boolean" }, "is_latest": { "type": "boolean" }, "last_modified": { "type": "string" }, "name": { "type": "string" }, "size": { "type": "integer", "format": "int64" }, "version_id": { "type": "string" } } }, "rewindResponse": { "type": "object", "properties": { "objects": { "type": "array", "items": { "$ref": "#/definitions/rewindItem" } } } }, "selectedSAs": { "type": "array", "items": { "type": "string" } }, "selectedUsers": { "type": "array", "items": { "type": "string" } }, "serverDrives": { "type": "object", "properties": { "availableSpace": { "type": "integer" }, "drivePath": { "type": "string" }, "endpoint": { "type": "string" }, "healing": { "type": "boolean" }, "model": { "type": "string" }, "rootDisk": { "type": "boolean" }, "state": { "type": "string" }, "totalSpace": { "type": "integer" }, "usedSpace": { "type": "integer" }, "uuid": { "type": "string" } } }, "serverProperties": { "type": "object", "properties": { "commitID": { "type": "string" }, "drives": { "type": "array", "items": { "$ref": "#/definitions/serverDrives" } }, "endpoint": { "type": "string" }, "network": { "type": "object", "additionalProperties": { "type": "string" } }, "poolNumber": { "type": "integer" }, "state": { "type": "string" }, "uptime": { "type": "integer" }, "version": { "type": "string" } } }, "serviceAccount": { "type": "object", "properties": { "accountStatus": { "type": "string" }, "description": { "type": "string" }, "expiration": { "type": "string" }, "impliedPolicy": { "type": "boolean" }, "name": { "type": "string" }, "parentUser": { "type": "string" }, "policy": { "type": "string" } } }, "serviceAccountCreds": { "type": "object", "properties": { "accessKey": { "type": "string" }, "secretKey": { "type": "string" }, "url": { "type": "string" } } }, "serviceAccountRequest": { "type": "object", "properties": { "comment": { "type": "string" }, "description": { "type": "string" }, "expiry": { "type": "string" }, "name": { "type": "string" }, "policy": { "type": "string", "title": "policy to be applied to the Service Account if any" } } }, "serviceAccountRequestCreds": { "type": "object", "properties": { "accessKey": { "type": "string" }, "comment": { "type": "string" }, "description": { "type": "string" }, "expiry": { "type": "string" }, "name": { "type": "string" }, "policy": { "type": "string", "title": "policy to be applied to the Service Account if any" }, "secretKey": { "type": "string" } } }, "serviceAccounts": { "type": "array", "items": { "$ref": "#/definitions/ServiceAccountsItems0" } }, "sessionResponse": { "type": "object", "properties": { "allowResources": { "type": "array", "items": { "$ref": "#/definitions/permissionResource" } }, "customStyles": { "type": "string" }, "distributedMode": { "type": "boolean" }, "envConstants": { "$ref": "#/definitions/environmentConstants" }, "features": { "type": "array", "items": { "type": "string" } }, "operator": { "type": "boolean" }, "permissions": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "serverEndPoint": { "type": "string" }, "status": { "type": "string", "enum": [ "ok" ] } } }, "setBucketPolicyRequest": { "type": "object", "required": [ "access" ], "properties": { "access": { "$ref": "#/definitions/bucketAccess" }, "definition": { "type": "string" } } }, "setBucketQuota": { "type": "object", "required": [ "enabled" ], "properties": { "amount": { "type": "integer" }, "enabled": { "type": "boolean" }, "quota_type": { "type": "string", "enum": [ "hard" ] } } }, "setBucketVersioning": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "excludeFolders": { "type": "boolean" }, "excludePrefixes": { "type": "array", "maxLength": 10, "items": { "type": "string" } } } }, "setConfigRequest": { "type": "object", "required": [ "key_values" ], "properties": { "arn_resource_id": { "type": "string", "title": "Used if configuration is an event notification's target" }, "key_values": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/configurationKV" } } } }, "setConfigResponse": { "type": "object", "properties": { "restart": { "description": "Returns wheter server needs to restart to apply changes or not", "type": "boolean" } } }, "setIDPResponse": { "type": "object", "properties": { "restart": { "type": "boolean" } } }, "setNotificationEndpointResponse": { "type": "object", "required": [ "service", "account_id", "properties" ], "properties": { "account_id": { "type": "string" }, "properties": { "type": "object", "additionalProperties": { "type": "string" } }, "restart": { "type": "boolean" }, "service": { "$ref": "#/definitions/nofiticationService" } } }, "setPolicyMultipleNameRequest": { "type": "object", "properties": { "groups": { "type": "array", "items": { "$ref": "#/definitions/iamEntity" } }, "name": { "type": "array", "items": { "type": "string" } }, "users": { "type": "array", "items": { "$ref": "#/definitions/iamEntity" } } } }, "setPolicyNameRequest": { "type": "object", "required": [ "name", "entityType", "entityName" ], "properties": { "entityName": { "type": "string" }, "entityType": { "$ref": "#/definitions/policyEntity" }, "name": { "type": "array", "items": { "type": "string" } } } }, "setPolicyRequest": { "type": "object", "required": [ "entityType", "entityName" ], "properties": { "entityName": { "type": "string" }, "entityType": { "$ref": "#/definitions/policyEntity" } } }, "siteReplicationAddRequest": { "type": "array", "items": { "$ref": "#/definitions/peerSite" } }, "siteReplicationAddResponse": { "type": "object", "properties": { "errorDetail": { "type": "string" }, "initialSyncErrorMessage": { "type": "string" }, "status": { "type": "string" }, "success": { "type": "boolean" } } }, "siteReplicationInfoResponse": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "name": { "type": "string" }, "serviceAccountAccessKey": { "type": "string" }, "sites": { "type": "array", "items": { "$ref": "#/definitions/peerInfo" } } } }, "siteReplicationStatusResponse": { "type": "object", "properties": { "bucketStats": { "type": "object" }, "enabled": { "type": "boolean" }, "groupStats": { "type": "object" }, "maxBuckets": { "type": "integer" }, "maxGroups": { "type": "integer" }, "maxPolicies": { "type": "integer" }, "maxUsers": { "type": "integer" }, "policyStats": { "type": "object" }, "sites": { "type": "object" }, "statsSummary": { "type": "object" }, "userStats": { "type": "object" } } }, "startProfilingItem": { "type": "object", "properties": { "error": { "type": "string" }, "nodeName": { "type": "string" }, "success": { "type": "boolean" } } }, "startProfilingList": { "type": "object", "properties": { "startResults": { "type": "array", "items": { "$ref": "#/definitions/startProfilingItem" } }, "total": { "type": "integer", "format": "int64", "title": "number of start results" } } }, "tier": { "type": "object", "properties": { "azure": { "type": "object", "$ref": "#/definitions/tier_azure" }, "gcs": { "type": "object", "$ref": "#/definitions/tier_gcs" }, "minio": { "type": "object", "$ref": "#/definitions/tier_minio" }, "s3": { "type": "object", "$ref": "#/definitions/tier_s3" }, "status": { "type": "boolean" }, "type": { "type": "string", "enum": [ "s3", "gcs", "azure", "minio", "unsupported" ] } } }, "tierCredentialsRequest": { "type": "object", "properties": { "access_key": { "type": "string" }, "creds": { "description": "a base64 encoded value", "type": "string" }, "secret_key": { "type": "string" } } }, "tierListResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/definitions/tier" } } } }, "tier_azure": { "type": "object", "properties": { "accountkey": { "type": "string" }, "accountname": { "type": "string" }, "bucket": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" }, "objects": { "type": "string" }, "prefix": { "type": "string" }, "region": { "type": "string" }, "usage": { "type": "string" }, "versions": { "type": "string" } } }, "tier_gcs": { "type": "object", "properties": { "bucket": { "type": "string" }, "creds": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" }, "objects": { "type": "string" }, "prefix": { "type": "string" }, "region": { "type": "string" }, "usage": { "type": "string" }, "versions": { "type": "string" } } }, "tier_minio": { "type": "object", "properties": { "accesskey": { "type": "string" }, "bucket": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" }, "objects": { "type": "string" }, "prefix": { "type": "string" }, "region": { "type": "string" }, "secretkey": { "type": "string" }, "storageclass": { "type": "string" }, "usage": { "type": "string" }, "versions": { "type": "string" } } }, "tier_s3": { "type": "object", "properties": { "accesskey": { "type": "string" }, "bucket": { "type": "string" }, "endpoint": { "type": "string" }, "name": { "type": "string" }, "objects": { "type": "string" }, "prefix": { "type": "string" }, "region": { "type": "string" }, "secretkey": { "type": "string" }, "storageclass": { "type": "string" }, "usage": { "type": "string" }, "versions": { "type": "string" } } }, "tiersNameListResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "string" } } } }, "transitionResponse": { "type": "object", "properties": { "date": { "type": "string" }, "days": { "type": "integer", "format": "int64" }, "noncurrent_storage_class": { "type": "string" }, "noncurrent_transition_days": { "type": "integer", "format": "int64" }, "storage_class": { "type": "string" } } }, "updateBucketLifecycle": { "type": "object", "required": [ "type" ], "properties": { "disable": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expired_object_delete_all": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expired_object_delete_marker": { "description": "Non required, toggle to disable or enable rule", "type": "boolean" }, "expiry_days": { "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_expiration_days": { "description": "Non required, can be set in case of expiration is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_days": { "description": "Non required, can be set in case of transition is enabled", "type": "integer", "format": "int32", "default": 0 }, "noncurrentversion_transition_storage_class": { "description": "Non required, can be set in case of transition is enabled", "type": "string" }, "prefix": { "description": "Non required field, it matches a prefix to perform ILM operations on it", "type": "string" }, "storage_class": { "description": "Required only in case of transition is set. it refers to a tier", "type": "string" }, "tags": { "description": "Non required field, tags to match ILM files", "type": "string" }, "transition_days": { "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", "type": "integer", "format": "int32", "default": 0 }, "type": { "description": "ILM Rule type (Expiry or transition)", "type": "string", "enum": [ "expiry", "transition" ] } } }, "updateGroupRequest": { "type": "object", "required": [ "members", "status" ], "properties": { "members": { "type": "array", "items": { "type": "string" } }, "status": { "type": "string" } } }, "updateServiceAccountRequest": { "type": "object", "required": [ "policy" ], "properties": { "description": { "type": "string" }, "expiry": { "type": "string" }, "name": { "type": "string" }, "policy": { "type": "string" }, "secretKey": { "type": "string" }, "status": { "type": "string" } } }, "updateUser": { "type": "object", "required": [ "status", "groups" ], "properties": { "groups": { "type": "array", "items": { "type": "string" } }, "status": { "type": "string" } } }, "updateUserGroups": { "type": "object", "required": [ "groups" ], "properties": { "groups": { "type": "array", "items": { "type": "string" } } } }, "user": { "type": "object", "properties": { "accessKey": { "type": "string" }, "hasPolicy": { "type": "boolean" }, "memberOf": { "type": "array", "items": { "type": "string" } }, "policy": { "type": "array", "items": { "type": "string" } }, "status": { "type": "string" } } }, "userSAs": { "type": "object", "properties": { "path": { "type": "string" }, "recursive": { "type": "boolean" }, "versionID": { "type": "string" } } }, "userServiceAccountItem": { "type": "object", "properties": { "numSAs": { "type": "integer", "format": "int64" }, "userName": { "type": "string" } } }, "userServiceAccountSummary": { "type": "object", "properties": { "hasSA": { "type": "boolean" }, "userServiceAccountList": { "type": "array", "title": "list of users with number of service accounts", "items": { "$ref": "#/definitions/userServiceAccountItem" } } } }, "widget": { "type": "object", "properties": { "id": { "type": "integer", "format": "int32" }, "options": { "type": "object", "properties": { "reduceOptions": { "type": "object", "properties": { "calcs": { "type": "array", "items": { "type": "string" } } } } } }, "targets": { "type": "array", "items": { "$ref": "#/definitions/resultTarget" } }, "title": { "type": "string" }, "type": { "type": "string" } } }, "widgetDetails": { "type": "object", "properties": { "id": { "type": "integer", "format": "int32" }, "options": { "type": "object", "properties": { "reduceOptions": { "type": "object", "properties": { "calcs": { "type": "array", "items": { "type": "string" } } } } } }, "targets": { "type": "array", "items": { "$ref": "#/definitions/resultTarget" } }, "title": { "type": "string" }, "type": { "type": "string" } } }, "widgetResult": { "type": "object", "properties": { "metric": { "type": "object", "additionalProperties": { "type": "string" } }, "values": { "type": "array", "items": {} } } } }, "parameters": { "limit": { "type": "number", "format": "int32", "default": 20, "name": "limit", "in": "query" }, "offset": { "type": "number", "format": "int32", "default": 0, "name": "offset", "in": "query" } }, "securityDefinitions": { "anonymous": { "type": "apiKey", "name": "X-Anonymous", "in": "header" }, "key": { "type": "oauth2", "flow": "accessCode", "authorizationUrl": "http://min.io", "tokenUrl": "http://min.io" } }, "security": [ { "key": [] } ] }`)) } ================================================ FILE: api/errors.go ================================================ // 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 api import ( "context" "errors" "strings" "github.com/minio/minio-go/v7" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" ) var ( ErrDefault = errors.New("an error occurred, please try again") ErrInvalidLogin = errors.New("invalid login") ErrForbidden = errors.New("403 Forbidden") ErrBadRequest = errors.New("400 Bad Request") ErrFileTooLarge = errors.New("413 File too Large") ErrInvalidSession = errors.New("invalid session") ErrNotFound = errors.New("not found") ErrGroupAlreadyExists = errors.New("error group name already in use") ErrInvalidErasureCodingValue = errors.New("invalid Erasure Coding Value") ErrBucketBodyNotInRequest = errors.New("error bucket body not in request") ErrBucketNameNotInRequest = errors.New("error bucket name not in request") ErrGroupBodyNotInRequest = errors.New("error group body not in request") ErrGroupNameNotInRequest = errors.New("error group name not in request") ErrPolicyNameNotInRequest = errors.New("error policy name not in request") ErrPolicyBodyNotInRequest = errors.New("error policy body not in request") ErrInvalidEncryptionAlgorithm = errors.New("error invalid encryption algorithm") ErrSSENotConfigured = errors.New("error server side encryption configuration not found") ErrBucketLifeCycleNotConfigured = errors.New("error bucket life cycle configuration not found") ErrChangePassword = errors.New("error please check your current password") ErrInvalidLicense = errors.New("invalid license key") ErrLicenseNotFound = errors.New("license not found") ErrAvoidSelfAccountDelete = errors.New("logged in user cannot be deleted by itself") ErrAccessDenied = errors.New("access denied") ErrOauth2Provider = errors.New("unable to contact configured identity provider") ErrOauth2Login = errors.New("unable to login using configured identity provider") ErrNonUniqueAccessKey = errors.New("access key already in use") ErrRemoteTierExists = errors.New("specified remote tier already exists") ErrRemoteTierNotFound = errors.New("specified remote tier was not found") ErrRemoteTierUppercase = errors.New("tier name must be in uppercase") ErrRemoteTierBucketNotFound = errors.New("remote tier bucket not found") ErrRemoteInvalidCredentials = errors.New("invalid remote tier credentials") ErrUnableToGetTenantUsage = errors.New("unable to get tenant usage") ErrTooManyNodes = errors.New("cannot request more nodes than what is available in the cluster") ErrTooFewNodes = errors.New("there are not enough nodes in the cluster to support this tenant") ErrTooFewAvailableNodes = errors.New("there is not enough available nodes to satisfy this requirement") ErrFewerThanFourNodes = errors.New("at least 4 nodes are required for a tenant") ErrUnableToGetTenantLogs = errors.New("unable to get tenant logs") ErrUnableToUpdateTenantCertificates = errors.New("unable to update tenant certificates") ErrUpdatingEncryptionConfig = errors.New("unable to update encryption configuration") ErrDeletingEncryptionConfig = errors.New("error disabling tenant encryption") ErrEncryptionConfigNotFound = errors.New("encryption configuration not found") ErrPolicyNotFound = errors.New("policy does not exist") ErrLoginNotAllowed = errors.New("login not allowed") ErrHealthReportFail = errors.New("failure to generate Health report") ErrNetworkError = errors.New("unable to login due to network error") ) type CodedAPIError struct { Code int APIError *models.APIError } // ErrorWithContext : func ErrorWithContext(ctx context.Context, err ...interface{}) *CodedAPIError { errorCode := 500 errorMessage := ErrDefault.Error() var detailedMessage string var err1 error var exists bool if len(err) > 0 { if err1, exists = err[0].(error); exists { detailedMessage = err1.Error() var lastError error if len(err) > 1 { if err2, lastExists := err[1].(error); lastExists { lastError = err2 } } if err1.Error() == ErrForbidden.Error() { errorCode = 403 } if err1.Error() == ErrBadRequest.Error() { errorCode = 400 } if err1 == ErrNotFound { errorCode = 404 errorMessage = ErrNotFound.Error() } if errors.Is(err1, ErrInvalidLogin) { detailedMessage = "" errorCode = 401 errorMessage = ErrInvalidLogin.Error() } if errors.Is(err1, ErrNetworkError) { detailedMessage = "" errorCode = 503 errorMessage = ErrNetworkError.Error() } if strings.Contains(strings.ToLower(err1.Error()), ErrAccessDenied.Error()) { errorCode = 403 errorMessage = err1.Error() } // If the last error is ErrInvalidLogin, this is a login failure if errors.Is(lastError, ErrInvalidLogin) { detailedMessage = "" errorCode = 401 errorMessage = err1.Error() } if strings.Contains(err1.Error(), ErrLoginNotAllowed.Error()) { detailedMessage = "" errorCode = 400 errorMessage = ErrLoginNotAllowed.Error() } // console invalid erasure coding value if errors.Is(err1, ErrInvalidErasureCodingValue) { errorCode = 400 errorMessage = ErrInvalidErasureCodingValue.Error() } if errors.Is(err1, ErrBucketBodyNotInRequest) { errorCode = 400 errorMessage = ErrBucketBodyNotInRequest.Error() } if errors.Is(err1, ErrBucketNameNotInRequest) { errorCode = 400 errorMessage = ErrBucketNameNotInRequest.Error() } if errors.Is(err1, ErrGroupBodyNotInRequest) { errorCode = 400 errorMessage = ErrGroupBodyNotInRequest.Error() } if errors.Is(err1, ErrGroupNameNotInRequest) { errorCode = 400 errorMessage = ErrGroupNameNotInRequest.Error() } if errors.Is(err1, ErrPolicyNameNotInRequest) { errorCode = 400 errorMessage = ErrPolicyNameNotInRequest.Error() } if errors.Is(err1, ErrPolicyBodyNotInRequest) { errorCode = 400 errorMessage = ErrPolicyBodyNotInRequest.Error() } // console invalid session errors if errors.Is(err1, ErrInvalidSession) { errorCode = 401 errorMessage = ErrInvalidSession.Error() } if errors.Is(err1, ErrGroupAlreadyExists) { errorCode = 400 errorMessage = ErrGroupAlreadyExists.Error() } // Bucket life cycle not configured if errors.Is(err1, ErrBucketLifeCycleNotConfigured) { errorCode = 404 errorMessage = ErrBucketLifeCycleNotConfigured.Error() } // Encryption not configured if errors.Is(err1, ErrSSENotConfigured) { errorCode = 404 errorMessage = ErrSSENotConfigured.Error() } if errors.Is(err1, ErrEncryptionConfigNotFound) { errorCode = 404 errorMessage = err1.Error() } // account change password if errors.Is(err1, ErrChangePassword) { errorCode = 403 errorMessage = ErrChangePassword.Error() } if madmin.ToErrorResponse(err1).Code == "SignatureDoesNotMatch" { errorCode = 403 errorMessage = ErrChangePassword.Error() } if errors.Is(err1, ErrLicenseNotFound) { errorCode = 404 errorMessage = ErrLicenseNotFound.Error() } if errors.Is(err1, ErrInvalidLicense) { errorCode = 404 errorMessage = ErrInvalidLicense.Error() } if errors.Is(err1, ErrAvoidSelfAccountDelete) { errorCode = 403 errorMessage = ErrAvoidSelfAccountDelete.Error() } if errors.Is(err1, ErrAccessDenied) { errorCode = 403 errorMessage = ErrAccessDenied.Error() } if errors.Is(err1, ErrPolicyNotFound) { errorCode = 404 errorMessage = ErrPolicyNotFound.Error() } if madmin.ToErrorResponse(err1).Code == "AccessDenied" { errorCode = 403 errorMessage = ErrAccessDenied.Error() } if madmin.ToErrorResponse(err1).Code == "InvalidAccessKeyId" { errorCode = 401 errorMessage = ErrInvalidSession.Error() } // console invalid session errors if madmin.ToErrorResponse(err1).Code == "XMinioAdminNoSuchUser" { errorCode = 401 errorMessage = ErrInvalidSession.Error() } // tiering errors if err1.Error() == ErrRemoteTierExists.Error() { errorCode = 400 errorMessage = err1.Error() } if err1.Error() == ErrRemoteTierNotFound.Error() { errorCode = 400 errorMessage = err1.Error() } if err1.Error() == ErrRemoteTierUppercase.Error() { errorCode = 400 errorMessage = err1.Error() } if err1.Error() == ErrRemoteTierBucketNotFound.Error() { errorCode = 400 errorMessage = err1.Error() } if err1.Error() == ErrRemoteInvalidCredentials.Error() { errorCode = 403 errorMessage = err1.Error() } if err1.Error() == ErrFileTooLarge.Error() { errorCode = 413 errorMessage = err1.Error() } // bucket already exists if minio.ToErrorResponse(err1).Code == "BucketAlreadyOwnedByYou" { errorCode = 400 errorMessage = "Bucket already exists" } LogError("ErrorWithContext:%v", err...) LogIf(ctx, err1, err...) } if len(err) > 1 && err[1] != nil { if err2, ok := err[1].(error); ok { errorMessage = err2.Error() } } } return &CodedAPIError{Code: errorCode, APIError: &models.APIError{Message: errorMessage, DetailedMessage: detailedMessage}} } // Error receives an errors object and parse it against k8sErrors, returns the right errors code paired with a generic errors message func Error(err ...interface{}) *CodedAPIError { ctx, cancel := context.WithCancel(context.Background()) defer cancel() return ErrorWithContext(ctx, err...) } ================================================ FILE: api/errors_test.go ================================================ // 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 api import ( "context" "fmt" "testing" "github.com/minio/console/models" "github.com/stretchr/testify/assert" ) func TestError(t *testing.T) { type args struct { err []interface{} } type testError struct { name string args args want *CodedAPIError } var tests []testError type expectedError struct { err error code int } appErrors := map[string]expectedError{ "ErrDefault": {code: 500, err: ErrDefault}, "ErrForbidden": {code: 403, err: ErrForbidden}, "ErrFileTooLarge": {code: 413, err: ErrFileTooLarge}, "ErrInvalidSession": {code: 401, err: ErrInvalidSession}, "ErrNotFound": {code: 404, err: ErrNotFound}, "ErrGroupAlreadyExists": {code: 400, err: ErrGroupAlreadyExists}, "ErrInvalidErasureCodingValue": {code: 400, err: ErrInvalidErasureCodingValue}, "ErrBucketBodyNotInRequest": {code: 400, err: ErrBucketBodyNotInRequest}, "ErrBucketNameNotInRequest": {code: 400, err: ErrBucketNameNotInRequest}, "ErrGroupBodyNotInRequest": {code: 400, err: ErrGroupBodyNotInRequest}, "ErrGroupNameNotInRequest": {code: 400, err: ErrGroupNameNotInRequest}, "ErrPolicyNameNotInRequest": {code: 400, err: ErrPolicyNameNotInRequest}, "ErrPolicyBodyNotInRequest": {code: 400, err: ErrPolicyBodyNotInRequest}, "ErrInvalidEncryptionAlgorithm": {code: 500, err: ErrInvalidEncryptionAlgorithm}, "ErrSSENotConfigured": {code: 404, err: ErrSSENotConfigured}, "ErrBucketLifeCycleNotConfigured": {code: 404, err: ErrBucketLifeCycleNotConfigured}, "ErrChangePassword": {code: 403, err: ErrChangePassword}, "ErrInvalidLicense": {code: 404, err: ErrInvalidLicense}, "ErrLicenseNotFound": {code: 404, err: ErrLicenseNotFound}, "ErrAvoidSelfAccountDelete": {code: 403, err: ErrAvoidSelfAccountDelete}, "ErrNonUniqueAccessKey": {code: 500, err: ErrNonUniqueAccessKey}, "ErrRemoteTierExists": {code: 400, err: ErrRemoteTierExists}, "ErrRemoteTierNotFound": {code: 400, err: ErrRemoteTierNotFound}, "ErrRemoteTierUppercase": {code: 400, err: ErrRemoteTierUppercase}, "ErrRemoteTierBucketNotFound": {code: 400, err: ErrRemoteTierBucketNotFound}, "ErrRemoteInvalidCredentials": {code: 403, err: ErrRemoteInvalidCredentials}, "ErrTooFewNodes": {code: 500, err: ErrTooFewNodes}, "ErrUnableToGetTenantUsage": {code: 500, err: ErrUnableToGetTenantUsage}, "ErrTooManyNodes": {code: 500, err: ErrTooManyNodes}, "ErrAccessDenied": {code: 403, err: ErrAccessDenied}, "ErrTooFewAvailableNodes": {code: 500, err: ErrTooFewAvailableNodes}, "ErrFewerThanFourNodes": {code: 500, err: ErrFewerThanFourNodes}, "ErrUnableToGetTenantLogs": {code: 500, err: ErrUnableToGetTenantLogs}, "ErrUnableToUpdateTenantCertificates": {code: 500, err: ErrUnableToUpdateTenantCertificates}, "ErrUpdatingEncryptionConfig": {code: 500, err: ErrUpdatingEncryptionConfig}, "ErrDeletingEncryptionConfig": {code: 500, err: ErrDeletingEncryptionConfig}, "ErrEncryptionConfigNotFound": {code: 404, err: ErrEncryptionConfigNotFound}, } for k, e := range appErrors { tests = append(tests, testError{ name: fmt.Sprintf("%s error", k), args: args{ err: []interface{}{e.err}, }, want: &CodedAPIError{ Code: e.code, APIError: &models.APIError{Message: e.err.Error(), DetailedMessage: e.err.Error()}, }, }) } tests = append(tests, testError{ name: "passing multiple errors but ErrInvalidLogin is last", args: args{ err: []interface{}{ErrDefault, ErrInvalidLogin}, }, want: &CodedAPIError{ Code: int(401), APIError: &models.APIError{Message: ErrDefault.Error(), DetailedMessage: ""}, }, }) tests = append(tests, testError{ name: "login error omits detailedMessage", args: args{ err: []interface{}{ErrInvalidLogin}, }, want: &CodedAPIError{ Code: int(401), APIError: &models.APIError{Message: ErrInvalidLogin.Error(), DetailedMessage: ""}, }, }) for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { got := Error(tt.args.err...) assert.Equalf(t, tt.want.Code, got.Code, "Error(%v) Got (%v)", tt.want.Code, got.Code) assert.Equalf(t, tt.want.APIError.DetailedMessage, got.APIError.DetailedMessage, "Error(%s) Got (%s)", tt.want.APIError.DetailedMessage, got.APIError.DetailedMessage) }) } } func TestErrorWithContext(t *testing.T) { type args struct { ctx context.Context err []interface{} } tests := []struct { name string args args want *CodedAPIError }{ { name: "default error", args: args{ ctx: context.Background(), err: []interface{}{ErrDefault}, }, want: &CodedAPIError{ Code: 500, APIError: &models.APIError{Message: ErrDefault.Error(), DetailedMessage: ErrDefault.Error()}, }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { assert.Equalf(t, tt.want, ErrorWithContext(tt.args.ctx, tt.args.err...), "ErrorWithContext(%v, %v)", tt.args.ctx, tt.args.err) }) } } ================================================ FILE: api/logs.go ================================================ // 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 api import ( "context" "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...) } func logIf(_ context.Context, _ error, _ ...interface{}) { } // globally changeable logger styles var ( LogInfo = logInfo LogError = logError LogIf = logIf ) // 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 api 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 } ================================================ FILE: api/logs_test.go ================================================ // 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 api 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(_ *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(_ *testing.T) { logInfo("message", nil) } ================================================ FILE: api/operations/account/account_change_password.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package account import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // AccountChangePasswordHandlerFunc turns a function with the right signature into a account change password handler type AccountChangePasswordHandlerFunc func(AccountChangePasswordParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn AccountChangePasswordHandlerFunc) Handle(params AccountChangePasswordParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // AccountChangePasswordHandler interface for that can handle valid account change password params type AccountChangePasswordHandler interface { Handle(AccountChangePasswordParams, *models.Principal) middleware.Responder } // NewAccountChangePassword creates a new http.Handler for the account change password operation func NewAccountChangePassword(ctx *middleware.Context, handler AccountChangePasswordHandler) *AccountChangePassword { return &AccountChangePassword{Context: ctx, Handler: handler} } /* AccountChangePassword swagger:route POST /account/change-password Account accountChangePassword Change password of currently logged in user. */ type AccountChangePassword struct { Context *middleware.Context Handler AccountChangePasswordHandler } func (o *AccountChangePassword) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewAccountChangePasswordParams() 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) } ================================================ FILE: api/operations/account/account_change_password_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package account import ( stderrors "errors" "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" ) // NewAccountChangePasswordParams creates a new AccountChangePasswordParams object // // There are no default values defined in the spec. func NewAccountChangePasswordParams() AccountChangePasswordParams { return AccountChangePasswordParams{} } // AccountChangePasswordParams contains all the bound params for the account change password operation // typically these are obtained from a http.Request // // swagger:parameters AccountChangePassword type AccountChangePasswordParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.AccountChangePasswordRequest } // 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 NewAccountChangePasswordParams() beforehand. func (o *AccountChangePasswordParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.AccountChangePasswordRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/account/account_change_password_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package account import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // AccountChangePasswordNoContentCode is the HTTP code returned for type AccountChangePasswordNoContent const AccountChangePasswordNoContentCode int = 204 /* AccountChangePasswordNoContent A successful login. swagger:response accountChangePasswordNoContent */ type AccountChangePasswordNoContent struct { } // NewAccountChangePasswordNoContent creates AccountChangePasswordNoContent with default headers values func NewAccountChangePasswordNoContent() *AccountChangePasswordNoContent { return &AccountChangePasswordNoContent{} } // WriteResponse to the client func (o *AccountChangePasswordNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* AccountChangePasswordDefault Generic error response. swagger:response accountChangePasswordDefault */ type AccountChangePasswordDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewAccountChangePasswordDefault creates AccountChangePasswordDefault with default headers values func NewAccountChangePasswordDefault(code int) *AccountChangePasswordDefault { if code <= 0 { code = 500 } return &AccountChangePasswordDefault{ _statusCode: code, } } // WithStatusCode adds the status to the account change password default response func (o *AccountChangePasswordDefault) WithStatusCode(code int) *AccountChangePasswordDefault { o._statusCode = code return o } // SetStatusCode sets the status to the account change password default response func (o *AccountChangePasswordDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the account change password default response func (o *AccountChangePasswordDefault) WithPayload(payload *models.APIError) *AccountChangePasswordDefault { o.Payload = payload return o } // SetPayload sets the payload to the account change password default response func (o *AccountChangePasswordDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *AccountChangePasswordDefault) 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 } } } ================================================ FILE: api/operations/account/account_change_password_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package account import ( "errors" "net/url" golangswaggerpaths "path" ) // AccountChangePasswordURL generates an URL for the account change password operation type AccountChangePasswordURL 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 *AccountChangePasswordURL) WithBasePath(bp string) *AccountChangePasswordURL { 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 *AccountChangePasswordURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *AccountChangePasswordURL) Build() (*url.URL, error) { var _result url.URL var _path = "/account/change-password" _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 *AccountChangePasswordURL) 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 *AccountChangePasswordURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *AccountChangePasswordURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on AccountChangePasswordURL") } if host == "" { return nil, errors.New("host is required for a full url on AccountChangePasswordURL") } 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 *AccountChangePasswordURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/account/change_user_password.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package account import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ChangeUserPasswordHandlerFunc turns a function with the right signature into a change user password handler type ChangeUserPasswordHandlerFunc func(ChangeUserPasswordParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ChangeUserPasswordHandlerFunc) Handle(params ChangeUserPasswordParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ChangeUserPasswordHandler interface for that can handle valid change user password params type ChangeUserPasswordHandler interface { Handle(ChangeUserPasswordParams, *models.Principal) middleware.Responder } // NewChangeUserPassword creates a new http.Handler for the change user password operation func NewChangeUserPassword(ctx *middleware.Context, handler ChangeUserPasswordHandler) *ChangeUserPassword { return &ChangeUserPassword{Context: ctx, Handler: handler} } /* ChangeUserPassword swagger:route POST /account/change-user-password Account changeUserPassword Change password of currently logged in user. */ type ChangeUserPassword struct { Context *middleware.Context Handler ChangeUserPasswordHandler } func (o *ChangeUserPassword) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewChangeUserPasswordParams() 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) } ================================================ FILE: api/operations/account/change_user_password_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package account import ( stderrors "errors" "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" ) // NewChangeUserPasswordParams creates a new ChangeUserPasswordParams object // // There are no default values defined in the spec. func NewChangeUserPasswordParams() ChangeUserPasswordParams { return ChangeUserPasswordParams{} } // ChangeUserPasswordParams contains all the bound params for the change user password operation // typically these are obtained from a http.Request // // swagger:parameters ChangeUserPassword type ChangeUserPasswordParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.ChangeUserPasswordRequest } // 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 NewChangeUserPasswordParams() beforehand. func (o *ChangeUserPasswordParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.ChangeUserPasswordRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/account/change_user_password_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package account import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ChangeUserPasswordCreatedCode is the HTTP code returned for type ChangeUserPasswordCreated const ChangeUserPasswordCreatedCode int = 201 /* ChangeUserPasswordCreated Password successfully changed. swagger:response changeUserPasswordCreated */ type ChangeUserPasswordCreated struct { } // NewChangeUserPasswordCreated creates ChangeUserPasswordCreated with default headers values func NewChangeUserPasswordCreated() *ChangeUserPasswordCreated { return &ChangeUserPasswordCreated{} } // WriteResponse to the client func (o *ChangeUserPasswordCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(201) } /* ChangeUserPasswordDefault Generic error response. swagger:response changeUserPasswordDefault */ type ChangeUserPasswordDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewChangeUserPasswordDefault creates ChangeUserPasswordDefault with default headers values func NewChangeUserPasswordDefault(code int) *ChangeUserPasswordDefault { if code <= 0 { code = 500 } return &ChangeUserPasswordDefault{ _statusCode: code, } } // WithStatusCode adds the status to the change user password default response func (o *ChangeUserPasswordDefault) WithStatusCode(code int) *ChangeUserPasswordDefault { o._statusCode = code return o } // SetStatusCode sets the status to the change user password default response func (o *ChangeUserPasswordDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the change user password default response func (o *ChangeUserPasswordDefault) WithPayload(payload *models.APIError) *ChangeUserPasswordDefault { o.Payload = payload return o } // SetPayload sets the payload to the change user password default response func (o *ChangeUserPasswordDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ChangeUserPasswordDefault) 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 } } } ================================================ FILE: api/operations/account/change_user_password_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package account import ( "errors" "net/url" golangswaggerpaths "path" ) // ChangeUserPasswordURL generates an URL for the change user password operation type ChangeUserPasswordURL 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 *ChangeUserPasswordURL) WithBasePath(bp string) *ChangeUserPasswordURL { 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 *ChangeUserPasswordURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ChangeUserPasswordURL) Build() (*url.URL, error) { var _result url.URL var _path = "/account/change-user-password" _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 *ChangeUserPasswordURL) 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 *ChangeUserPasswordURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ChangeUserPasswordURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ChangeUserPasswordURL") } if host == "" { return nil, errors.New("host is required for a full url on ChangeUserPasswordURL") } 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 *ChangeUserPasswordURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/auth/login.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "net/http" "github.com/go-openapi/runtime/middleware" ) // LoginHandlerFunc turns a function with the right signature into a login handler type LoginHandlerFunc func(LoginParams) middleware.Responder // Handle executing the request and returning a response func (fn LoginHandlerFunc) Handle(params LoginParams) middleware.Responder { return fn(params) } // LoginHandler interface for that can handle valid login params type LoginHandler interface { Handle(LoginParams) middleware.Responder } // NewLogin creates a new http.Handler for the login operation func NewLogin(ctx *middleware.Context, handler LoginHandler) *Login { return &Login{Context: ctx, Handler: handler} } /* Login swagger:route POST /login Auth login Login to Console */ type Login struct { Context *middleware.Context Handler LoginHandler } func (o *Login) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewLoginParams() 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) } ================================================ FILE: api/operations/auth/login_detail.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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) } ================================================ FILE: api/operations/auth/login_detail_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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 } ================================================ FILE: api/operations/auth/login_detail_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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.APIError `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.APIError) *LoginDetailDefault { o.Payload = payload return o } // SetPayload sets the payload to the login detail default response func (o *LoginDetailDefault) SetPayload(payload *models.APIError) { 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 } } } ================================================ FILE: api/operations/auth/login_detail_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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() } ================================================ FILE: api/operations/auth/login_oauth2_auth.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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) } ================================================ FILE: api/operations/auth/login_oauth2_auth_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( stderrors "errors" "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 func() { _ = r.Body.Close() }() var body models.LoginOauth2AuthRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/auth/login_oauth2_auth_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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.APIError `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.APIError) *LoginOauth2AuthDefault { o.Payload = payload return o } // SetPayload sets the payload to the login oauth2 auth default response func (o *LoginOauth2AuthDefault) SetPayload(payload *models.APIError) { 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 } } } ================================================ FILE: api/operations/auth/login_oauth2_auth_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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() } ================================================ FILE: api/operations/auth/login_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( stderrors "errors" "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" ) // NewLoginParams creates a new LoginParams object // // There are no default values defined in the spec. func NewLoginParams() LoginParams { return LoginParams{} } // LoginParams contains all the bound params for the login operation // typically these are obtained from a http.Request // // swagger:parameters Login type LoginParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.LoginRequest } // 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 NewLoginParams() beforehand. func (o *LoginParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.LoginRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/auth/login_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // LoginNoContentCode is the HTTP code returned for type LoginNoContent const LoginNoContentCode int = 204 /* LoginNoContent A successful login. swagger:response loginNoContent */ type LoginNoContent struct { } // NewLoginNoContent creates LoginNoContent with default headers values func NewLoginNoContent() *LoginNoContent { return &LoginNoContent{} } // WriteResponse to the client func (o *LoginNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* LoginDefault Generic error response. swagger:response loginDefault */ type LoginDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewLoginDefault creates LoginDefault with default headers values func NewLoginDefault(code int) *LoginDefault { if code <= 0 { code = 500 } return &LoginDefault{ _statusCode: code, } } // WithStatusCode adds the status to the login default response func (o *LoginDefault) WithStatusCode(code int) *LoginDefault { o._statusCode = code return o } // SetStatusCode sets the status to the login default response func (o *LoginDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the login default response func (o *LoginDefault) WithPayload(payload *models.APIError) *LoginDefault { o.Payload = payload return o } // SetPayload sets the payload to the login default response func (o *LoginDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *LoginDefault) 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 } } } ================================================ FILE: api/operations/auth/login_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "errors" "net/url" golangswaggerpaths "path" ) // LoginURL generates an URL for the login operation type LoginURL 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 *LoginURL) WithBasePath(bp string) *LoginURL { 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 *LoginURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *LoginURL) 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 *LoginURL) 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 *LoginURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *LoginURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on LoginURL") } if host == "" { return nil, errors.New("host is required for a full url on LoginURL") } 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 *LoginURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/auth/logout.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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 Console. */ 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) } ================================================ FILE: api/operations/auth/logout_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( stderrors "errors" "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" ) // 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:"-"` /* Required: true In: body */ Body *models.LogoutRequest } // 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 runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.LogoutRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/auth/logout_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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.APIError `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.APIError) *LogoutDefault { o.Payload = payload return o } // SetPayload sets the payload to the logout default response func (o *LogoutDefault) SetPayload(payload *models.APIError) { 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 } } } ================================================ FILE: api/operations/auth/logout_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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() } ================================================ FILE: api/operations/auth/session_check.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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) } ================================================ FILE: api/operations/auth/session_check_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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 } ================================================ FILE: api/operations/auth/session_check_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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.SessionResponse `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.SessionResponse) *SessionCheckOK { o.Payload = payload return o } // SetPayload sets the payload to the session check o k response func (o *SessionCheckOK) SetPayload(payload *models.SessionResponse) { 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.APIError `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.APIError) *SessionCheckDefault { o.Payload = payload return o } // SetPayload sets the payload to the session check default response func (o *SessionCheckDefault) SetPayload(payload *models.APIError) { 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 } } } ================================================ FILE: api/operations/auth/session_check_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 ( "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() } ================================================ FILE: api/operations/bucket/add_bucket_lifecycle.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // AddBucketLifecycleHandlerFunc turns a function with the right signature into a add bucket lifecycle handler type AddBucketLifecycleHandlerFunc func(AddBucketLifecycleParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn AddBucketLifecycleHandlerFunc) Handle(params AddBucketLifecycleParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // AddBucketLifecycleHandler interface for that can handle valid add bucket lifecycle params type AddBucketLifecycleHandler interface { Handle(AddBucketLifecycleParams, *models.Principal) middleware.Responder } // NewAddBucketLifecycle creates a new http.Handler for the add bucket lifecycle operation func NewAddBucketLifecycle(ctx *middleware.Context, handler AddBucketLifecycleHandler) *AddBucketLifecycle { return &AddBucketLifecycle{Context: ctx, Handler: handler} } /* AddBucketLifecycle swagger:route POST /buckets/{bucket_name}/lifecycle Bucket addBucketLifecycle Add Bucket Lifecycle */ type AddBucketLifecycle struct { Context *middleware.Context Handler AddBucketLifecycleHandler } func (o *AddBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewAddBucketLifecycleParams() 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) } ================================================ FILE: api/operations/bucket/add_bucket_lifecycle_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewAddBucketLifecycleParams creates a new AddBucketLifecycleParams object // // There are no default values defined in the spec. func NewAddBucketLifecycleParams() AddBucketLifecycleParams { return AddBucketLifecycleParams{} } // AddBucketLifecycleParams contains all the bound params for the add bucket lifecycle operation // typically these are obtained from a http.Request // // swagger:parameters AddBucketLifecycle type AddBucketLifecycleParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.AddBucketLifecycle /* Required: true In: path */ BucketName 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 NewAddBucketLifecycleParams() beforehand. func (o *AddBucketLifecycleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.AddBucketLifecycle if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *AddBucketLifecycleParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/add_bucket_lifecycle_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // AddBucketLifecycleCreatedCode is the HTTP code returned for type AddBucketLifecycleCreated const AddBucketLifecycleCreatedCode int = 201 /* AddBucketLifecycleCreated A successful response. swagger:response addBucketLifecycleCreated */ type AddBucketLifecycleCreated struct { } // NewAddBucketLifecycleCreated creates AddBucketLifecycleCreated with default headers values func NewAddBucketLifecycleCreated() *AddBucketLifecycleCreated { return &AddBucketLifecycleCreated{} } // WriteResponse to the client func (o *AddBucketLifecycleCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(201) } /* AddBucketLifecycleDefault Generic error response. swagger:response addBucketLifecycleDefault */ type AddBucketLifecycleDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewAddBucketLifecycleDefault creates AddBucketLifecycleDefault with default headers values func NewAddBucketLifecycleDefault(code int) *AddBucketLifecycleDefault { if code <= 0 { code = 500 } return &AddBucketLifecycleDefault{ _statusCode: code, } } // WithStatusCode adds the status to the add bucket lifecycle default response func (o *AddBucketLifecycleDefault) WithStatusCode(code int) *AddBucketLifecycleDefault { o._statusCode = code return o } // SetStatusCode sets the status to the add bucket lifecycle default response func (o *AddBucketLifecycleDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the add bucket lifecycle default response func (o *AddBucketLifecycleDefault) WithPayload(payload *models.APIError) *AddBucketLifecycleDefault { o.Payload = payload return o } // SetPayload sets the payload to the add bucket lifecycle default response func (o *AddBucketLifecycleDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *AddBucketLifecycleDefault) 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 } } } ================================================ FILE: api/operations/bucket/add_bucket_lifecycle_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // AddBucketLifecycleURL generates an URL for the add bucket lifecycle operation type AddBucketLifecycleURL struct { BucketName 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 *AddBucketLifecycleURL) WithBasePath(bp string) *AddBucketLifecycleURL { 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 *AddBucketLifecycleURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *AddBucketLifecycleURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/lifecycle" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on AddBucketLifecycleURL") } _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 *AddBucketLifecycleURL) 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 *AddBucketLifecycleURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *AddBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on AddBucketLifecycleURL") } if host == "" { return nil, errors.New("host is required for a full url on AddBucketLifecycleURL") } 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 *AddBucketLifecycleURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/add_multi_bucket_lifecycle.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // AddMultiBucketLifecycleHandlerFunc turns a function with the right signature into a add multi bucket lifecycle handler type AddMultiBucketLifecycleHandlerFunc func(AddMultiBucketLifecycleParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn AddMultiBucketLifecycleHandlerFunc) Handle(params AddMultiBucketLifecycleParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // AddMultiBucketLifecycleHandler interface for that can handle valid add multi bucket lifecycle params type AddMultiBucketLifecycleHandler interface { Handle(AddMultiBucketLifecycleParams, *models.Principal) middleware.Responder } // NewAddMultiBucketLifecycle creates a new http.Handler for the add multi bucket lifecycle operation func NewAddMultiBucketLifecycle(ctx *middleware.Context, handler AddMultiBucketLifecycleHandler) *AddMultiBucketLifecycle { return &AddMultiBucketLifecycle{Context: ctx, Handler: handler} } /* AddMultiBucketLifecycle swagger:route POST /buckets/multi-lifecycle Bucket addMultiBucketLifecycle Add Multi Bucket Lifecycle */ type AddMultiBucketLifecycle struct { Context *middleware.Context Handler AddMultiBucketLifecycleHandler } func (o *AddMultiBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewAddMultiBucketLifecycleParams() 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) } ================================================ FILE: api/operations/bucket/add_multi_bucket_lifecycle_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewAddMultiBucketLifecycleParams creates a new AddMultiBucketLifecycleParams object // // There are no default values defined in the spec. func NewAddMultiBucketLifecycleParams() AddMultiBucketLifecycleParams { return AddMultiBucketLifecycleParams{} } // AddMultiBucketLifecycleParams contains all the bound params for the add multi bucket lifecycle operation // typically these are obtained from a http.Request // // swagger:parameters AddMultiBucketLifecycle type AddMultiBucketLifecycleParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.AddMultiBucketLifecycle } // 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 NewAddMultiBucketLifecycleParams() beforehand. func (o *AddMultiBucketLifecycleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.AddMultiBucketLifecycle if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/bucket/add_multi_bucket_lifecycle_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // AddMultiBucketLifecycleOKCode is the HTTP code returned for type AddMultiBucketLifecycleOK const AddMultiBucketLifecycleOKCode int = 200 /* AddMultiBucketLifecycleOK A successful response. swagger:response addMultiBucketLifecycleOK */ type AddMultiBucketLifecycleOK struct { /* In: Body */ Payload *models.MultiLifecycleResult `json:"body,omitempty"` } // NewAddMultiBucketLifecycleOK creates AddMultiBucketLifecycleOK with default headers values func NewAddMultiBucketLifecycleOK() *AddMultiBucketLifecycleOK { return &AddMultiBucketLifecycleOK{} } // WithPayload adds the payload to the add multi bucket lifecycle o k response func (o *AddMultiBucketLifecycleOK) WithPayload(payload *models.MultiLifecycleResult) *AddMultiBucketLifecycleOK { o.Payload = payload return o } // SetPayload sets the payload to the add multi bucket lifecycle o k response func (o *AddMultiBucketLifecycleOK) SetPayload(payload *models.MultiLifecycleResult) { o.Payload = payload } // WriteResponse to the client func (o *AddMultiBucketLifecycleOK) 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 } } } /* AddMultiBucketLifecycleDefault Generic error response. swagger:response addMultiBucketLifecycleDefault */ type AddMultiBucketLifecycleDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewAddMultiBucketLifecycleDefault creates AddMultiBucketLifecycleDefault with default headers values func NewAddMultiBucketLifecycleDefault(code int) *AddMultiBucketLifecycleDefault { if code <= 0 { code = 500 } return &AddMultiBucketLifecycleDefault{ _statusCode: code, } } // WithStatusCode adds the status to the add multi bucket lifecycle default response func (o *AddMultiBucketLifecycleDefault) WithStatusCode(code int) *AddMultiBucketLifecycleDefault { o._statusCode = code return o } // SetStatusCode sets the status to the add multi bucket lifecycle default response func (o *AddMultiBucketLifecycleDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the add multi bucket lifecycle default response func (o *AddMultiBucketLifecycleDefault) WithPayload(payload *models.APIError) *AddMultiBucketLifecycleDefault { o.Payload = payload return o } // SetPayload sets the payload to the add multi bucket lifecycle default response func (o *AddMultiBucketLifecycleDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *AddMultiBucketLifecycleDefault) 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 } } } ================================================ FILE: api/operations/bucket/add_multi_bucket_lifecycle_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" ) // AddMultiBucketLifecycleURL generates an URL for the add multi bucket lifecycle operation type AddMultiBucketLifecycleURL 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 *AddMultiBucketLifecycleURL) WithBasePath(bp string) *AddMultiBucketLifecycleURL { 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 *AddMultiBucketLifecycleURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *AddMultiBucketLifecycleURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/multi-lifecycle" _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 *AddMultiBucketLifecycleURL) 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 *AddMultiBucketLifecycleURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *AddMultiBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on AddMultiBucketLifecycleURL") } if host == "" { return nil, errors.New("host is required for a full url on AddMultiBucketLifecycleURL") } 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 *AddMultiBucketLifecycleURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/add_remote_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // AddRemoteBucketHandlerFunc turns a function with the right signature into a add remote bucket handler type AddRemoteBucketHandlerFunc func(AddRemoteBucketParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn AddRemoteBucketHandlerFunc) Handle(params AddRemoteBucketParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // AddRemoteBucketHandler interface for that can handle valid add remote bucket params type AddRemoteBucketHandler interface { Handle(AddRemoteBucketParams, *models.Principal) middleware.Responder } // NewAddRemoteBucket creates a new http.Handler for the add remote bucket operation func NewAddRemoteBucket(ctx *middleware.Context, handler AddRemoteBucketHandler) *AddRemoteBucket { return &AddRemoteBucket{Context: ctx, Handler: handler} } /* AddRemoteBucket swagger:route POST /remote-buckets Bucket addRemoteBucket Add Remote Bucket */ type AddRemoteBucket struct { Context *middleware.Context Handler AddRemoteBucketHandler } func (o *AddRemoteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewAddRemoteBucketParams() 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) } ================================================ FILE: api/operations/bucket/add_remote_bucket_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewAddRemoteBucketParams creates a new AddRemoteBucketParams object // // There are no default values defined in the spec. func NewAddRemoteBucketParams() AddRemoteBucketParams { return AddRemoteBucketParams{} } // AddRemoteBucketParams contains all the bound params for the add remote bucket operation // typically these are obtained from a http.Request // // swagger:parameters AddRemoteBucket type AddRemoteBucketParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.CreateRemoteBucket } // 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 NewAddRemoteBucketParams() beforehand. func (o *AddRemoteBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.CreateRemoteBucket if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/bucket/add_remote_bucket_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // AddRemoteBucketCreatedCode is the HTTP code returned for type AddRemoteBucketCreated const AddRemoteBucketCreatedCode int = 201 /* AddRemoteBucketCreated A successful response. swagger:response addRemoteBucketCreated */ type AddRemoteBucketCreated struct { } // NewAddRemoteBucketCreated creates AddRemoteBucketCreated with default headers values func NewAddRemoteBucketCreated() *AddRemoteBucketCreated { return &AddRemoteBucketCreated{} } // WriteResponse to the client func (o *AddRemoteBucketCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(201) } /* AddRemoteBucketDefault Generic error response. swagger:response addRemoteBucketDefault */ type AddRemoteBucketDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewAddRemoteBucketDefault creates AddRemoteBucketDefault with default headers values func NewAddRemoteBucketDefault(code int) *AddRemoteBucketDefault { if code <= 0 { code = 500 } return &AddRemoteBucketDefault{ _statusCode: code, } } // WithStatusCode adds the status to the add remote bucket default response func (o *AddRemoteBucketDefault) WithStatusCode(code int) *AddRemoteBucketDefault { o._statusCode = code return o } // SetStatusCode sets the status to the add remote bucket default response func (o *AddRemoteBucketDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the add remote bucket default response func (o *AddRemoteBucketDefault) WithPayload(payload *models.APIError) *AddRemoteBucketDefault { o.Payload = payload return o } // SetPayload sets the payload to the add remote bucket default response func (o *AddRemoteBucketDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *AddRemoteBucketDefault) 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 } } } ================================================ FILE: api/operations/bucket/add_remote_bucket_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" ) // AddRemoteBucketURL generates an URL for the add remote bucket operation type AddRemoteBucketURL 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 *AddRemoteBucketURL) WithBasePath(bp string) *AddRemoteBucketURL { 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 *AddRemoteBucketURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *AddRemoteBucketURL) Build() (*url.URL, error) { var _result url.URL var _path = "/remote-buckets" _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 *AddRemoteBucketURL) 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 *AddRemoteBucketURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *AddRemoteBucketURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on AddRemoteBucketURL") } if host == "" { return nil, errors.New("host is required for a full url on AddRemoteBucketURL") } 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 *AddRemoteBucketURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/bucket_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // BucketInfoHandlerFunc turns a function with the right signature into a bucket info handler type BucketInfoHandlerFunc func(BucketInfoParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn BucketInfoHandlerFunc) Handle(params BucketInfoParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // BucketInfoHandler interface for that can handle valid bucket info params type BucketInfoHandler interface { Handle(BucketInfoParams, *models.Principal) middleware.Responder } // NewBucketInfo creates a new http.Handler for the bucket info operation func NewBucketInfo(ctx *middleware.Context, handler BucketInfoHandler) *BucketInfo { return &BucketInfo{Context: ctx, Handler: handler} } /* BucketInfo swagger:route GET /buckets/{name} Bucket bucketInfo Bucket Info */ type BucketInfo struct { Context *middleware.Context Handler BucketInfoHandler } func (o *BucketInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewBucketInfoParams() 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) } ================================================ FILE: api/operations/bucket/bucket_info_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewBucketInfoParams creates a new BucketInfoParams object // // There are no default values defined in the spec. func NewBucketInfoParams() BucketInfoParams { return BucketInfoParams{} } // BucketInfoParams contains all the bound params for the bucket info operation // typically these are obtained from a http.Request // // swagger:parameters BucketInfo type BucketInfoParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewBucketInfoParams() beforehand. func (o *BucketInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *BucketInfoParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/bucket/bucket_info_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // BucketInfoOKCode is the HTTP code returned for type BucketInfoOK const BucketInfoOKCode int = 200 /* BucketInfoOK A successful response. swagger:response bucketInfoOK */ type BucketInfoOK struct { /* In: Body */ Payload *models.Bucket `json:"body,omitempty"` } // NewBucketInfoOK creates BucketInfoOK with default headers values func NewBucketInfoOK() *BucketInfoOK { return &BucketInfoOK{} } // WithPayload adds the payload to the bucket info o k response func (o *BucketInfoOK) WithPayload(payload *models.Bucket) *BucketInfoOK { o.Payload = payload return o } // SetPayload sets the payload to the bucket info o k response func (o *BucketInfoOK) SetPayload(payload *models.Bucket) { o.Payload = payload } // WriteResponse to the client func (o *BucketInfoOK) 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 } } } /* BucketInfoDefault Generic error response. swagger:response bucketInfoDefault */ type BucketInfoDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewBucketInfoDefault creates BucketInfoDefault with default headers values func NewBucketInfoDefault(code int) *BucketInfoDefault { if code <= 0 { code = 500 } return &BucketInfoDefault{ _statusCode: code, } } // WithStatusCode adds the status to the bucket info default response func (o *BucketInfoDefault) WithStatusCode(code int) *BucketInfoDefault { o._statusCode = code return o } // SetStatusCode sets the status to the bucket info default response func (o *BucketInfoDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the bucket info default response func (o *BucketInfoDefault) WithPayload(payload *models.APIError) *BucketInfoDefault { o.Payload = payload return o } // SetPayload sets the payload to the bucket info default response func (o *BucketInfoDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *BucketInfoDefault) 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 } } } ================================================ FILE: api/operations/bucket/bucket_info_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // BucketInfoURL generates an URL for the bucket info operation type BucketInfoURL struct { Name 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 *BucketInfoURL) WithBasePath(bp string) *BucketInfoURL { 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 *BucketInfoURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *BucketInfoURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on BucketInfoURL") } _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 *BucketInfoURL) 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 *BucketInfoURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *BucketInfoURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on BucketInfoURL") } if host == "" { return nil, errors.New("host is required for a full url on BucketInfoURL") } 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 *BucketInfoURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/bucket_set_policy.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // BucketSetPolicyHandlerFunc turns a function with the right signature into a bucket set policy handler type BucketSetPolicyHandlerFunc func(BucketSetPolicyParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn BucketSetPolicyHandlerFunc) Handle(params BucketSetPolicyParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // BucketSetPolicyHandler interface for that can handle valid bucket set policy params type BucketSetPolicyHandler interface { Handle(BucketSetPolicyParams, *models.Principal) middleware.Responder } // NewBucketSetPolicy creates a new http.Handler for the bucket set policy operation func NewBucketSetPolicy(ctx *middleware.Context, handler BucketSetPolicyHandler) *BucketSetPolicy { return &BucketSetPolicy{Context: ctx, Handler: handler} } /* BucketSetPolicy swagger:route PUT /buckets/{name}/set-policy Bucket bucketSetPolicy Bucket Set Policy */ type BucketSetPolicy struct { Context *middleware.Context Handler BucketSetPolicyHandler } func (o *BucketSetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewBucketSetPolicyParams() 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) } ================================================ FILE: api/operations/bucket/bucket_set_policy_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewBucketSetPolicyParams creates a new BucketSetPolicyParams object // // There are no default values defined in the spec. func NewBucketSetPolicyParams() BucketSetPolicyParams { return BucketSetPolicyParams{} } // BucketSetPolicyParams contains all the bound params for the bucket set policy operation // typically these are obtained from a http.Request // // swagger:parameters BucketSetPolicy type BucketSetPolicyParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.SetBucketPolicyRequest /* Required: true In: path */ Name 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 NewBucketSetPolicyParams() beforehand. func (o *BucketSetPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.SetBucketPolicyRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *BucketSetPolicyParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/bucket/bucket_set_policy_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // BucketSetPolicyOKCode is the HTTP code returned for type BucketSetPolicyOK const BucketSetPolicyOKCode int = 200 /* BucketSetPolicyOK A successful response. swagger:response bucketSetPolicyOK */ type BucketSetPolicyOK struct { /* In: Body */ Payload *models.Bucket `json:"body,omitempty"` } // NewBucketSetPolicyOK creates BucketSetPolicyOK with default headers values func NewBucketSetPolicyOK() *BucketSetPolicyOK { return &BucketSetPolicyOK{} } // WithPayload adds the payload to the bucket set policy o k response func (o *BucketSetPolicyOK) WithPayload(payload *models.Bucket) *BucketSetPolicyOK { o.Payload = payload return o } // SetPayload sets the payload to the bucket set policy o k response func (o *BucketSetPolicyOK) SetPayload(payload *models.Bucket) { o.Payload = payload } // WriteResponse to the client func (o *BucketSetPolicyOK) 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 } } } /* BucketSetPolicyDefault Generic error response. swagger:response bucketSetPolicyDefault */ type BucketSetPolicyDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewBucketSetPolicyDefault creates BucketSetPolicyDefault with default headers values func NewBucketSetPolicyDefault(code int) *BucketSetPolicyDefault { if code <= 0 { code = 500 } return &BucketSetPolicyDefault{ _statusCode: code, } } // WithStatusCode adds the status to the bucket set policy default response func (o *BucketSetPolicyDefault) WithStatusCode(code int) *BucketSetPolicyDefault { o._statusCode = code return o } // SetStatusCode sets the status to the bucket set policy default response func (o *BucketSetPolicyDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the bucket set policy default response func (o *BucketSetPolicyDefault) WithPayload(payload *models.APIError) *BucketSetPolicyDefault { o.Payload = payload return o } // SetPayload sets the payload to the bucket set policy default response func (o *BucketSetPolicyDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *BucketSetPolicyDefault) 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 } } } ================================================ FILE: api/operations/bucket/bucket_set_policy_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // BucketSetPolicyURL generates an URL for the bucket set policy operation type BucketSetPolicyURL struct { Name 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 *BucketSetPolicyURL) WithBasePath(bp string) *BucketSetPolicyURL { 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 *BucketSetPolicyURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *BucketSetPolicyURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{name}/set-policy" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on BucketSetPolicyURL") } _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 *BucketSetPolicyURL) 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 *BucketSetPolicyURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *BucketSetPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on BucketSetPolicyURL") } if host == "" { return nil, errors.New("host is required for a full url on BucketSetPolicyURL") } 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 *BucketSetPolicyURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/create_bucket_event.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // CreateBucketEventHandlerFunc turns a function with the right signature into a create bucket event handler type CreateBucketEventHandlerFunc func(CreateBucketEventParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn CreateBucketEventHandlerFunc) Handle(params CreateBucketEventParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // CreateBucketEventHandler interface for that can handle valid create bucket event params type CreateBucketEventHandler interface { Handle(CreateBucketEventParams, *models.Principal) middleware.Responder } // NewCreateBucketEvent creates a new http.Handler for the create bucket event operation func NewCreateBucketEvent(ctx *middleware.Context, handler CreateBucketEventHandler) *CreateBucketEvent { return &CreateBucketEvent{Context: ctx, Handler: handler} } /* CreateBucketEvent swagger:route POST /buckets/{bucket_name}/events Bucket createBucketEvent Create Bucket Event */ type CreateBucketEvent struct { Context *middleware.Context Handler CreateBucketEventHandler } func (o *CreateBucketEvent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewCreateBucketEventParams() 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) } ================================================ FILE: api/operations/bucket/create_bucket_event_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewCreateBucketEventParams creates a new CreateBucketEventParams object // // There are no default values defined in the spec. func NewCreateBucketEventParams() CreateBucketEventParams { return CreateBucketEventParams{} } // CreateBucketEventParams contains all the bound params for the create bucket event operation // typically these are obtained from a http.Request // // swagger:parameters CreateBucketEvent type CreateBucketEventParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.BucketEventRequest /* Required: true In: path */ BucketName 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 NewCreateBucketEventParams() beforehand. func (o *CreateBucketEventParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.BucketEventRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *CreateBucketEventParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/create_bucket_event_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // CreateBucketEventCreatedCode is the HTTP code returned for type CreateBucketEventCreated const CreateBucketEventCreatedCode int = 201 /* CreateBucketEventCreated A successful response. swagger:response createBucketEventCreated */ type CreateBucketEventCreated struct { } // NewCreateBucketEventCreated creates CreateBucketEventCreated with default headers values func NewCreateBucketEventCreated() *CreateBucketEventCreated { return &CreateBucketEventCreated{} } // WriteResponse to the client func (o *CreateBucketEventCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(201) } /* CreateBucketEventDefault Generic error response. swagger:response createBucketEventDefault */ type CreateBucketEventDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewCreateBucketEventDefault creates CreateBucketEventDefault with default headers values func NewCreateBucketEventDefault(code int) *CreateBucketEventDefault { if code <= 0 { code = 500 } return &CreateBucketEventDefault{ _statusCode: code, } } // WithStatusCode adds the status to the create bucket event default response func (o *CreateBucketEventDefault) WithStatusCode(code int) *CreateBucketEventDefault { o._statusCode = code return o } // SetStatusCode sets the status to the create bucket event default response func (o *CreateBucketEventDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the create bucket event default response func (o *CreateBucketEventDefault) WithPayload(payload *models.APIError) *CreateBucketEventDefault { o.Payload = payload return o } // SetPayload sets the payload to the create bucket event default response func (o *CreateBucketEventDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *CreateBucketEventDefault) 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 } } } ================================================ FILE: api/operations/bucket/create_bucket_event_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // CreateBucketEventURL generates an URL for the create bucket event operation type CreateBucketEventURL struct { BucketName 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 *CreateBucketEventURL) WithBasePath(bp string) *CreateBucketEventURL { 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 *CreateBucketEventURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *CreateBucketEventURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/events" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on CreateBucketEventURL") } _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 *CreateBucketEventURL) 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 *CreateBucketEventURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *CreateBucketEventURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on CreateBucketEventURL") } if host == "" { return nil, errors.New("host is required for a full url on CreateBucketEventURL") } 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 *CreateBucketEventURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/delete_access_rule_with_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteAccessRuleWithBucketHandlerFunc turns a function with the right signature into a delete access rule with bucket handler type DeleteAccessRuleWithBucketHandlerFunc func(DeleteAccessRuleWithBucketParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteAccessRuleWithBucketHandlerFunc) Handle(params DeleteAccessRuleWithBucketParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteAccessRuleWithBucketHandler interface for that can handle valid delete access rule with bucket params type DeleteAccessRuleWithBucketHandler interface { Handle(DeleteAccessRuleWithBucketParams, *models.Principal) middleware.Responder } // NewDeleteAccessRuleWithBucket creates a new http.Handler for the delete access rule with bucket operation func NewDeleteAccessRuleWithBucket(ctx *middleware.Context, handler DeleteAccessRuleWithBucketHandler) *DeleteAccessRuleWithBucket { return &DeleteAccessRuleWithBucket{Context: ctx, Handler: handler} } /* DeleteAccessRuleWithBucket swagger:route DELETE /bucket/{bucket}/access-rules Bucket deleteAccessRuleWithBucket Delete Access Rule From Given Bucket */ type DeleteAccessRuleWithBucket struct { Context *middleware.Context Handler DeleteAccessRuleWithBucketHandler } func (o *DeleteAccessRuleWithBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteAccessRuleWithBucketParams() 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) } ================================================ FILE: api/operations/bucket/delete_access_rule_with_bucket_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewDeleteAccessRuleWithBucketParams creates a new DeleteAccessRuleWithBucketParams object // // There are no default values defined in the spec. func NewDeleteAccessRuleWithBucketParams() DeleteAccessRuleWithBucketParams { return DeleteAccessRuleWithBucketParams{} } // DeleteAccessRuleWithBucketParams contains all the bound params for the delete access rule with bucket operation // typically these are obtained from a http.Request // // swagger:parameters DeleteAccessRuleWithBucket type DeleteAccessRuleWithBucketParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Bucket string /* Required: true In: body */ Prefix *models.PrefixWrapper } // 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 NewDeleteAccessRuleWithBucketParams() beforehand. func (o *DeleteAccessRuleWithBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucket, rhkBucket, _ := route.Params.GetOK("bucket") if err := o.bindBucket(rBucket, rhkBucket, route.Formats); err != nil { res = append(res, err) } if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.PrefixWrapper if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(err, io.EOF) { res = append(res, errors.Required("prefix", "body", "")) } else { res = append(res, errors.NewParseError("prefix", "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.Prefix = &body } } } else { res = append(res, errors.Required("prefix", "body", "")) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucket binds and validates parameter Bucket from path. func (o *DeleteAccessRuleWithBucketParams) bindBucket(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.Bucket = raw return nil } ================================================ FILE: api/operations/bucket/delete_access_rule_with_bucket_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteAccessRuleWithBucketOKCode is the HTTP code returned for type DeleteAccessRuleWithBucketOK const DeleteAccessRuleWithBucketOKCode int = 200 /* DeleteAccessRuleWithBucketOK A successful response. swagger:response deleteAccessRuleWithBucketOK */ type DeleteAccessRuleWithBucketOK struct { /* In: Body */ Payload bool `json:"body,omitempty"` } // NewDeleteAccessRuleWithBucketOK creates DeleteAccessRuleWithBucketOK with default headers values func NewDeleteAccessRuleWithBucketOK() *DeleteAccessRuleWithBucketOK { return &DeleteAccessRuleWithBucketOK{} } // WithPayload adds the payload to the delete access rule with bucket o k response func (o *DeleteAccessRuleWithBucketOK) WithPayload(payload bool) *DeleteAccessRuleWithBucketOK { o.Payload = payload return o } // SetPayload sets the payload to the delete access rule with bucket o k response func (o *DeleteAccessRuleWithBucketOK) SetPayload(payload bool) { o.Payload = payload } // WriteResponse to the client func (o *DeleteAccessRuleWithBucketOK) 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 } } /* DeleteAccessRuleWithBucketDefault Generic error response. swagger:response deleteAccessRuleWithBucketDefault */ type DeleteAccessRuleWithBucketDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteAccessRuleWithBucketDefault creates DeleteAccessRuleWithBucketDefault with default headers values func NewDeleteAccessRuleWithBucketDefault(code int) *DeleteAccessRuleWithBucketDefault { if code <= 0 { code = 500 } return &DeleteAccessRuleWithBucketDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete access rule with bucket default response func (o *DeleteAccessRuleWithBucketDefault) WithStatusCode(code int) *DeleteAccessRuleWithBucketDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete access rule with bucket default response func (o *DeleteAccessRuleWithBucketDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete access rule with bucket default response func (o *DeleteAccessRuleWithBucketDefault) WithPayload(payload *models.APIError) *DeleteAccessRuleWithBucketDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete access rule with bucket default response func (o *DeleteAccessRuleWithBucketDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteAccessRuleWithBucketDefault) 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 } } } ================================================ FILE: api/operations/bucket/delete_access_rule_with_bucket_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteAccessRuleWithBucketURL generates an URL for the delete access rule with bucket operation type DeleteAccessRuleWithBucketURL struct { Bucket 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 *DeleteAccessRuleWithBucketURL) WithBasePath(bp string) *DeleteAccessRuleWithBucketURL { 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 *DeleteAccessRuleWithBucketURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteAccessRuleWithBucketURL) Build() (*url.URL, error) { var _result url.URL var _path = "/bucket/{bucket}/access-rules" bucket := o.Bucket if bucket != "" { _path = strings.ReplaceAll(_path, "{bucket}", bucket) } else { return nil, errors.New("bucket is required on DeleteAccessRuleWithBucketURL") } _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 *DeleteAccessRuleWithBucketURL) 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 *DeleteAccessRuleWithBucketURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteAccessRuleWithBucketURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteAccessRuleWithBucketURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteAccessRuleWithBucketURL") } 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 *DeleteAccessRuleWithBucketURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/delete_all_replication_rules.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteAllReplicationRulesHandlerFunc turns a function with the right signature into a delete all replication rules handler type DeleteAllReplicationRulesHandlerFunc func(DeleteAllReplicationRulesParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteAllReplicationRulesHandlerFunc) Handle(params DeleteAllReplicationRulesParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteAllReplicationRulesHandler interface for that can handle valid delete all replication rules params type DeleteAllReplicationRulesHandler interface { Handle(DeleteAllReplicationRulesParams, *models.Principal) middleware.Responder } // NewDeleteAllReplicationRules creates a new http.Handler for the delete all replication rules operation func NewDeleteAllReplicationRules(ctx *middleware.Context, handler DeleteAllReplicationRulesHandler) *DeleteAllReplicationRules { return &DeleteAllReplicationRules{Context: ctx, Handler: handler} } /* DeleteAllReplicationRules swagger:route DELETE /buckets/{bucket_name}/delete-all-replication-rules Bucket deleteAllReplicationRules Deletes all replication rules from a bucket */ type DeleteAllReplicationRules struct { Context *middleware.Context Handler DeleteAllReplicationRulesHandler } func (o *DeleteAllReplicationRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteAllReplicationRulesParams() 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) } ================================================ FILE: api/operations/bucket/delete_all_replication_rules_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewDeleteAllReplicationRulesParams creates a new DeleteAllReplicationRulesParams object // // There are no default values defined in the spec. func NewDeleteAllReplicationRulesParams() DeleteAllReplicationRulesParams { return DeleteAllReplicationRulesParams{} } // DeleteAllReplicationRulesParams contains all the bound params for the delete all replication rules operation // typically these are obtained from a http.Request // // swagger:parameters DeleteAllReplicationRules type DeleteAllReplicationRulesParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName 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 NewDeleteAllReplicationRulesParams() beforehand. func (o *DeleteAllReplicationRulesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DeleteAllReplicationRulesParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/delete_all_replication_rules_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteAllReplicationRulesNoContentCode is the HTTP code returned for type DeleteAllReplicationRulesNoContent const DeleteAllReplicationRulesNoContentCode int = 204 /* DeleteAllReplicationRulesNoContent A successful response. swagger:response deleteAllReplicationRulesNoContent */ type DeleteAllReplicationRulesNoContent struct { } // NewDeleteAllReplicationRulesNoContent creates DeleteAllReplicationRulesNoContent with default headers values func NewDeleteAllReplicationRulesNoContent() *DeleteAllReplicationRulesNoContent { return &DeleteAllReplicationRulesNoContent{} } // WriteResponse to the client func (o *DeleteAllReplicationRulesNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* DeleteAllReplicationRulesDefault Generic error response. swagger:response deleteAllReplicationRulesDefault */ type DeleteAllReplicationRulesDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteAllReplicationRulesDefault creates DeleteAllReplicationRulesDefault with default headers values func NewDeleteAllReplicationRulesDefault(code int) *DeleteAllReplicationRulesDefault { if code <= 0 { code = 500 } return &DeleteAllReplicationRulesDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete all replication rules default response func (o *DeleteAllReplicationRulesDefault) WithStatusCode(code int) *DeleteAllReplicationRulesDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete all replication rules default response func (o *DeleteAllReplicationRulesDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete all replication rules default response func (o *DeleteAllReplicationRulesDefault) WithPayload(payload *models.APIError) *DeleteAllReplicationRulesDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete all replication rules default response func (o *DeleteAllReplicationRulesDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteAllReplicationRulesDefault) 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 } } } ================================================ FILE: api/operations/bucket/delete_all_replication_rules_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteAllReplicationRulesURL generates an URL for the delete all replication rules operation type DeleteAllReplicationRulesURL struct { BucketName 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 *DeleteAllReplicationRulesURL) WithBasePath(bp string) *DeleteAllReplicationRulesURL { 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 *DeleteAllReplicationRulesURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteAllReplicationRulesURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/delete-all-replication-rules" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DeleteAllReplicationRulesURL") } _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 *DeleteAllReplicationRulesURL) 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 *DeleteAllReplicationRulesURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteAllReplicationRulesURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteAllReplicationRulesURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteAllReplicationRulesURL") } 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 *DeleteAllReplicationRulesURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/delete_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteBucketHandlerFunc turns a function with the right signature into a delete bucket handler type DeleteBucketHandlerFunc func(DeleteBucketParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteBucketHandlerFunc) Handle(params DeleteBucketParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteBucketHandler interface for that can handle valid delete bucket params type DeleteBucketHandler interface { Handle(DeleteBucketParams, *models.Principal) middleware.Responder } // NewDeleteBucket creates a new http.Handler for the delete bucket operation func NewDeleteBucket(ctx *middleware.Context, handler DeleteBucketHandler) *DeleteBucket { return &DeleteBucket{Context: ctx, Handler: handler} } /* DeleteBucket swagger:route DELETE /buckets/{name} Bucket deleteBucket Delete Bucket */ type DeleteBucket struct { Context *middleware.Context Handler DeleteBucketHandler } func (o *DeleteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteBucketParams() 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) } ================================================ FILE: api/operations/bucket/delete_bucket_event.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteBucketEventHandlerFunc turns a function with the right signature into a delete bucket event handler type DeleteBucketEventHandlerFunc func(DeleteBucketEventParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteBucketEventHandlerFunc) Handle(params DeleteBucketEventParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteBucketEventHandler interface for that can handle valid delete bucket event params type DeleteBucketEventHandler interface { Handle(DeleteBucketEventParams, *models.Principal) middleware.Responder } // NewDeleteBucketEvent creates a new http.Handler for the delete bucket event operation func NewDeleteBucketEvent(ctx *middleware.Context, handler DeleteBucketEventHandler) *DeleteBucketEvent { return &DeleteBucketEvent{Context: ctx, Handler: handler} } /* DeleteBucketEvent swagger:route DELETE /buckets/{bucket_name}/events/{arn} Bucket deleteBucketEvent Delete Bucket Event */ type DeleteBucketEvent struct { Context *middleware.Context Handler DeleteBucketEventHandler } func (o *DeleteBucketEvent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteBucketEventParams() 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) } ================================================ FILE: api/operations/bucket/delete_bucket_event_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewDeleteBucketEventParams creates a new DeleteBucketEventParams object // // There are no default values defined in the spec. func NewDeleteBucketEventParams() DeleteBucketEventParams { return DeleteBucketEventParams{} } // DeleteBucketEventParams contains all the bound params for the delete bucket event operation // typically these are obtained from a http.Request // // swagger:parameters DeleteBucketEvent type DeleteBucketEventParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Arn string /* Required: true In: body */ Body *models.NotificationDeleteRequest /* Required: true In: path */ BucketName 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 NewDeleteBucketEventParams() beforehand. func (o *DeleteBucketEventParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rArn, rhkArn, _ := route.Params.GetOK("arn") if err := o.bindArn(rArn, rhkArn, route.Formats); err != nil { res = append(res, err) } if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.NotificationDeleteRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindArn binds and validates parameter Arn from path. func (o *DeleteBucketEventParams) bindArn(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.Arn = raw return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DeleteBucketEventParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/delete_bucket_event_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteBucketEventNoContentCode is the HTTP code returned for type DeleteBucketEventNoContent const DeleteBucketEventNoContentCode int = 204 /* DeleteBucketEventNoContent A successful response. swagger:response deleteBucketEventNoContent */ type DeleteBucketEventNoContent struct { } // NewDeleteBucketEventNoContent creates DeleteBucketEventNoContent with default headers values func NewDeleteBucketEventNoContent() *DeleteBucketEventNoContent { return &DeleteBucketEventNoContent{} } // WriteResponse to the client func (o *DeleteBucketEventNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* DeleteBucketEventDefault Generic error response. swagger:response deleteBucketEventDefault */ type DeleteBucketEventDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteBucketEventDefault creates DeleteBucketEventDefault with default headers values func NewDeleteBucketEventDefault(code int) *DeleteBucketEventDefault { if code <= 0 { code = 500 } return &DeleteBucketEventDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete bucket event default response func (o *DeleteBucketEventDefault) WithStatusCode(code int) *DeleteBucketEventDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete bucket event default response func (o *DeleteBucketEventDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete bucket event default response func (o *DeleteBucketEventDefault) WithPayload(payload *models.APIError) *DeleteBucketEventDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete bucket event default response func (o *DeleteBucketEventDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteBucketEventDefault) 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 } } } ================================================ FILE: api/operations/bucket/delete_bucket_event_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteBucketEventURL generates an URL for the delete bucket event operation type DeleteBucketEventURL struct { Arn string BucketName 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 *DeleteBucketEventURL) WithBasePath(bp string) *DeleteBucketEventURL { 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 *DeleteBucketEventURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteBucketEventURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/events/{arn}" arn := o.Arn if arn != "" { _path = strings.ReplaceAll(_path, "{arn}", arn) } else { return nil, errors.New("arn is required on DeleteBucketEventURL") } bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DeleteBucketEventURL") } _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 *DeleteBucketEventURL) 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 *DeleteBucketEventURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteBucketEventURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteBucketEventURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteBucketEventURL") } 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 *DeleteBucketEventURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/delete_bucket_lifecycle_rule.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteBucketLifecycleRuleHandlerFunc turns a function with the right signature into a delete bucket lifecycle rule handler type DeleteBucketLifecycleRuleHandlerFunc func(DeleteBucketLifecycleRuleParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteBucketLifecycleRuleHandlerFunc) Handle(params DeleteBucketLifecycleRuleParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteBucketLifecycleRuleHandler interface for that can handle valid delete bucket lifecycle rule params type DeleteBucketLifecycleRuleHandler interface { Handle(DeleteBucketLifecycleRuleParams, *models.Principal) middleware.Responder } // NewDeleteBucketLifecycleRule creates a new http.Handler for the delete bucket lifecycle rule operation func NewDeleteBucketLifecycleRule(ctx *middleware.Context, handler DeleteBucketLifecycleRuleHandler) *DeleteBucketLifecycleRule { return &DeleteBucketLifecycleRule{Context: ctx, Handler: handler} } /* DeleteBucketLifecycleRule swagger:route DELETE /buckets/{bucket_name}/lifecycle/{lifecycle_id} Bucket deleteBucketLifecycleRule Delete Lifecycle rule */ type DeleteBucketLifecycleRule struct { Context *middleware.Context Handler DeleteBucketLifecycleRuleHandler } func (o *DeleteBucketLifecycleRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteBucketLifecycleRuleParams() 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) } ================================================ FILE: api/operations/bucket/delete_bucket_lifecycle_rule_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewDeleteBucketLifecycleRuleParams creates a new DeleteBucketLifecycleRuleParams object // // There are no default values defined in the spec. func NewDeleteBucketLifecycleRuleParams() DeleteBucketLifecycleRuleParams { return DeleteBucketLifecycleRuleParams{} } // DeleteBucketLifecycleRuleParams contains all the bound params for the delete bucket lifecycle rule operation // typically these are obtained from a http.Request // // swagger:parameters DeleteBucketLifecycleRule type DeleteBucketLifecycleRuleParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* Required: true In: path */ LifecycleID 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 NewDeleteBucketLifecycleRuleParams() beforehand. func (o *DeleteBucketLifecycleRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } rLifecycleID, rhkLifecycleID, _ := route.Params.GetOK("lifecycle_id") if err := o.bindLifecycleID(rLifecycleID, rhkLifecycleID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DeleteBucketLifecycleRuleParams) bindBucketName(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.BucketName = raw return nil } // bindLifecycleID binds and validates parameter LifecycleID from path. func (o *DeleteBucketLifecycleRuleParams) bindLifecycleID(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.LifecycleID = raw return nil } ================================================ FILE: api/operations/bucket/delete_bucket_lifecycle_rule_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteBucketLifecycleRuleNoContentCode is the HTTP code returned for type DeleteBucketLifecycleRuleNoContent const DeleteBucketLifecycleRuleNoContentCode int = 204 /* DeleteBucketLifecycleRuleNoContent A successful response. swagger:response deleteBucketLifecycleRuleNoContent */ type DeleteBucketLifecycleRuleNoContent struct { } // NewDeleteBucketLifecycleRuleNoContent creates DeleteBucketLifecycleRuleNoContent with default headers values func NewDeleteBucketLifecycleRuleNoContent() *DeleteBucketLifecycleRuleNoContent { return &DeleteBucketLifecycleRuleNoContent{} } // WriteResponse to the client func (o *DeleteBucketLifecycleRuleNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* DeleteBucketLifecycleRuleDefault Generic error response. swagger:response deleteBucketLifecycleRuleDefault */ type DeleteBucketLifecycleRuleDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteBucketLifecycleRuleDefault creates DeleteBucketLifecycleRuleDefault with default headers values func NewDeleteBucketLifecycleRuleDefault(code int) *DeleteBucketLifecycleRuleDefault { if code <= 0 { code = 500 } return &DeleteBucketLifecycleRuleDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete bucket lifecycle rule default response func (o *DeleteBucketLifecycleRuleDefault) WithStatusCode(code int) *DeleteBucketLifecycleRuleDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete bucket lifecycle rule default response func (o *DeleteBucketLifecycleRuleDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete bucket lifecycle rule default response func (o *DeleteBucketLifecycleRuleDefault) WithPayload(payload *models.APIError) *DeleteBucketLifecycleRuleDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete bucket lifecycle rule default response func (o *DeleteBucketLifecycleRuleDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteBucketLifecycleRuleDefault) 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 } } } ================================================ FILE: api/operations/bucket/delete_bucket_lifecycle_rule_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteBucketLifecycleRuleURL generates an URL for the delete bucket lifecycle rule operation type DeleteBucketLifecycleRuleURL struct { BucketName string LifecycleID 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 *DeleteBucketLifecycleRuleURL) WithBasePath(bp string) *DeleteBucketLifecycleRuleURL { 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 *DeleteBucketLifecycleRuleURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteBucketLifecycleRuleURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/lifecycle/{lifecycle_id}" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DeleteBucketLifecycleRuleURL") } lifecycleID := o.LifecycleID if lifecycleID != "" { _path = strings.ReplaceAll(_path, "{lifecycle_id}", lifecycleID) } else { return nil, errors.New("lifecycleId is required on DeleteBucketLifecycleRuleURL") } _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 *DeleteBucketLifecycleRuleURL) 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 *DeleteBucketLifecycleRuleURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteBucketLifecycleRuleURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteBucketLifecycleRuleURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteBucketLifecycleRuleURL") } 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 *DeleteBucketLifecycleRuleURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/delete_bucket_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewDeleteBucketParams creates a new DeleteBucketParams object // // There are no default values defined in the spec. func NewDeleteBucketParams() DeleteBucketParams { return DeleteBucketParams{} } // DeleteBucketParams contains all the bound params for the delete bucket operation // typically these are obtained from a http.Request // // swagger:parameters DeleteBucket type DeleteBucketParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewDeleteBucketParams() beforehand. func (o *DeleteBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *DeleteBucketParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/bucket/delete_bucket_replication_rule.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteBucketReplicationRuleHandlerFunc turns a function with the right signature into a delete bucket replication rule handler type DeleteBucketReplicationRuleHandlerFunc func(DeleteBucketReplicationRuleParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteBucketReplicationRuleHandlerFunc) Handle(params DeleteBucketReplicationRuleParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteBucketReplicationRuleHandler interface for that can handle valid delete bucket replication rule params type DeleteBucketReplicationRuleHandler interface { Handle(DeleteBucketReplicationRuleParams, *models.Principal) middleware.Responder } // NewDeleteBucketReplicationRule creates a new http.Handler for the delete bucket replication rule operation func NewDeleteBucketReplicationRule(ctx *middleware.Context, handler DeleteBucketReplicationRuleHandler) *DeleteBucketReplicationRule { return &DeleteBucketReplicationRule{Context: ctx, Handler: handler} } /* DeleteBucketReplicationRule swagger:route DELETE /buckets/{bucket_name}/replication/{rule_id} Bucket deleteBucketReplicationRule Bucket Replication Rule Delete */ type DeleteBucketReplicationRule struct { Context *middleware.Context Handler DeleteBucketReplicationRuleHandler } func (o *DeleteBucketReplicationRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteBucketReplicationRuleParams() 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) } ================================================ FILE: api/operations/bucket/delete_bucket_replication_rule_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewDeleteBucketReplicationRuleParams creates a new DeleteBucketReplicationRuleParams object // // There are no default values defined in the spec. func NewDeleteBucketReplicationRuleParams() DeleteBucketReplicationRuleParams { return DeleteBucketReplicationRuleParams{} } // DeleteBucketReplicationRuleParams contains all the bound params for the delete bucket replication rule operation // typically these are obtained from a http.Request // // swagger:parameters DeleteBucketReplicationRule type DeleteBucketReplicationRuleParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* Required: true In: path */ RuleID 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 NewDeleteBucketReplicationRuleParams() beforehand. func (o *DeleteBucketReplicationRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } rRuleID, rhkRuleID, _ := route.Params.GetOK("rule_id") if err := o.bindRuleID(rRuleID, rhkRuleID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DeleteBucketReplicationRuleParams) bindBucketName(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.BucketName = raw return nil } // bindRuleID binds and validates parameter RuleID from path. func (o *DeleteBucketReplicationRuleParams) bindRuleID(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.RuleID = raw return nil } ================================================ FILE: api/operations/bucket/delete_bucket_replication_rule_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteBucketReplicationRuleNoContentCode is the HTTP code returned for type DeleteBucketReplicationRuleNoContent const DeleteBucketReplicationRuleNoContentCode int = 204 /* DeleteBucketReplicationRuleNoContent A successful response. swagger:response deleteBucketReplicationRuleNoContent */ type DeleteBucketReplicationRuleNoContent struct { } // NewDeleteBucketReplicationRuleNoContent creates DeleteBucketReplicationRuleNoContent with default headers values func NewDeleteBucketReplicationRuleNoContent() *DeleteBucketReplicationRuleNoContent { return &DeleteBucketReplicationRuleNoContent{} } // WriteResponse to the client func (o *DeleteBucketReplicationRuleNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* DeleteBucketReplicationRuleDefault Generic error response. swagger:response deleteBucketReplicationRuleDefault */ type DeleteBucketReplicationRuleDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteBucketReplicationRuleDefault creates DeleteBucketReplicationRuleDefault with default headers values func NewDeleteBucketReplicationRuleDefault(code int) *DeleteBucketReplicationRuleDefault { if code <= 0 { code = 500 } return &DeleteBucketReplicationRuleDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete bucket replication rule default response func (o *DeleteBucketReplicationRuleDefault) WithStatusCode(code int) *DeleteBucketReplicationRuleDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete bucket replication rule default response func (o *DeleteBucketReplicationRuleDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete bucket replication rule default response func (o *DeleteBucketReplicationRuleDefault) WithPayload(payload *models.APIError) *DeleteBucketReplicationRuleDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete bucket replication rule default response func (o *DeleteBucketReplicationRuleDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteBucketReplicationRuleDefault) 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 } } } ================================================ FILE: api/operations/bucket/delete_bucket_replication_rule_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteBucketReplicationRuleURL generates an URL for the delete bucket replication rule operation type DeleteBucketReplicationRuleURL struct { BucketName string RuleID 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 *DeleteBucketReplicationRuleURL) WithBasePath(bp string) *DeleteBucketReplicationRuleURL { 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 *DeleteBucketReplicationRuleURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteBucketReplicationRuleURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/replication/{rule_id}" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DeleteBucketReplicationRuleURL") } ruleID := o.RuleID if ruleID != "" { _path = strings.ReplaceAll(_path, "{rule_id}", ruleID) } else { return nil, errors.New("ruleId is required on DeleteBucketReplicationRuleURL") } _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 *DeleteBucketReplicationRuleURL) 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 *DeleteBucketReplicationRuleURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteBucketReplicationRuleURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteBucketReplicationRuleURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteBucketReplicationRuleURL") } 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 *DeleteBucketReplicationRuleURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/delete_bucket_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteBucketNoContentCode is the HTTP code returned for type DeleteBucketNoContent const DeleteBucketNoContentCode int = 204 /* DeleteBucketNoContent A successful response. swagger:response deleteBucketNoContent */ type DeleteBucketNoContent struct { } // NewDeleteBucketNoContent creates DeleteBucketNoContent with default headers values func NewDeleteBucketNoContent() *DeleteBucketNoContent { return &DeleteBucketNoContent{} } // WriteResponse to the client func (o *DeleteBucketNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* DeleteBucketDefault Generic error response. swagger:response deleteBucketDefault */ type DeleteBucketDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteBucketDefault creates DeleteBucketDefault with default headers values func NewDeleteBucketDefault(code int) *DeleteBucketDefault { if code <= 0 { code = 500 } return &DeleteBucketDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete bucket default response func (o *DeleteBucketDefault) WithStatusCode(code int) *DeleteBucketDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete bucket default response func (o *DeleteBucketDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete bucket default response func (o *DeleteBucketDefault) WithPayload(payload *models.APIError) *DeleteBucketDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete bucket default response func (o *DeleteBucketDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteBucketDefault) 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 } } } ================================================ FILE: api/operations/bucket/delete_bucket_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteBucketURL generates an URL for the delete bucket operation type DeleteBucketURL struct { Name 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 *DeleteBucketURL) WithBasePath(bp string) *DeleteBucketURL { 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 *DeleteBucketURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteBucketURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on DeleteBucketURL") } _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 *DeleteBucketURL) 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 *DeleteBucketURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteBucketURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteBucketURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteBucketURL") } 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 *DeleteBucketURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/delete_remote_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteRemoteBucketHandlerFunc turns a function with the right signature into a delete remote bucket handler type DeleteRemoteBucketHandlerFunc func(DeleteRemoteBucketParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteRemoteBucketHandlerFunc) Handle(params DeleteRemoteBucketParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteRemoteBucketHandler interface for that can handle valid delete remote bucket params type DeleteRemoteBucketHandler interface { Handle(DeleteRemoteBucketParams, *models.Principal) middleware.Responder } // NewDeleteRemoteBucket creates a new http.Handler for the delete remote bucket operation func NewDeleteRemoteBucket(ctx *middleware.Context, handler DeleteRemoteBucketHandler) *DeleteRemoteBucket { return &DeleteRemoteBucket{Context: ctx, Handler: handler} } /* DeleteRemoteBucket swagger:route DELETE /remote-buckets/{source_bucket_name}/{arn} Bucket deleteRemoteBucket Delete Remote Bucket */ type DeleteRemoteBucket struct { Context *middleware.Context Handler DeleteRemoteBucketHandler } func (o *DeleteRemoteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteRemoteBucketParams() 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) } ================================================ FILE: api/operations/bucket/delete_remote_bucket_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewDeleteRemoteBucketParams creates a new DeleteRemoteBucketParams object // // There are no default values defined in the spec. func NewDeleteRemoteBucketParams() DeleteRemoteBucketParams { return DeleteRemoteBucketParams{} } // DeleteRemoteBucketParams contains all the bound params for the delete remote bucket operation // typically these are obtained from a http.Request // // swagger:parameters DeleteRemoteBucket type DeleteRemoteBucketParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Arn string /* Required: true In: path */ SourceBucketName 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 NewDeleteRemoteBucketParams() beforehand. func (o *DeleteRemoteBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rArn, rhkArn, _ := route.Params.GetOK("arn") if err := o.bindArn(rArn, rhkArn, route.Formats); err != nil { res = append(res, err) } rSourceBucketName, rhkSourceBucketName, _ := route.Params.GetOK("source_bucket_name") if err := o.bindSourceBucketName(rSourceBucketName, rhkSourceBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindArn binds and validates parameter Arn from path. func (o *DeleteRemoteBucketParams) bindArn(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.Arn = raw return nil } // bindSourceBucketName binds and validates parameter SourceBucketName from path. func (o *DeleteRemoteBucketParams) bindSourceBucketName(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.SourceBucketName = raw return nil } ================================================ FILE: api/operations/bucket/delete_remote_bucket_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteRemoteBucketNoContentCode is the HTTP code returned for type DeleteRemoteBucketNoContent const DeleteRemoteBucketNoContentCode int = 204 /* DeleteRemoteBucketNoContent A successful response. swagger:response deleteRemoteBucketNoContent */ type DeleteRemoteBucketNoContent struct { } // NewDeleteRemoteBucketNoContent creates DeleteRemoteBucketNoContent with default headers values func NewDeleteRemoteBucketNoContent() *DeleteRemoteBucketNoContent { return &DeleteRemoteBucketNoContent{} } // WriteResponse to the client func (o *DeleteRemoteBucketNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* DeleteRemoteBucketDefault Generic error response. swagger:response deleteRemoteBucketDefault */ type DeleteRemoteBucketDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteRemoteBucketDefault creates DeleteRemoteBucketDefault with default headers values func NewDeleteRemoteBucketDefault(code int) *DeleteRemoteBucketDefault { if code <= 0 { code = 500 } return &DeleteRemoteBucketDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete remote bucket default response func (o *DeleteRemoteBucketDefault) WithStatusCode(code int) *DeleteRemoteBucketDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete remote bucket default response func (o *DeleteRemoteBucketDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete remote bucket default response func (o *DeleteRemoteBucketDefault) WithPayload(payload *models.APIError) *DeleteRemoteBucketDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete remote bucket default response func (o *DeleteRemoteBucketDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteRemoteBucketDefault) 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 } } } ================================================ FILE: api/operations/bucket/delete_remote_bucket_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteRemoteBucketURL generates an URL for the delete remote bucket operation type DeleteRemoteBucketURL struct { Arn string SourceBucketName 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 *DeleteRemoteBucketURL) WithBasePath(bp string) *DeleteRemoteBucketURL { 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 *DeleteRemoteBucketURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteRemoteBucketURL) Build() (*url.URL, error) { var _result url.URL var _path = "/remote-buckets/{source_bucket_name}/{arn}" arn := o.Arn if arn != "" { _path = strings.ReplaceAll(_path, "{arn}", arn) } else { return nil, errors.New("arn is required on DeleteRemoteBucketURL") } sourceBucketName := o.SourceBucketName if sourceBucketName != "" { _path = strings.ReplaceAll(_path, "{source_bucket_name}", sourceBucketName) } else { return nil, errors.New("sourceBucketName is required on DeleteRemoteBucketURL") } _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 *DeleteRemoteBucketURL) 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 *DeleteRemoteBucketURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteRemoteBucketURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteRemoteBucketURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteRemoteBucketURL") } 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 *DeleteRemoteBucketURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/delete_selected_replication_rules.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteSelectedReplicationRulesHandlerFunc turns a function with the right signature into a delete selected replication rules handler type DeleteSelectedReplicationRulesHandlerFunc func(DeleteSelectedReplicationRulesParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteSelectedReplicationRulesHandlerFunc) Handle(params DeleteSelectedReplicationRulesParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteSelectedReplicationRulesHandler interface for that can handle valid delete selected replication rules params type DeleteSelectedReplicationRulesHandler interface { Handle(DeleteSelectedReplicationRulesParams, *models.Principal) middleware.Responder } // NewDeleteSelectedReplicationRules creates a new http.Handler for the delete selected replication rules operation func NewDeleteSelectedReplicationRules(ctx *middleware.Context, handler DeleteSelectedReplicationRulesHandler) *DeleteSelectedReplicationRules { return &DeleteSelectedReplicationRules{Context: ctx, Handler: handler} } /* DeleteSelectedReplicationRules swagger:route DELETE /buckets/{bucket_name}/delete-selected-replication-rules Bucket deleteSelectedReplicationRules Deletes selected replication rules from a bucket */ type DeleteSelectedReplicationRules struct { Context *middleware.Context Handler DeleteSelectedReplicationRulesHandler } func (o *DeleteSelectedReplicationRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteSelectedReplicationRulesParams() 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) } ================================================ FILE: api/operations/bucket/delete_selected_replication_rules_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewDeleteSelectedReplicationRulesParams creates a new DeleteSelectedReplicationRulesParams object // // There are no default values defined in the spec. func NewDeleteSelectedReplicationRulesParams() DeleteSelectedReplicationRulesParams { return DeleteSelectedReplicationRulesParams{} } // DeleteSelectedReplicationRulesParams contains all the bound params for the delete selected replication rules operation // typically these are obtained from a http.Request // // swagger:parameters DeleteSelectedReplicationRules type DeleteSelectedReplicationRulesParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* Required: true In: body */ Rules *models.BucketReplicationRuleList } // 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 NewDeleteSelectedReplicationRulesParams() beforehand. func (o *DeleteSelectedReplicationRulesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.BucketReplicationRuleList if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(err, io.EOF) { res = append(res, errors.Required("rules", "body", "")) } else { res = append(res, errors.NewParseError("rules", "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.Rules = &body } } } else { res = append(res, errors.Required("rules", "body", "")) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DeleteSelectedReplicationRulesParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/delete_selected_replication_rules_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteSelectedReplicationRulesNoContentCode is the HTTP code returned for type DeleteSelectedReplicationRulesNoContent const DeleteSelectedReplicationRulesNoContentCode int = 204 /* DeleteSelectedReplicationRulesNoContent A successful response. swagger:response deleteSelectedReplicationRulesNoContent */ type DeleteSelectedReplicationRulesNoContent struct { } // NewDeleteSelectedReplicationRulesNoContent creates DeleteSelectedReplicationRulesNoContent with default headers values func NewDeleteSelectedReplicationRulesNoContent() *DeleteSelectedReplicationRulesNoContent { return &DeleteSelectedReplicationRulesNoContent{} } // WriteResponse to the client func (o *DeleteSelectedReplicationRulesNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* DeleteSelectedReplicationRulesDefault Generic error response. swagger:response deleteSelectedReplicationRulesDefault */ type DeleteSelectedReplicationRulesDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteSelectedReplicationRulesDefault creates DeleteSelectedReplicationRulesDefault with default headers values func NewDeleteSelectedReplicationRulesDefault(code int) *DeleteSelectedReplicationRulesDefault { if code <= 0 { code = 500 } return &DeleteSelectedReplicationRulesDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete selected replication rules default response func (o *DeleteSelectedReplicationRulesDefault) WithStatusCode(code int) *DeleteSelectedReplicationRulesDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete selected replication rules default response func (o *DeleteSelectedReplicationRulesDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete selected replication rules default response func (o *DeleteSelectedReplicationRulesDefault) WithPayload(payload *models.APIError) *DeleteSelectedReplicationRulesDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete selected replication rules default response func (o *DeleteSelectedReplicationRulesDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteSelectedReplicationRulesDefault) 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 } } } ================================================ FILE: api/operations/bucket/delete_selected_replication_rules_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteSelectedReplicationRulesURL generates an URL for the delete selected replication rules operation type DeleteSelectedReplicationRulesURL struct { BucketName 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 *DeleteSelectedReplicationRulesURL) WithBasePath(bp string) *DeleteSelectedReplicationRulesURL { 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 *DeleteSelectedReplicationRulesURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteSelectedReplicationRulesURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/delete-selected-replication-rules" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DeleteSelectedReplicationRulesURL") } _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 *DeleteSelectedReplicationRulesURL) 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 *DeleteSelectedReplicationRulesURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteSelectedReplicationRulesURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteSelectedReplicationRulesURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteSelectedReplicationRulesURL") } 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 *DeleteSelectedReplicationRulesURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/disable_bucket_encryption.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DisableBucketEncryptionHandlerFunc turns a function with the right signature into a disable bucket encryption handler type DisableBucketEncryptionHandlerFunc func(DisableBucketEncryptionParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DisableBucketEncryptionHandlerFunc) Handle(params DisableBucketEncryptionParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DisableBucketEncryptionHandler interface for that can handle valid disable bucket encryption params type DisableBucketEncryptionHandler interface { Handle(DisableBucketEncryptionParams, *models.Principal) middleware.Responder } // NewDisableBucketEncryption creates a new http.Handler for the disable bucket encryption operation func NewDisableBucketEncryption(ctx *middleware.Context, handler DisableBucketEncryptionHandler) *DisableBucketEncryption { return &DisableBucketEncryption{Context: ctx, Handler: handler} } /* DisableBucketEncryption swagger:route POST /buckets/{bucket_name}/encryption/disable Bucket disableBucketEncryption Disable bucket encryption. */ type DisableBucketEncryption struct { Context *middleware.Context Handler DisableBucketEncryptionHandler } func (o *DisableBucketEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDisableBucketEncryptionParams() 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) } ================================================ FILE: api/operations/bucket/disable_bucket_encryption_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewDisableBucketEncryptionParams creates a new DisableBucketEncryptionParams object // // There are no default values defined in the spec. func NewDisableBucketEncryptionParams() DisableBucketEncryptionParams { return DisableBucketEncryptionParams{} } // DisableBucketEncryptionParams contains all the bound params for the disable bucket encryption operation // typically these are obtained from a http.Request // // swagger:parameters DisableBucketEncryption type DisableBucketEncryptionParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName 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 NewDisableBucketEncryptionParams() beforehand. func (o *DisableBucketEncryptionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DisableBucketEncryptionParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/disable_bucket_encryption_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DisableBucketEncryptionOKCode is the HTTP code returned for type DisableBucketEncryptionOK const DisableBucketEncryptionOKCode int = 200 /* DisableBucketEncryptionOK A successful response. swagger:response disableBucketEncryptionOK */ type DisableBucketEncryptionOK struct { } // NewDisableBucketEncryptionOK creates DisableBucketEncryptionOK with default headers values func NewDisableBucketEncryptionOK() *DisableBucketEncryptionOK { return &DisableBucketEncryptionOK{} } // WriteResponse to the client func (o *DisableBucketEncryptionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* DisableBucketEncryptionDefault Generic error response. swagger:response disableBucketEncryptionDefault */ type DisableBucketEncryptionDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDisableBucketEncryptionDefault creates DisableBucketEncryptionDefault with default headers values func NewDisableBucketEncryptionDefault(code int) *DisableBucketEncryptionDefault { if code <= 0 { code = 500 } return &DisableBucketEncryptionDefault{ _statusCode: code, } } // WithStatusCode adds the status to the disable bucket encryption default response func (o *DisableBucketEncryptionDefault) WithStatusCode(code int) *DisableBucketEncryptionDefault { o._statusCode = code return o } // SetStatusCode sets the status to the disable bucket encryption default response func (o *DisableBucketEncryptionDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the disable bucket encryption default response func (o *DisableBucketEncryptionDefault) WithPayload(payload *models.APIError) *DisableBucketEncryptionDefault { o.Payload = payload return o } // SetPayload sets the payload to the disable bucket encryption default response func (o *DisableBucketEncryptionDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DisableBucketEncryptionDefault) 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 } } } ================================================ FILE: api/operations/bucket/disable_bucket_encryption_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DisableBucketEncryptionURL generates an URL for the disable bucket encryption operation type DisableBucketEncryptionURL struct { BucketName 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 *DisableBucketEncryptionURL) WithBasePath(bp string) *DisableBucketEncryptionURL { 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 *DisableBucketEncryptionURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DisableBucketEncryptionURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/encryption/disable" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DisableBucketEncryptionURL") } _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 *DisableBucketEncryptionURL) 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 *DisableBucketEncryptionURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DisableBucketEncryptionURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DisableBucketEncryptionURL") } if host == "" { return nil, errors.New("host is required for a full url on DisableBucketEncryptionURL") } 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 *DisableBucketEncryptionURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/enable_bucket_encryption.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // EnableBucketEncryptionHandlerFunc turns a function with the right signature into a enable bucket encryption handler type EnableBucketEncryptionHandlerFunc func(EnableBucketEncryptionParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn EnableBucketEncryptionHandlerFunc) Handle(params EnableBucketEncryptionParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // EnableBucketEncryptionHandler interface for that can handle valid enable bucket encryption params type EnableBucketEncryptionHandler interface { Handle(EnableBucketEncryptionParams, *models.Principal) middleware.Responder } // NewEnableBucketEncryption creates a new http.Handler for the enable bucket encryption operation func NewEnableBucketEncryption(ctx *middleware.Context, handler EnableBucketEncryptionHandler) *EnableBucketEncryption { return &EnableBucketEncryption{Context: ctx, Handler: handler} } /* EnableBucketEncryption swagger:route POST /buckets/{bucket_name}/encryption/enable Bucket enableBucketEncryption Enable bucket encryption. */ type EnableBucketEncryption struct { Context *middleware.Context Handler EnableBucketEncryptionHandler } func (o *EnableBucketEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewEnableBucketEncryptionParams() 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) } ================================================ FILE: api/operations/bucket/enable_bucket_encryption_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewEnableBucketEncryptionParams creates a new EnableBucketEncryptionParams object // // There are no default values defined in the spec. func NewEnableBucketEncryptionParams() EnableBucketEncryptionParams { return EnableBucketEncryptionParams{} } // EnableBucketEncryptionParams contains all the bound params for the enable bucket encryption operation // typically these are obtained from a http.Request // // swagger:parameters EnableBucketEncryption type EnableBucketEncryptionParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.BucketEncryptionRequest /* Required: true In: path */ BucketName 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 NewEnableBucketEncryptionParams() beforehand. func (o *EnableBucketEncryptionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.BucketEncryptionRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *EnableBucketEncryptionParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/enable_bucket_encryption_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // EnableBucketEncryptionOKCode is the HTTP code returned for type EnableBucketEncryptionOK const EnableBucketEncryptionOKCode int = 200 /* EnableBucketEncryptionOK A successful response. swagger:response enableBucketEncryptionOK */ type EnableBucketEncryptionOK struct { } // NewEnableBucketEncryptionOK creates EnableBucketEncryptionOK with default headers values func NewEnableBucketEncryptionOK() *EnableBucketEncryptionOK { return &EnableBucketEncryptionOK{} } // WriteResponse to the client func (o *EnableBucketEncryptionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* EnableBucketEncryptionDefault Generic error response. swagger:response enableBucketEncryptionDefault */ type EnableBucketEncryptionDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewEnableBucketEncryptionDefault creates EnableBucketEncryptionDefault with default headers values func NewEnableBucketEncryptionDefault(code int) *EnableBucketEncryptionDefault { if code <= 0 { code = 500 } return &EnableBucketEncryptionDefault{ _statusCode: code, } } // WithStatusCode adds the status to the enable bucket encryption default response func (o *EnableBucketEncryptionDefault) WithStatusCode(code int) *EnableBucketEncryptionDefault { o._statusCode = code return o } // SetStatusCode sets the status to the enable bucket encryption default response func (o *EnableBucketEncryptionDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the enable bucket encryption default response func (o *EnableBucketEncryptionDefault) WithPayload(payload *models.APIError) *EnableBucketEncryptionDefault { o.Payload = payload return o } // SetPayload sets the payload to the enable bucket encryption default response func (o *EnableBucketEncryptionDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *EnableBucketEncryptionDefault) 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 } } } ================================================ FILE: api/operations/bucket/enable_bucket_encryption_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // EnableBucketEncryptionURL generates an URL for the enable bucket encryption operation type EnableBucketEncryptionURL struct { BucketName 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 *EnableBucketEncryptionURL) WithBasePath(bp string) *EnableBucketEncryptionURL { 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 *EnableBucketEncryptionURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *EnableBucketEncryptionURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/encryption/enable" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on EnableBucketEncryptionURL") } _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 *EnableBucketEncryptionURL) 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 *EnableBucketEncryptionURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *EnableBucketEncryptionURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on EnableBucketEncryptionURL") } if host == "" { return nil, errors.New("host is required for a full url on EnableBucketEncryptionURL") } 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 *EnableBucketEncryptionURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/get_bucket_encryption_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetBucketEncryptionInfoHandlerFunc turns a function with the right signature into a get bucket encryption info handler type GetBucketEncryptionInfoHandlerFunc func(GetBucketEncryptionInfoParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetBucketEncryptionInfoHandlerFunc) Handle(params GetBucketEncryptionInfoParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetBucketEncryptionInfoHandler interface for that can handle valid get bucket encryption info params type GetBucketEncryptionInfoHandler interface { Handle(GetBucketEncryptionInfoParams, *models.Principal) middleware.Responder } // NewGetBucketEncryptionInfo creates a new http.Handler for the get bucket encryption info operation func NewGetBucketEncryptionInfo(ctx *middleware.Context, handler GetBucketEncryptionInfoHandler) *GetBucketEncryptionInfo { return &GetBucketEncryptionInfo{Context: ctx, Handler: handler} } /* GetBucketEncryptionInfo swagger:route GET /buckets/{bucket_name}/encryption/info Bucket getBucketEncryptionInfo Get bucket encryption information. */ type GetBucketEncryptionInfo struct { Context *middleware.Context Handler GetBucketEncryptionInfoHandler } func (o *GetBucketEncryptionInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetBucketEncryptionInfoParams() 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) } ================================================ FILE: api/operations/bucket/get_bucket_encryption_info_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetBucketEncryptionInfoParams creates a new GetBucketEncryptionInfoParams object // // There are no default values defined in the spec. func NewGetBucketEncryptionInfoParams() GetBucketEncryptionInfoParams { return GetBucketEncryptionInfoParams{} } // GetBucketEncryptionInfoParams contains all the bound params for the get bucket encryption info operation // typically these are obtained from a http.Request // // swagger:parameters GetBucketEncryptionInfo type GetBucketEncryptionInfoParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName 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 NewGetBucketEncryptionInfoParams() beforehand. func (o *GetBucketEncryptionInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *GetBucketEncryptionInfoParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/get_bucket_encryption_info_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetBucketEncryptionInfoOKCode is the HTTP code returned for type GetBucketEncryptionInfoOK const GetBucketEncryptionInfoOKCode int = 200 /* GetBucketEncryptionInfoOK A successful response. swagger:response getBucketEncryptionInfoOK */ type GetBucketEncryptionInfoOK struct { /* In: Body */ Payload *models.BucketEncryptionInfo `json:"body,omitempty"` } // NewGetBucketEncryptionInfoOK creates GetBucketEncryptionInfoOK with default headers values func NewGetBucketEncryptionInfoOK() *GetBucketEncryptionInfoOK { return &GetBucketEncryptionInfoOK{} } // WithPayload adds the payload to the get bucket encryption info o k response func (o *GetBucketEncryptionInfoOK) WithPayload(payload *models.BucketEncryptionInfo) *GetBucketEncryptionInfoOK { o.Payload = payload return o } // SetPayload sets the payload to the get bucket encryption info o k response func (o *GetBucketEncryptionInfoOK) SetPayload(payload *models.BucketEncryptionInfo) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketEncryptionInfoOK) 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 } } } /* GetBucketEncryptionInfoDefault Generic error response. swagger:response getBucketEncryptionInfoDefault */ type GetBucketEncryptionInfoDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetBucketEncryptionInfoDefault creates GetBucketEncryptionInfoDefault with default headers values func NewGetBucketEncryptionInfoDefault(code int) *GetBucketEncryptionInfoDefault { if code <= 0 { code = 500 } return &GetBucketEncryptionInfoDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get bucket encryption info default response func (o *GetBucketEncryptionInfoDefault) WithStatusCode(code int) *GetBucketEncryptionInfoDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get bucket encryption info default response func (o *GetBucketEncryptionInfoDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get bucket encryption info default response func (o *GetBucketEncryptionInfoDefault) WithPayload(payload *models.APIError) *GetBucketEncryptionInfoDefault { o.Payload = payload return o } // SetPayload sets the payload to the get bucket encryption info default response func (o *GetBucketEncryptionInfoDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketEncryptionInfoDefault) 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 } } } ================================================ FILE: api/operations/bucket/get_bucket_encryption_info_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetBucketEncryptionInfoURL generates an URL for the get bucket encryption info operation type GetBucketEncryptionInfoURL struct { BucketName 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 *GetBucketEncryptionInfoURL) WithBasePath(bp string) *GetBucketEncryptionInfoURL { 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 *GetBucketEncryptionInfoURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetBucketEncryptionInfoURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/encryption/info" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on GetBucketEncryptionInfoURL") } _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 *GetBucketEncryptionInfoURL) 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 *GetBucketEncryptionInfoURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetBucketEncryptionInfoURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetBucketEncryptionInfoURL") } if host == "" { return nil, errors.New("host is required for a full url on GetBucketEncryptionInfoURL") } 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 *GetBucketEncryptionInfoURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/get_bucket_lifecycle.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetBucketLifecycleHandlerFunc turns a function with the right signature into a get bucket lifecycle handler type GetBucketLifecycleHandlerFunc func(GetBucketLifecycleParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetBucketLifecycleHandlerFunc) Handle(params GetBucketLifecycleParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetBucketLifecycleHandler interface for that can handle valid get bucket lifecycle params type GetBucketLifecycleHandler interface { Handle(GetBucketLifecycleParams, *models.Principal) middleware.Responder } // NewGetBucketLifecycle creates a new http.Handler for the get bucket lifecycle operation func NewGetBucketLifecycle(ctx *middleware.Context, handler GetBucketLifecycleHandler) *GetBucketLifecycle { return &GetBucketLifecycle{Context: ctx, Handler: handler} } /* GetBucketLifecycle swagger:route GET /buckets/{bucket_name}/lifecycle Bucket getBucketLifecycle Bucket Lifecycle */ type GetBucketLifecycle struct { Context *middleware.Context Handler GetBucketLifecycleHandler } func (o *GetBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetBucketLifecycleParams() 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) } ================================================ FILE: api/operations/bucket/get_bucket_lifecycle_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetBucketLifecycleParams creates a new GetBucketLifecycleParams object // // There are no default values defined in the spec. func NewGetBucketLifecycleParams() GetBucketLifecycleParams { return GetBucketLifecycleParams{} } // GetBucketLifecycleParams contains all the bound params for the get bucket lifecycle operation // typically these are obtained from a http.Request // // swagger:parameters GetBucketLifecycle type GetBucketLifecycleParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName 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 NewGetBucketLifecycleParams() beforehand. func (o *GetBucketLifecycleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *GetBucketLifecycleParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/get_bucket_lifecycle_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetBucketLifecycleOKCode is the HTTP code returned for type GetBucketLifecycleOK const GetBucketLifecycleOKCode int = 200 /* GetBucketLifecycleOK A successful response. swagger:response getBucketLifecycleOK */ type GetBucketLifecycleOK struct { /* In: Body */ Payload *models.BucketLifecycleResponse `json:"body,omitempty"` } // NewGetBucketLifecycleOK creates GetBucketLifecycleOK with default headers values func NewGetBucketLifecycleOK() *GetBucketLifecycleOK { return &GetBucketLifecycleOK{} } // WithPayload adds the payload to the get bucket lifecycle o k response func (o *GetBucketLifecycleOK) WithPayload(payload *models.BucketLifecycleResponse) *GetBucketLifecycleOK { o.Payload = payload return o } // SetPayload sets the payload to the get bucket lifecycle o k response func (o *GetBucketLifecycleOK) SetPayload(payload *models.BucketLifecycleResponse) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketLifecycleOK) 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 } } } /* GetBucketLifecycleDefault Generic error response. swagger:response getBucketLifecycleDefault */ type GetBucketLifecycleDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetBucketLifecycleDefault creates GetBucketLifecycleDefault with default headers values func NewGetBucketLifecycleDefault(code int) *GetBucketLifecycleDefault { if code <= 0 { code = 500 } return &GetBucketLifecycleDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get bucket lifecycle default response func (o *GetBucketLifecycleDefault) WithStatusCode(code int) *GetBucketLifecycleDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get bucket lifecycle default response func (o *GetBucketLifecycleDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get bucket lifecycle default response func (o *GetBucketLifecycleDefault) WithPayload(payload *models.APIError) *GetBucketLifecycleDefault { o.Payload = payload return o } // SetPayload sets the payload to the get bucket lifecycle default response func (o *GetBucketLifecycleDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketLifecycleDefault) 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 } } } ================================================ FILE: api/operations/bucket/get_bucket_lifecycle_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetBucketLifecycleURL generates an URL for the get bucket lifecycle operation type GetBucketLifecycleURL struct { BucketName 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 *GetBucketLifecycleURL) WithBasePath(bp string) *GetBucketLifecycleURL { 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 *GetBucketLifecycleURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetBucketLifecycleURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/lifecycle" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on GetBucketLifecycleURL") } _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 *GetBucketLifecycleURL) 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 *GetBucketLifecycleURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetBucketLifecycleURL") } if host == "" { return nil, errors.New("host is required for a full url on GetBucketLifecycleURL") } 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 *GetBucketLifecycleURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/get_bucket_object_locking_status.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetBucketObjectLockingStatusHandlerFunc turns a function with the right signature into a get bucket object locking status handler type GetBucketObjectLockingStatusHandlerFunc func(GetBucketObjectLockingStatusParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetBucketObjectLockingStatusHandlerFunc) Handle(params GetBucketObjectLockingStatusParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetBucketObjectLockingStatusHandler interface for that can handle valid get bucket object locking status params type GetBucketObjectLockingStatusHandler interface { Handle(GetBucketObjectLockingStatusParams, *models.Principal) middleware.Responder } // NewGetBucketObjectLockingStatus creates a new http.Handler for the get bucket object locking status operation func NewGetBucketObjectLockingStatus(ctx *middleware.Context, handler GetBucketObjectLockingStatusHandler) *GetBucketObjectLockingStatus { return &GetBucketObjectLockingStatus{Context: ctx, Handler: handler} } /* GetBucketObjectLockingStatus swagger:route GET /buckets/{bucket_name}/object-locking Bucket getBucketObjectLockingStatus Returns the status of object locking support on the bucket */ type GetBucketObjectLockingStatus struct { Context *middleware.Context Handler GetBucketObjectLockingStatusHandler } func (o *GetBucketObjectLockingStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetBucketObjectLockingStatusParams() 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) } ================================================ FILE: api/operations/bucket/get_bucket_object_locking_status_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetBucketObjectLockingStatusParams creates a new GetBucketObjectLockingStatusParams object // // There are no default values defined in the spec. func NewGetBucketObjectLockingStatusParams() GetBucketObjectLockingStatusParams { return GetBucketObjectLockingStatusParams{} } // GetBucketObjectLockingStatusParams contains all the bound params for the get bucket object locking status operation // typically these are obtained from a http.Request // // swagger:parameters GetBucketObjectLockingStatus type GetBucketObjectLockingStatusParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName 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 NewGetBucketObjectLockingStatusParams() beforehand. func (o *GetBucketObjectLockingStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *GetBucketObjectLockingStatusParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/get_bucket_object_locking_status_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetBucketObjectLockingStatusOKCode is the HTTP code returned for type GetBucketObjectLockingStatusOK const GetBucketObjectLockingStatusOKCode int = 200 /* GetBucketObjectLockingStatusOK A successful response. swagger:response getBucketObjectLockingStatusOK */ type GetBucketObjectLockingStatusOK struct { /* In: Body */ Payload *models.BucketObLockingResponse `json:"body,omitempty"` } // NewGetBucketObjectLockingStatusOK creates GetBucketObjectLockingStatusOK with default headers values func NewGetBucketObjectLockingStatusOK() *GetBucketObjectLockingStatusOK { return &GetBucketObjectLockingStatusOK{} } // WithPayload adds the payload to the get bucket object locking status o k response func (o *GetBucketObjectLockingStatusOK) WithPayload(payload *models.BucketObLockingResponse) *GetBucketObjectLockingStatusOK { o.Payload = payload return o } // SetPayload sets the payload to the get bucket object locking status o k response func (o *GetBucketObjectLockingStatusOK) SetPayload(payload *models.BucketObLockingResponse) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketObjectLockingStatusOK) 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 } } } /* GetBucketObjectLockingStatusDefault Generic error response. swagger:response getBucketObjectLockingStatusDefault */ type GetBucketObjectLockingStatusDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetBucketObjectLockingStatusDefault creates GetBucketObjectLockingStatusDefault with default headers values func NewGetBucketObjectLockingStatusDefault(code int) *GetBucketObjectLockingStatusDefault { if code <= 0 { code = 500 } return &GetBucketObjectLockingStatusDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get bucket object locking status default response func (o *GetBucketObjectLockingStatusDefault) WithStatusCode(code int) *GetBucketObjectLockingStatusDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get bucket object locking status default response func (o *GetBucketObjectLockingStatusDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get bucket object locking status default response func (o *GetBucketObjectLockingStatusDefault) WithPayload(payload *models.APIError) *GetBucketObjectLockingStatusDefault { o.Payload = payload return o } // SetPayload sets the payload to the get bucket object locking status default response func (o *GetBucketObjectLockingStatusDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketObjectLockingStatusDefault) 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 } } } ================================================ FILE: api/operations/bucket/get_bucket_object_locking_status_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetBucketObjectLockingStatusURL generates an URL for the get bucket object locking status operation type GetBucketObjectLockingStatusURL struct { BucketName 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 *GetBucketObjectLockingStatusURL) WithBasePath(bp string) *GetBucketObjectLockingStatusURL { 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 *GetBucketObjectLockingStatusURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetBucketObjectLockingStatusURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/object-locking" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on GetBucketObjectLockingStatusURL") } _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 *GetBucketObjectLockingStatusURL) 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 *GetBucketObjectLockingStatusURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetBucketObjectLockingStatusURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetBucketObjectLockingStatusURL") } if host == "" { return nil, errors.New("host is required for a full url on GetBucketObjectLockingStatusURL") } 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 *GetBucketObjectLockingStatusURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/get_bucket_quota.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetBucketQuotaHandlerFunc turns a function with the right signature into a get bucket quota handler type GetBucketQuotaHandlerFunc func(GetBucketQuotaParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetBucketQuotaHandlerFunc) Handle(params GetBucketQuotaParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetBucketQuotaHandler interface for that can handle valid get bucket quota params type GetBucketQuotaHandler interface { Handle(GetBucketQuotaParams, *models.Principal) middleware.Responder } // NewGetBucketQuota creates a new http.Handler for the get bucket quota operation func NewGetBucketQuota(ctx *middleware.Context, handler GetBucketQuotaHandler) *GetBucketQuota { return &GetBucketQuota{Context: ctx, Handler: handler} } /* GetBucketQuota swagger:route GET /buckets/{name}/quota Bucket getBucketQuota Get Bucket Quota */ type GetBucketQuota struct { Context *middleware.Context Handler GetBucketQuotaHandler } func (o *GetBucketQuota) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetBucketQuotaParams() 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) } ================================================ FILE: api/operations/bucket/get_bucket_quota_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetBucketQuotaParams creates a new GetBucketQuotaParams object // // There are no default values defined in the spec. func NewGetBucketQuotaParams() GetBucketQuotaParams { return GetBucketQuotaParams{} } // GetBucketQuotaParams contains all the bound params for the get bucket quota operation // typically these are obtained from a http.Request // // swagger:parameters GetBucketQuota type GetBucketQuotaParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewGetBucketQuotaParams() beforehand. func (o *GetBucketQuotaParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *GetBucketQuotaParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/bucket/get_bucket_quota_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetBucketQuotaOKCode is the HTTP code returned for type GetBucketQuotaOK const GetBucketQuotaOKCode int = 200 /* GetBucketQuotaOK A successful response. swagger:response getBucketQuotaOK */ type GetBucketQuotaOK struct { /* In: Body */ Payload *models.BucketQuota `json:"body,omitempty"` } // NewGetBucketQuotaOK creates GetBucketQuotaOK with default headers values func NewGetBucketQuotaOK() *GetBucketQuotaOK { return &GetBucketQuotaOK{} } // WithPayload adds the payload to the get bucket quota o k response func (o *GetBucketQuotaOK) WithPayload(payload *models.BucketQuota) *GetBucketQuotaOK { o.Payload = payload return o } // SetPayload sets the payload to the get bucket quota o k response func (o *GetBucketQuotaOK) SetPayload(payload *models.BucketQuota) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketQuotaOK) 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 } } } /* GetBucketQuotaDefault Generic error response. swagger:response getBucketQuotaDefault */ type GetBucketQuotaDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetBucketQuotaDefault creates GetBucketQuotaDefault with default headers values func NewGetBucketQuotaDefault(code int) *GetBucketQuotaDefault { if code <= 0 { code = 500 } return &GetBucketQuotaDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get bucket quota default response func (o *GetBucketQuotaDefault) WithStatusCode(code int) *GetBucketQuotaDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get bucket quota default response func (o *GetBucketQuotaDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get bucket quota default response func (o *GetBucketQuotaDefault) WithPayload(payload *models.APIError) *GetBucketQuotaDefault { o.Payload = payload return o } // SetPayload sets the payload to the get bucket quota default response func (o *GetBucketQuotaDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketQuotaDefault) 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 } } } ================================================ FILE: api/operations/bucket/get_bucket_quota_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetBucketQuotaURL generates an URL for the get bucket quota operation type GetBucketQuotaURL struct { Name 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 *GetBucketQuotaURL) WithBasePath(bp string) *GetBucketQuotaURL { 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 *GetBucketQuotaURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetBucketQuotaURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{name}/quota" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on GetBucketQuotaURL") } _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 *GetBucketQuotaURL) 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 *GetBucketQuotaURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetBucketQuotaURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetBucketQuotaURL") } if host == "" { return nil, errors.New("host is required for a full url on GetBucketQuotaURL") } 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 *GetBucketQuotaURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/get_bucket_replication.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetBucketReplicationHandlerFunc turns a function with the right signature into a get bucket replication handler type GetBucketReplicationHandlerFunc func(GetBucketReplicationParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetBucketReplicationHandlerFunc) Handle(params GetBucketReplicationParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetBucketReplicationHandler interface for that can handle valid get bucket replication params type GetBucketReplicationHandler interface { Handle(GetBucketReplicationParams, *models.Principal) middleware.Responder } // NewGetBucketReplication creates a new http.Handler for the get bucket replication operation func NewGetBucketReplication(ctx *middleware.Context, handler GetBucketReplicationHandler) *GetBucketReplication { return &GetBucketReplication{Context: ctx, Handler: handler} } /* GetBucketReplication swagger:route GET /buckets/{bucket_name}/replication Bucket getBucketReplication Bucket Replication */ type GetBucketReplication struct { Context *middleware.Context Handler GetBucketReplicationHandler } func (o *GetBucketReplication) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetBucketReplicationParams() 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) } ================================================ FILE: api/operations/bucket/get_bucket_replication_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetBucketReplicationParams creates a new GetBucketReplicationParams object // // There are no default values defined in the spec. func NewGetBucketReplicationParams() GetBucketReplicationParams { return GetBucketReplicationParams{} } // GetBucketReplicationParams contains all the bound params for the get bucket replication operation // typically these are obtained from a http.Request // // swagger:parameters GetBucketReplication type GetBucketReplicationParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName 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 NewGetBucketReplicationParams() beforehand. func (o *GetBucketReplicationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *GetBucketReplicationParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/get_bucket_replication_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetBucketReplicationOKCode is the HTTP code returned for type GetBucketReplicationOK const GetBucketReplicationOKCode int = 200 /* GetBucketReplicationOK A successful response. swagger:response getBucketReplicationOK */ type GetBucketReplicationOK struct { /* In: Body */ Payload *models.BucketReplicationResponse `json:"body,omitempty"` } // NewGetBucketReplicationOK creates GetBucketReplicationOK with default headers values func NewGetBucketReplicationOK() *GetBucketReplicationOK { return &GetBucketReplicationOK{} } // WithPayload adds the payload to the get bucket replication o k response func (o *GetBucketReplicationOK) WithPayload(payload *models.BucketReplicationResponse) *GetBucketReplicationOK { o.Payload = payload return o } // SetPayload sets the payload to the get bucket replication o k response func (o *GetBucketReplicationOK) SetPayload(payload *models.BucketReplicationResponse) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketReplicationOK) 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 } } } /* GetBucketReplicationDefault Generic error response. swagger:response getBucketReplicationDefault */ type GetBucketReplicationDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetBucketReplicationDefault creates GetBucketReplicationDefault with default headers values func NewGetBucketReplicationDefault(code int) *GetBucketReplicationDefault { if code <= 0 { code = 500 } return &GetBucketReplicationDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get bucket replication default response func (o *GetBucketReplicationDefault) WithStatusCode(code int) *GetBucketReplicationDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get bucket replication default response func (o *GetBucketReplicationDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get bucket replication default response func (o *GetBucketReplicationDefault) WithPayload(payload *models.APIError) *GetBucketReplicationDefault { o.Payload = payload return o } // SetPayload sets the payload to the get bucket replication default response func (o *GetBucketReplicationDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketReplicationDefault) 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 } } } ================================================ FILE: api/operations/bucket/get_bucket_replication_rule.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetBucketReplicationRuleHandlerFunc turns a function with the right signature into a get bucket replication rule handler type GetBucketReplicationRuleHandlerFunc func(GetBucketReplicationRuleParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetBucketReplicationRuleHandlerFunc) Handle(params GetBucketReplicationRuleParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetBucketReplicationRuleHandler interface for that can handle valid get bucket replication rule params type GetBucketReplicationRuleHandler interface { Handle(GetBucketReplicationRuleParams, *models.Principal) middleware.Responder } // NewGetBucketReplicationRule creates a new http.Handler for the get bucket replication rule operation func NewGetBucketReplicationRule(ctx *middleware.Context, handler GetBucketReplicationRuleHandler) *GetBucketReplicationRule { return &GetBucketReplicationRule{Context: ctx, Handler: handler} } /* GetBucketReplicationRule swagger:route GET /buckets/{bucket_name}/replication/{rule_id} Bucket getBucketReplicationRule Bucket Replication */ type GetBucketReplicationRule struct { Context *middleware.Context Handler GetBucketReplicationRuleHandler } func (o *GetBucketReplicationRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetBucketReplicationRuleParams() 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) } ================================================ FILE: api/operations/bucket/get_bucket_replication_rule_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetBucketReplicationRuleParams creates a new GetBucketReplicationRuleParams object // // There are no default values defined in the spec. func NewGetBucketReplicationRuleParams() GetBucketReplicationRuleParams { return GetBucketReplicationRuleParams{} } // GetBucketReplicationRuleParams contains all the bound params for the get bucket replication rule operation // typically these are obtained from a http.Request // // swagger:parameters GetBucketReplicationRule type GetBucketReplicationRuleParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* Required: true In: path */ RuleID 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 NewGetBucketReplicationRuleParams() beforehand. func (o *GetBucketReplicationRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } rRuleID, rhkRuleID, _ := route.Params.GetOK("rule_id") if err := o.bindRuleID(rRuleID, rhkRuleID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *GetBucketReplicationRuleParams) bindBucketName(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.BucketName = raw return nil } // bindRuleID binds and validates parameter RuleID from path. func (o *GetBucketReplicationRuleParams) bindRuleID(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.RuleID = raw return nil } ================================================ FILE: api/operations/bucket/get_bucket_replication_rule_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetBucketReplicationRuleOKCode is the HTTP code returned for type GetBucketReplicationRuleOK const GetBucketReplicationRuleOKCode int = 200 /* GetBucketReplicationRuleOK A successful response. swagger:response getBucketReplicationRuleOK */ type GetBucketReplicationRuleOK struct { /* In: Body */ Payload *models.BucketReplicationRule `json:"body,omitempty"` } // NewGetBucketReplicationRuleOK creates GetBucketReplicationRuleOK with default headers values func NewGetBucketReplicationRuleOK() *GetBucketReplicationRuleOK { return &GetBucketReplicationRuleOK{} } // WithPayload adds the payload to the get bucket replication rule o k response func (o *GetBucketReplicationRuleOK) WithPayload(payload *models.BucketReplicationRule) *GetBucketReplicationRuleOK { o.Payload = payload return o } // SetPayload sets the payload to the get bucket replication rule o k response func (o *GetBucketReplicationRuleOK) SetPayload(payload *models.BucketReplicationRule) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketReplicationRuleOK) 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 } } } /* GetBucketReplicationRuleDefault Generic error response. swagger:response getBucketReplicationRuleDefault */ type GetBucketReplicationRuleDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetBucketReplicationRuleDefault creates GetBucketReplicationRuleDefault with default headers values func NewGetBucketReplicationRuleDefault(code int) *GetBucketReplicationRuleDefault { if code <= 0 { code = 500 } return &GetBucketReplicationRuleDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get bucket replication rule default response func (o *GetBucketReplicationRuleDefault) WithStatusCode(code int) *GetBucketReplicationRuleDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get bucket replication rule default response func (o *GetBucketReplicationRuleDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get bucket replication rule default response func (o *GetBucketReplicationRuleDefault) WithPayload(payload *models.APIError) *GetBucketReplicationRuleDefault { o.Payload = payload return o } // SetPayload sets the payload to the get bucket replication rule default response func (o *GetBucketReplicationRuleDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketReplicationRuleDefault) 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 } } } ================================================ FILE: api/operations/bucket/get_bucket_replication_rule_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetBucketReplicationRuleURL generates an URL for the get bucket replication rule operation type GetBucketReplicationRuleURL struct { BucketName string RuleID 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 *GetBucketReplicationRuleURL) WithBasePath(bp string) *GetBucketReplicationRuleURL { 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 *GetBucketReplicationRuleURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetBucketReplicationRuleURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/replication/{rule_id}" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on GetBucketReplicationRuleURL") } ruleID := o.RuleID if ruleID != "" { _path = strings.ReplaceAll(_path, "{rule_id}", ruleID) } else { return nil, errors.New("ruleId is required on GetBucketReplicationRuleURL") } _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 *GetBucketReplicationRuleURL) 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 *GetBucketReplicationRuleURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetBucketReplicationRuleURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetBucketReplicationRuleURL") } if host == "" { return nil, errors.New("host is required for a full url on GetBucketReplicationRuleURL") } 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 *GetBucketReplicationRuleURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/get_bucket_replication_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetBucketReplicationURL generates an URL for the get bucket replication operation type GetBucketReplicationURL struct { BucketName 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 *GetBucketReplicationURL) WithBasePath(bp string) *GetBucketReplicationURL { 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 *GetBucketReplicationURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetBucketReplicationURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/replication" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on GetBucketReplicationURL") } _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 *GetBucketReplicationURL) 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 *GetBucketReplicationURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetBucketReplicationURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetBucketReplicationURL") } if host == "" { return nil, errors.New("host is required for a full url on GetBucketReplicationURL") } 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 *GetBucketReplicationURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/get_bucket_retention_config.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetBucketRetentionConfigHandlerFunc turns a function with the right signature into a get bucket retention config handler type GetBucketRetentionConfigHandlerFunc func(GetBucketRetentionConfigParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetBucketRetentionConfigHandlerFunc) Handle(params GetBucketRetentionConfigParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetBucketRetentionConfigHandler interface for that can handle valid get bucket retention config params type GetBucketRetentionConfigHandler interface { Handle(GetBucketRetentionConfigParams, *models.Principal) middleware.Responder } // NewGetBucketRetentionConfig creates a new http.Handler for the get bucket retention config operation func NewGetBucketRetentionConfig(ctx *middleware.Context, handler GetBucketRetentionConfigHandler) *GetBucketRetentionConfig { return &GetBucketRetentionConfig{Context: ctx, Handler: handler} } /* GetBucketRetentionConfig swagger:route GET /buckets/{bucket_name}/retention Bucket getBucketRetentionConfig Get Bucket's retention config */ type GetBucketRetentionConfig struct { Context *middleware.Context Handler GetBucketRetentionConfigHandler } func (o *GetBucketRetentionConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetBucketRetentionConfigParams() 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) } ================================================ FILE: api/operations/bucket/get_bucket_retention_config_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetBucketRetentionConfigParams creates a new GetBucketRetentionConfigParams object // // There are no default values defined in the spec. func NewGetBucketRetentionConfigParams() GetBucketRetentionConfigParams { return GetBucketRetentionConfigParams{} } // GetBucketRetentionConfigParams contains all the bound params for the get bucket retention config operation // typically these are obtained from a http.Request // // swagger:parameters GetBucketRetentionConfig type GetBucketRetentionConfigParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName 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 NewGetBucketRetentionConfigParams() beforehand. func (o *GetBucketRetentionConfigParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *GetBucketRetentionConfigParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/get_bucket_retention_config_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetBucketRetentionConfigOKCode is the HTTP code returned for type GetBucketRetentionConfigOK const GetBucketRetentionConfigOKCode int = 200 /* GetBucketRetentionConfigOK A successful response. swagger:response getBucketRetentionConfigOK */ type GetBucketRetentionConfigOK struct { /* In: Body */ Payload *models.GetBucketRetentionConfig `json:"body,omitempty"` } // NewGetBucketRetentionConfigOK creates GetBucketRetentionConfigOK with default headers values func NewGetBucketRetentionConfigOK() *GetBucketRetentionConfigOK { return &GetBucketRetentionConfigOK{} } // WithPayload adds the payload to the get bucket retention config o k response func (o *GetBucketRetentionConfigOK) WithPayload(payload *models.GetBucketRetentionConfig) *GetBucketRetentionConfigOK { o.Payload = payload return o } // SetPayload sets the payload to the get bucket retention config o k response func (o *GetBucketRetentionConfigOK) SetPayload(payload *models.GetBucketRetentionConfig) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketRetentionConfigOK) 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 } } } /* GetBucketRetentionConfigDefault Generic error response. swagger:response getBucketRetentionConfigDefault */ type GetBucketRetentionConfigDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetBucketRetentionConfigDefault creates GetBucketRetentionConfigDefault with default headers values func NewGetBucketRetentionConfigDefault(code int) *GetBucketRetentionConfigDefault { if code <= 0 { code = 500 } return &GetBucketRetentionConfigDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get bucket retention config default response func (o *GetBucketRetentionConfigDefault) WithStatusCode(code int) *GetBucketRetentionConfigDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get bucket retention config default response func (o *GetBucketRetentionConfigDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get bucket retention config default response func (o *GetBucketRetentionConfigDefault) WithPayload(payload *models.APIError) *GetBucketRetentionConfigDefault { o.Payload = payload return o } // SetPayload sets the payload to the get bucket retention config default response func (o *GetBucketRetentionConfigDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketRetentionConfigDefault) 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 } } } ================================================ FILE: api/operations/bucket/get_bucket_retention_config_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetBucketRetentionConfigURL generates an URL for the get bucket retention config operation type GetBucketRetentionConfigURL struct { BucketName 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 *GetBucketRetentionConfigURL) WithBasePath(bp string) *GetBucketRetentionConfigURL { 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 *GetBucketRetentionConfigURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetBucketRetentionConfigURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/retention" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on GetBucketRetentionConfigURL") } _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 *GetBucketRetentionConfigURL) 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 *GetBucketRetentionConfigURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetBucketRetentionConfigURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetBucketRetentionConfigURL") } if host == "" { return nil, errors.New("host is required for a full url on GetBucketRetentionConfigURL") } 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 *GetBucketRetentionConfigURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/get_bucket_rewind.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetBucketRewindHandlerFunc turns a function with the right signature into a get bucket rewind handler type GetBucketRewindHandlerFunc func(GetBucketRewindParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetBucketRewindHandlerFunc) Handle(params GetBucketRewindParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetBucketRewindHandler interface for that can handle valid get bucket rewind params type GetBucketRewindHandler interface { Handle(GetBucketRewindParams, *models.Principal) middleware.Responder } // NewGetBucketRewind creates a new http.Handler for the get bucket rewind operation func NewGetBucketRewind(ctx *middleware.Context, handler GetBucketRewindHandler) *GetBucketRewind { return &GetBucketRewind{Context: ctx, Handler: handler} } /* GetBucketRewind swagger:route GET /buckets/{bucket_name}/rewind/{date} Bucket getBucketRewind Get objects in a bucket for a rewind date */ type GetBucketRewind struct { Context *middleware.Context Handler GetBucketRewindHandler } func (o *GetBucketRewind) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetBucketRewindParams() 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) } ================================================ FILE: api/operations/bucket/get_bucket_rewind_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetBucketRewindParams creates a new GetBucketRewindParams object // // There are no default values defined in the spec. func NewGetBucketRewindParams() GetBucketRewindParams { return GetBucketRewindParams{} } // GetBucketRewindParams contains all the bound params for the get bucket rewind operation // typically these are obtained from a http.Request // // swagger:parameters GetBucketRewind type GetBucketRewindParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* Required: true In: path */ Date string /* In: query */ Prefix *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 NewGetBucketRewindParams() beforehand. func (o *GetBucketRewindParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } rDate, rhkDate, _ := route.Params.GetOK("date") if err := o.bindDate(rDate, rhkDate, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *GetBucketRewindParams) bindBucketName(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.BucketName = raw return nil } // bindDate binds and validates parameter Date from path. func (o *GetBucketRewindParams) bindDate(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.Date = raw return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *GetBucketRewindParams) bindPrefix(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.Prefix = &raw return nil } ================================================ FILE: api/operations/bucket/get_bucket_rewind_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetBucketRewindOKCode is the HTTP code returned for type GetBucketRewindOK const GetBucketRewindOKCode int = 200 /* GetBucketRewindOK A successful response. swagger:response getBucketRewindOK */ type GetBucketRewindOK struct { /* In: Body */ Payload *models.RewindResponse `json:"body,omitempty"` } // NewGetBucketRewindOK creates GetBucketRewindOK with default headers values func NewGetBucketRewindOK() *GetBucketRewindOK { return &GetBucketRewindOK{} } // WithPayload adds the payload to the get bucket rewind o k response func (o *GetBucketRewindOK) WithPayload(payload *models.RewindResponse) *GetBucketRewindOK { o.Payload = payload return o } // SetPayload sets the payload to the get bucket rewind o k response func (o *GetBucketRewindOK) SetPayload(payload *models.RewindResponse) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketRewindOK) 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 } } } /* GetBucketRewindDefault Generic error response. swagger:response getBucketRewindDefault */ type GetBucketRewindDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetBucketRewindDefault creates GetBucketRewindDefault with default headers values func NewGetBucketRewindDefault(code int) *GetBucketRewindDefault { if code <= 0 { code = 500 } return &GetBucketRewindDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get bucket rewind default response func (o *GetBucketRewindDefault) WithStatusCode(code int) *GetBucketRewindDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get bucket rewind default response func (o *GetBucketRewindDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get bucket rewind default response func (o *GetBucketRewindDefault) WithPayload(payload *models.APIError) *GetBucketRewindDefault { o.Payload = payload return o } // SetPayload sets the payload to the get bucket rewind default response func (o *GetBucketRewindDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketRewindDefault) 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 } } } ================================================ FILE: api/operations/bucket/get_bucket_rewind_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetBucketRewindURL generates an URL for the get bucket rewind operation type GetBucketRewindURL struct { BucketName string Date string Prefix *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 *GetBucketRewindURL) WithBasePath(bp string) *GetBucketRewindURL { 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 *GetBucketRewindURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetBucketRewindURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/rewind/{date}" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on GetBucketRewindURL") } date := o.Date if date != "" { _path = strings.ReplaceAll(_path, "{date}", date) } else { return nil, errors.New("date is required on GetBucketRewindURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var prefixQ string if o.Prefix != nil { prefixQ = *o.Prefix } if prefixQ != "" { qs.Set("prefix", prefixQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *GetBucketRewindURL) 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 *GetBucketRewindURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetBucketRewindURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetBucketRewindURL") } if host == "" { return nil, errors.New("host is required for a full url on GetBucketRewindURL") } 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 *GetBucketRewindURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/get_bucket_versioning.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetBucketVersioningHandlerFunc turns a function with the right signature into a get bucket versioning handler type GetBucketVersioningHandlerFunc func(GetBucketVersioningParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetBucketVersioningHandlerFunc) Handle(params GetBucketVersioningParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetBucketVersioningHandler interface for that can handle valid get bucket versioning params type GetBucketVersioningHandler interface { Handle(GetBucketVersioningParams, *models.Principal) middleware.Responder } // NewGetBucketVersioning creates a new http.Handler for the get bucket versioning operation func NewGetBucketVersioning(ctx *middleware.Context, handler GetBucketVersioningHandler) *GetBucketVersioning { return &GetBucketVersioning{Context: ctx, Handler: handler} } /* GetBucketVersioning swagger:route GET /buckets/{bucket_name}/versioning Bucket getBucketVersioning Bucket Versioning */ type GetBucketVersioning struct { Context *middleware.Context Handler GetBucketVersioningHandler } func (o *GetBucketVersioning) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetBucketVersioningParams() 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) } ================================================ FILE: api/operations/bucket/get_bucket_versioning_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetBucketVersioningParams creates a new GetBucketVersioningParams object // // There are no default values defined in the spec. func NewGetBucketVersioningParams() GetBucketVersioningParams { return GetBucketVersioningParams{} } // GetBucketVersioningParams contains all the bound params for the get bucket versioning operation // typically these are obtained from a http.Request // // swagger:parameters GetBucketVersioning type GetBucketVersioningParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName 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 NewGetBucketVersioningParams() beforehand. func (o *GetBucketVersioningParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *GetBucketVersioningParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/get_bucket_versioning_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetBucketVersioningOKCode is the HTTP code returned for type GetBucketVersioningOK const GetBucketVersioningOKCode int = 200 /* GetBucketVersioningOK A successful response. swagger:response getBucketVersioningOK */ type GetBucketVersioningOK struct { /* In: Body */ Payload *models.BucketVersioningResponse `json:"body,omitempty"` } // NewGetBucketVersioningOK creates GetBucketVersioningOK with default headers values func NewGetBucketVersioningOK() *GetBucketVersioningOK { return &GetBucketVersioningOK{} } // WithPayload adds the payload to the get bucket versioning o k response func (o *GetBucketVersioningOK) WithPayload(payload *models.BucketVersioningResponse) *GetBucketVersioningOK { o.Payload = payload return o } // SetPayload sets the payload to the get bucket versioning o k response func (o *GetBucketVersioningOK) SetPayload(payload *models.BucketVersioningResponse) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketVersioningOK) 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 } } } /* GetBucketVersioningDefault Generic error response. swagger:response getBucketVersioningDefault */ type GetBucketVersioningDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetBucketVersioningDefault creates GetBucketVersioningDefault with default headers values func NewGetBucketVersioningDefault(code int) *GetBucketVersioningDefault { if code <= 0 { code = 500 } return &GetBucketVersioningDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get bucket versioning default response func (o *GetBucketVersioningDefault) WithStatusCode(code int) *GetBucketVersioningDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get bucket versioning default response func (o *GetBucketVersioningDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get bucket versioning default response func (o *GetBucketVersioningDefault) WithPayload(payload *models.APIError) *GetBucketVersioningDefault { o.Payload = payload return o } // SetPayload sets the payload to the get bucket versioning default response func (o *GetBucketVersioningDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetBucketVersioningDefault) 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 } } } ================================================ FILE: api/operations/bucket/get_bucket_versioning_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetBucketVersioningURL generates an URL for the get bucket versioning operation type GetBucketVersioningURL struct { BucketName 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 *GetBucketVersioningURL) WithBasePath(bp string) *GetBucketVersioningURL { 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 *GetBucketVersioningURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetBucketVersioningURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/versioning" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on GetBucketVersioningURL") } _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 *GetBucketVersioningURL) 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 *GetBucketVersioningURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetBucketVersioningURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetBucketVersioningURL") } if host == "" { return nil, errors.New("host is required for a full url on GetBucketVersioningURL") } 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 *GetBucketVersioningURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/get_max_share_link_exp.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetMaxShareLinkExpHandlerFunc turns a function with the right signature into a get max share link exp handler type GetMaxShareLinkExpHandlerFunc func(GetMaxShareLinkExpParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetMaxShareLinkExpHandlerFunc) Handle(params GetMaxShareLinkExpParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetMaxShareLinkExpHandler interface for that can handle valid get max share link exp params type GetMaxShareLinkExpHandler interface { Handle(GetMaxShareLinkExpParams, *models.Principal) middleware.Responder } // NewGetMaxShareLinkExp creates a new http.Handler for the get max share link exp operation func NewGetMaxShareLinkExp(ctx *middleware.Context, handler GetMaxShareLinkExpHandler) *GetMaxShareLinkExp { return &GetMaxShareLinkExp{Context: ctx, Handler: handler} } /* GetMaxShareLinkExp swagger:route GET /buckets/max-share-exp Bucket getMaxShareLinkExp Get max expiration time for share link in seconds */ type GetMaxShareLinkExp struct { Context *middleware.Context Handler GetMaxShareLinkExpHandler } func (o *GetMaxShareLinkExp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetMaxShareLinkExpParams() 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) } ================================================ FILE: api/operations/bucket/get_max_share_link_exp_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewGetMaxShareLinkExpParams creates a new GetMaxShareLinkExpParams object // // There are no default values defined in the spec. func NewGetMaxShareLinkExpParams() GetMaxShareLinkExpParams { return GetMaxShareLinkExpParams{} } // GetMaxShareLinkExpParams contains all the bound params for the get max share link exp operation // typically these are obtained from a http.Request // // swagger:parameters GetMaxShareLinkExp type GetMaxShareLinkExpParams 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 NewGetMaxShareLinkExpParams() beforehand. func (o *GetMaxShareLinkExpParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/bucket/get_max_share_link_exp_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetMaxShareLinkExpOKCode is the HTTP code returned for type GetMaxShareLinkExpOK const GetMaxShareLinkExpOKCode int = 200 /* GetMaxShareLinkExpOK A successful response. swagger:response getMaxShareLinkExpOK */ type GetMaxShareLinkExpOK struct { /* In: Body */ Payload *models.MaxShareLinkExpResponse `json:"body,omitempty"` } // NewGetMaxShareLinkExpOK creates GetMaxShareLinkExpOK with default headers values func NewGetMaxShareLinkExpOK() *GetMaxShareLinkExpOK { return &GetMaxShareLinkExpOK{} } // WithPayload adds the payload to the get max share link exp o k response func (o *GetMaxShareLinkExpOK) WithPayload(payload *models.MaxShareLinkExpResponse) *GetMaxShareLinkExpOK { o.Payload = payload return o } // SetPayload sets the payload to the get max share link exp o k response func (o *GetMaxShareLinkExpOK) SetPayload(payload *models.MaxShareLinkExpResponse) { o.Payload = payload } // WriteResponse to the client func (o *GetMaxShareLinkExpOK) 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 } } } /* GetMaxShareLinkExpDefault Generic error response. swagger:response getMaxShareLinkExpDefault */ type GetMaxShareLinkExpDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetMaxShareLinkExpDefault creates GetMaxShareLinkExpDefault with default headers values func NewGetMaxShareLinkExpDefault(code int) *GetMaxShareLinkExpDefault { if code <= 0 { code = 500 } return &GetMaxShareLinkExpDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get max share link exp default response func (o *GetMaxShareLinkExpDefault) WithStatusCode(code int) *GetMaxShareLinkExpDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get max share link exp default response func (o *GetMaxShareLinkExpDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get max share link exp default response func (o *GetMaxShareLinkExpDefault) WithPayload(payload *models.APIError) *GetMaxShareLinkExpDefault { o.Payload = payload return o } // SetPayload sets the payload to the get max share link exp default response func (o *GetMaxShareLinkExpDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetMaxShareLinkExpDefault) 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 } } } ================================================ FILE: api/operations/bucket/get_max_share_link_exp_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" ) // GetMaxShareLinkExpURL generates an URL for the get max share link exp operation type GetMaxShareLinkExpURL 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 *GetMaxShareLinkExpURL) WithBasePath(bp string) *GetMaxShareLinkExpURL { 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 *GetMaxShareLinkExpURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetMaxShareLinkExpURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/max-share-exp" _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 *GetMaxShareLinkExpURL) 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 *GetMaxShareLinkExpURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetMaxShareLinkExpURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetMaxShareLinkExpURL") } if host == "" { return nil, errors.New("host is required for a full url on GetMaxShareLinkExpURL") } 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 *GetMaxShareLinkExpURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/list_access_rules_with_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListAccessRulesWithBucketHandlerFunc turns a function with the right signature into a list access rules with bucket handler type ListAccessRulesWithBucketHandlerFunc func(ListAccessRulesWithBucketParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListAccessRulesWithBucketHandlerFunc) Handle(params ListAccessRulesWithBucketParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListAccessRulesWithBucketHandler interface for that can handle valid list access rules with bucket params type ListAccessRulesWithBucketHandler interface { Handle(ListAccessRulesWithBucketParams, *models.Principal) middleware.Responder } // NewListAccessRulesWithBucket creates a new http.Handler for the list access rules with bucket operation func NewListAccessRulesWithBucket(ctx *middleware.Context, handler ListAccessRulesWithBucketHandler) *ListAccessRulesWithBucket { return &ListAccessRulesWithBucket{Context: ctx, Handler: handler} } /* ListAccessRulesWithBucket swagger:route GET /bucket/{bucket}/access-rules Bucket listAccessRulesWithBucket List Access Rules With Given Bucket */ type ListAccessRulesWithBucket struct { Context *middleware.Context Handler ListAccessRulesWithBucketHandler } func (o *ListAccessRulesWithBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListAccessRulesWithBucketParams() 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) } ================================================ FILE: api/operations/bucket/list_access_rules_with_bucket_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket 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" ) // NewListAccessRulesWithBucketParams creates a new ListAccessRulesWithBucketParams object // with the default values initialized. func NewListAccessRulesWithBucketParams() ListAccessRulesWithBucketParams { var ( // initialize parameters with default values limitDefault = int32(20) offsetDefault = int32(0) ) return ListAccessRulesWithBucketParams{ Limit: &limitDefault, Offset: &offsetDefault, } } // ListAccessRulesWithBucketParams contains all the bound params for the list access rules with bucket operation // typically these are obtained from a http.Request // // swagger:parameters ListAccessRulesWithBucket type ListAccessRulesWithBucketParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Bucket string /* In: query Default: 20 */ Limit *int32 /* In: query Default: 0 */ Offset *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 NewListAccessRulesWithBucketParams() beforehand. func (o *ListAccessRulesWithBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucket, rhkBucket, _ := route.Params.GetOK("bucket") if err := o.bindBucket(rBucket, rhkBucket, route.Formats); err != nil { res = append(res, err) } 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) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucket binds and validates parameter Bucket from path. func (o *ListAccessRulesWithBucketParams) bindBucket(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.Bucket = raw return nil } // bindLimit binds and validates parameter Limit from query. func (o *ListAccessRulesWithBucketParams) 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 // Default values have been previously initialized by NewListAccessRulesWithBucketParams() 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 *ListAccessRulesWithBucketParams) 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 // Default values have been previously initialized by NewListAccessRulesWithBucketParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("offset", "query", "int32", raw) } o.Offset = &value return nil } ================================================ FILE: api/operations/bucket/list_access_rules_with_bucket_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListAccessRulesWithBucketOKCode is the HTTP code returned for type ListAccessRulesWithBucketOK const ListAccessRulesWithBucketOKCode int = 200 /* ListAccessRulesWithBucketOK A successful response. swagger:response listAccessRulesWithBucketOK */ type ListAccessRulesWithBucketOK struct { /* In: Body */ Payload *models.ListAccessRulesResponse `json:"body,omitempty"` } // NewListAccessRulesWithBucketOK creates ListAccessRulesWithBucketOK with default headers values func NewListAccessRulesWithBucketOK() *ListAccessRulesWithBucketOK { return &ListAccessRulesWithBucketOK{} } // WithPayload adds the payload to the list access rules with bucket o k response func (o *ListAccessRulesWithBucketOK) WithPayload(payload *models.ListAccessRulesResponse) *ListAccessRulesWithBucketOK { o.Payload = payload return o } // SetPayload sets the payload to the list access rules with bucket o k response func (o *ListAccessRulesWithBucketOK) SetPayload(payload *models.ListAccessRulesResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListAccessRulesWithBucketOK) 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 } } } /* ListAccessRulesWithBucketDefault Generic error response. swagger:response listAccessRulesWithBucketDefault */ type ListAccessRulesWithBucketDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListAccessRulesWithBucketDefault creates ListAccessRulesWithBucketDefault with default headers values func NewListAccessRulesWithBucketDefault(code int) *ListAccessRulesWithBucketDefault { if code <= 0 { code = 500 } return &ListAccessRulesWithBucketDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list access rules with bucket default response func (o *ListAccessRulesWithBucketDefault) WithStatusCode(code int) *ListAccessRulesWithBucketDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list access rules with bucket default response func (o *ListAccessRulesWithBucketDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list access rules with bucket default response func (o *ListAccessRulesWithBucketDefault) WithPayload(payload *models.APIError) *ListAccessRulesWithBucketDefault { o.Payload = payload return o } // SetPayload sets the payload to the list access rules with bucket default response func (o *ListAccessRulesWithBucketDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListAccessRulesWithBucketDefault) 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 } } } ================================================ FILE: api/operations/bucket/list_access_rules_with_bucket_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" "github.com/go-openapi/swag" ) // ListAccessRulesWithBucketURL generates an URL for the list access rules with bucket operation type ListAccessRulesWithBucketURL struct { Bucket string Limit *int32 Offset *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 *ListAccessRulesWithBucketURL) WithBasePath(bp string) *ListAccessRulesWithBucketURL { 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 *ListAccessRulesWithBucketURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListAccessRulesWithBucketURL) Build() (*url.URL, error) { var _result url.URL var _path = "/bucket/{bucket}/access-rules" bucket := o.Bucket if bucket != "" { _path = strings.ReplaceAll(_path, "{bucket}", bucket) } else { return nil, errors.New("bucket is required on ListAccessRulesWithBucketURL") } _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) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListAccessRulesWithBucketURL) 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 *ListAccessRulesWithBucketURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListAccessRulesWithBucketURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListAccessRulesWithBucketURL") } if host == "" { return nil, errors.New("host is required for a full url on ListAccessRulesWithBucketURL") } 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 *ListAccessRulesWithBucketURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/list_bucket_events.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListBucketEventsHandlerFunc turns a function with the right signature into a list bucket events handler type ListBucketEventsHandlerFunc func(ListBucketEventsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListBucketEventsHandlerFunc) Handle(params ListBucketEventsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListBucketEventsHandler interface for that can handle valid list bucket events params type ListBucketEventsHandler interface { Handle(ListBucketEventsParams, *models.Principal) middleware.Responder } // NewListBucketEvents creates a new http.Handler for the list bucket events operation func NewListBucketEvents(ctx *middleware.Context, handler ListBucketEventsHandler) *ListBucketEvents { return &ListBucketEvents{Context: ctx, Handler: handler} } /* ListBucketEvents swagger:route GET /buckets/{bucket_name}/events Bucket listBucketEvents List Bucket Events */ type ListBucketEvents struct { Context *middleware.Context Handler ListBucketEventsHandler } func (o *ListBucketEvents) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListBucketEventsParams() 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) } ================================================ FILE: api/operations/bucket/list_bucket_events_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket 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" ) // NewListBucketEventsParams creates a new ListBucketEventsParams object // with the default values initialized. func NewListBucketEventsParams() ListBucketEventsParams { var ( // initialize parameters with default values limitDefault = int32(20) offsetDefault = int32(0) ) return ListBucketEventsParams{ Limit: &limitDefault, Offset: &offsetDefault, } } // ListBucketEventsParams contains all the bound params for the list bucket events operation // typically these are obtained from a http.Request // // swagger:parameters ListBucketEvents type ListBucketEventsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* In: query Default: 20 */ Limit *int32 /* In: query Default: 0 */ Offset *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 NewListBucketEventsParams() beforehand. func (o *ListBucketEventsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } 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) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *ListBucketEventsParams) bindBucketName(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.BucketName = raw return nil } // bindLimit binds and validates parameter Limit from query. func (o *ListBucketEventsParams) 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 // Default values have been previously initialized by NewListBucketEventsParams() 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 *ListBucketEventsParams) 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 // Default values have been previously initialized by NewListBucketEventsParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("offset", "query", "int32", raw) } o.Offset = &value return nil } ================================================ FILE: api/operations/bucket/list_bucket_events_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListBucketEventsOKCode is the HTTP code returned for type ListBucketEventsOK const ListBucketEventsOKCode int = 200 /* ListBucketEventsOK A successful response. swagger:response listBucketEventsOK */ type ListBucketEventsOK struct { /* In: Body */ Payload *models.ListBucketEventsResponse `json:"body,omitempty"` } // NewListBucketEventsOK creates ListBucketEventsOK with default headers values func NewListBucketEventsOK() *ListBucketEventsOK { return &ListBucketEventsOK{} } // WithPayload adds the payload to the list bucket events o k response func (o *ListBucketEventsOK) WithPayload(payload *models.ListBucketEventsResponse) *ListBucketEventsOK { o.Payload = payload return o } // SetPayload sets the payload to the list bucket events o k response func (o *ListBucketEventsOK) SetPayload(payload *models.ListBucketEventsResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListBucketEventsOK) 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 } } } /* ListBucketEventsDefault Generic error response. swagger:response listBucketEventsDefault */ type ListBucketEventsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListBucketEventsDefault creates ListBucketEventsDefault with default headers values func NewListBucketEventsDefault(code int) *ListBucketEventsDefault { if code <= 0 { code = 500 } return &ListBucketEventsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list bucket events default response func (o *ListBucketEventsDefault) WithStatusCode(code int) *ListBucketEventsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list bucket events default response func (o *ListBucketEventsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list bucket events default response func (o *ListBucketEventsDefault) WithPayload(payload *models.APIError) *ListBucketEventsDefault { o.Payload = payload return o } // SetPayload sets the payload to the list bucket events default response func (o *ListBucketEventsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListBucketEventsDefault) 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 } } } ================================================ FILE: api/operations/bucket/list_bucket_events_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" "github.com/go-openapi/swag" ) // ListBucketEventsURL generates an URL for the list bucket events operation type ListBucketEventsURL struct { BucketName string Limit *int32 Offset *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 *ListBucketEventsURL) WithBasePath(bp string) *ListBucketEventsURL { 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 *ListBucketEventsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListBucketEventsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/events" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on ListBucketEventsURL") } _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) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListBucketEventsURL) 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 *ListBucketEventsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListBucketEventsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListBucketEventsURL") } if host == "" { return nil, errors.New("host is required for a full url on ListBucketEventsURL") } 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 *ListBucketEventsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/list_buckets.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListBucketsHandlerFunc turns a function with the right signature into a list buckets handler type ListBucketsHandlerFunc func(ListBucketsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListBucketsHandlerFunc) Handle(params ListBucketsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListBucketsHandler interface for that can handle valid list buckets params type ListBucketsHandler interface { Handle(ListBucketsParams, *models.Principal) middleware.Responder } // NewListBuckets creates a new http.Handler for the list buckets operation func NewListBuckets(ctx *middleware.Context, handler ListBucketsHandler) *ListBuckets { return &ListBuckets{Context: ctx, Handler: handler} } /* ListBuckets swagger:route GET /buckets Bucket listBuckets List Buckets */ type ListBuckets struct { Context *middleware.Context Handler ListBucketsHandler } func (o *ListBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListBucketsParams() 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) } ================================================ FILE: api/operations/bucket/list_buckets_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewListBucketsParams creates a new ListBucketsParams object // // There are no default values defined in the spec. func NewListBucketsParams() ListBucketsParams { return ListBucketsParams{} } // ListBucketsParams contains all the bound params for the list buckets operation // typically these are obtained from a http.Request // // swagger:parameters ListBuckets type ListBucketsParams 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 NewListBucketsParams() beforehand. func (o *ListBucketsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/bucket/list_buckets_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListBucketsOKCode is the HTTP code returned for type ListBucketsOK const ListBucketsOKCode int = 200 /* ListBucketsOK A successful response. swagger:response listBucketsOK */ type ListBucketsOK struct { /* In: Body */ Payload *models.ListBucketsResponse `json:"body,omitempty"` } // NewListBucketsOK creates ListBucketsOK with default headers values func NewListBucketsOK() *ListBucketsOK { return &ListBucketsOK{} } // WithPayload adds the payload to the list buckets o k response func (o *ListBucketsOK) WithPayload(payload *models.ListBucketsResponse) *ListBucketsOK { o.Payload = payload return o } // SetPayload sets the payload to the list buckets o k response func (o *ListBucketsOK) SetPayload(payload *models.ListBucketsResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListBucketsOK) 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 } } } /* ListBucketsDefault Generic error response. swagger:response listBucketsDefault */ type ListBucketsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListBucketsDefault creates ListBucketsDefault with default headers values func NewListBucketsDefault(code int) *ListBucketsDefault { if code <= 0 { code = 500 } return &ListBucketsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list buckets default response func (o *ListBucketsDefault) WithStatusCode(code int) *ListBucketsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list buckets default response func (o *ListBucketsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list buckets default response func (o *ListBucketsDefault) WithPayload(payload *models.APIError) *ListBucketsDefault { o.Payload = payload return o } // SetPayload sets the payload to the list buckets default response func (o *ListBucketsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListBucketsDefault) 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 } } } ================================================ FILE: api/operations/bucket/list_buckets_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" ) // ListBucketsURL generates an URL for the list buckets operation type ListBucketsURL 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 *ListBucketsURL) WithBasePath(bp string) *ListBucketsURL { 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 *ListBucketsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListBucketsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets" _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 *ListBucketsURL) 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 *ListBucketsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListBucketsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListBucketsURL") } if host == "" { return nil, errors.New("host is required for a full url on ListBucketsURL") } 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 *ListBucketsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/list_external_buckets.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListExternalBucketsHandlerFunc turns a function with the right signature into a list external buckets handler type ListExternalBucketsHandlerFunc func(ListExternalBucketsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListExternalBucketsHandlerFunc) Handle(params ListExternalBucketsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListExternalBucketsHandler interface for that can handle valid list external buckets params type ListExternalBucketsHandler interface { Handle(ListExternalBucketsParams, *models.Principal) middleware.Responder } // NewListExternalBuckets creates a new http.Handler for the list external buckets operation func NewListExternalBuckets(ctx *middleware.Context, handler ListExternalBucketsHandler) *ListExternalBuckets { return &ListExternalBuckets{Context: ctx, Handler: handler} } /* ListExternalBuckets swagger:route POST /list-external-buckets Bucket listExternalBuckets Lists an External list of buckets using custom credentials */ type ListExternalBuckets struct { Context *middleware.Context Handler ListExternalBucketsHandler } func (o *ListExternalBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListExternalBucketsParams() 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) } ================================================ FILE: api/operations/bucket/list_external_buckets_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewListExternalBucketsParams creates a new ListExternalBucketsParams object // // There are no default values defined in the spec. func NewListExternalBucketsParams() ListExternalBucketsParams { return ListExternalBucketsParams{} } // ListExternalBucketsParams contains all the bound params for the list external buckets operation // typically these are obtained from a http.Request // // swagger:parameters ListExternalBuckets type ListExternalBucketsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.ListExternalBucketsParams } // 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 NewListExternalBucketsParams() beforehand. func (o *ListExternalBucketsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.ListExternalBucketsParams if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/bucket/list_external_buckets_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListExternalBucketsOKCode is the HTTP code returned for type ListExternalBucketsOK const ListExternalBucketsOKCode int = 200 /* ListExternalBucketsOK A successful response. swagger:response listExternalBucketsOK */ type ListExternalBucketsOK struct { /* In: Body */ Payload *models.ListBucketsResponse `json:"body,omitempty"` } // NewListExternalBucketsOK creates ListExternalBucketsOK with default headers values func NewListExternalBucketsOK() *ListExternalBucketsOK { return &ListExternalBucketsOK{} } // WithPayload adds the payload to the list external buckets o k response func (o *ListExternalBucketsOK) WithPayload(payload *models.ListBucketsResponse) *ListExternalBucketsOK { o.Payload = payload return o } // SetPayload sets the payload to the list external buckets o k response func (o *ListExternalBucketsOK) SetPayload(payload *models.ListBucketsResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListExternalBucketsOK) 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 } } } /* ListExternalBucketsDefault Generic error response. swagger:response listExternalBucketsDefault */ type ListExternalBucketsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListExternalBucketsDefault creates ListExternalBucketsDefault with default headers values func NewListExternalBucketsDefault(code int) *ListExternalBucketsDefault { if code <= 0 { code = 500 } return &ListExternalBucketsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list external buckets default response func (o *ListExternalBucketsDefault) WithStatusCode(code int) *ListExternalBucketsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list external buckets default response func (o *ListExternalBucketsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list external buckets default response func (o *ListExternalBucketsDefault) WithPayload(payload *models.APIError) *ListExternalBucketsDefault { o.Payload = payload return o } // SetPayload sets the payload to the list external buckets default response func (o *ListExternalBucketsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListExternalBucketsDefault) 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 } } } ================================================ FILE: api/operations/bucket/list_external_buckets_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" ) // ListExternalBucketsURL generates an URL for the list external buckets operation type ListExternalBucketsURL 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 *ListExternalBucketsURL) WithBasePath(bp string) *ListExternalBucketsURL { 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 *ListExternalBucketsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListExternalBucketsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/list-external-buckets" _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 *ListExternalBucketsURL) 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 *ListExternalBucketsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListExternalBucketsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListExternalBucketsURL") } if host == "" { return nil, errors.New("host is required for a full url on ListExternalBucketsURL") } 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 *ListExternalBucketsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/list_policies_with_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListPoliciesWithBucketHandlerFunc turns a function with the right signature into a list policies with bucket handler type ListPoliciesWithBucketHandlerFunc func(ListPoliciesWithBucketParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListPoliciesWithBucketHandlerFunc) Handle(params ListPoliciesWithBucketParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListPoliciesWithBucketHandler interface for that can handle valid list policies with bucket params type ListPoliciesWithBucketHandler interface { Handle(ListPoliciesWithBucketParams, *models.Principal) middleware.Responder } // NewListPoliciesWithBucket creates a new http.Handler for the list policies with bucket operation func NewListPoliciesWithBucket(ctx *middleware.Context, handler ListPoliciesWithBucketHandler) *ListPoliciesWithBucket { return &ListPoliciesWithBucket{Context: ctx, Handler: handler} } /* ListPoliciesWithBucket swagger:route GET /bucket-policy/{bucket} Bucket listPoliciesWithBucket List Policies With Given Bucket */ type ListPoliciesWithBucket struct { Context *middleware.Context Handler ListPoliciesWithBucketHandler } func (o *ListPoliciesWithBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListPoliciesWithBucketParams() 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) } ================================================ FILE: api/operations/bucket/list_policies_with_bucket_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket 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" ) // NewListPoliciesWithBucketParams creates a new ListPoliciesWithBucketParams object // with the default values initialized. func NewListPoliciesWithBucketParams() ListPoliciesWithBucketParams { var ( // initialize parameters with default values limitDefault = int32(20) offsetDefault = int32(0) ) return ListPoliciesWithBucketParams{ Limit: &limitDefault, Offset: &offsetDefault, } } // ListPoliciesWithBucketParams contains all the bound params for the list policies with bucket operation // typically these are obtained from a http.Request // // swagger:parameters ListPoliciesWithBucket type ListPoliciesWithBucketParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Bucket string /* In: query Default: 20 */ Limit *int32 /* In: query Default: 0 */ Offset *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 NewListPoliciesWithBucketParams() beforehand. func (o *ListPoliciesWithBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucket, rhkBucket, _ := route.Params.GetOK("bucket") if err := o.bindBucket(rBucket, rhkBucket, route.Formats); err != nil { res = append(res, err) } 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) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucket binds and validates parameter Bucket from path. func (o *ListPoliciesWithBucketParams) bindBucket(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.Bucket = raw return nil } // bindLimit binds and validates parameter Limit from query. func (o *ListPoliciesWithBucketParams) 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 // Default values have been previously initialized by NewListPoliciesWithBucketParams() 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 *ListPoliciesWithBucketParams) 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 // Default values have been previously initialized by NewListPoliciesWithBucketParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("offset", "query", "int32", raw) } o.Offset = &value return nil } ================================================ FILE: api/operations/bucket/list_policies_with_bucket_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListPoliciesWithBucketOKCode is the HTTP code returned for type ListPoliciesWithBucketOK const ListPoliciesWithBucketOKCode int = 200 /* ListPoliciesWithBucketOK A successful response. swagger:response listPoliciesWithBucketOK */ type ListPoliciesWithBucketOK struct { /* In: Body */ Payload *models.ListPoliciesResponse `json:"body,omitempty"` } // NewListPoliciesWithBucketOK creates ListPoliciesWithBucketOK with default headers values func NewListPoliciesWithBucketOK() *ListPoliciesWithBucketOK { return &ListPoliciesWithBucketOK{} } // WithPayload adds the payload to the list policies with bucket o k response func (o *ListPoliciesWithBucketOK) WithPayload(payload *models.ListPoliciesResponse) *ListPoliciesWithBucketOK { o.Payload = payload return o } // SetPayload sets the payload to the list policies with bucket o k response func (o *ListPoliciesWithBucketOK) SetPayload(payload *models.ListPoliciesResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListPoliciesWithBucketOK) 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 } } } /* ListPoliciesWithBucketDefault Generic error response. swagger:response listPoliciesWithBucketDefault */ type ListPoliciesWithBucketDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListPoliciesWithBucketDefault creates ListPoliciesWithBucketDefault with default headers values func NewListPoliciesWithBucketDefault(code int) *ListPoliciesWithBucketDefault { if code <= 0 { code = 500 } return &ListPoliciesWithBucketDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list policies with bucket default response func (o *ListPoliciesWithBucketDefault) WithStatusCode(code int) *ListPoliciesWithBucketDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list policies with bucket default response func (o *ListPoliciesWithBucketDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list policies with bucket default response func (o *ListPoliciesWithBucketDefault) WithPayload(payload *models.APIError) *ListPoliciesWithBucketDefault { o.Payload = payload return o } // SetPayload sets the payload to the list policies with bucket default response func (o *ListPoliciesWithBucketDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListPoliciesWithBucketDefault) 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 } } } ================================================ FILE: api/operations/bucket/list_policies_with_bucket_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" "github.com/go-openapi/swag" ) // ListPoliciesWithBucketURL generates an URL for the list policies with bucket operation type ListPoliciesWithBucketURL struct { Bucket string Limit *int32 Offset *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 *ListPoliciesWithBucketURL) WithBasePath(bp string) *ListPoliciesWithBucketURL { 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 *ListPoliciesWithBucketURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListPoliciesWithBucketURL) Build() (*url.URL, error) { var _result url.URL var _path = "/bucket-policy/{bucket}" bucket := o.Bucket if bucket != "" { _path = strings.ReplaceAll(_path, "{bucket}", bucket) } else { return nil, errors.New("bucket is required on ListPoliciesWithBucketURL") } _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) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListPoliciesWithBucketURL) 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 *ListPoliciesWithBucketURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListPoliciesWithBucketURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListPoliciesWithBucketURL") } if host == "" { return nil, errors.New("host is required for a full url on ListPoliciesWithBucketURL") } 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 *ListPoliciesWithBucketURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/list_remote_buckets.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListRemoteBucketsHandlerFunc turns a function with the right signature into a list remote buckets handler type ListRemoteBucketsHandlerFunc func(ListRemoteBucketsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListRemoteBucketsHandlerFunc) Handle(params ListRemoteBucketsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListRemoteBucketsHandler interface for that can handle valid list remote buckets params type ListRemoteBucketsHandler interface { Handle(ListRemoteBucketsParams, *models.Principal) middleware.Responder } // NewListRemoteBuckets creates a new http.Handler for the list remote buckets operation func NewListRemoteBuckets(ctx *middleware.Context, handler ListRemoteBucketsHandler) *ListRemoteBuckets { return &ListRemoteBuckets{Context: ctx, Handler: handler} } /* ListRemoteBuckets swagger:route GET /remote-buckets Bucket listRemoteBuckets List Remote Buckets */ type ListRemoteBuckets struct { Context *middleware.Context Handler ListRemoteBucketsHandler } func (o *ListRemoteBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListRemoteBucketsParams() 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) } ================================================ FILE: api/operations/bucket/list_remote_buckets_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewListRemoteBucketsParams creates a new ListRemoteBucketsParams object // // There are no default values defined in the spec. func NewListRemoteBucketsParams() ListRemoteBucketsParams { return ListRemoteBucketsParams{} } // ListRemoteBucketsParams contains all the bound params for the list remote buckets operation // typically these are obtained from a http.Request // // swagger:parameters ListRemoteBuckets type ListRemoteBucketsParams 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 NewListRemoteBucketsParams() beforehand. func (o *ListRemoteBucketsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/bucket/list_remote_buckets_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListRemoteBucketsOKCode is the HTTP code returned for type ListRemoteBucketsOK const ListRemoteBucketsOKCode int = 200 /* ListRemoteBucketsOK A successful response. swagger:response listRemoteBucketsOK */ type ListRemoteBucketsOK struct { /* In: Body */ Payload *models.ListRemoteBucketsResponse `json:"body,omitempty"` } // NewListRemoteBucketsOK creates ListRemoteBucketsOK with default headers values func NewListRemoteBucketsOK() *ListRemoteBucketsOK { return &ListRemoteBucketsOK{} } // WithPayload adds the payload to the list remote buckets o k response func (o *ListRemoteBucketsOK) WithPayload(payload *models.ListRemoteBucketsResponse) *ListRemoteBucketsOK { o.Payload = payload return o } // SetPayload sets the payload to the list remote buckets o k response func (o *ListRemoteBucketsOK) SetPayload(payload *models.ListRemoteBucketsResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListRemoteBucketsOK) 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 } } } /* ListRemoteBucketsDefault Generic error response. swagger:response listRemoteBucketsDefault */ type ListRemoteBucketsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListRemoteBucketsDefault creates ListRemoteBucketsDefault with default headers values func NewListRemoteBucketsDefault(code int) *ListRemoteBucketsDefault { if code <= 0 { code = 500 } return &ListRemoteBucketsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list remote buckets default response func (o *ListRemoteBucketsDefault) WithStatusCode(code int) *ListRemoteBucketsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list remote buckets default response func (o *ListRemoteBucketsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list remote buckets default response func (o *ListRemoteBucketsDefault) WithPayload(payload *models.APIError) *ListRemoteBucketsDefault { o.Payload = payload return o } // SetPayload sets the payload to the list remote buckets default response func (o *ListRemoteBucketsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListRemoteBucketsDefault) 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 } } } ================================================ FILE: api/operations/bucket/list_remote_buckets_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" ) // ListRemoteBucketsURL generates an URL for the list remote buckets operation type ListRemoteBucketsURL 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 *ListRemoteBucketsURL) WithBasePath(bp string) *ListRemoteBucketsURL { 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 *ListRemoteBucketsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListRemoteBucketsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/remote-buckets" _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 *ListRemoteBucketsURL) 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 *ListRemoteBucketsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListRemoteBucketsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListRemoteBucketsURL") } if host == "" { return nil, errors.New("host is required for a full url on ListRemoteBucketsURL") } 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 *ListRemoteBucketsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/list_users_with_access_to_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListUsersWithAccessToBucketHandlerFunc turns a function with the right signature into a list users with access to bucket handler type ListUsersWithAccessToBucketHandlerFunc func(ListUsersWithAccessToBucketParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListUsersWithAccessToBucketHandlerFunc) Handle(params ListUsersWithAccessToBucketParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListUsersWithAccessToBucketHandler interface for that can handle valid list users with access to bucket params type ListUsersWithAccessToBucketHandler interface { Handle(ListUsersWithAccessToBucketParams, *models.Principal) middleware.Responder } // NewListUsersWithAccessToBucket creates a new http.Handler for the list users with access to bucket operation func NewListUsersWithAccessToBucket(ctx *middleware.Context, handler ListUsersWithAccessToBucketHandler) *ListUsersWithAccessToBucket { return &ListUsersWithAccessToBucket{Context: ctx, Handler: handler} } /* ListUsersWithAccessToBucket swagger:route GET /bucket-users/{bucket} Bucket listUsersWithAccessToBucket List Users With Access to a Given Bucket */ type ListUsersWithAccessToBucket struct { Context *middleware.Context Handler ListUsersWithAccessToBucketHandler } func (o *ListUsersWithAccessToBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListUsersWithAccessToBucketParams() 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) } ================================================ FILE: api/operations/bucket/list_users_with_access_to_bucket_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket 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" ) // NewListUsersWithAccessToBucketParams creates a new ListUsersWithAccessToBucketParams object // with the default values initialized. func NewListUsersWithAccessToBucketParams() ListUsersWithAccessToBucketParams { var ( // initialize parameters with default values limitDefault = int32(20) offsetDefault = int32(0) ) return ListUsersWithAccessToBucketParams{ Limit: &limitDefault, Offset: &offsetDefault, } } // ListUsersWithAccessToBucketParams contains all the bound params for the list users with access to bucket operation // typically these are obtained from a http.Request // // swagger:parameters ListUsersWithAccessToBucket type ListUsersWithAccessToBucketParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Bucket string /* In: query Default: 20 */ Limit *int32 /* In: query Default: 0 */ Offset *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 NewListUsersWithAccessToBucketParams() beforehand. func (o *ListUsersWithAccessToBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucket, rhkBucket, _ := route.Params.GetOK("bucket") if err := o.bindBucket(rBucket, rhkBucket, route.Formats); err != nil { res = append(res, err) } 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) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucket binds and validates parameter Bucket from path. func (o *ListUsersWithAccessToBucketParams) bindBucket(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.Bucket = raw return nil } // bindLimit binds and validates parameter Limit from query. func (o *ListUsersWithAccessToBucketParams) 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 // Default values have been previously initialized by NewListUsersWithAccessToBucketParams() 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 *ListUsersWithAccessToBucketParams) 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 // Default values have been previously initialized by NewListUsersWithAccessToBucketParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("offset", "query", "int32", raw) } o.Offset = &value return nil } ================================================ FILE: api/operations/bucket/list_users_with_access_to_bucket_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListUsersWithAccessToBucketOKCode is the HTTP code returned for type ListUsersWithAccessToBucketOK const ListUsersWithAccessToBucketOKCode int = 200 /* ListUsersWithAccessToBucketOK A successful response. swagger:response listUsersWithAccessToBucketOK */ type ListUsersWithAccessToBucketOK struct { /* In: Body */ Payload []string `json:"body,omitempty"` } // NewListUsersWithAccessToBucketOK creates ListUsersWithAccessToBucketOK with default headers values func NewListUsersWithAccessToBucketOK() *ListUsersWithAccessToBucketOK { return &ListUsersWithAccessToBucketOK{} } // WithPayload adds the payload to the list users with access to bucket o k response func (o *ListUsersWithAccessToBucketOK) WithPayload(payload []string) *ListUsersWithAccessToBucketOK { o.Payload = payload return o } // SetPayload sets the payload to the list users with access to bucket o k response func (o *ListUsersWithAccessToBucketOK) SetPayload(payload []string) { o.Payload = payload } // WriteResponse to the client func (o *ListUsersWithAccessToBucketOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(200) payload := o.Payload if payload == nil { // return empty array payload = make([]string, 0, 50) } if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } /* ListUsersWithAccessToBucketDefault Generic error response. swagger:response listUsersWithAccessToBucketDefault */ type ListUsersWithAccessToBucketDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListUsersWithAccessToBucketDefault creates ListUsersWithAccessToBucketDefault with default headers values func NewListUsersWithAccessToBucketDefault(code int) *ListUsersWithAccessToBucketDefault { if code <= 0 { code = 500 } return &ListUsersWithAccessToBucketDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list users with access to bucket default response func (o *ListUsersWithAccessToBucketDefault) WithStatusCode(code int) *ListUsersWithAccessToBucketDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list users with access to bucket default response func (o *ListUsersWithAccessToBucketDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list users with access to bucket default response func (o *ListUsersWithAccessToBucketDefault) WithPayload(payload *models.APIError) *ListUsersWithAccessToBucketDefault { o.Payload = payload return o } // SetPayload sets the payload to the list users with access to bucket default response func (o *ListUsersWithAccessToBucketDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListUsersWithAccessToBucketDefault) 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 } } } ================================================ FILE: api/operations/bucket/list_users_with_access_to_bucket_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" "github.com/go-openapi/swag" ) // ListUsersWithAccessToBucketURL generates an URL for the list users with access to bucket operation type ListUsersWithAccessToBucketURL struct { Bucket string Limit *int32 Offset *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 *ListUsersWithAccessToBucketURL) WithBasePath(bp string) *ListUsersWithAccessToBucketURL { 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 *ListUsersWithAccessToBucketURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListUsersWithAccessToBucketURL) Build() (*url.URL, error) { var _result url.URL var _path = "/bucket-users/{bucket}" bucket := o.Bucket if bucket != "" { _path = strings.ReplaceAll(_path, "{bucket}", bucket) } else { return nil, errors.New("bucket is required on ListUsersWithAccessToBucketURL") } _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) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListUsersWithAccessToBucketURL) 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 *ListUsersWithAccessToBucketURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListUsersWithAccessToBucketURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListUsersWithAccessToBucketURL") } if host == "" { return nil, errors.New("host is required for a full url on ListUsersWithAccessToBucketURL") } 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 *ListUsersWithAccessToBucketURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/make_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // MakeBucketHandlerFunc turns a function with the right signature into a make bucket handler type MakeBucketHandlerFunc func(MakeBucketParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn MakeBucketHandlerFunc) Handle(params MakeBucketParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // MakeBucketHandler interface for that can handle valid make bucket params type MakeBucketHandler interface { Handle(MakeBucketParams, *models.Principal) middleware.Responder } // NewMakeBucket creates a new http.Handler for the make bucket operation func NewMakeBucket(ctx *middleware.Context, handler MakeBucketHandler) *MakeBucket { return &MakeBucket{Context: ctx, Handler: handler} } /* MakeBucket swagger:route POST /buckets Bucket makeBucket Make bucket */ type MakeBucket struct { Context *middleware.Context Handler MakeBucketHandler } func (o *MakeBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewMakeBucketParams() 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) } ================================================ FILE: api/operations/bucket/make_bucket_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewMakeBucketParams creates a new MakeBucketParams object // // There are no default values defined in the spec. func NewMakeBucketParams() MakeBucketParams { return MakeBucketParams{} } // MakeBucketParams contains all the bound params for the make bucket operation // typically these are obtained from a http.Request // // swagger:parameters MakeBucket type MakeBucketParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.MakeBucketRequest } // 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 NewMakeBucketParams() beforehand. func (o *MakeBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.MakeBucketRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/bucket/make_bucket_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // MakeBucketOKCode is the HTTP code returned for type MakeBucketOK const MakeBucketOKCode int = 200 /* MakeBucketOK A successful response. swagger:response makeBucketOK */ type MakeBucketOK struct { /* In: Body */ Payload *models.MakeBucketsResponse `json:"body,omitempty"` } // NewMakeBucketOK creates MakeBucketOK with default headers values func NewMakeBucketOK() *MakeBucketOK { return &MakeBucketOK{} } // WithPayload adds the payload to the make bucket o k response func (o *MakeBucketOK) WithPayload(payload *models.MakeBucketsResponse) *MakeBucketOK { o.Payload = payload return o } // SetPayload sets the payload to the make bucket o k response func (o *MakeBucketOK) SetPayload(payload *models.MakeBucketsResponse) { o.Payload = payload } // WriteResponse to the client func (o *MakeBucketOK) 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 } } } /* MakeBucketDefault Generic error response. swagger:response makeBucketDefault */ type MakeBucketDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewMakeBucketDefault creates MakeBucketDefault with default headers values func NewMakeBucketDefault(code int) *MakeBucketDefault { if code <= 0 { code = 500 } return &MakeBucketDefault{ _statusCode: code, } } // WithStatusCode adds the status to the make bucket default response func (o *MakeBucketDefault) WithStatusCode(code int) *MakeBucketDefault { o._statusCode = code return o } // SetStatusCode sets the status to the make bucket default response func (o *MakeBucketDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the make bucket default response func (o *MakeBucketDefault) WithPayload(payload *models.APIError) *MakeBucketDefault { o.Payload = payload return o } // SetPayload sets the payload to the make bucket default response func (o *MakeBucketDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *MakeBucketDefault) 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 } } } ================================================ FILE: api/operations/bucket/make_bucket_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" ) // MakeBucketURL generates an URL for the make bucket operation type MakeBucketURL 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 *MakeBucketURL) WithBasePath(bp string) *MakeBucketURL { 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 *MakeBucketURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *MakeBucketURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets" _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 *MakeBucketURL) 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 *MakeBucketURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *MakeBucketURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on MakeBucketURL") } if host == "" { return nil, errors.New("host is required for a full url on MakeBucketURL") } 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 *MakeBucketURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/put_bucket_tags.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // PutBucketTagsHandlerFunc turns a function with the right signature into a put bucket tags handler type PutBucketTagsHandlerFunc func(PutBucketTagsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn PutBucketTagsHandlerFunc) Handle(params PutBucketTagsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // PutBucketTagsHandler interface for that can handle valid put bucket tags params type PutBucketTagsHandler interface { Handle(PutBucketTagsParams, *models.Principal) middleware.Responder } // NewPutBucketTags creates a new http.Handler for the put bucket tags operation func NewPutBucketTags(ctx *middleware.Context, handler PutBucketTagsHandler) *PutBucketTags { return &PutBucketTags{Context: ctx, Handler: handler} } /* PutBucketTags swagger:route PUT /buckets/{bucket_name}/tags Bucket putBucketTags Put Bucket's tags */ type PutBucketTags struct { Context *middleware.Context Handler PutBucketTagsHandler } func (o *PutBucketTags) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewPutBucketTagsParams() 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) } ================================================ FILE: api/operations/bucket/put_bucket_tags_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewPutBucketTagsParams creates a new PutBucketTagsParams object // // There are no default values defined in the spec. func NewPutBucketTagsParams() PutBucketTagsParams { return PutBucketTagsParams{} } // PutBucketTagsParams contains all the bound params for the put bucket tags operation // typically these are obtained from a http.Request // // swagger:parameters PutBucketTags type PutBucketTagsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.PutBucketTagsRequest /* Required: true In: path */ BucketName 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 NewPutBucketTagsParams() beforehand. func (o *PutBucketTagsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.PutBucketTagsRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *PutBucketTagsParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/put_bucket_tags_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // PutBucketTagsOKCode is the HTTP code returned for type PutBucketTagsOK const PutBucketTagsOKCode int = 200 /* PutBucketTagsOK A successful response. swagger:response putBucketTagsOK */ type PutBucketTagsOK struct { } // NewPutBucketTagsOK creates PutBucketTagsOK with default headers values func NewPutBucketTagsOK() *PutBucketTagsOK { return &PutBucketTagsOK{} } // WriteResponse to the client func (o *PutBucketTagsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* PutBucketTagsDefault Generic error response. swagger:response putBucketTagsDefault */ type PutBucketTagsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewPutBucketTagsDefault creates PutBucketTagsDefault with default headers values func NewPutBucketTagsDefault(code int) *PutBucketTagsDefault { if code <= 0 { code = 500 } return &PutBucketTagsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the put bucket tags default response func (o *PutBucketTagsDefault) WithStatusCode(code int) *PutBucketTagsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the put bucket tags default response func (o *PutBucketTagsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the put bucket tags default response func (o *PutBucketTagsDefault) WithPayload(payload *models.APIError) *PutBucketTagsDefault { o.Payload = payload return o } // SetPayload sets the payload to the put bucket tags default response func (o *PutBucketTagsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *PutBucketTagsDefault) 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 } } } ================================================ FILE: api/operations/bucket/put_bucket_tags_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // PutBucketTagsURL generates an URL for the put bucket tags operation type PutBucketTagsURL struct { BucketName 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 *PutBucketTagsURL) WithBasePath(bp string) *PutBucketTagsURL { 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 *PutBucketTagsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *PutBucketTagsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/tags" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on PutBucketTagsURL") } _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 *PutBucketTagsURL) 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 *PutBucketTagsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *PutBucketTagsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on PutBucketTagsURL") } if host == "" { return nil, errors.New("host is required for a full url on PutBucketTagsURL") } 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 *PutBucketTagsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/remote_bucket_details.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // RemoteBucketDetailsHandlerFunc turns a function with the right signature into a remote bucket details handler type RemoteBucketDetailsHandlerFunc func(RemoteBucketDetailsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn RemoteBucketDetailsHandlerFunc) Handle(params RemoteBucketDetailsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // RemoteBucketDetailsHandler interface for that can handle valid remote bucket details params type RemoteBucketDetailsHandler interface { Handle(RemoteBucketDetailsParams, *models.Principal) middleware.Responder } // NewRemoteBucketDetails creates a new http.Handler for the remote bucket details operation func NewRemoteBucketDetails(ctx *middleware.Context, handler RemoteBucketDetailsHandler) *RemoteBucketDetails { return &RemoteBucketDetails{Context: ctx, Handler: handler} } /* RemoteBucketDetails swagger:route GET /remote-buckets/{name} Bucket remoteBucketDetails Remote Bucket Details */ type RemoteBucketDetails struct { Context *middleware.Context Handler RemoteBucketDetailsHandler } func (o *RemoteBucketDetails) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewRemoteBucketDetailsParams() 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) } ================================================ FILE: api/operations/bucket/remote_bucket_details_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewRemoteBucketDetailsParams creates a new RemoteBucketDetailsParams object // // There are no default values defined in the spec. func NewRemoteBucketDetailsParams() RemoteBucketDetailsParams { return RemoteBucketDetailsParams{} } // RemoteBucketDetailsParams contains all the bound params for the remote bucket details operation // typically these are obtained from a http.Request // // swagger:parameters RemoteBucketDetails type RemoteBucketDetailsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewRemoteBucketDetailsParams() beforehand. func (o *RemoteBucketDetailsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *RemoteBucketDetailsParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/bucket/remote_bucket_details_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // RemoteBucketDetailsOKCode is the HTTP code returned for type RemoteBucketDetailsOK const RemoteBucketDetailsOKCode int = 200 /* RemoteBucketDetailsOK A successful response. swagger:response remoteBucketDetailsOK */ type RemoteBucketDetailsOK struct { /* In: Body */ Payload *models.RemoteBucket `json:"body,omitempty"` } // NewRemoteBucketDetailsOK creates RemoteBucketDetailsOK with default headers values func NewRemoteBucketDetailsOK() *RemoteBucketDetailsOK { return &RemoteBucketDetailsOK{} } // WithPayload adds the payload to the remote bucket details o k response func (o *RemoteBucketDetailsOK) WithPayload(payload *models.RemoteBucket) *RemoteBucketDetailsOK { o.Payload = payload return o } // SetPayload sets the payload to the remote bucket details o k response func (o *RemoteBucketDetailsOK) SetPayload(payload *models.RemoteBucket) { o.Payload = payload } // WriteResponse to the client func (o *RemoteBucketDetailsOK) 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 } } } /* RemoteBucketDetailsDefault Generic error response. swagger:response remoteBucketDetailsDefault */ type RemoteBucketDetailsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewRemoteBucketDetailsDefault creates RemoteBucketDetailsDefault with default headers values func NewRemoteBucketDetailsDefault(code int) *RemoteBucketDetailsDefault { if code <= 0 { code = 500 } return &RemoteBucketDetailsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the remote bucket details default response func (o *RemoteBucketDetailsDefault) WithStatusCode(code int) *RemoteBucketDetailsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the remote bucket details default response func (o *RemoteBucketDetailsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the remote bucket details default response func (o *RemoteBucketDetailsDefault) WithPayload(payload *models.APIError) *RemoteBucketDetailsDefault { o.Payload = payload return o } // SetPayload sets the payload to the remote bucket details default response func (o *RemoteBucketDetailsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *RemoteBucketDetailsDefault) 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 } } } ================================================ FILE: api/operations/bucket/remote_bucket_details_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // RemoteBucketDetailsURL generates an URL for the remote bucket details operation type RemoteBucketDetailsURL struct { Name 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 *RemoteBucketDetailsURL) WithBasePath(bp string) *RemoteBucketDetailsURL { 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 *RemoteBucketDetailsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *RemoteBucketDetailsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/remote-buckets/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on RemoteBucketDetailsURL") } _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 *RemoteBucketDetailsURL) 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 *RemoteBucketDetailsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *RemoteBucketDetailsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on RemoteBucketDetailsURL") } if host == "" { return nil, errors.New("host is required for a full url on RemoteBucketDetailsURL") } 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 *RemoteBucketDetailsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/set_access_rule_with_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SetAccessRuleWithBucketHandlerFunc turns a function with the right signature into a set access rule with bucket handler type SetAccessRuleWithBucketHandlerFunc func(SetAccessRuleWithBucketParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SetAccessRuleWithBucketHandlerFunc) Handle(params SetAccessRuleWithBucketParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SetAccessRuleWithBucketHandler interface for that can handle valid set access rule with bucket params type SetAccessRuleWithBucketHandler interface { Handle(SetAccessRuleWithBucketParams, *models.Principal) middleware.Responder } // NewSetAccessRuleWithBucket creates a new http.Handler for the set access rule with bucket operation func NewSetAccessRuleWithBucket(ctx *middleware.Context, handler SetAccessRuleWithBucketHandler) *SetAccessRuleWithBucket { return &SetAccessRuleWithBucket{Context: ctx, Handler: handler} } /* SetAccessRuleWithBucket swagger:route PUT /bucket/{bucket}/access-rules Bucket setAccessRuleWithBucket Add Access Rule To Given Bucket */ type SetAccessRuleWithBucket struct { Context *middleware.Context Handler SetAccessRuleWithBucketHandler } func (o *SetAccessRuleWithBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSetAccessRuleWithBucketParams() 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) } ================================================ FILE: api/operations/bucket/set_access_rule_with_bucket_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewSetAccessRuleWithBucketParams creates a new SetAccessRuleWithBucketParams object // // There are no default values defined in the spec. func NewSetAccessRuleWithBucketParams() SetAccessRuleWithBucketParams { return SetAccessRuleWithBucketParams{} } // SetAccessRuleWithBucketParams contains all the bound params for the set access rule with bucket operation // typically these are obtained from a http.Request // // swagger:parameters SetAccessRuleWithBucket type SetAccessRuleWithBucketParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Bucket string /* Required: true In: body */ Prefixaccess *models.PrefixAccessPair } // 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 NewSetAccessRuleWithBucketParams() beforehand. func (o *SetAccessRuleWithBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucket, rhkBucket, _ := route.Params.GetOK("bucket") if err := o.bindBucket(rBucket, rhkBucket, route.Formats); err != nil { res = append(res, err) } if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.PrefixAccessPair if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(err, io.EOF) { res = append(res, errors.Required("prefixaccess", "body", "")) } else { res = append(res, errors.NewParseError("prefixaccess", "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.Prefixaccess = &body } } } else { res = append(res, errors.Required("prefixaccess", "body", "")) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucket binds and validates parameter Bucket from path. func (o *SetAccessRuleWithBucketParams) bindBucket(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.Bucket = raw return nil } ================================================ FILE: api/operations/bucket/set_access_rule_with_bucket_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SetAccessRuleWithBucketOKCode is the HTTP code returned for type SetAccessRuleWithBucketOK const SetAccessRuleWithBucketOKCode int = 200 /* SetAccessRuleWithBucketOK A successful response. swagger:response setAccessRuleWithBucketOK */ type SetAccessRuleWithBucketOK struct { /* In: Body */ Payload bool `json:"body,omitempty"` } // NewSetAccessRuleWithBucketOK creates SetAccessRuleWithBucketOK with default headers values func NewSetAccessRuleWithBucketOK() *SetAccessRuleWithBucketOK { return &SetAccessRuleWithBucketOK{} } // WithPayload adds the payload to the set access rule with bucket o k response func (o *SetAccessRuleWithBucketOK) WithPayload(payload bool) *SetAccessRuleWithBucketOK { o.Payload = payload return o } // SetPayload sets the payload to the set access rule with bucket o k response func (o *SetAccessRuleWithBucketOK) SetPayload(payload bool) { o.Payload = payload } // WriteResponse to the client func (o *SetAccessRuleWithBucketOK) 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 } } /* SetAccessRuleWithBucketDefault Generic error response. swagger:response setAccessRuleWithBucketDefault */ type SetAccessRuleWithBucketDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSetAccessRuleWithBucketDefault creates SetAccessRuleWithBucketDefault with default headers values func NewSetAccessRuleWithBucketDefault(code int) *SetAccessRuleWithBucketDefault { if code <= 0 { code = 500 } return &SetAccessRuleWithBucketDefault{ _statusCode: code, } } // WithStatusCode adds the status to the set access rule with bucket default response func (o *SetAccessRuleWithBucketDefault) WithStatusCode(code int) *SetAccessRuleWithBucketDefault { o._statusCode = code return o } // SetStatusCode sets the status to the set access rule with bucket default response func (o *SetAccessRuleWithBucketDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the set access rule with bucket default response func (o *SetAccessRuleWithBucketDefault) WithPayload(payload *models.APIError) *SetAccessRuleWithBucketDefault { o.Payload = payload return o } // SetPayload sets the payload to the set access rule with bucket default response func (o *SetAccessRuleWithBucketDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SetAccessRuleWithBucketDefault) 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 } } } ================================================ FILE: api/operations/bucket/set_access_rule_with_bucket_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // SetAccessRuleWithBucketURL generates an URL for the set access rule with bucket operation type SetAccessRuleWithBucketURL struct { Bucket 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 *SetAccessRuleWithBucketURL) WithBasePath(bp string) *SetAccessRuleWithBucketURL { 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 *SetAccessRuleWithBucketURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SetAccessRuleWithBucketURL) Build() (*url.URL, error) { var _result url.URL var _path = "/bucket/{bucket}/access-rules" bucket := o.Bucket if bucket != "" { _path = strings.ReplaceAll(_path, "{bucket}", bucket) } else { return nil, errors.New("bucket is required on SetAccessRuleWithBucketURL") } _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 *SetAccessRuleWithBucketURL) 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 *SetAccessRuleWithBucketURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SetAccessRuleWithBucketURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SetAccessRuleWithBucketURL") } if host == "" { return nil, errors.New("host is required for a full url on SetAccessRuleWithBucketURL") } 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 *SetAccessRuleWithBucketURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/set_bucket_quota.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SetBucketQuotaHandlerFunc turns a function with the right signature into a set bucket quota handler type SetBucketQuotaHandlerFunc func(SetBucketQuotaParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SetBucketQuotaHandlerFunc) Handle(params SetBucketQuotaParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SetBucketQuotaHandler interface for that can handle valid set bucket quota params type SetBucketQuotaHandler interface { Handle(SetBucketQuotaParams, *models.Principal) middleware.Responder } // NewSetBucketQuota creates a new http.Handler for the set bucket quota operation func NewSetBucketQuota(ctx *middleware.Context, handler SetBucketQuotaHandler) *SetBucketQuota { return &SetBucketQuota{Context: ctx, Handler: handler} } /* SetBucketQuota swagger:route PUT /buckets/{name}/quota Bucket setBucketQuota Bucket Quota */ type SetBucketQuota struct { Context *middleware.Context Handler SetBucketQuotaHandler } func (o *SetBucketQuota) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSetBucketQuotaParams() 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) } ================================================ FILE: api/operations/bucket/set_bucket_quota_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewSetBucketQuotaParams creates a new SetBucketQuotaParams object // // There are no default values defined in the spec. func NewSetBucketQuotaParams() SetBucketQuotaParams { return SetBucketQuotaParams{} } // SetBucketQuotaParams contains all the bound params for the set bucket quota operation // typically these are obtained from a http.Request // // swagger:parameters SetBucketQuota type SetBucketQuotaParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.SetBucketQuota /* Required: true In: path */ Name 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 NewSetBucketQuotaParams() beforehand. func (o *SetBucketQuotaParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.SetBucketQuota if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *SetBucketQuotaParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/bucket/set_bucket_quota_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SetBucketQuotaOKCode is the HTTP code returned for type SetBucketQuotaOK const SetBucketQuotaOKCode int = 200 /* SetBucketQuotaOK A successful response. swagger:response setBucketQuotaOK */ type SetBucketQuotaOK struct { /* In: Body */ Payload *models.Bucket `json:"body,omitempty"` } // NewSetBucketQuotaOK creates SetBucketQuotaOK with default headers values func NewSetBucketQuotaOK() *SetBucketQuotaOK { return &SetBucketQuotaOK{} } // WithPayload adds the payload to the set bucket quota o k response func (o *SetBucketQuotaOK) WithPayload(payload *models.Bucket) *SetBucketQuotaOK { o.Payload = payload return o } // SetPayload sets the payload to the set bucket quota o k response func (o *SetBucketQuotaOK) SetPayload(payload *models.Bucket) { o.Payload = payload } // WriteResponse to the client func (o *SetBucketQuotaOK) 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 } } } /* SetBucketQuotaDefault Generic error response. swagger:response setBucketQuotaDefault */ type SetBucketQuotaDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSetBucketQuotaDefault creates SetBucketQuotaDefault with default headers values func NewSetBucketQuotaDefault(code int) *SetBucketQuotaDefault { if code <= 0 { code = 500 } return &SetBucketQuotaDefault{ _statusCode: code, } } // WithStatusCode adds the status to the set bucket quota default response func (o *SetBucketQuotaDefault) WithStatusCode(code int) *SetBucketQuotaDefault { o._statusCode = code return o } // SetStatusCode sets the status to the set bucket quota default response func (o *SetBucketQuotaDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the set bucket quota default response func (o *SetBucketQuotaDefault) WithPayload(payload *models.APIError) *SetBucketQuotaDefault { o.Payload = payload return o } // SetPayload sets the payload to the set bucket quota default response func (o *SetBucketQuotaDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SetBucketQuotaDefault) 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 } } } ================================================ FILE: api/operations/bucket/set_bucket_quota_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // SetBucketQuotaURL generates an URL for the set bucket quota operation type SetBucketQuotaURL struct { Name 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 *SetBucketQuotaURL) WithBasePath(bp string) *SetBucketQuotaURL { 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 *SetBucketQuotaURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SetBucketQuotaURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{name}/quota" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on SetBucketQuotaURL") } _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 *SetBucketQuotaURL) 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 *SetBucketQuotaURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SetBucketQuotaURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SetBucketQuotaURL") } if host == "" { return nil, errors.New("host is required for a full url on SetBucketQuotaURL") } 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 *SetBucketQuotaURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/set_bucket_retention_config.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SetBucketRetentionConfigHandlerFunc turns a function with the right signature into a set bucket retention config handler type SetBucketRetentionConfigHandlerFunc func(SetBucketRetentionConfigParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SetBucketRetentionConfigHandlerFunc) Handle(params SetBucketRetentionConfigParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SetBucketRetentionConfigHandler interface for that can handle valid set bucket retention config params type SetBucketRetentionConfigHandler interface { Handle(SetBucketRetentionConfigParams, *models.Principal) middleware.Responder } // NewSetBucketRetentionConfig creates a new http.Handler for the set bucket retention config operation func NewSetBucketRetentionConfig(ctx *middleware.Context, handler SetBucketRetentionConfigHandler) *SetBucketRetentionConfig { return &SetBucketRetentionConfig{Context: ctx, Handler: handler} } /* SetBucketRetentionConfig swagger:route PUT /buckets/{bucket_name}/retention Bucket setBucketRetentionConfig Set Bucket's retention config */ type SetBucketRetentionConfig struct { Context *middleware.Context Handler SetBucketRetentionConfigHandler } func (o *SetBucketRetentionConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSetBucketRetentionConfigParams() 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) } ================================================ FILE: api/operations/bucket/set_bucket_retention_config_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewSetBucketRetentionConfigParams creates a new SetBucketRetentionConfigParams object // // There are no default values defined in the spec. func NewSetBucketRetentionConfigParams() SetBucketRetentionConfigParams { return SetBucketRetentionConfigParams{} } // SetBucketRetentionConfigParams contains all the bound params for the set bucket retention config operation // typically these are obtained from a http.Request // // swagger:parameters SetBucketRetentionConfig type SetBucketRetentionConfigParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.PutBucketRetentionRequest /* Required: true In: path */ BucketName 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 NewSetBucketRetentionConfigParams() beforehand. func (o *SetBucketRetentionConfigParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.PutBucketRetentionRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *SetBucketRetentionConfigParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/set_bucket_retention_config_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SetBucketRetentionConfigOKCode is the HTTP code returned for type SetBucketRetentionConfigOK const SetBucketRetentionConfigOKCode int = 200 /* SetBucketRetentionConfigOK A successful response. swagger:response setBucketRetentionConfigOK */ type SetBucketRetentionConfigOK struct { } // NewSetBucketRetentionConfigOK creates SetBucketRetentionConfigOK with default headers values func NewSetBucketRetentionConfigOK() *SetBucketRetentionConfigOK { return &SetBucketRetentionConfigOK{} } // WriteResponse to the client func (o *SetBucketRetentionConfigOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* SetBucketRetentionConfigDefault Generic error response. swagger:response setBucketRetentionConfigDefault */ type SetBucketRetentionConfigDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSetBucketRetentionConfigDefault creates SetBucketRetentionConfigDefault with default headers values func NewSetBucketRetentionConfigDefault(code int) *SetBucketRetentionConfigDefault { if code <= 0 { code = 500 } return &SetBucketRetentionConfigDefault{ _statusCode: code, } } // WithStatusCode adds the status to the set bucket retention config default response func (o *SetBucketRetentionConfigDefault) WithStatusCode(code int) *SetBucketRetentionConfigDefault { o._statusCode = code return o } // SetStatusCode sets the status to the set bucket retention config default response func (o *SetBucketRetentionConfigDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the set bucket retention config default response func (o *SetBucketRetentionConfigDefault) WithPayload(payload *models.APIError) *SetBucketRetentionConfigDefault { o.Payload = payload return o } // SetPayload sets the payload to the set bucket retention config default response func (o *SetBucketRetentionConfigDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SetBucketRetentionConfigDefault) 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 } } } ================================================ FILE: api/operations/bucket/set_bucket_retention_config_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // SetBucketRetentionConfigURL generates an URL for the set bucket retention config operation type SetBucketRetentionConfigURL struct { BucketName 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 *SetBucketRetentionConfigURL) WithBasePath(bp string) *SetBucketRetentionConfigURL { 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 *SetBucketRetentionConfigURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SetBucketRetentionConfigURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/retention" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on SetBucketRetentionConfigURL") } _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 *SetBucketRetentionConfigURL) 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 *SetBucketRetentionConfigURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SetBucketRetentionConfigURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SetBucketRetentionConfigURL") } if host == "" { return nil, errors.New("host is required for a full url on SetBucketRetentionConfigURL") } 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 *SetBucketRetentionConfigURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/set_bucket_versioning.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SetBucketVersioningHandlerFunc turns a function with the right signature into a set bucket versioning handler type SetBucketVersioningHandlerFunc func(SetBucketVersioningParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SetBucketVersioningHandlerFunc) Handle(params SetBucketVersioningParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SetBucketVersioningHandler interface for that can handle valid set bucket versioning params type SetBucketVersioningHandler interface { Handle(SetBucketVersioningParams, *models.Principal) middleware.Responder } // NewSetBucketVersioning creates a new http.Handler for the set bucket versioning operation func NewSetBucketVersioning(ctx *middleware.Context, handler SetBucketVersioningHandler) *SetBucketVersioning { return &SetBucketVersioning{Context: ctx, Handler: handler} } /* SetBucketVersioning swagger:route PUT /buckets/{bucket_name}/versioning Bucket setBucketVersioning Set Bucket Versioning */ type SetBucketVersioning struct { Context *middleware.Context Handler SetBucketVersioningHandler } func (o *SetBucketVersioning) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSetBucketVersioningParams() 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) } ================================================ FILE: api/operations/bucket/set_bucket_versioning_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewSetBucketVersioningParams creates a new SetBucketVersioningParams object // // There are no default values defined in the spec. func NewSetBucketVersioningParams() SetBucketVersioningParams { return SetBucketVersioningParams{} } // SetBucketVersioningParams contains all the bound params for the set bucket versioning operation // typically these are obtained from a http.Request // // swagger:parameters SetBucketVersioning type SetBucketVersioningParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.SetBucketVersioning /* Required: true In: path */ BucketName 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 NewSetBucketVersioningParams() beforehand. func (o *SetBucketVersioningParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.SetBucketVersioning if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *SetBucketVersioningParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/bucket/set_bucket_versioning_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SetBucketVersioningCreatedCode is the HTTP code returned for type SetBucketVersioningCreated const SetBucketVersioningCreatedCode int = 201 /* SetBucketVersioningCreated A successful response. swagger:response setBucketVersioningCreated */ type SetBucketVersioningCreated struct { } // NewSetBucketVersioningCreated creates SetBucketVersioningCreated with default headers values func NewSetBucketVersioningCreated() *SetBucketVersioningCreated { return &SetBucketVersioningCreated{} } // WriteResponse to the client func (o *SetBucketVersioningCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(201) } /* SetBucketVersioningDefault Generic error response. swagger:response setBucketVersioningDefault */ type SetBucketVersioningDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSetBucketVersioningDefault creates SetBucketVersioningDefault with default headers values func NewSetBucketVersioningDefault(code int) *SetBucketVersioningDefault { if code <= 0 { code = 500 } return &SetBucketVersioningDefault{ _statusCode: code, } } // WithStatusCode adds the status to the set bucket versioning default response func (o *SetBucketVersioningDefault) WithStatusCode(code int) *SetBucketVersioningDefault { o._statusCode = code return o } // SetStatusCode sets the status to the set bucket versioning default response func (o *SetBucketVersioningDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the set bucket versioning default response func (o *SetBucketVersioningDefault) WithPayload(payload *models.APIError) *SetBucketVersioningDefault { o.Payload = payload return o } // SetPayload sets the payload to the set bucket versioning default response func (o *SetBucketVersioningDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SetBucketVersioningDefault) 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 } } } ================================================ FILE: api/operations/bucket/set_bucket_versioning_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // SetBucketVersioningURL generates an URL for the set bucket versioning operation type SetBucketVersioningURL struct { BucketName 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 *SetBucketVersioningURL) WithBasePath(bp string) *SetBucketVersioningURL { 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 *SetBucketVersioningURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SetBucketVersioningURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/versioning" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on SetBucketVersioningURL") } _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 *SetBucketVersioningURL) 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 *SetBucketVersioningURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SetBucketVersioningURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SetBucketVersioningURL") } if host == "" { return nil, errors.New("host is required for a full url on SetBucketVersioningURL") } 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 *SetBucketVersioningURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/set_multi_bucket_replication.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SetMultiBucketReplicationHandlerFunc turns a function with the right signature into a set multi bucket replication handler type SetMultiBucketReplicationHandlerFunc func(SetMultiBucketReplicationParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SetMultiBucketReplicationHandlerFunc) Handle(params SetMultiBucketReplicationParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SetMultiBucketReplicationHandler interface for that can handle valid set multi bucket replication params type SetMultiBucketReplicationHandler interface { Handle(SetMultiBucketReplicationParams, *models.Principal) middleware.Responder } // NewSetMultiBucketReplication creates a new http.Handler for the set multi bucket replication operation func NewSetMultiBucketReplication(ctx *middleware.Context, handler SetMultiBucketReplicationHandler) *SetMultiBucketReplication { return &SetMultiBucketReplication{Context: ctx, Handler: handler} } /* SetMultiBucketReplication swagger:route POST /buckets-replication Bucket setMultiBucketReplication Sets Multi Bucket Replication in multiple Buckets */ type SetMultiBucketReplication struct { Context *middleware.Context Handler SetMultiBucketReplicationHandler } func (o *SetMultiBucketReplication) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSetMultiBucketReplicationParams() 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) } ================================================ FILE: api/operations/bucket/set_multi_bucket_replication_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewSetMultiBucketReplicationParams creates a new SetMultiBucketReplicationParams object // // There are no default values defined in the spec. func NewSetMultiBucketReplicationParams() SetMultiBucketReplicationParams { return SetMultiBucketReplicationParams{} } // SetMultiBucketReplicationParams contains all the bound params for the set multi bucket replication operation // typically these are obtained from a http.Request // // swagger:parameters SetMultiBucketReplication type SetMultiBucketReplicationParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.MultiBucketReplication } // 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 NewSetMultiBucketReplicationParams() beforehand. func (o *SetMultiBucketReplicationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.MultiBucketReplication if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/bucket/set_multi_bucket_replication_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SetMultiBucketReplicationOKCode is the HTTP code returned for type SetMultiBucketReplicationOK const SetMultiBucketReplicationOKCode int = 200 /* SetMultiBucketReplicationOK A successful response. swagger:response setMultiBucketReplicationOK */ type SetMultiBucketReplicationOK struct { /* In: Body */ Payload *models.MultiBucketResponseState `json:"body,omitempty"` } // NewSetMultiBucketReplicationOK creates SetMultiBucketReplicationOK with default headers values func NewSetMultiBucketReplicationOK() *SetMultiBucketReplicationOK { return &SetMultiBucketReplicationOK{} } // WithPayload adds the payload to the set multi bucket replication o k response func (o *SetMultiBucketReplicationOK) WithPayload(payload *models.MultiBucketResponseState) *SetMultiBucketReplicationOK { o.Payload = payload return o } // SetPayload sets the payload to the set multi bucket replication o k response func (o *SetMultiBucketReplicationOK) SetPayload(payload *models.MultiBucketResponseState) { o.Payload = payload } // WriteResponse to the client func (o *SetMultiBucketReplicationOK) 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 } } } /* SetMultiBucketReplicationDefault Generic error response. swagger:response setMultiBucketReplicationDefault */ type SetMultiBucketReplicationDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSetMultiBucketReplicationDefault creates SetMultiBucketReplicationDefault with default headers values func NewSetMultiBucketReplicationDefault(code int) *SetMultiBucketReplicationDefault { if code <= 0 { code = 500 } return &SetMultiBucketReplicationDefault{ _statusCode: code, } } // WithStatusCode adds the status to the set multi bucket replication default response func (o *SetMultiBucketReplicationDefault) WithStatusCode(code int) *SetMultiBucketReplicationDefault { o._statusCode = code return o } // SetStatusCode sets the status to the set multi bucket replication default response func (o *SetMultiBucketReplicationDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the set multi bucket replication default response func (o *SetMultiBucketReplicationDefault) WithPayload(payload *models.APIError) *SetMultiBucketReplicationDefault { o.Payload = payload return o } // SetPayload sets the payload to the set multi bucket replication default response func (o *SetMultiBucketReplicationDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SetMultiBucketReplicationDefault) 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 } } } ================================================ FILE: api/operations/bucket/set_multi_bucket_replication_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" ) // SetMultiBucketReplicationURL generates an URL for the set multi bucket replication operation type SetMultiBucketReplicationURL 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 *SetMultiBucketReplicationURL) WithBasePath(bp string) *SetMultiBucketReplicationURL { 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 *SetMultiBucketReplicationURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SetMultiBucketReplicationURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets-replication" _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 *SetMultiBucketReplicationURL) 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 *SetMultiBucketReplicationURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SetMultiBucketReplicationURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SetMultiBucketReplicationURL") } if host == "" { return nil, errors.New("host is required for a full url on SetMultiBucketReplicationURL") } 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 *SetMultiBucketReplicationURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/update_bucket_lifecycle.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // UpdateBucketLifecycleHandlerFunc turns a function with the right signature into a update bucket lifecycle handler type UpdateBucketLifecycleHandlerFunc func(UpdateBucketLifecycleParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn UpdateBucketLifecycleHandlerFunc) Handle(params UpdateBucketLifecycleParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // UpdateBucketLifecycleHandler interface for that can handle valid update bucket lifecycle params type UpdateBucketLifecycleHandler interface { Handle(UpdateBucketLifecycleParams, *models.Principal) middleware.Responder } // NewUpdateBucketLifecycle creates a new http.Handler for the update bucket lifecycle operation func NewUpdateBucketLifecycle(ctx *middleware.Context, handler UpdateBucketLifecycleHandler) *UpdateBucketLifecycle { return &UpdateBucketLifecycle{Context: ctx, Handler: handler} } /* UpdateBucketLifecycle swagger:route PUT /buckets/{bucket_name}/lifecycle/{lifecycle_id} Bucket updateBucketLifecycle Update Lifecycle rule */ type UpdateBucketLifecycle struct { Context *middleware.Context Handler UpdateBucketLifecycleHandler } func (o *UpdateBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewUpdateBucketLifecycleParams() 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) } ================================================ FILE: api/operations/bucket/update_bucket_lifecycle_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewUpdateBucketLifecycleParams creates a new UpdateBucketLifecycleParams object // // There are no default values defined in the spec. func NewUpdateBucketLifecycleParams() UpdateBucketLifecycleParams { return UpdateBucketLifecycleParams{} } // UpdateBucketLifecycleParams contains all the bound params for the update bucket lifecycle operation // typically these are obtained from a http.Request // // swagger:parameters UpdateBucketLifecycle type UpdateBucketLifecycleParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.UpdateBucketLifecycle /* Required: true In: path */ BucketName string /* Required: true In: path */ LifecycleID 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 NewUpdateBucketLifecycleParams() beforehand. func (o *UpdateBucketLifecycleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.UpdateBucketLifecycle if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } rLifecycleID, rhkLifecycleID, _ := route.Params.GetOK("lifecycle_id") if err := o.bindLifecycleID(rLifecycleID, rhkLifecycleID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *UpdateBucketLifecycleParams) bindBucketName(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.BucketName = raw return nil } // bindLifecycleID binds and validates parameter LifecycleID from path. func (o *UpdateBucketLifecycleParams) bindLifecycleID(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.LifecycleID = raw return nil } ================================================ FILE: api/operations/bucket/update_bucket_lifecycle_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // UpdateBucketLifecycleOKCode is the HTTP code returned for type UpdateBucketLifecycleOK const UpdateBucketLifecycleOKCode int = 200 /* UpdateBucketLifecycleOK A successful response. swagger:response updateBucketLifecycleOK */ type UpdateBucketLifecycleOK struct { } // NewUpdateBucketLifecycleOK creates UpdateBucketLifecycleOK with default headers values func NewUpdateBucketLifecycleOK() *UpdateBucketLifecycleOK { return &UpdateBucketLifecycleOK{} } // WriteResponse to the client func (o *UpdateBucketLifecycleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* UpdateBucketLifecycleDefault Generic error response. swagger:response updateBucketLifecycleDefault */ type UpdateBucketLifecycleDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewUpdateBucketLifecycleDefault creates UpdateBucketLifecycleDefault with default headers values func NewUpdateBucketLifecycleDefault(code int) *UpdateBucketLifecycleDefault { if code <= 0 { code = 500 } return &UpdateBucketLifecycleDefault{ _statusCode: code, } } // WithStatusCode adds the status to the update bucket lifecycle default response func (o *UpdateBucketLifecycleDefault) WithStatusCode(code int) *UpdateBucketLifecycleDefault { o._statusCode = code return o } // SetStatusCode sets the status to the update bucket lifecycle default response func (o *UpdateBucketLifecycleDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the update bucket lifecycle default response func (o *UpdateBucketLifecycleDefault) WithPayload(payload *models.APIError) *UpdateBucketLifecycleDefault { o.Payload = payload return o } // SetPayload sets the payload to the update bucket lifecycle default response func (o *UpdateBucketLifecycleDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *UpdateBucketLifecycleDefault) 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 } } } ================================================ FILE: api/operations/bucket/update_bucket_lifecycle_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // UpdateBucketLifecycleURL generates an URL for the update bucket lifecycle operation type UpdateBucketLifecycleURL struct { BucketName string LifecycleID 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 *UpdateBucketLifecycleURL) WithBasePath(bp string) *UpdateBucketLifecycleURL { 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 *UpdateBucketLifecycleURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *UpdateBucketLifecycleURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/lifecycle/{lifecycle_id}" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on UpdateBucketLifecycleURL") } lifecycleID := o.LifecycleID if lifecycleID != "" { _path = strings.ReplaceAll(_path, "{lifecycle_id}", lifecycleID) } else { return nil, errors.New("lifecycleId is required on UpdateBucketLifecycleURL") } _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 *UpdateBucketLifecycleURL) 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 *UpdateBucketLifecycleURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *UpdateBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on UpdateBucketLifecycleURL") } if host == "" { return nil, errors.New("host is required for a full url on UpdateBucketLifecycleURL") } 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 *UpdateBucketLifecycleURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/bucket/update_multi_bucket_replication.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // UpdateMultiBucketReplicationHandlerFunc turns a function with the right signature into a update multi bucket replication handler type UpdateMultiBucketReplicationHandlerFunc func(UpdateMultiBucketReplicationParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn UpdateMultiBucketReplicationHandlerFunc) Handle(params UpdateMultiBucketReplicationParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // UpdateMultiBucketReplicationHandler interface for that can handle valid update multi bucket replication params type UpdateMultiBucketReplicationHandler interface { Handle(UpdateMultiBucketReplicationParams, *models.Principal) middleware.Responder } // NewUpdateMultiBucketReplication creates a new http.Handler for the update multi bucket replication operation func NewUpdateMultiBucketReplication(ctx *middleware.Context, handler UpdateMultiBucketReplicationHandler) *UpdateMultiBucketReplication { return &UpdateMultiBucketReplication{Context: ctx, Handler: handler} } /* UpdateMultiBucketReplication swagger:route PUT /buckets/{bucket_name}/replication/{rule_id} Bucket updateMultiBucketReplication Update Replication rule */ type UpdateMultiBucketReplication struct { Context *middleware.Context Handler UpdateMultiBucketReplicationHandler } func (o *UpdateMultiBucketReplication) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewUpdateMultiBucketReplicationParams() 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) } ================================================ FILE: api/operations/bucket/update_multi_bucket_replication_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( stderrors "errors" "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" ) // NewUpdateMultiBucketReplicationParams creates a new UpdateMultiBucketReplicationParams object // // There are no default values defined in the spec. func NewUpdateMultiBucketReplicationParams() UpdateMultiBucketReplicationParams { return UpdateMultiBucketReplicationParams{} } // UpdateMultiBucketReplicationParams contains all the bound params for the update multi bucket replication operation // typically these are obtained from a http.Request // // swagger:parameters UpdateMultiBucketReplication type UpdateMultiBucketReplicationParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.MultiBucketReplicationEdit /* Required: true In: path */ BucketName string /* Required: true In: path */ RuleID 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 NewUpdateMultiBucketReplicationParams() beforehand. func (o *UpdateMultiBucketReplicationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.MultiBucketReplicationEdit if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } rRuleID, rhkRuleID, _ := route.Params.GetOK("rule_id") if err := o.bindRuleID(rRuleID, rhkRuleID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *UpdateMultiBucketReplicationParams) bindBucketName(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.BucketName = raw return nil } // bindRuleID binds and validates parameter RuleID from path. func (o *UpdateMultiBucketReplicationParams) bindRuleID(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.RuleID = raw return nil } ================================================ FILE: api/operations/bucket/update_multi_bucket_replication_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // UpdateMultiBucketReplicationCreatedCode is the HTTP code returned for type UpdateMultiBucketReplicationCreated const UpdateMultiBucketReplicationCreatedCode int = 201 /* UpdateMultiBucketReplicationCreated A successful response. swagger:response updateMultiBucketReplicationCreated */ type UpdateMultiBucketReplicationCreated struct { } // NewUpdateMultiBucketReplicationCreated creates UpdateMultiBucketReplicationCreated with default headers values func NewUpdateMultiBucketReplicationCreated() *UpdateMultiBucketReplicationCreated { return &UpdateMultiBucketReplicationCreated{} } // WriteResponse to the client func (o *UpdateMultiBucketReplicationCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(201) } /* UpdateMultiBucketReplicationDefault Generic error response. swagger:response updateMultiBucketReplicationDefault */ type UpdateMultiBucketReplicationDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewUpdateMultiBucketReplicationDefault creates UpdateMultiBucketReplicationDefault with default headers values func NewUpdateMultiBucketReplicationDefault(code int) *UpdateMultiBucketReplicationDefault { if code <= 0 { code = 500 } return &UpdateMultiBucketReplicationDefault{ _statusCode: code, } } // WithStatusCode adds the status to the update multi bucket replication default response func (o *UpdateMultiBucketReplicationDefault) WithStatusCode(code int) *UpdateMultiBucketReplicationDefault { o._statusCode = code return o } // SetStatusCode sets the status to the update multi bucket replication default response func (o *UpdateMultiBucketReplicationDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the update multi bucket replication default response func (o *UpdateMultiBucketReplicationDefault) WithPayload(payload *models.APIError) *UpdateMultiBucketReplicationDefault { o.Payload = payload return o } // SetPayload sets the payload to the update multi bucket replication default response func (o *UpdateMultiBucketReplicationDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *UpdateMultiBucketReplicationDefault) 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 } } } ================================================ FILE: api/operations/bucket/update_multi_bucket_replication_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package bucket import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // UpdateMultiBucketReplicationURL generates an URL for the update multi bucket replication operation type UpdateMultiBucketReplicationURL struct { BucketName string RuleID 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 *UpdateMultiBucketReplicationURL) WithBasePath(bp string) *UpdateMultiBucketReplicationURL { 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 *UpdateMultiBucketReplicationURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *UpdateMultiBucketReplicationURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/replication/{rule_id}" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on UpdateMultiBucketReplicationURL") } ruleID := o.RuleID if ruleID != "" { _path = strings.ReplaceAll(_path, "{rule_id}", ruleID) } else { return nil, errors.New("ruleId is required on UpdateMultiBucketReplicationURL") } _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 *UpdateMultiBucketReplicationURL) 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 *UpdateMultiBucketReplicationURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *UpdateMultiBucketReplicationURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on UpdateMultiBucketReplicationURL") } if host == "" { return nil, errors.New("host is required for a full url on UpdateMultiBucketReplicationURL") } 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 *UpdateMultiBucketReplicationURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/configuration/add_notification_endpoint.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // AddNotificationEndpointHandlerFunc turns a function with the right signature into a add notification endpoint handler type AddNotificationEndpointHandlerFunc func(AddNotificationEndpointParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn AddNotificationEndpointHandlerFunc) Handle(params AddNotificationEndpointParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // AddNotificationEndpointHandler interface for that can handle valid add notification endpoint params type AddNotificationEndpointHandler interface { Handle(AddNotificationEndpointParams, *models.Principal) middleware.Responder } // NewAddNotificationEndpoint creates a new http.Handler for the add notification endpoint operation func NewAddNotificationEndpoint(ctx *middleware.Context, handler AddNotificationEndpointHandler) *AddNotificationEndpoint { return &AddNotificationEndpoint{Context: ctx, Handler: handler} } /* AddNotificationEndpoint swagger:route POST /admin/notification_endpoints Configuration addNotificationEndpoint Allows to configure a new notification endpoint */ type AddNotificationEndpoint struct { Context *middleware.Context Handler AddNotificationEndpointHandler } func (o *AddNotificationEndpoint) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewAddNotificationEndpointParams() 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) } ================================================ FILE: api/operations/configuration/add_notification_endpoint_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( stderrors "errors" "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" ) // NewAddNotificationEndpointParams creates a new AddNotificationEndpointParams object // // There are no default values defined in the spec. func NewAddNotificationEndpointParams() AddNotificationEndpointParams { return AddNotificationEndpointParams{} } // AddNotificationEndpointParams contains all the bound params for the add notification endpoint operation // typically these are obtained from a http.Request // // swagger:parameters AddNotificationEndpoint type AddNotificationEndpointParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.NotificationEndpoint } // 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 NewAddNotificationEndpointParams() beforehand. func (o *AddNotificationEndpointParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.NotificationEndpoint if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/configuration/add_notification_endpoint_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // AddNotificationEndpointCreatedCode is the HTTP code returned for type AddNotificationEndpointCreated const AddNotificationEndpointCreatedCode int = 201 /* AddNotificationEndpointCreated A successful response. swagger:response addNotificationEndpointCreated */ type AddNotificationEndpointCreated struct { /* In: Body */ Payload *models.SetNotificationEndpointResponse `json:"body,omitempty"` } // NewAddNotificationEndpointCreated creates AddNotificationEndpointCreated with default headers values func NewAddNotificationEndpointCreated() *AddNotificationEndpointCreated { return &AddNotificationEndpointCreated{} } // WithPayload adds the payload to the add notification endpoint created response func (o *AddNotificationEndpointCreated) WithPayload(payload *models.SetNotificationEndpointResponse) *AddNotificationEndpointCreated { o.Payload = payload return o } // SetPayload sets the payload to the add notification endpoint created response func (o *AddNotificationEndpointCreated) SetPayload(payload *models.SetNotificationEndpointResponse) { o.Payload = payload } // WriteResponse to the client func (o *AddNotificationEndpointCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(201) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } } /* AddNotificationEndpointDefault Generic error response. swagger:response addNotificationEndpointDefault */ type AddNotificationEndpointDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewAddNotificationEndpointDefault creates AddNotificationEndpointDefault with default headers values func NewAddNotificationEndpointDefault(code int) *AddNotificationEndpointDefault { if code <= 0 { code = 500 } return &AddNotificationEndpointDefault{ _statusCode: code, } } // WithStatusCode adds the status to the add notification endpoint default response func (o *AddNotificationEndpointDefault) WithStatusCode(code int) *AddNotificationEndpointDefault { o._statusCode = code return o } // SetStatusCode sets the status to the add notification endpoint default response func (o *AddNotificationEndpointDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the add notification endpoint default response func (o *AddNotificationEndpointDefault) WithPayload(payload *models.APIError) *AddNotificationEndpointDefault { o.Payload = payload return o } // SetPayload sets the payload to the add notification endpoint default response func (o *AddNotificationEndpointDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *AddNotificationEndpointDefault) 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 } } } ================================================ FILE: api/operations/configuration/add_notification_endpoint_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "errors" "net/url" golangswaggerpaths "path" ) // AddNotificationEndpointURL generates an URL for the add notification endpoint operation type AddNotificationEndpointURL 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 *AddNotificationEndpointURL) WithBasePath(bp string) *AddNotificationEndpointURL { 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 *AddNotificationEndpointURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *AddNotificationEndpointURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/notification_endpoints" _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 *AddNotificationEndpointURL) 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 *AddNotificationEndpointURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *AddNotificationEndpointURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on AddNotificationEndpointURL") } if host == "" { return nil, errors.New("host is required for a full url on AddNotificationEndpointURL") } 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 *AddNotificationEndpointURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/configuration/config_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ConfigInfoHandlerFunc turns a function with the right signature into a config info handler type ConfigInfoHandlerFunc func(ConfigInfoParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ConfigInfoHandlerFunc) Handle(params ConfigInfoParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ConfigInfoHandler interface for that can handle valid config info params type ConfigInfoHandler interface { Handle(ConfigInfoParams, *models.Principal) middleware.Responder } // NewConfigInfo creates a new http.Handler for the config info operation func NewConfigInfo(ctx *middleware.Context, handler ConfigInfoHandler) *ConfigInfo { return &ConfigInfo{Context: ctx, Handler: handler} } /* ConfigInfo swagger:route GET /configs/{name} Configuration configInfo Configuration info */ type ConfigInfo struct { Context *middleware.Context Handler ConfigInfoHandler } func (o *ConfigInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewConfigInfoParams() 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) } ================================================ FILE: api/operations/configuration/config_info_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewConfigInfoParams creates a new ConfigInfoParams object // // There are no default values defined in the spec. func NewConfigInfoParams() ConfigInfoParams { return ConfigInfoParams{} } // ConfigInfoParams contains all the bound params for the config info operation // typically these are obtained from a http.Request // // swagger:parameters ConfigInfo type ConfigInfoParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewConfigInfoParams() beforehand. func (o *ConfigInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *ConfigInfoParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/configuration/config_info_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ConfigInfoOKCode is the HTTP code returned for type ConfigInfoOK const ConfigInfoOKCode int = 200 /* ConfigInfoOK A successful response. swagger:response configInfoOK */ type ConfigInfoOK struct { /* In: Body */ Payload []*models.Configuration `json:"body,omitempty"` } // NewConfigInfoOK creates ConfigInfoOK with default headers values func NewConfigInfoOK() *ConfigInfoOK { return &ConfigInfoOK{} } // WithPayload adds the payload to the config info o k response func (o *ConfigInfoOK) WithPayload(payload []*models.Configuration) *ConfigInfoOK { o.Payload = payload return o } // SetPayload sets the payload to the config info o k response func (o *ConfigInfoOK) SetPayload(payload []*models.Configuration) { o.Payload = payload } // WriteResponse to the client func (o *ConfigInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(200) payload := o.Payload if payload == nil { // return empty array payload = make([]*models.Configuration, 0, 50) } if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } /* ConfigInfoDefault Generic error response. swagger:response configInfoDefault */ type ConfigInfoDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewConfigInfoDefault creates ConfigInfoDefault with default headers values func NewConfigInfoDefault(code int) *ConfigInfoDefault { if code <= 0 { code = 500 } return &ConfigInfoDefault{ _statusCode: code, } } // WithStatusCode adds the status to the config info default response func (o *ConfigInfoDefault) WithStatusCode(code int) *ConfigInfoDefault { o._statusCode = code return o } // SetStatusCode sets the status to the config info default response func (o *ConfigInfoDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the config info default response func (o *ConfigInfoDefault) WithPayload(payload *models.APIError) *ConfigInfoDefault { o.Payload = payload return o } // SetPayload sets the payload to the config info default response func (o *ConfigInfoDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ConfigInfoDefault) 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 } } } ================================================ FILE: api/operations/configuration/config_info_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // ConfigInfoURL generates an URL for the config info operation type ConfigInfoURL struct { Name 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 *ConfigInfoURL) WithBasePath(bp string) *ConfigInfoURL { 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 *ConfigInfoURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ConfigInfoURL) Build() (*url.URL, error) { var _result url.URL var _path = "/configs/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on ConfigInfoURL") } _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 *ConfigInfoURL) 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 *ConfigInfoURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ConfigInfoURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ConfigInfoURL") } if host == "" { return nil, errors.New("host is required for a full url on ConfigInfoURL") } 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 *ConfigInfoURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/configuration/export_config.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ExportConfigHandlerFunc turns a function with the right signature into a export config handler type ExportConfigHandlerFunc func(ExportConfigParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ExportConfigHandlerFunc) Handle(params ExportConfigParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ExportConfigHandler interface for that can handle valid export config params type ExportConfigHandler interface { Handle(ExportConfigParams, *models.Principal) middleware.Responder } // NewExportConfig creates a new http.Handler for the export config operation func NewExportConfig(ctx *middleware.Context, handler ExportConfigHandler) *ExportConfig { return &ExportConfig{Context: ctx, Handler: handler} } /* ExportConfig swagger:route GET /configs/export Configuration exportConfig Export the current config from MinIO server */ type ExportConfig struct { Context *middleware.Context Handler ExportConfigHandler } func (o *ExportConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewExportConfigParams() 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) } ================================================ FILE: api/operations/configuration/export_config_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewExportConfigParams creates a new ExportConfigParams object // // There are no default values defined in the spec. func NewExportConfigParams() ExportConfigParams { return ExportConfigParams{} } // ExportConfigParams contains all the bound params for the export config operation // typically these are obtained from a http.Request // // swagger:parameters ExportConfig type ExportConfigParams 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 NewExportConfigParams() beforehand. func (o *ExportConfigParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/configuration/export_config_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ExportConfigOKCode is the HTTP code returned for type ExportConfigOK const ExportConfigOKCode int = 200 /* ExportConfigOK A successful response. swagger:response exportConfigOK */ type ExportConfigOK struct { /* In: Body */ Payload *models.ConfigExportResponse `json:"body,omitempty"` } // NewExportConfigOK creates ExportConfigOK with default headers values func NewExportConfigOK() *ExportConfigOK { return &ExportConfigOK{} } // WithPayload adds the payload to the export config o k response func (o *ExportConfigOK) WithPayload(payload *models.ConfigExportResponse) *ExportConfigOK { o.Payload = payload return o } // SetPayload sets the payload to the export config o k response func (o *ExportConfigOK) SetPayload(payload *models.ConfigExportResponse) { o.Payload = payload } // WriteResponse to the client func (o *ExportConfigOK) 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 } } } /* ExportConfigDefault Generic error response. swagger:response exportConfigDefault */ type ExportConfigDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewExportConfigDefault creates ExportConfigDefault with default headers values func NewExportConfigDefault(code int) *ExportConfigDefault { if code <= 0 { code = 500 } return &ExportConfigDefault{ _statusCode: code, } } // WithStatusCode adds the status to the export config default response func (o *ExportConfigDefault) WithStatusCode(code int) *ExportConfigDefault { o._statusCode = code return o } // SetStatusCode sets the status to the export config default response func (o *ExportConfigDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the export config default response func (o *ExportConfigDefault) WithPayload(payload *models.APIError) *ExportConfigDefault { o.Payload = payload return o } // SetPayload sets the payload to the export config default response func (o *ExportConfigDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ExportConfigDefault) 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 } } } ================================================ FILE: api/operations/configuration/export_config_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "errors" "net/url" golangswaggerpaths "path" ) // ExportConfigURL generates an URL for the export config operation type ExportConfigURL 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 *ExportConfigURL) WithBasePath(bp string) *ExportConfigURL { 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 *ExportConfigURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ExportConfigURL) Build() (*url.URL, error) { var _result url.URL var _path = "/configs/export" _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 *ExportConfigURL) 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 *ExportConfigURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ExportConfigURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ExportConfigURL") } if host == "" { return nil, errors.New("host is required for a full url on ExportConfigURL") } 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 *ExportConfigURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/configuration/list_config.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListConfigHandlerFunc turns a function with the right signature into a list config handler type ListConfigHandlerFunc func(ListConfigParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListConfigHandlerFunc) Handle(params ListConfigParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListConfigHandler interface for that can handle valid list config params type ListConfigHandler interface { Handle(ListConfigParams, *models.Principal) middleware.Responder } // NewListConfig creates a new http.Handler for the list config operation func NewListConfig(ctx *middleware.Context, handler ListConfigHandler) *ListConfig { return &ListConfig{Context: ctx, Handler: handler} } /* ListConfig swagger:route GET /configs Configuration listConfig List Configurations */ type ListConfig struct { Context *middleware.Context Handler ListConfigHandler } func (o *ListConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListConfigParams() 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) } ================================================ FILE: api/operations/configuration/list_config_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration 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" ) // NewListConfigParams creates a new ListConfigParams object // with the default values initialized. func NewListConfigParams() ListConfigParams { var ( // initialize parameters with default values limitDefault = int32(20) offsetDefault = int32(0) ) return ListConfigParams{ Limit: &limitDefault, Offset: &offsetDefault, } } // ListConfigParams contains all the bound params for the list config operation // typically these are obtained from a http.Request // // swagger:parameters ListConfig type ListConfigParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* In: query Default: 20 */ Limit *int32 /* In: query Default: 0 */ Offset *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 NewListConfigParams() beforehand. func (o *ListConfigParams) 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) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindLimit binds and validates parameter Limit from query. func (o *ListConfigParams) 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 // Default values have been previously initialized by NewListConfigParams() 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 *ListConfigParams) 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 // Default values have been previously initialized by NewListConfigParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("offset", "query", "int32", raw) } o.Offset = &value return nil } ================================================ FILE: api/operations/configuration/list_config_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListConfigOKCode is the HTTP code returned for type ListConfigOK const ListConfigOKCode int = 200 /* ListConfigOK A successful response. swagger:response listConfigOK */ type ListConfigOK struct { /* In: Body */ Payload *models.ListConfigResponse `json:"body,omitempty"` } // NewListConfigOK creates ListConfigOK with default headers values func NewListConfigOK() *ListConfigOK { return &ListConfigOK{} } // WithPayload adds the payload to the list config o k response func (o *ListConfigOK) WithPayload(payload *models.ListConfigResponse) *ListConfigOK { o.Payload = payload return o } // SetPayload sets the payload to the list config o k response func (o *ListConfigOK) SetPayload(payload *models.ListConfigResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListConfigOK) 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 } } } /* ListConfigDefault Generic error response. swagger:response listConfigDefault */ type ListConfigDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListConfigDefault creates ListConfigDefault with default headers values func NewListConfigDefault(code int) *ListConfigDefault { if code <= 0 { code = 500 } return &ListConfigDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list config default response func (o *ListConfigDefault) WithStatusCode(code int) *ListConfigDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list config default response func (o *ListConfigDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list config default response func (o *ListConfigDefault) WithPayload(payload *models.APIError) *ListConfigDefault { o.Payload = payload return o } // SetPayload sets the payload to the list config default response func (o *ListConfigDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListConfigDefault) 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 } } } ================================================ FILE: api/operations/configuration/list_config_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "errors" "net/url" golangswaggerpaths "path" "github.com/go-openapi/swag" ) // ListConfigURL generates an URL for the list config operation type ListConfigURL struct { Limit *int32 Offset *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 *ListConfigURL) WithBasePath(bp string) *ListConfigURL { 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 *ListConfigURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListConfigURL) Build() (*url.URL, error) { var _result url.URL var _path = "/configs" _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) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListConfigURL) 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 *ListConfigURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListConfigURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListConfigURL") } if host == "" { return nil, errors.New("host is required for a full url on ListConfigURL") } 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 *ListConfigURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/configuration/notification_endpoint_list.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // NotificationEndpointListHandlerFunc turns a function with the right signature into a notification endpoint list handler type NotificationEndpointListHandlerFunc func(NotificationEndpointListParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn NotificationEndpointListHandlerFunc) Handle(params NotificationEndpointListParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // NotificationEndpointListHandler interface for that can handle valid notification endpoint list params type NotificationEndpointListHandler interface { Handle(NotificationEndpointListParams, *models.Principal) middleware.Responder } // NewNotificationEndpointList creates a new http.Handler for the notification endpoint list operation func NewNotificationEndpointList(ctx *middleware.Context, handler NotificationEndpointListHandler) *NotificationEndpointList { return &NotificationEndpointList{Context: ctx, Handler: handler} } /* NotificationEndpointList swagger:route GET /admin/notification_endpoints Configuration notificationEndpointList Returns a list of active notification endpoints */ type NotificationEndpointList struct { Context *middleware.Context Handler NotificationEndpointListHandler } func (o *NotificationEndpointList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewNotificationEndpointListParams() 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) } ================================================ FILE: api/operations/configuration/notification_endpoint_list_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewNotificationEndpointListParams creates a new NotificationEndpointListParams object // // There are no default values defined in the spec. func NewNotificationEndpointListParams() NotificationEndpointListParams { return NotificationEndpointListParams{} } // NotificationEndpointListParams contains all the bound params for the notification endpoint list operation // typically these are obtained from a http.Request // // swagger:parameters NotificationEndpointList type NotificationEndpointListParams 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 NewNotificationEndpointListParams() beforehand. func (o *NotificationEndpointListParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/configuration/notification_endpoint_list_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // NotificationEndpointListOKCode is the HTTP code returned for type NotificationEndpointListOK const NotificationEndpointListOKCode int = 200 /* NotificationEndpointListOK A successful response. swagger:response notificationEndpointListOK */ type NotificationEndpointListOK struct { /* In: Body */ Payload *models.NotifEndpointResponse `json:"body,omitempty"` } // NewNotificationEndpointListOK creates NotificationEndpointListOK with default headers values func NewNotificationEndpointListOK() *NotificationEndpointListOK { return &NotificationEndpointListOK{} } // WithPayload adds the payload to the notification endpoint list o k response func (o *NotificationEndpointListOK) WithPayload(payload *models.NotifEndpointResponse) *NotificationEndpointListOK { o.Payload = payload return o } // SetPayload sets the payload to the notification endpoint list o k response func (o *NotificationEndpointListOK) SetPayload(payload *models.NotifEndpointResponse) { o.Payload = payload } // WriteResponse to the client func (o *NotificationEndpointListOK) 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 } } } /* NotificationEndpointListDefault Generic error response. swagger:response notificationEndpointListDefault */ type NotificationEndpointListDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewNotificationEndpointListDefault creates NotificationEndpointListDefault with default headers values func NewNotificationEndpointListDefault(code int) *NotificationEndpointListDefault { if code <= 0 { code = 500 } return &NotificationEndpointListDefault{ _statusCode: code, } } // WithStatusCode adds the status to the notification endpoint list default response func (o *NotificationEndpointListDefault) WithStatusCode(code int) *NotificationEndpointListDefault { o._statusCode = code return o } // SetStatusCode sets the status to the notification endpoint list default response func (o *NotificationEndpointListDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the notification endpoint list default response func (o *NotificationEndpointListDefault) WithPayload(payload *models.APIError) *NotificationEndpointListDefault { o.Payload = payload return o } // SetPayload sets the payload to the notification endpoint list default response func (o *NotificationEndpointListDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *NotificationEndpointListDefault) 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 } } } ================================================ FILE: api/operations/configuration/notification_endpoint_list_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "errors" "net/url" golangswaggerpaths "path" ) // NotificationEndpointListURL generates an URL for the notification endpoint list operation type NotificationEndpointListURL 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 *NotificationEndpointListURL) WithBasePath(bp string) *NotificationEndpointListURL { 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 *NotificationEndpointListURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *NotificationEndpointListURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/notification_endpoints" _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 *NotificationEndpointListURL) 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 *NotificationEndpointListURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *NotificationEndpointListURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on NotificationEndpointListURL") } if host == "" { return nil, errors.New("host is required for a full url on NotificationEndpointListURL") } 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 *NotificationEndpointListURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/configuration/post_configs_import.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // PostConfigsImportHandlerFunc turns a function with the right signature into a post configs import handler type PostConfigsImportHandlerFunc func(PostConfigsImportParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn PostConfigsImportHandlerFunc) Handle(params PostConfigsImportParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // PostConfigsImportHandler interface for that can handle valid post configs import params type PostConfigsImportHandler interface { Handle(PostConfigsImportParams, *models.Principal) middleware.Responder } // NewPostConfigsImport creates a new http.Handler for the post configs import operation func NewPostConfigsImport(ctx *middleware.Context, handler PostConfigsImportHandler) *PostConfigsImport { return &PostConfigsImport{Context: ctx, Handler: handler} } /* PostConfigsImport swagger:route POST /configs/import Configuration postConfigsImport Uploads a file to import MinIO server config. */ type PostConfigsImport struct { Context *middleware.Context Handler PostConfigsImportHandler } func (o *PostConfigsImport) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewPostConfigsImportParams() 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) } ================================================ FILE: api/operations/configuration/post_configs_import_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( stderrors "errors" "io" "mime/multipart" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" ) // PostConfigsImportMaxParseMemory sets the maximum size in bytes for // the multipart form parser for this operation. // // The default value is 32 MB. // The multipart parser stores up to this + 10MB. var PostConfigsImportMaxParseMemory int64 = 32 << 20 // NewPostConfigsImportParams creates a new PostConfigsImportParams object // // There are no default values defined in the spec. func NewPostConfigsImportParams() PostConfigsImportParams { return PostConfigsImportParams{} } // PostConfigsImportParams contains all the bound params for the post configs import operation // typically these are obtained from a http.Request // // swagger:parameters PostConfigsImport type PostConfigsImportParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: formData */ File io.ReadCloser } // 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 NewPostConfigsImportParams() beforehand. func (o *PostConfigsImportParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if err := r.ParseMultipartForm(PostConfigsImportMaxParseMemory); err != nil { if !stderrors.Is(err, http.ErrNotMultipart) { return errors.New(400, "%v", err) } else if errParse := r.ParseForm(); errParse != nil { return errors.New(400, "%v", errParse) } } file, fileHeader, err := r.FormFile("file") if err != nil { res = append(res, errors.New(400, "reading file %q failed: %v", "file", err)) } else { if errBind := o.bindFile(file, fileHeader); errBind != nil { // Required: true res = append(res, errBind) } else { o.File = &runtime.File{Data: file, Header: fileHeader} } } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindFile binds file parameter File. // // The only supported validations on files are MinLength and MaxLength func (o *PostConfigsImportParams) bindFile(file multipart.File, header *multipart.FileHeader) error { return nil } ================================================ FILE: api/operations/configuration/post_configs_import_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // PostConfigsImportOKCode is the HTTP code returned for type PostConfigsImportOK const PostConfigsImportOKCode int = 200 /* PostConfigsImportOK A successful response. swagger:response postConfigsImportOK */ type PostConfigsImportOK struct { } // NewPostConfigsImportOK creates PostConfigsImportOK with default headers values func NewPostConfigsImportOK() *PostConfigsImportOK { return &PostConfigsImportOK{} } // WriteResponse to the client func (o *PostConfigsImportOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* PostConfigsImportDefault Generic error response. swagger:response postConfigsImportDefault */ type PostConfigsImportDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewPostConfigsImportDefault creates PostConfigsImportDefault with default headers values func NewPostConfigsImportDefault(code int) *PostConfigsImportDefault { if code <= 0 { code = 500 } return &PostConfigsImportDefault{ _statusCode: code, } } // WithStatusCode adds the status to the post configs import default response func (o *PostConfigsImportDefault) WithStatusCode(code int) *PostConfigsImportDefault { o._statusCode = code return o } // SetStatusCode sets the status to the post configs import default response func (o *PostConfigsImportDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the post configs import default response func (o *PostConfigsImportDefault) WithPayload(payload *models.APIError) *PostConfigsImportDefault { o.Payload = payload return o } // SetPayload sets the payload to the post configs import default response func (o *PostConfigsImportDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *PostConfigsImportDefault) 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 } } } ================================================ FILE: api/operations/configuration/post_configs_import_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "errors" "net/url" golangswaggerpaths "path" ) // PostConfigsImportURL generates an URL for the post configs import operation type PostConfigsImportURL 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 *PostConfigsImportURL) WithBasePath(bp string) *PostConfigsImportURL { 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 *PostConfigsImportURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *PostConfigsImportURL) Build() (*url.URL, error) { var _result url.URL var _path = "/configs/import" _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 *PostConfigsImportURL) 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 *PostConfigsImportURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *PostConfigsImportURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on PostConfigsImportURL") } if host == "" { return nil, errors.New("host is required for a full url on PostConfigsImportURL") } 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 *PostConfigsImportURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/configuration/reset_config.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ResetConfigHandlerFunc turns a function with the right signature into a reset config handler type ResetConfigHandlerFunc func(ResetConfigParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ResetConfigHandlerFunc) Handle(params ResetConfigParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ResetConfigHandler interface for that can handle valid reset config params type ResetConfigHandler interface { Handle(ResetConfigParams, *models.Principal) middleware.Responder } // NewResetConfig creates a new http.Handler for the reset config operation func NewResetConfig(ctx *middleware.Context, handler ResetConfigHandler) *ResetConfig { return &ResetConfig{Context: ctx, Handler: handler} } /* ResetConfig swagger:route POST /configs/{name}/reset Configuration resetConfig Configuration reset */ type ResetConfig struct { Context *middleware.Context Handler ResetConfigHandler } func (o *ResetConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewResetConfigParams() 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) } ================================================ FILE: api/operations/configuration/reset_config_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewResetConfigParams creates a new ResetConfigParams object // // There are no default values defined in the spec. func NewResetConfigParams() ResetConfigParams { return ResetConfigParams{} } // ResetConfigParams contains all the bound params for the reset config operation // typically these are obtained from a http.Request // // swagger:parameters ResetConfig type ResetConfigParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewResetConfigParams() beforehand. func (o *ResetConfigParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *ResetConfigParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/configuration/reset_config_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ResetConfigOKCode is the HTTP code returned for type ResetConfigOK const ResetConfigOKCode int = 200 /* ResetConfigOK A successful response. swagger:response resetConfigOK */ type ResetConfigOK struct { /* In: Body */ Payload *models.SetConfigResponse `json:"body,omitempty"` } // NewResetConfigOK creates ResetConfigOK with default headers values func NewResetConfigOK() *ResetConfigOK { return &ResetConfigOK{} } // WithPayload adds the payload to the reset config o k response func (o *ResetConfigOK) WithPayload(payload *models.SetConfigResponse) *ResetConfigOK { o.Payload = payload return o } // SetPayload sets the payload to the reset config o k response func (o *ResetConfigOK) SetPayload(payload *models.SetConfigResponse) { o.Payload = payload } // WriteResponse to the client func (o *ResetConfigOK) 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 } } } /* ResetConfigDefault Generic error response. swagger:response resetConfigDefault */ type ResetConfigDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewResetConfigDefault creates ResetConfigDefault with default headers values func NewResetConfigDefault(code int) *ResetConfigDefault { if code <= 0 { code = 500 } return &ResetConfigDefault{ _statusCode: code, } } // WithStatusCode adds the status to the reset config default response func (o *ResetConfigDefault) WithStatusCode(code int) *ResetConfigDefault { o._statusCode = code return o } // SetStatusCode sets the status to the reset config default response func (o *ResetConfigDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the reset config default response func (o *ResetConfigDefault) WithPayload(payload *models.APIError) *ResetConfigDefault { o.Payload = payload return o } // SetPayload sets the payload to the reset config default response func (o *ResetConfigDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ResetConfigDefault) 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 } } } ================================================ FILE: api/operations/configuration/reset_config_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // ResetConfigURL generates an URL for the reset config operation type ResetConfigURL struct { Name 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 *ResetConfigURL) WithBasePath(bp string) *ResetConfigURL { 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 *ResetConfigURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ResetConfigURL) Build() (*url.URL, error) { var _result url.URL var _path = "/configs/{name}/reset" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on ResetConfigURL") } _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 *ResetConfigURL) 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 *ResetConfigURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ResetConfigURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ResetConfigURL") } if host == "" { return nil, errors.New("host is required for a full url on ResetConfigURL") } 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 *ResetConfigURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/configuration/set_config.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SetConfigHandlerFunc turns a function with the right signature into a set config handler type SetConfigHandlerFunc func(SetConfigParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SetConfigHandlerFunc) Handle(params SetConfigParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SetConfigHandler interface for that can handle valid set config params type SetConfigHandler interface { Handle(SetConfigParams, *models.Principal) middleware.Responder } // NewSetConfig creates a new http.Handler for the set config operation func NewSetConfig(ctx *middleware.Context, handler SetConfigHandler) *SetConfig { return &SetConfig{Context: ctx, Handler: handler} } /* SetConfig swagger:route PUT /configs/{name} Configuration setConfig Set Configuration */ type SetConfig struct { Context *middleware.Context Handler SetConfigHandler } func (o *SetConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSetConfigParams() 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) } ================================================ FILE: api/operations/configuration/set_config_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( stderrors "errors" "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" ) // NewSetConfigParams creates a new SetConfigParams object // // There are no default values defined in the spec. func NewSetConfigParams() SetConfigParams { return SetConfigParams{} } // SetConfigParams contains all the bound params for the set config operation // typically these are obtained from a http.Request // // swagger:parameters SetConfig type SetConfigParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.SetConfigRequest /* Required: true In: path */ Name 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 NewSetConfigParams() beforehand. func (o *SetConfigParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.SetConfigRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *SetConfigParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/configuration/set_config_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SetConfigOKCode is the HTTP code returned for type SetConfigOK const SetConfigOKCode int = 200 /* SetConfigOK A successful response. swagger:response setConfigOK */ type SetConfigOK struct { /* In: Body */ Payload *models.SetConfigResponse `json:"body,omitempty"` } // NewSetConfigOK creates SetConfigOK with default headers values func NewSetConfigOK() *SetConfigOK { return &SetConfigOK{} } // WithPayload adds the payload to the set config o k response func (o *SetConfigOK) WithPayload(payload *models.SetConfigResponse) *SetConfigOK { o.Payload = payload return o } // SetPayload sets the payload to the set config o k response func (o *SetConfigOK) SetPayload(payload *models.SetConfigResponse) { o.Payload = payload } // WriteResponse to the client func (o *SetConfigOK) 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 } } } /* SetConfigDefault Generic error response. swagger:response setConfigDefault */ type SetConfigDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSetConfigDefault creates SetConfigDefault with default headers values func NewSetConfigDefault(code int) *SetConfigDefault { if code <= 0 { code = 500 } return &SetConfigDefault{ _statusCode: code, } } // WithStatusCode adds the status to the set config default response func (o *SetConfigDefault) WithStatusCode(code int) *SetConfigDefault { o._statusCode = code return o } // SetStatusCode sets the status to the set config default response func (o *SetConfigDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the set config default response func (o *SetConfigDefault) WithPayload(payload *models.APIError) *SetConfigDefault { o.Payload = payload return o } // SetPayload sets the payload to the set config default response func (o *SetConfigDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SetConfigDefault) 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 } } } ================================================ FILE: api/operations/configuration/set_config_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package configuration import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // SetConfigURL generates an URL for the set config operation type SetConfigURL struct { Name 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 *SetConfigURL) WithBasePath(bp string) *SetConfigURL { 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 *SetConfigURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SetConfigURL) Build() (*url.URL, error) { var _result url.URL var _path = "/configs/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on SetConfigURL") } _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 *SetConfigURL) 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 *SetConfigURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SetConfigURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SetConfigURL") } if host == "" { return nil, errors.New("host is required for a full url on SetConfigURL") } 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 *SetConfigURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/console_api.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "fmt" "io" "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/api/operations/account" "github.com/minio/console/api/operations/auth" "github.com/minio/console/api/operations/bucket" "github.com/minio/console/api/operations/configuration" "github.com/minio/console/api/operations/group" "github.com/minio/console/api/operations/idp" "github.com/minio/console/api/operations/inspect" "github.com/minio/console/api/operations/k_m_s" "github.com/minio/console/api/operations/logging" "github.com/minio/console/api/operations/object" "github.com/minio/console/api/operations/policy" "github.com/minio/console/api/operations/profile" "github.com/minio/console/api/operations/public" "github.com/minio/console/api/operations/release" "github.com/minio/console/api/operations/service" "github.com/minio/console/api/operations/service_account" "github.com/minio/console/api/operations/site_replication" "github.com/minio/console/api/operations/system" "github.com/minio/console/api/operations/tiering" "github.com/minio/console/api/operations/user" "github.com/minio/console/models" ) // NewConsoleAPI creates a new Console instance func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { return &ConsoleAPI{ 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(), MultipartformConsumer: runtime.DiscardConsumer, ApplicationZipProducer: runtime.ProducerFunc(func(w io.Writer, data any) error { _ = w _ = data return errors.NotImplemented("applicationZip producer has not yet been implemented") }), BinProducer: runtime.ByteStreamProducer(), JSONProducer: runtime.JSONProducer(), AccountAccountChangePasswordHandler: account.AccountChangePasswordHandlerFunc(func(params account.AccountChangePasswordParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation account.AccountChangePassword has not yet been implemented") }), BucketAddBucketLifecycleHandler: bucket.AddBucketLifecycleHandlerFunc(func(params bucket.AddBucketLifecycleParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.AddBucketLifecycle has not yet been implemented") }), GroupAddGroupHandler: group.AddGroupHandlerFunc(func(params group.AddGroupParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation group.AddGroup has not yet been implemented") }), BucketAddMultiBucketLifecycleHandler: bucket.AddMultiBucketLifecycleHandlerFunc(func(params bucket.AddMultiBucketLifecycleParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.AddMultiBucketLifecycle has not yet been implemented") }), ConfigurationAddNotificationEndpointHandler: configuration.AddNotificationEndpointHandlerFunc(func(params configuration.AddNotificationEndpointParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation configuration.AddNotificationEndpoint has not yet been implemented") }), PolicyAddPolicyHandler: policy.AddPolicyHandlerFunc(func(params policy.AddPolicyParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation policy.AddPolicy has not yet been implemented") }), BucketAddRemoteBucketHandler: bucket.AddRemoteBucketHandlerFunc(func(params bucket.AddRemoteBucketParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.AddRemoteBucket has not yet been implemented") }), TieringAddTierHandler: tiering.AddTierHandlerFunc(func(params tiering.AddTierParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation tiering.AddTier has not yet been implemented") }), UserAddUserHandler: user.AddUserHandlerFunc(func(params user.AddUserParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.AddUser has not yet been implemented") }), SystemAdminInfoHandler: system.AdminInfoHandlerFunc(func(params system.AdminInfoParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation system.AdminInfo has not yet been implemented") }), SystemArnListHandler: system.ArnListHandlerFunc(func(params system.ArnListParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation system.ArnList has not yet been implemented") }), BucketBucketInfoHandler: bucket.BucketInfoHandlerFunc(func(params bucket.BucketInfoParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.BucketInfo has not yet been implemented") }), BucketBucketSetPolicyHandler: bucket.BucketSetPolicyHandlerFunc(func(params bucket.BucketSetPolicyParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.BucketSetPolicy has not yet been implemented") }), UserBulkUpdateUsersGroupsHandler: user.BulkUpdateUsersGroupsHandlerFunc(func(params user.BulkUpdateUsersGroupsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.BulkUpdateUsersGroups has not yet been implemented") }), AccountChangeUserPasswordHandler: account.ChangeUserPasswordHandlerFunc(func(params account.ChangeUserPasswordParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation account.ChangeUserPassword has not yet been implemented") }), UserCheckUserServiceAccountsHandler: user.CheckUserServiceAccountsHandlerFunc(func(params user.CheckUserServiceAccountsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.CheckUserServiceAccounts has not yet been implemented") }), ConfigurationConfigInfoHandler: configuration.ConfigInfoHandlerFunc(func(params configuration.ConfigInfoParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation configuration.ConfigInfo has not yet been implemented") }), UserCreateAUserServiceAccountHandler: user.CreateAUserServiceAccountHandlerFunc(func(params user.CreateAUserServiceAccountParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.CreateAUserServiceAccount has not yet been implemented") }), BucketCreateBucketEventHandler: bucket.CreateBucketEventHandlerFunc(func(params bucket.CreateBucketEventParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.CreateBucketEvent has not yet been implemented") }), IdpCreateConfigurationHandler: idp.CreateConfigurationHandlerFunc(func(params idp.CreateConfigurationParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation idp.CreateConfiguration has not yet been implemented") }), ServiceAccountCreateServiceAccountHandler: service_account.CreateServiceAccountHandlerFunc(func(params service_account.CreateServiceAccountParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation service_account.CreateServiceAccount has not yet been implemented") }), UserCreateServiceAccountCredentialsHandler: user.CreateServiceAccountCredentialsHandlerFunc(func(params user.CreateServiceAccountCredentialsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.CreateServiceAccountCredentials has not yet been implemented") }), ServiceAccountCreateServiceAccountCredsHandler: service_account.CreateServiceAccountCredsHandlerFunc(func(params service_account.CreateServiceAccountCredsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation service_account.CreateServiceAccountCreds has not yet been implemented") }), SystemDashboardWidgetDetailsHandler: system.DashboardWidgetDetailsHandlerFunc(func(params system.DashboardWidgetDetailsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation system.DashboardWidgetDetails has not yet been implemented") }), BucketDeleteAccessRuleWithBucketHandler: bucket.DeleteAccessRuleWithBucketHandlerFunc(func(params bucket.DeleteAccessRuleWithBucketParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.DeleteAccessRuleWithBucket has not yet been implemented") }), BucketDeleteAllReplicationRulesHandler: bucket.DeleteAllReplicationRulesHandlerFunc(func(params bucket.DeleteAllReplicationRulesParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.DeleteAllReplicationRules has not yet been implemented") }), BucketDeleteBucketHandler: bucket.DeleteBucketHandlerFunc(func(params bucket.DeleteBucketParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.DeleteBucket has not yet been implemented") }), BucketDeleteBucketEventHandler: bucket.DeleteBucketEventHandlerFunc(func(params bucket.DeleteBucketEventParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.DeleteBucketEvent has not yet been implemented") }), BucketDeleteBucketLifecycleRuleHandler: bucket.DeleteBucketLifecycleRuleHandlerFunc(func(params bucket.DeleteBucketLifecycleRuleParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.DeleteBucketLifecycleRule has not yet been implemented") }), BucketDeleteBucketReplicationRuleHandler: bucket.DeleteBucketReplicationRuleHandlerFunc(func(params bucket.DeleteBucketReplicationRuleParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.DeleteBucketReplicationRule has not yet been implemented") }), IdpDeleteConfigurationHandler: idp.DeleteConfigurationHandlerFunc(func(params idp.DeleteConfigurationParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation idp.DeleteConfiguration has not yet been implemented") }), ObjectDeleteMultipleObjectsHandler: object.DeleteMultipleObjectsHandlerFunc(func(params object.DeleteMultipleObjectsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.DeleteMultipleObjects has not yet been implemented") }), ServiceAccountDeleteMultipleServiceAccountsHandler: service_account.DeleteMultipleServiceAccountsHandlerFunc(func(params service_account.DeleteMultipleServiceAccountsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation service_account.DeleteMultipleServiceAccounts has not yet been implemented") }), ObjectDeleteObjectHandler: object.DeleteObjectHandlerFunc(func(params object.DeleteObjectParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.DeleteObject has not yet been implemented") }), ObjectDeleteObjectRetentionHandler: object.DeleteObjectRetentionHandlerFunc(func(params object.DeleteObjectRetentionParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.DeleteObjectRetention has not yet been implemented") }), BucketDeleteRemoteBucketHandler: bucket.DeleteRemoteBucketHandlerFunc(func(params bucket.DeleteRemoteBucketParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.DeleteRemoteBucket has not yet been implemented") }), BucketDeleteSelectedReplicationRulesHandler: bucket.DeleteSelectedReplicationRulesHandlerFunc(func(params bucket.DeleteSelectedReplicationRulesParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.DeleteSelectedReplicationRules has not yet been implemented") }), ServiceAccountDeleteServiceAccountHandler: service_account.DeleteServiceAccountHandlerFunc(func(params service_account.DeleteServiceAccountParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation service_account.DeleteServiceAccount has not yet been implemented") }), BucketDisableBucketEncryptionHandler: bucket.DisableBucketEncryptionHandlerFunc(func(params bucket.DisableBucketEncryptionParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.DisableBucketEncryption has not yet been implemented") }), ObjectDownloadObjectHandler: object.DownloadObjectHandlerFunc(func(params object.DownloadObjectParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.DownloadObject has not yet been implemented") }), ObjectDownloadMultipleObjectsHandler: object.DownloadMultipleObjectsHandlerFunc(func(params object.DownloadMultipleObjectsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.DownloadMultipleObjects has not yet been implemented") }), PublicDownloadSharedObjectHandler: public.DownloadSharedObjectHandlerFunc(func(params public.DownloadSharedObjectParams) middleware.Responder { _ = params return middleware.NotImplemented("operation public.DownloadSharedObject has not yet been implemented") }), TieringEditTierCredentialsHandler: tiering.EditTierCredentialsHandlerFunc(func(params tiering.EditTierCredentialsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation tiering.EditTierCredentials has not yet been implemented") }), BucketEnableBucketEncryptionHandler: bucket.EnableBucketEncryptionHandlerFunc(func(params bucket.EnableBucketEncryptionParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.EnableBucketEncryption has not yet been implemented") }), ConfigurationExportConfigHandler: configuration.ExportConfigHandlerFunc(func(params configuration.ExportConfigParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation configuration.ExportConfig has not yet been implemented") }), BucketGetBucketEncryptionInfoHandler: bucket.GetBucketEncryptionInfoHandlerFunc(func(params bucket.GetBucketEncryptionInfoParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.GetBucketEncryptionInfo has not yet been implemented") }), BucketGetBucketLifecycleHandler: bucket.GetBucketLifecycleHandlerFunc(func(params bucket.GetBucketLifecycleParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.GetBucketLifecycle has not yet been implemented") }), BucketGetBucketObjectLockingStatusHandler: bucket.GetBucketObjectLockingStatusHandlerFunc(func(params bucket.GetBucketObjectLockingStatusParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.GetBucketObjectLockingStatus has not yet been implemented") }), BucketGetBucketQuotaHandler: bucket.GetBucketQuotaHandlerFunc(func(params bucket.GetBucketQuotaParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.GetBucketQuota has not yet been implemented") }), BucketGetBucketReplicationHandler: bucket.GetBucketReplicationHandlerFunc(func(params bucket.GetBucketReplicationParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.GetBucketReplication has not yet been implemented") }), BucketGetBucketReplicationRuleHandler: bucket.GetBucketReplicationRuleHandlerFunc(func(params bucket.GetBucketReplicationRuleParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.GetBucketReplicationRule has not yet been implemented") }), BucketGetBucketRetentionConfigHandler: bucket.GetBucketRetentionConfigHandlerFunc(func(params bucket.GetBucketRetentionConfigParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.GetBucketRetentionConfig has not yet been implemented") }), BucketGetBucketRewindHandler: bucket.GetBucketRewindHandlerFunc(func(params bucket.GetBucketRewindParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.GetBucketRewind has not yet been implemented") }), BucketGetBucketVersioningHandler: bucket.GetBucketVersioningHandlerFunc(func(params bucket.GetBucketVersioningParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.GetBucketVersioning has not yet been implemented") }), IdpGetConfigurationHandler: idp.GetConfigurationHandlerFunc(func(params idp.GetConfigurationParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation idp.GetConfiguration has not yet been implemented") }), IdpGetLDAPEntitiesHandler: idp.GetLDAPEntitiesHandlerFunc(func(params idp.GetLDAPEntitiesParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation idp.GetLDAPEntities has not yet been implemented") }), BucketGetMaxShareLinkExpHandler: bucket.GetMaxShareLinkExpHandlerFunc(func(params bucket.GetMaxShareLinkExpParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.GetMaxShareLinkExp has not yet been implemented") }), ObjectGetObjectMetadataHandler: object.GetObjectMetadataHandlerFunc(func(params object.GetObjectMetadataParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.GetObjectMetadata has not yet been implemented") }), PolicyGetSAUserPolicyHandler: policy.GetSAUserPolicyHandlerFunc(func(params policy.GetSAUserPolicyParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation policy.GetSAUserPolicy has not yet been implemented") }), ServiceAccountGetServiceAccountHandler: service_account.GetServiceAccountHandlerFunc(func(params service_account.GetServiceAccountParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation service_account.GetServiceAccount has not yet been implemented") }), SiteReplicationGetSiteReplicationInfoHandler: site_replication.GetSiteReplicationInfoHandlerFunc(func(params site_replication.GetSiteReplicationInfoParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation site_replication.GetSiteReplicationInfo has not yet been implemented") }), SiteReplicationGetSiteReplicationStatusHandler: site_replication.GetSiteReplicationStatusHandlerFunc(func(params site_replication.GetSiteReplicationStatusParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation site_replication.GetSiteReplicationStatus has not yet been implemented") }), TieringGetTierHandler: tiering.GetTierHandlerFunc(func(params tiering.GetTierParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation tiering.GetTier has not yet been implemented") }), UserGetUserInfoHandler: user.GetUserInfoHandlerFunc(func(params user.GetUserInfoParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.GetUserInfo has not yet been implemented") }), PolicyGetUserPolicyHandler: policy.GetUserPolicyHandlerFunc(func(params policy.GetUserPolicyParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation policy.GetUserPolicy has not yet been implemented") }), GroupGroupInfoHandler: group.GroupInfoHandlerFunc(func(params group.GroupInfoParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation group.GroupInfo has not yet been implemented") }), InspectInspectHandler: inspect.InspectHandlerFunc(func(params inspect.InspectParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation inspect.Inspect has not yet been implemented") }), KmsKMSAPIsHandler: k_m_s.KMSAPIsHandlerFunc(func(params k_m_s.KMSAPIsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation k_m_s.KMSAPIs has not yet been implemented") }), KmsKMSCreateKeyHandler: k_m_s.KMSCreateKeyHandlerFunc(func(params k_m_s.KMSCreateKeyParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation k_m_s.KMSCreateKey has not yet been implemented") }), KmsKMSKeyStatusHandler: k_m_s.KMSKeyStatusHandlerFunc(func(params k_m_s.KMSKeyStatusParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation k_m_s.KMSKeyStatus has not yet been implemented") }), KmsKMSListKeysHandler: k_m_s.KMSListKeysHandlerFunc(func(params k_m_s.KMSListKeysParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation k_m_s.KMSListKeys has not yet been implemented") }), KmsKMSMetricsHandler: k_m_s.KMSMetricsHandlerFunc(func(params k_m_s.KMSMetricsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation k_m_s.KMSMetrics has not yet been implemented") }), KmsKMSStatusHandler: k_m_s.KMSStatusHandlerFunc(func(params k_m_s.KMSStatusParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation k_m_s.KMSStatus has not yet been implemented") }), KmsKMSVersionHandler: k_m_s.KMSVersionHandlerFunc(func(params k_m_s.KMSVersionParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation k_m_s.KMSVersion has not yet been implemented") }), UserListAUserServiceAccountsHandler: user.ListAUserServiceAccountsHandlerFunc(func(params user.ListAUserServiceAccountsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.ListAUserServiceAccounts has not yet been implemented") }), BucketListAccessRulesWithBucketHandler: bucket.ListAccessRulesWithBucketHandlerFunc(func(params bucket.ListAccessRulesWithBucketParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.ListAccessRulesWithBucket has not yet been implemented") }), BucketListBucketEventsHandler: bucket.ListBucketEventsHandlerFunc(func(params bucket.ListBucketEventsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.ListBucketEvents has not yet been implemented") }), BucketListBucketsHandler: bucket.ListBucketsHandlerFunc(func(params bucket.ListBucketsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.ListBuckets has not yet been implemented") }), ConfigurationListConfigHandler: configuration.ListConfigHandlerFunc(func(params configuration.ListConfigParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation configuration.ListConfig has not yet been implemented") }), IdpListConfigurationsHandler: idp.ListConfigurationsHandlerFunc(func(params idp.ListConfigurationsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation idp.ListConfigurations has not yet been implemented") }), BucketListExternalBucketsHandler: bucket.ListExternalBucketsHandlerFunc(func(params bucket.ListExternalBucketsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.ListExternalBuckets has not yet been implemented") }), GroupListGroupsHandler: group.ListGroupsHandlerFunc(func(params group.ListGroupsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation group.ListGroups has not yet been implemented") }), PolicyListGroupsForPolicyHandler: policy.ListGroupsForPolicyHandlerFunc(func(params policy.ListGroupsForPolicyParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation policy.ListGroupsForPolicy has not yet been implemented") }), SystemListNodesHandler: system.ListNodesHandlerFunc(func(params system.ListNodesParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation system.ListNodes has not yet been implemented") }), ObjectListObjectsHandler: object.ListObjectsHandlerFunc(func(params object.ListObjectsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.ListObjects has not yet been implemented") }), PolicyListPoliciesHandler: policy.ListPoliciesHandlerFunc(func(params policy.ListPoliciesParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation policy.ListPolicies has not yet been implemented") }), BucketListPoliciesWithBucketHandler: bucket.ListPoliciesWithBucketHandlerFunc(func(params bucket.ListPoliciesWithBucketParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.ListPoliciesWithBucket has not yet been implemented") }), ReleaseListReleasesHandler: release.ListReleasesHandlerFunc(func(params release.ListReleasesParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation release.ListReleases has not yet been implemented") }), BucketListRemoteBucketsHandler: bucket.ListRemoteBucketsHandlerFunc(func(params bucket.ListRemoteBucketsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.ListRemoteBuckets has not yet been implemented") }), ServiceAccountListUserServiceAccountsHandler: service_account.ListUserServiceAccountsHandlerFunc(func(params service_account.ListUserServiceAccountsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation service_account.ListUserServiceAccounts has not yet been implemented") }), UserListUsersHandler: user.ListUsersHandlerFunc(func(params user.ListUsersParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.ListUsers has not yet been implemented") }), PolicyListUsersForPolicyHandler: policy.ListUsersForPolicyHandlerFunc(func(params policy.ListUsersForPolicyParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation policy.ListUsersForPolicy has not yet been implemented") }), BucketListUsersWithAccessToBucketHandler: bucket.ListUsersWithAccessToBucketHandlerFunc(func(params bucket.ListUsersWithAccessToBucketParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.ListUsersWithAccessToBucket has not yet been implemented") }), LoggingLogSearchHandler: logging.LogSearchHandlerFunc(func(params logging.LogSearchParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation logging.LogSearch has not yet been implemented") }), AuthLoginHandler: auth.LoginHandlerFunc(func(params auth.LoginParams) middleware.Responder { _ = params return middleware.NotImplemented("operation auth.Login has not yet been implemented") }), AuthLoginDetailHandler: auth.LoginDetailHandlerFunc(func(params auth.LoginDetailParams) middleware.Responder { _ = params return middleware.NotImplemented("operation auth.LoginDetail has not yet been implemented") }), AuthLoginOauth2AuthHandler: auth.LoginOauth2AuthHandlerFunc(func(params auth.LoginOauth2AuthParams) middleware.Responder { _ = params return middleware.NotImplemented("operation auth.LoginOauth2Auth has not yet been implemented") }), AuthLogoutHandler: auth.LogoutHandlerFunc(func(params auth.LogoutParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation auth.Logout has not yet been implemented") }), BucketMakeBucketHandler: bucket.MakeBucketHandlerFunc(func(params bucket.MakeBucketParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.MakeBucket has not yet been implemented") }), ConfigurationNotificationEndpointListHandler: configuration.NotificationEndpointListHandlerFunc(func(params configuration.NotificationEndpointListParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation configuration.NotificationEndpointList has not yet been implemented") }), PolicyPolicyInfoHandler: policy.PolicyInfoHandlerFunc(func(params policy.PolicyInfoParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation policy.PolicyInfo has not yet been implemented") }), ObjectPostBucketsBucketNameObjectsUploadHandler: object.PostBucketsBucketNameObjectsUploadHandlerFunc(func(params object.PostBucketsBucketNameObjectsUploadParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.PostBucketsBucketNameObjectsUpload has not yet been implemented") }), ConfigurationPostConfigsImportHandler: configuration.PostConfigsImportHandlerFunc(func(params configuration.PostConfigsImportParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation configuration.PostConfigsImport has not yet been implemented") }), ProfileProfilingStartHandler: profile.ProfilingStartHandlerFunc(func(params profile.ProfilingStartParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation profile.ProfilingStart has not yet been implemented") }), ProfileProfilingStopHandler: profile.ProfilingStopHandlerFunc(func(params profile.ProfilingStopParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation profile.ProfilingStop has not yet been implemented") }), BucketPutBucketTagsHandler: bucket.PutBucketTagsHandlerFunc(func(params bucket.PutBucketTagsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.PutBucketTags has not yet been implemented") }), ObjectPutObjectLegalHoldHandler: object.PutObjectLegalHoldHandlerFunc(func(params object.PutObjectLegalHoldParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.PutObjectLegalHold has not yet been implemented") }), ObjectPutObjectRestoreHandler: object.PutObjectRestoreHandlerFunc(func(params object.PutObjectRestoreParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.PutObjectRestore has not yet been implemented") }), ObjectPutObjectRetentionHandler: object.PutObjectRetentionHandlerFunc(func(params object.PutObjectRetentionParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.PutObjectRetention has not yet been implemented") }), ObjectPutObjectTagsHandler: object.PutObjectTagsHandlerFunc(func(params object.PutObjectTagsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.PutObjectTags has not yet been implemented") }), BucketRemoteBucketDetailsHandler: bucket.RemoteBucketDetailsHandlerFunc(func(params bucket.RemoteBucketDetailsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.RemoteBucketDetails has not yet been implemented") }), GroupRemoveGroupHandler: group.RemoveGroupHandlerFunc(func(params group.RemoveGroupParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation group.RemoveGroup has not yet been implemented") }), PolicyRemovePolicyHandler: policy.RemovePolicyHandlerFunc(func(params policy.RemovePolicyParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation policy.RemovePolicy has not yet been implemented") }), TieringRemoveTierHandler: tiering.RemoveTierHandlerFunc(func(params tiering.RemoveTierParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation tiering.RemoveTier has not yet been implemented") }), UserRemoveUserHandler: user.RemoveUserHandlerFunc(func(params user.RemoveUserParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.RemoveUser has not yet been implemented") }), ConfigurationResetConfigHandler: configuration.ResetConfigHandlerFunc(func(params configuration.ResetConfigParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation configuration.ResetConfig has not yet been implemented") }), ServiceRestartServiceHandler: service.RestartServiceHandlerFunc(func(params service.RestartServiceParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation service.RestartService has not yet been implemented") }), AuthSessionCheckHandler: auth.SessionCheckHandlerFunc(func(params auth.SessionCheckParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation auth.SessionCheck has not yet been implemented") }), BucketSetAccessRuleWithBucketHandler: bucket.SetAccessRuleWithBucketHandlerFunc(func(params bucket.SetAccessRuleWithBucketParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.SetAccessRuleWithBucket has not yet been implemented") }), BucketSetBucketQuotaHandler: bucket.SetBucketQuotaHandlerFunc(func(params bucket.SetBucketQuotaParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.SetBucketQuota has not yet been implemented") }), BucketSetBucketRetentionConfigHandler: bucket.SetBucketRetentionConfigHandlerFunc(func(params bucket.SetBucketRetentionConfigParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.SetBucketRetentionConfig has not yet been implemented") }), BucketSetBucketVersioningHandler: bucket.SetBucketVersioningHandlerFunc(func(params bucket.SetBucketVersioningParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.SetBucketVersioning has not yet been implemented") }), ConfigurationSetConfigHandler: configuration.SetConfigHandlerFunc(func(params configuration.SetConfigParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation configuration.SetConfig has not yet been implemented") }), BucketSetMultiBucketReplicationHandler: bucket.SetMultiBucketReplicationHandlerFunc(func(params bucket.SetMultiBucketReplicationParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.SetMultiBucketReplication has not yet been implemented") }), PolicySetPolicyHandler: policy.SetPolicyHandlerFunc(func(params policy.SetPolicyParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation policy.SetPolicy has not yet been implemented") }), PolicySetPolicyMultipleHandler: policy.SetPolicyMultipleHandlerFunc(func(params policy.SetPolicyMultipleParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation policy.SetPolicyMultiple has not yet been implemented") }), ObjectShareObjectHandler: object.ShareObjectHandlerFunc(func(params object.ShareObjectParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation object.ShareObject has not yet been implemented") }), SiteReplicationSiteReplicationEditHandler: site_replication.SiteReplicationEditHandlerFunc(func(params site_replication.SiteReplicationEditParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation site_replication.SiteReplicationEdit has not yet been implemented") }), SiteReplicationSiteReplicationInfoAddHandler: site_replication.SiteReplicationInfoAddHandlerFunc(func(params site_replication.SiteReplicationInfoAddParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation site_replication.SiteReplicationInfoAdd has not yet been implemented") }), SiteReplicationSiteReplicationRemoveHandler: site_replication.SiteReplicationRemoveHandlerFunc(func(params site_replication.SiteReplicationRemoveParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation site_replication.SiteReplicationRemove has not yet been implemented") }), TieringTiersListHandler: tiering.TiersListHandlerFunc(func(params tiering.TiersListParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation tiering.TiersList has not yet been implemented") }), TieringTiersListNamesHandler: tiering.TiersListNamesHandlerFunc(func(params tiering.TiersListNamesParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation tiering.TiersListNames has not yet been implemented") }), BucketUpdateBucketLifecycleHandler: bucket.UpdateBucketLifecycleHandlerFunc(func(params bucket.UpdateBucketLifecycleParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.UpdateBucketLifecycle has not yet been implemented") }), IdpUpdateConfigurationHandler: idp.UpdateConfigurationHandlerFunc(func(params idp.UpdateConfigurationParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation idp.UpdateConfiguration has not yet been implemented") }), GroupUpdateGroupHandler: group.UpdateGroupHandlerFunc(func(params group.UpdateGroupParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation group.UpdateGroup has not yet been implemented") }), BucketUpdateMultiBucketReplicationHandler: bucket.UpdateMultiBucketReplicationHandlerFunc(func(params bucket.UpdateMultiBucketReplicationParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation bucket.UpdateMultiBucketReplication has not yet been implemented") }), ServiceAccountUpdateServiceAccountHandler: service_account.UpdateServiceAccountHandlerFunc(func(params service_account.UpdateServiceAccountParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation service_account.UpdateServiceAccount has not yet been implemented") }), UserUpdateUserGroupsHandler: user.UpdateUserGroupsHandlerFunc(func(params user.UpdateUserGroupsParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.UpdateUserGroups has not yet been implemented") }), UserUpdateUserInfoHandler: user.UpdateUserInfoHandlerFunc(func(params user.UpdateUserInfoParams, principal *models.Principal) middleware.Responder { _ = params _ = principal return middleware.NotImplemented("operation user.UpdateUserInfo has not yet been implemented") }), // Applies when the "X-Anonymous" header is set AnonymousAuth: func(token string) (*models.Principal, error) { _ = token return nil, errors.NotImplemented("api key auth (anonymous) X-Anonymous from header param [X-Anonymous] has not yet been implemented") }, KeyAuth: func(token string, scopes []string) (*models.Principal, error) { _ = token _ = scopes 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(), } } /*ConsoleAPI the console API */ type ConsoleAPI 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 // MultipartformConsumer registers a consumer for the following mime types: // - multipart/form-data MultipartformConsumer runtime.Consumer // ApplicationZipProducer registers a producer for the following mime types: // - application/zip ApplicationZipProducer runtime.Producer // BinProducer registers a producer for the following mime types: // - application/octet-stream BinProducer runtime.Producer // JSONProducer registers a producer for the following mime types: // - application/json JSONProducer runtime.Producer // AnonymousAuth registers a function that takes a token and returns a principal // it performs authentication based on an api key X-Anonymous provided in the header AnonymousAuth func(string) (*models.Principal, error) // 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 // AccountAccountChangePasswordHandler sets the operation handler for the account change password operation AccountAccountChangePasswordHandler account.AccountChangePasswordHandler // BucketAddBucketLifecycleHandler sets the operation handler for the add bucket lifecycle operation BucketAddBucketLifecycleHandler bucket.AddBucketLifecycleHandler // GroupAddGroupHandler sets the operation handler for the add group operation GroupAddGroupHandler group.AddGroupHandler // BucketAddMultiBucketLifecycleHandler sets the operation handler for the add multi bucket lifecycle operation BucketAddMultiBucketLifecycleHandler bucket.AddMultiBucketLifecycleHandler // ConfigurationAddNotificationEndpointHandler sets the operation handler for the add notification endpoint operation ConfigurationAddNotificationEndpointHandler configuration.AddNotificationEndpointHandler // PolicyAddPolicyHandler sets the operation handler for the add policy operation PolicyAddPolicyHandler policy.AddPolicyHandler // BucketAddRemoteBucketHandler sets the operation handler for the add remote bucket operation BucketAddRemoteBucketHandler bucket.AddRemoteBucketHandler // TieringAddTierHandler sets the operation handler for the add tier operation TieringAddTierHandler tiering.AddTierHandler // UserAddUserHandler sets the operation handler for the add user operation UserAddUserHandler user.AddUserHandler // SystemAdminInfoHandler sets the operation handler for the admin info operation SystemAdminInfoHandler system.AdminInfoHandler // SystemArnListHandler sets the operation handler for the arn list operation SystemArnListHandler system.ArnListHandler // BucketBucketInfoHandler sets the operation handler for the bucket info operation BucketBucketInfoHandler bucket.BucketInfoHandler // BucketBucketSetPolicyHandler sets the operation handler for the bucket set policy operation BucketBucketSetPolicyHandler bucket.BucketSetPolicyHandler // UserBulkUpdateUsersGroupsHandler sets the operation handler for the bulk update users groups operation UserBulkUpdateUsersGroupsHandler user.BulkUpdateUsersGroupsHandler // AccountChangeUserPasswordHandler sets the operation handler for the change user password operation AccountChangeUserPasswordHandler account.ChangeUserPasswordHandler // UserCheckUserServiceAccountsHandler sets the operation handler for the check user service accounts operation UserCheckUserServiceAccountsHandler user.CheckUserServiceAccountsHandler // ConfigurationConfigInfoHandler sets the operation handler for the config info operation ConfigurationConfigInfoHandler configuration.ConfigInfoHandler // UserCreateAUserServiceAccountHandler sets the operation handler for the create a user service account operation UserCreateAUserServiceAccountHandler user.CreateAUserServiceAccountHandler // BucketCreateBucketEventHandler sets the operation handler for the create bucket event operation BucketCreateBucketEventHandler bucket.CreateBucketEventHandler // IdpCreateConfigurationHandler sets the operation handler for the create configuration operation IdpCreateConfigurationHandler idp.CreateConfigurationHandler // ServiceAccountCreateServiceAccountHandler sets the operation handler for the create service account operation ServiceAccountCreateServiceAccountHandler service_account.CreateServiceAccountHandler // UserCreateServiceAccountCredentialsHandler sets the operation handler for the create service account credentials operation UserCreateServiceAccountCredentialsHandler user.CreateServiceAccountCredentialsHandler // ServiceAccountCreateServiceAccountCredsHandler sets the operation handler for the create service account creds operation ServiceAccountCreateServiceAccountCredsHandler service_account.CreateServiceAccountCredsHandler // SystemDashboardWidgetDetailsHandler sets the operation handler for the dashboard widget details operation SystemDashboardWidgetDetailsHandler system.DashboardWidgetDetailsHandler // BucketDeleteAccessRuleWithBucketHandler sets the operation handler for the delete access rule with bucket operation BucketDeleteAccessRuleWithBucketHandler bucket.DeleteAccessRuleWithBucketHandler // BucketDeleteAllReplicationRulesHandler sets the operation handler for the delete all replication rules operation BucketDeleteAllReplicationRulesHandler bucket.DeleteAllReplicationRulesHandler // BucketDeleteBucketHandler sets the operation handler for the delete bucket operation BucketDeleteBucketHandler bucket.DeleteBucketHandler // BucketDeleteBucketEventHandler sets the operation handler for the delete bucket event operation BucketDeleteBucketEventHandler bucket.DeleteBucketEventHandler // BucketDeleteBucketLifecycleRuleHandler sets the operation handler for the delete bucket lifecycle rule operation BucketDeleteBucketLifecycleRuleHandler bucket.DeleteBucketLifecycleRuleHandler // BucketDeleteBucketReplicationRuleHandler sets the operation handler for the delete bucket replication rule operation BucketDeleteBucketReplicationRuleHandler bucket.DeleteBucketReplicationRuleHandler // IdpDeleteConfigurationHandler sets the operation handler for the delete configuration operation IdpDeleteConfigurationHandler idp.DeleteConfigurationHandler // ObjectDeleteMultipleObjectsHandler sets the operation handler for the delete multiple objects operation ObjectDeleteMultipleObjectsHandler object.DeleteMultipleObjectsHandler // ServiceAccountDeleteMultipleServiceAccountsHandler sets the operation handler for the delete multiple service accounts operation ServiceAccountDeleteMultipleServiceAccountsHandler service_account.DeleteMultipleServiceAccountsHandler // ObjectDeleteObjectHandler sets the operation handler for the delete object operation ObjectDeleteObjectHandler object.DeleteObjectHandler // ObjectDeleteObjectRetentionHandler sets the operation handler for the delete object retention operation ObjectDeleteObjectRetentionHandler object.DeleteObjectRetentionHandler // BucketDeleteRemoteBucketHandler sets the operation handler for the delete remote bucket operation BucketDeleteRemoteBucketHandler bucket.DeleteRemoteBucketHandler // BucketDeleteSelectedReplicationRulesHandler sets the operation handler for the delete selected replication rules operation BucketDeleteSelectedReplicationRulesHandler bucket.DeleteSelectedReplicationRulesHandler // ServiceAccountDeleteServiceAccountHandler sets the operation handler for the delete service account operation ServiceAccountDeleteServiceAccountHandler service_account.DeleteServiceAccountHandler // BucketDisableBucketEncryptionHandler sets the operation handler for the disable bucket encryption operation BucketDisableBucketEncryptionHandler bucket.DisableBucketEncryptionHandler // ObjectDownloadObjectHandler sets the operation handler for the download object operation ObjectDownloadObjectHandler object.DownloadObjectHandler // ObjectDownloadMultipleObjectsHandler sets the operation handler for the download multiple objects operation ObjectDownloadMultipleObjectsHandler object.DownloadMultipleObjectsHandler // PublicDownloadSharedObjectHandler sets the operation handler for the download shared object operation PublicDownloadSharedObjectHandler public.DownloadSharedObjectHandler // TieringEditTierCredentialsHandler sets the operation handler for the edit tier credentials operation TieringEditTierCredentialsHandler tiering.EditTierCredentialsHandler // BucketEnableBucketEncryptionHandler sets the operation handler for the enable bucket encryption operation BucketEnableBucketEncryptionHandler bucket.EnableBucketEncryptionHandler // ConfigurationExportConfigHandler sets the operation handler for the export config operation ConfigurationExportConfigHandler configuration.ExportConfigHandler // BucketGetBucketEncryptionInfoHandler sets the operation handler for the get bucket encryption info operation BucketGetBucketEncryptionInfoHandler bucket.GetBucketEncryptionInfoHandler // BucketGetBucketLifecycleHandler sets the operation handler for the get bucket lifecycle operation BucketGetBucketLifecycleHandler bucket.GetBucketLifecycleHandler // BucketGetBucketObjectLockingStatusHandler sets the operation handler for the get bucket object locking status operation BucketGetBucketObjectLockingStatusHandler bucket.GetBucketObjectLockingStatusHandler // BucketGetBucketQuotaHandler sets the operation handler for the get bucket quota operation BucketGetBucketQuotaHandler bucket.GetBucketQuotaHandler // BucketGetBucketReplicationHandler sets the operation handler for the get bucket replication operation BucketGetBucketReplicationHandler bucket.GetBucketReplicationHandler // BucketGetBucketReplicationRuleHandler sets the operation handler for the get bucket replication rule operation BucketGetBucketReplicationRuleHandler bucket.GetBucketReplicationRuleHandler // BucketGetBucketRetentionConfigHandler sets the operation handler for the get bucket retention config operation BucketGetBucketRetentionConfigHandler bucket.GetBucketRetentionConfigHandler // BucketGetBucketRewindHandler sets the operation handler for the get bucket rewind operation BucketGetBucketRewindHandler bucket.GetBucketRewindHandler // BucketGetBucketVersioningHandler sets the operation handler for the get bucket versioning operation BucketGetBucketVersioningHandler bucket.GetBucketVersioningHandler // IdpGetConfigurationHandler sets the operation handler for the get configuration operation IdpGetConfigurationHandler idp.GetConfigurationHandler // IdpGetLDAPEntitiesHandler sets the operation handler for the get l d a p entities operation IdpGetLDAPEntitiesHandler idp.GetLDAPEntitiesHandler // BucketGetMaxShareLinkExpHandler sets the operation handler for the get max share link exp operation BucketGetMaxShareLinkExpHandler bucket.GetMaxShareLinkExpHandler // ObjectGetObjectMetadataHandler sets the operation handler for the get object metadata operation ObjectGetObjectMetadataHandler object.GetObjectMetadataHandler // PolicyGetSAUserPolicyHandler sets the operation handler for the get s a user policy operation PolicyGetSAUserPolicyHandler policy.GetSAUserPolicyHandler // ServiceAccountGetServiceAccountHandler sets the operation handler for the get service account operation ServiceAccountGetServiceAccountHandler service_account.GetServiceAccountHandler // SiteReplicationGetSiteReplicationInfoHandler sets the operation handler for the get site replication info operation SiteReplicationGetSiteReplicationInfoHandler site_replication.GetSiteReplicationInfoHandler // SiteReplicationGetSiteReplicationStatusHandler sets the operation handler for the get site replication status operation SiteReplicationGetSiteReplicationStatusHandler site_replication.GetSiteReplicationStatusHandler // TieringGetTierHandler sets the operation handler for the get tier operation TieringGetTierHandler tiering.GetTierHandler // UserGetUserInfoHandler sets the operation handler for the get user info operation UserGetUserInfoHandler user.GetUserInfoHandler // PolicyGetUserPolicyHandler sets the operation handler for the get user policy operation PolicyGetUserPolicyHandler policy.GetUserPolicyHandler // GroupGroupInfoHandler sets the operation handler for the group info operation GroupGroupInfoHandler group.GroupInfoHandler // InspectInspectHandler sets the operation handler for the inspect operation InspectInspectHandler inspect.InspectHandler // KmsKMSAPIsHandler sets the operation handler for the k m s APIs operation KmsKMSAPIsHandler k_m_s.KMSAPIsHandler // KmsKMSCreateKeyHandler sets the operation handler for the k m s create key operation KmsKMSCreateKeyHandler k_m_s.KMSCreateKeyHandler // KmsKMSKeyStatusHandler sets the operation handler for the k m s key status operation KmsKMSKeyStatusHandler k_m_s.KMSKeyStatusHandler // KmsKMSListKeysHandler sets the operation handler for the k m s list keys operation KmsKMSListKeysHandler k_m_s.KMSListKeysHandler // KmsKMSMetricsHandler sets the operation handler for the k m s metrics operation KmsKMSMetricsHandler k_m_s.KMSMetricsHandler // KmsKMSStatusHandler sets the operation handler for the k m s status operation KmsKMSStatusHandler k_m_s.KMSStatusHandler // KmsKMSVersionHandler sets the operation handler for the k m s version operation KmsKMSVersionHandler k_m_s.KMSVersionHandler // UserListAUserServiceAccountsHandler sets the operation handler for the list a user service accounts operation UserListAUserServiceAccountsHandler user.ListAUserServiceAccountsHandler // BucketListAccessRulesWithBucketHandler sets the operation handler for the list access rules with bucket operation BucketListAccessRulesWithBucketHandler bucket.ListAccessRulesWithBucketHandler // BucketListBucketEventsHandler sets the operation handler for the list bucket events operation BucketListBucketEventsHandler bucket.ListBucketEventsHandler // BucketListBucketsHandler sets the operation handler for the list buckets operation BucketListBucketsHandler bucket.ListBucketsHandler // ConfigurationListConfigHandler sets the operation handler for the list config operation ConfigurationListConfigHandler configuration.ListConfigHandler // IdpListConfigurationsHandler sets the operation handler for the list configurations operation IdpListConfigurationsHandler idp.ListConfigurationsHandler // BucketListExternalBucketsHandler sets the operation handler for the list external buckets operation BucketListExternalBucketsHandler bucket.ListExternalBucketsHandler // GroupListGroupsHandler sets the operation handler for the list groups operation GroupListGroupsHandler group.ListGroupsHandler // PolicyListGroupsForPolicyHandler sets the operation handler for the list groups for policy operation PolicyListGroupsForPolicyHandler policy.ListGroupsForPolicyHandler // SystemListNodesHandler sets the operation handler for the list nodes operation SystemListNodesHandler system.ListNodesHandler // ObjectListObjectsHandler sets the operation handler for the list objects operation ObjectListObjectsHandler object.ListObjectsHandler // PolicyListPoliciesHandler sets the operation handler for the list policies operation PolicyListPoliciesHandler policy.ListPoliciesHandler // BucketListPoliciesWithBucketHandler sets the operation handler for the list policies with bucket operation BucketListPoliciesWithBucketHandler bucket.ListPoliciesWithBucketHandler // ReleaseListReleasesHandler sets the operation handler for the list releases operation ReleaseListReleasesHandler release.ListReleasesHandler // BucketListRemoteBucketsHandler sets the operation handler for the list remote buckets operation BucketListRemoteBucketsHandler bucket.ListRemoteBucketsHandler // ServiceAccountListUserServiceAccountsHandler sets the operation handler for the list user service accounts operation ServiceAccountListUserServiceAccountsHandler service_account.ListUserServiceAccountsHandler // UserListUsersHandler sets the operation handler for the list users operation UserListUsersHandler user.ListUsersHandler // PolicyListUsersForPolicyHandler sets the operation handler for the list users for policy operation PolicyListUsersForPolicyHandler policy.ListUsersForPolicyHandler // BucketListUsersWithAccessToBucketHandler sets the operation handler for the list users with access to bucket operation BucketListUsersWithAccessToBucketHandler bucket.ListUsersWithAccessToBucketHandler // LoggingLogSearchHandler sets the operation handler for the log search operation LoggingLogSearchHandler logging.LogSearchHandler // AuthLoginHandler sets the operation handler for the login operation AuthLoginHandler auth.LoginHandler // 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 // AuthLogoutHandler sets the operation handler for the logout operation AuthLogoutHandler auth.LogoutHandler // BucketMakeBucketHandler sets the operation handler for the make bucket operation BucketMakeBucketHandler bucket.MakeBucketHandler // ConfigurationNotificationEndpointListHandler sets the operation handler for the notification endpoint list operation ConfigurationNotificationEndpointListHandler configuration.NotificationEndpointListHandler // PolicyPolicyInfoHandler sets the operation handler for the policy info operation PolicyPolicyInfoHandler policy.PolicyInfoHandler // ObjectPostBucketsBucketNameObjectsUploadHandler sets the operation handler for the post buckets bucket name objects upload operation ObjectPostBucketsBucketNameObjectsUploadHandler object.PostBucketsBucketNameObjectsUploadHandler // ConfigurationPostConfigsImportHandler sets the operation handler for the post configs import operation ConfigurationPostConfigsImportHandler configuration.PostConfigsImportHandler // ProfileProfilingStartHandler sets the operation handler for the profiling start operation ProfileProfilingStartHandler profile.ProfilingStartHandler // ProfileProfilingStopHandler sets the operation handler for the profiling stop operation ProfileProfilingStopHandler profile.ProfilingStopHandler // BucketPutBucketTagsHandler sets the operation handler for the put bucket tags operation BucketPutBucketTagsHandler bucket.PutBucketTagsHandler // ObjectPutObjectLegalHoldHandler sets the operation handler for the put object legal hold operation ObjectPutObjectLegalHoldHandler object.PutObjectLegalHoldHandler // ObjectPutObjectRestoreHandler sets the operation handler for the put object restore operation ObjectPutObjectRestoreHandler object.PutObjectRestoreHandler // ObjectPutObjectRetentionHandler sets the operation handler for the put object retention operation ObjectPutObjectRetentionHandler object.PutObjectRetentionHandler // ObjectPutObjectTagsHandler sets the operation handler for the put object tags operation ObjectPutObjectTagsHandler object.PutObjectTagsHandler // BucketRemoteBucketDetailsHandler sets the operation handler for the remote bucket details operation BucketRemoteBucketDetailsHandler bucket.RemoteBucketDetailsHandler // GroupRemoveGroupHandler sets the operation handler for the remove group operation GroupRemoveGroupHandler group.RemoveGroupHandler // PolicyRemovePolicyHandler sets the operation handler for the remove policy operation PolicyRemovePolicyHandler policy.RemovePolicyHandler // TieringRemoveTierHandler sets the operation handler for the remove tier operation TieringRemoveTierHandler tiering.RemoveTierHandler // UserRemoveUserHandler sets the operation handler for the remove user operation UserRemoveUserHandler user.RemoveUserHandler // ConfigurationResetConfigHandler sets the operation handler for the reset config operation ConfigurationResetConfigHandler configuration.ResetConfigHandler // ServiceRestartServiceHandler sets the operation handler for the restart service operation ServiceRestartServiceHandler service.RestartServiceHandler // AuthSessionCheckHandler sets the operation handler for the session check operation AuthSessionCheckHandler auth.SessionCheckHandler // BucketSetAccessRuleWithBucketHandler sets the operation handler for the set access rule with bucket operation BucketSetAccessRuleWithBucketHandler bucket.SetAccessRuleWithBucketHandler // BucketSetBucketQuotaHandler sets the operation handler for the set bucket quota operation BucketSetBucketQuotaHandler bucket.SetBucketQuotaHandler // BucketSetBucketRetentionConfigHandler sets the operation handler for the set bucket retention config operation BucketSetBucketRetentionConfigHandler bucket.SetBucketRetentionConfigHandler // BucketSetBucketVersioningHandler sets the operation handler for the set bucket versioning operation BucketSetBucketVersioningHandler bucket.SetBucketVersioningHandler // ConfigurationSetConfigHandler sets the operation handler for the set config operation ConfigurationSetConfigHandler configuration.SetConfigHandler // BucketSetMultiBucketReplicationHandler sets the operation handler for the set multi bucket replication operation BucketSetMultiBucketReplicationHandler bucket.SetMultiBucketReplicationHandler // PolicySetPolicyHandler sets the operation handler for the set policy operation PolicySetPolicyHandler policy.SetPolicyHandler // PolicySetPolicyMultipleHandler sets the operation handler for the set policy multiple operation PolicySetPolicyMultipleHandler policy.SetPolicyMultipleHandler // ObjectShareObjectHandler sets the operation handler for the share object operation ObjectShareObjectHandler object.ShareObjectHandler // SiteReplicationSiteReplicationEditHandler sets the operation handler for the site replication edit operation SiteReplicationSiteReplicationEditHandler site_replication.SiteReplicationEditHandler // SiteReplicationSiteReplicationInfoAddHandler sets the operation handler for the site replication info add operation SiteReplicationSiteReplicationInfoAddHandler site_replication.SiteReplicationInfoAddHandler // SiteReplicationSiteReplicationRemoveHandler sets the operation handler for the site replication remove operation SiteReplicationSiteReplicationRemoveHandler site_replication.SiteReplicationRemoveHandler // TieringTiersListHandler sets the operation handler for the tiers list operation TieringTiersListHandler tiering.TiersListHandler // TieringTiersListNamesHandler sets the operation handler for the tiers list names operation TieringTiersListNamesHandler tiering.TiersListNamesHandler // BucketUpdateBucketLifecycleHandler sets the operation handler for the update bucket lifecycle operation BucketUpdateBucketLifecycleHandler bucket.UpdateBucketLifecycleHandler // IdpUpdateConfigurationHandler sets the operation handler for the update configuration operation IdpUpdateConfigurationHandler idp.UpdateConfigurationHandler // GroupUpdateGroupHandler sets the operation handler for the update group operation GroupUpdateGroupHandler group.UpdateGroupHandler // BucketUpdateMultiBucketReplicationHandler sets the operation handler for the update multi bucket replication operation BucketUpdateMultiBucketReplicationHandler bucket.UpdateMultiBucketReplicationHandler // ServiceAccountUpdateServiceAccountHandler sets the operation handler for the update service account operation ServiceAccountUpdateServiceAccountHandler service_account.UpdateServiceAccountHandler // UserUpdateUserGroupsHandler sets the operation handler for the update user groups operation UserUpdateUserGroupsHandler user.UpdateUserGroupsHandler // UserUpdateUserInfoHandler sets the operation handler for the update user info operation UserUpdateUserInfoHandler user.UpdateUserInfoHandler // 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, ...any) } // UseRedoc for documentation at /docs func (o *ConsoleAPI) UseRedoc() { o.useSwaggerUI = false } // UseSwaggerUI for documentation at /docs func (o *ConsoleAPI) UseSwaggerUI() { o.useSwaggerUI = true } // SetDefaultProduces sets the default produces media type func (o *ConsoleAPI) SetDefaultProduces(mediaType string) { o.defaultProduces = mediaType } // SetDefaultConsumes returns the default consumes media type func (o *ConsoleAPI) SetDefaultConsumes(mediaType string) { o.defaultConsumes = mediaType } // SetSpec sets a spec that will be served for the clients. func (o *ConsoleAPI) SetSpec(spec *loads.Document) { o.spec = spec } // DefaultProduces returns the default produces media type func (o *ConsoleAPI) DefaultProduces() string { return o.defaultProduces } // DefaultConsumes returns the default consumes media type func (o *ConsoleAPI) DefaultConsumes() string { return o.defaultConsumes } // Formats returns the registered string formats func (o *ConsoleAPI) Formats() strfmt.Registry { return o.formats } // RegisterFormat registers a custom format validator func (o *ConsoleAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) { o.formats.Add(name, format, validator) } // Validate validates the registrations in the ConsoleAPI func (o *ConsoleAPI) Validate() error { var unregistered []string if o.JSONConsumer == nil { unregistered = append(unregistered, "JSONConsumer") } if o.MultipartformConsumer == nil { unregistered = append(unregistered, "MultipartformConsumer") } if o.ApplicationZipProducer == nil { unregistered = append(unregistered, "ApplicationZipProducer") } if o.BinProducer == nil { unregistered = append(unregistered, "BinProducer") } if o.JSONProducer == nil { unregistered = append(unregistered, "JSONProducer") } if o.AnonymousAuth == nil { unregistered = append(unregistered, "XAnonymousAuth") } if o.KeyAuth == nil { unregistered = append(unregistered, "KeyAuth") } if o.AccountAccountChangePasswordHandler == nil { unregistered = append(unregistered, "account.AccountChangePasswordHandler") } if o.BucketAddBucketLifecycleHandler == nil { unregistered = append(unregistered, "bucket.AddBucketLifecycleHandler") } if o.GroupAddGroupHandler == nil { unregistered = append(unregistered, "group.AddGroupHandler") } if o.BucketAddMultiBucketLifecycleHandler == nil { unregistered = append(unregistered, "bucket.AddMultiBucketLifecycleHandler") } if o.ConfigurationAddNotificationEndpointHandler == nil { unregistered = append(unregistered, "configuration.AddNotificationEndpointHandler") } if o.PolicyAddPolicyHandler == nil { unregistered = append(unregistered, "policy.AddPolicyHandler") } if o.BucketAddRemoteBucketHandler == nil { unregistered = append(unregistered, "bucket.AddRemoteBucketHandler") } if o.TieringAddTierHandler == nil { unregistered = append(unregistered, "tiering.AddTierHandler") } if o.UserAddUserHandler == nil { unregistered = append(unregistered, "user.AddUserHandler") } if o.SystemAdminInfoHandler == nil { unregistered = append(unregistered, "system.AdminInfoHandler") } if o.SystemArnListHandler == nil { unregistered = append(unregistered, "system.ArnListHandler") } if o.BucketBucketInfoHandler == nil { unregistered = append(unregistered, "bucket.BucketInfoHandler") } if o.BucketBucketSetPolicyHandler == nil { unregistered = append(unregistered, "bucket.BucketSetPolicyHandler") } if o.UserBulkUpdateUsersGroupsHandler == nil { unregistered = append(unregistered, "user.BulkUpdateUsersGroupsHandler") } if o.AccountChangeUserPasswordHandler == nil { unregistered = append(unregistered, "account.ChangeUserPasswordHandler") } if o.UserCheckUserServiceAccountsHandler == nil { unregistered = append(unregistered, "user.CheckUserServiceAccountsHandler") } if o.ConfigurationConfigInfoHandler == nil { unregistered = append(unregistered, "configuration.ConfigInfoHandler") } if o.UserCreateAUserServiceAccountHandler == nil { unregistered = append(unregistered, "user.CreateAUserServiceAccountHandler") } if o.BucketCreateBucketEventHandler == nil { unregistered = append(unregistered, "bucket.CreateBucketEventHandler") } if o.IdpCreateConfigurationHandler == nil { unregistered = append(unregistered, "idp.CreateConfigurationHandler") } if o.ServiceAccountCreateServiceAccountHandler == nil { unregistered = append(unregistered, "service_account.CreateServiceAccountHandler") } if o.UserCreateServiceAccountCredentialsHandler == nil { unregistered = append(unregistered, "user.CreateServiceAccountCredentialsHandler") } if o.ServiceAccountCreateServiceAccountCredsHandler == nil { unregistered = append(unregistered, "service_account.CreateServiceAccountCredsHandler") } if o.SystemDashboardWidgetDetailsHandler == nil { unregistered = append(unregistered, "system.DashboardWidgetDetailsHandler") } if o.BucketDeleteAccessRuleWithBucketHandler == nil { unregistered = append(unregistered, "bucket.DeleteAccessRuleWithBucketHandler") } if o.BucketDeleteAllReplicationRulesHandler == nil { unregistered = append(unregistered, "bucket.DeleteAllReplicationRulesHandler") } if o.BucketDeleteBucketHandler == nil { unregistered = append(unregistered, "bucket.DeleteBucketHandler") } if o.BucketDeleteBucketEventHandler == nil { unregistered = append(unregistered, "bucket.DeleteBucketEventHandler") } if o.BucketDeleteBucketLifecycleRuleHandler == nil { unregistered = append(unregistered, "bucket.DeleteBucketLifecycleRuleHandler") } if o.BucketDeleteBucketReplicationRuleHandler == nil { unregistered = append(unregistered, "bucket.DeleteBucketReplicationRuleHandler") } if o.IdpDeleteConfigurationHandler == nil { unregistered = append(unregistered, "idp.DeleteConfigurationHandler") } if o.ObjectDeleteMultipleObjectsHandler == nil { unregistered = append(unregistered, "object.DeleteMultipleObjectsHandler") } if o.ServiceAccountDeleteMultipleServiceAccountsHandler == nil { unregistered = append(unregistered, "service_account.DeleteMultipleServiceAccountsHandler") } if o.ObjectDeleteObjectHandler == nil { unregistered = append(unregistered, "object.DeleteObjectHandler") } if o.ObjectDeleteObjectRetentionHandler == nil { unregistered = append(unregistered, "object.DeleteObjectRetentionHandler") } if o.BucketDeleteRemoteBucketHandler == nil { unregistered = append(unregistered, "bucket.DeleteRemoteBucketHandler") } if o.BucketDeleteSelectedReplicationRulesHandler == nil { unregistered = append(unregistered, "bucket.DeleteSelectedReplicationRulesHandler") } if o.ServiceAccountDeleteServiceAccountHandler == nil { unregistered = append(unregistered, "service_account.DeleteServiceAccountHandler") } if o.BucketDisableBucketEncryptionHandler == nil { unregistered = append(unregistered, "bucket.DisableBucketEncryptionHandler") } if o.ObjectDownloadObjectHandler == nil { unregistered = append(unregistered, "object.DownloadObjectHandler") } if o.ObjectDownloadMultipleObjectsHandler == nil { unregistered = append(unregistered, "object.DownloadMultipleObjectsHandler") } if o.PublicDownloadSharedObjectHandler == nil { unregistered = append(unregistered, "public.DownloadSharedObjectHandler") } if o.TieringEditTierCredentialsHandler == nil { unregistered = append(unregistered, "tiering.EditTierCredentialsHandler") } if o.BucketEnableBucketEncryptionHandler == nil { unregistered = append(unregistered, "bucket.EnableBucketEncryptionHandler") } if o.ConfigurationExportConfigHandler == nil { unregistered = append(unregistered, "configuration.ExportConfigHandler") } if o.BucketGetBucketEncryptionInfoHandler == nil { unregistered = append(unregistered, "bucket.GetBucketEncryptionInfoHandler") } if o.BucketGetBucketLifecycleHandler == nil { unregistered = append(unregistered, "bucket.GetBucketLifecycleHandler") } if o.BucketGetBucketObjectLockingStatusHandler == nil { unregistered = append(unregistered, "bucket.GetBucketObjectLockingStatusHandler") } if o.BucketGetBucketQuotaHandler == nil { unregistered = append(unregistered, "bucket.GetBucketQuotaHandler") } if o.BucketGetBucketReplicationHandler == nil { unregistered = append(unregistered, "bucket.GetBucketReplicationHandler") } if o.BucketGetBucketReplicationRuleHandler == nil { unregistered = append(unregistered, "bucket.GetBucketReplicationRuleHandler") } if o.BucketGetBucketRetentionConfigHandler == nil { unregistered = append(unregistered, "bucket.GetBucketRetentionConfigHandler") } if o.BucketGetBucketRewindHandler == nil { unregistered = append(unregistered, "bucket.GetBucketRewindHandler") } if o.BucketGetBucketVersioningHandler == nil { unregistered = append(unregistered, "bucket.GetBucketVersioningHandler") } if o.IdpGetConfigurationHandler == nil { unregistered = append(unregistered, "idp.GetConfigurationHandler") } if o.IdpGetLDAPEntitiesHandler == nil { unregistered = append(unregistered, "idp.GetLDAPEntitiesHandler") } if o.BucketGetMaxShareLinkExpHandler == nil { unregistered = append(unregistered, "bucket.GetMaxShareLinkExpHandler") } if o.ObjectGetObjectMetadataHandler == nil { unregistered = append(unregistered, "object.GetObjectMetadataHandler") } if o.PolicyGetSAUserPolicyHandler == nil { unregistered = append(unregistered, "policy.GetSAUserPolicyHandler") } if o.ServiceAccountGetServiceAccountHandler == nil { unregistered = append(unregistered, "service_account.GetServiceAccountHandler") } if o.SiteReplicationGetSiteReplicationInfoHandler == nil { unregistered = append(unregistered, "site_replication.GetSiteReplicationInfoHandler") } if o.SiteReplicationGetSiteReplicationStatusHandler == nil { unregistered = append(unregistered, "site_replication.GetSiteReplicationStatusHandler") } if o.TieringGetTierHandler == nil { unregistered = append(unregistered, "tiering.GetTierHandler") } if o.UserGetUserInfoHandler == nil { unregistered = append(unregistered, "user.GetUserInfoHandler") } if o.PolicyGetUserPolicyHandler == nil { unregistered = append(unregistered, "policy.GetUserPolicyHandler") } if o.GroupGroupInfoHandler == nil { unregistered = append(unregistered, "group.GroupInfoHandler") } if o.InspectInspectHandler == nil { unregistered = append(unregistered, "inspect.InspectHandler") } if o.KmsKMSAPIsHandler == nil { unregistered = append(unregistered, "k_m_s.KMSAPIsHandler") } if o.KmsKMSCreateKeyHandler == nil { unregistered = append(unregistered, "k_m_s.KMSCreateKeyHandler") } if o.KmsKMSKeyStatusHandler == nil { unregistered = append(unregistered, "k_m_s.KMSKeyStatusHandler") } if o.KmsKMSListKeysHandler == nil { unregistered = append(unregistered, "k_m_s.KMSListKeysHandler") } if o.KmsKMSMetricsHandler == nil { unregistered = append(unregistered, "k_m_s.KMSMetricsHandler") } if o.KmsKMSStatusHandler == nil { unregistered = append(unregistered, "k_m_s.KMSStatusHandler") } if o.KmsKMSVersionHandler == nil { unregistered = append(unregistered, "k_m_s.KMSVersionHandler") } if o.UserListAUserServiceAccountsHandler == nil { unregistered = append(unregistered, "user.ListAUserServiceAccountsHandler") } if o.BucketListAccessRulesWithBucketHandler == nil { unregistered = append(unregistered, "bucket.ListAccessRulesWithBucketHandler") } if o.BucketListBucketEventsHandler == nil { unregistered = append(unregistered, "bucket.ListBucketEventsHandler") } if o.BucketListBucketsHandler == nil { unregistered = append(unregistered, "bucket.ListBucketsHandler") } if o.ConfigurationListConfigHandler == nil { unregistered = append(unregistered, "configuration.ListConfigHandler") } if o.IdpListConfigurationsHandler == nil { unregistered = append(unregistered, "idp.ListConfigurationsHandler") } if o.BucketListExternalBucketsHandler == nil { unregistered = append(unregistered, "bucket.ListExternalBucketsHandler") } if o.GroupListGroupsHandler == nil { unregistered = append(unregistered, "group.ListGroupsHandler") } if o.PolicyListGroupsForPolicyHandler == nil { unregistered = append(unregistered, "policy.ListGroupsForPolicyHandler") } if o.SystemListNodesHandler == nil { unregistered = append(unregistered, "system.ListNodesHandler") } if o.ObjectListObjectsHandler == nil { unregistered = append(unregistered, "object.ListObjectsHandler") } if o.PolicyListPoliciesHandler == nil { unregistered = append(unregistered, "policy.ListPoliciesHandler") } if o.BucketListPoliciesWithBucketHandler == nil { unregistered = append(unregistered, "bucket.ListPoliciesWithBucketHandler") } if o.ReleaseListReleasesHandler == nil { unregistered = append(unregistered, "release.ListReleasesHandler") } if o.BucketListRemoteBucketsHandler == nil { unregistered = append(unregistered, "bucket.ListRemoteBucketsHandler") } if o.ServiceAccountListUserServiceAccountsHandler == nil { unregistered = append(unregistered, "service_account.ListUserServiceAccountsHandler") } if o.UserListUsersHandler == nil { unregistered = append(unregistered, "user.ListUsersHandler") } if o.PolicyListUsersForPolicyHandler == nil { unregistered = append(unregistered, "policy.ListUsersForPolicyHandler") } if o.BucketListUsersWithAccessToBucketHandler == nil { unregistered = append(unregistered, "bucket.ListUsersWithAccessToBucketHandler") } if o.LoggingLogSearchHandler == nil { unregistered = append(unregistered, "logging.LogSearchHandler") } if o.AuthLoginHandler == nil { unregistered = append(unregistered, "auth.LoginHandler") } if o.AuthLoginDetailHandler == nil { unregistered = append(unregistered, "auth.LoginDetailHandler") } if o.AuthLoginOauth2AuthHandler == nil { unregistered = append(unregistered, "auth.LoginOauth2AuthHandler") } if o.AuthLogoutHandler == nil { unregistered = append(unregistered, "auth.LogoutHandler") } if o.BucketMakeBucketHandler == nil { unregistered = append(unregistered, "bucket.MakeBucketHandler") } if o.ConfigurationNotificationEndpointListHandler == nil { unregistered = append(unregistered, "configuration.NotificationEndpointListHandler") } if o.PolicyPolicyInfoHandler == nil { unregistered = append(unregistered, "policy.PolicyInfoHandler") } if o.ObjectPostBucketsBucketNameObjectsUploadHandler == nil { unregistered = append(unregistered, "object.PostBucketsBucketNameObjectsUploadHandler") } if o.ConfigurationPostConfigsImportHandler == nil { unregistered = append(unregistered, "configuration.PostConfigsImportHandler") } if o.ProfileProfilingStartHandler == nil { unregistered = append(unregistered, "profile.ProfilingStartHandler") } if o.ProfileProfilingStopHandler == nil { unregistered = append(unregistered, "profile.ProfilingStopHandler") } if o.BucketPutBucketTagsHandler == nil { unregistered = append(unregistered, "bucket.PutBucketTagsHandler") } if o.ObjectPutObjectLegalHoldHandler == nil { unregistered = append(unregistered, "object.PutObjectLegalHoldHandler") } if o.ObjectPutObjectRestoreHandler == nil { unregistered = append(unregistered, "object.PutObjectRestoreHandler") } if o.ObjectPutObjectRetentionHandler == nil { unregistered = append(unregistered, "object.PutObjectRetentionHandler") } if o.ObjectPutObjectTagsHandler == nil { unregistered = append(unregistered, "object.PutObjectTagsHandler") } if o.BucketRemoteBucketDetailsHandler == nil { unregistered = append(unregistered, "bucket.RemoteBucketDetailsHandler") } if o.GroupRemoveGroupHandler == nil { unregistered = append(unregistered, "group.RemoveGroupHandler") } if o.PolicyRemovePolicyHandler == nil { unregistered = append(unregistered, "policy.RemovePolicyHandler") } if o.TieringRemoveTierHandler == nil { unregistered = append(unregistered, "tiering.RemoveTierHandler") } if o.UserRemoveUserHandler == nil { unregistered = append(unregistered, "user.RemoveUserHandler") } if o.ConfigurationResetConfigHandler == nil { unregistered = append(unregistered, "configuration.ResetConfigHandler") } if o.ServiceRestartServiceHandler == nil { unregistered = append(unregistered, "service.RestartServiceHandler") } if o.AuthSessionCheckHandler == nil { unregistered = append(unregistered, "auth.SessionCheckHandler") } if o.BucketSetAccessRuleWithBucketHandler == nil { unregistered = append(unregistered, "bucket.SetAccessRuleWithBucketHandler") } if o.BucketSetBucketQuotaHandler == nil { unregistered = append(unregistered, "bucket.SetBucketQuotaHandler") } if o.BucketSetBucketRetentionConfigHandler == nil { unregistered = append(unregistered, "bucket.SetBucketRetentionConfigHandler") } if o.BucketSetBucketVersioningHandler == nil { unregistered = append(unregistered, "bucket.SetBucketVersioningHandler") } if o.ConfigurationSetConfigHandler == nil { unregistered = append(unregistered, "configuration.SetConfigHandler") } if o.BucketSetMultiBucketReplicationHandler == nil { unregistered = append(unregistered, "bucket.SetMultiBucketReplicationHandler") } if o.PolicySetPolicyHandler == nil { unregistered = append(unregistered, "policy.SetPolicyHandler") } if o.PolicySetPolicyMultipleHandler == nil { unregistered = append(unregistered, "policy.SetPolicyMultipleHandler") } if o.ObjectShareObjectHandler == nil { unregistered = append(unregistered, "object.ShareObjectHandler") } if o.SiteReplicationSiteReplicationEditHandler == nil { unregistered = append(unregistered, "site_replication.SiteReplicationEditHandler") } if o.SiteReplicationSiteReplicationInfoAddHandler == nil { unregistered = append(unregistered, "site_replication.SiteReplicationInfoAddHandler") } if o.SiteReplicationSiteReplicationRemoveHandler == nil { unregistered = append(unregistered, "site_replication.SiteReplicationRemoveHandler") } if o.TieringTiersListHandler == nil { unregistered = append(unregistered, "tiering.TiersListHandler") } if o.TieringTiersListNamesHandler == nil { unregistered = append(unregistered, "tiering.TiersListNamesHandler") } if o.BucketUpdateBucketLifecycleHandler == nil { unregistered = append(unregistered, "bucket.UpdateBucketLifecycleHandler") } if o.IdpUpdateConfigurationHandler == nil { unregistered = append(unregistered, "idp.UpdateConfigurationHandler") } if o.GroupUpdateGroupHandler == nil { unregistered = append(unregistered, "group.UpdateGroupHandler") } if o.BucketUpdateMultiBucketReplicationHandler == nil { unregistered = append(unregistered, "bucket.UpdateMultiBucketReplicationHandler") } if o.ServiceAccountUpdateServiceAccountHandler == nil { unregistered = append(unregistered, "service_account.UpdateServiceAccountHandler") } if o.UserUpdateUserGroupsHandler == nil { unregistered = append(unregistered, "user.UpdateUserGroupsHandler") } if o.UserUpdateUserInfoHandler == nil { unregistered = append(unregistered, "user.UpdateUserInfoHandler") } 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 *ConsoleAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) { return o.ServeError } // AuthenticatorsFor gets the authenticators for the specified security schemes func (o *ConsoleAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { result := make(map[string]runtime.Authenticator) for name := range schemes { switch name { case "anonymous": scheme := schemes[name] result[name] = o.APIKeyAuthenticator(scheme.Name, scheme.In, func(token string) (any, error) { return o.AnonymousAuth(token) }) case "key": result[name] = o.BearerAuthenticator(name, func(token string, scopes []string) (any, error) { return o.KeyAuth(token, scopes) }) } } return result } // Authorizer returns the registered authorizer func (o *ConsoleAPI) Authorizer() runtime.Authorizer { return o.APIAuthorizer } // ConsumersFor gets the consumers for the specified media types. // // MIME type parameters are ignored here. func (o *ConsoleAPI) 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 case "multipart/form-data": result["multipart/form-data"] = o.MultipartformConsumer } 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 *ConsoleAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer { result := make(map[string]runtime.Producer, len(mediaTypes)) for _, mt := range mediaTypes { switch mt { case "application/zip": result["application/zip"] = o.ApplicationZipProducer case "application/octet-stream": result["application/octet-stream"] = o.BinProducer 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 *ConsoleAPI) 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 console API func (o *ConsoleAPI) Context() *middleware.Context { if o.context == nil { o.context = middleware.NewRoutableContext(o.spec, o, nil) } return o.context } func (o *ConsoleAPI) 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["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/account/change-password"] = account.NewAccountChangePassword(o.context, o.AccountAccountChangePasswordHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets/{bucket_name}/lifecycle"] = bucket.NewAddBucketLifecycle(o.context, o.BucketAddBucketLifecycleHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/groups"] = group.NewAddGroup(o.context, o.GroupAddGroupHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets/multi-lifecycle"] = bucket.NewAddMultiBucketLifecycle(o.context, o.BucketAddMultiBucketLifecycleHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/admin/notification_endpoints"] = configuration.NewAddNotificationEndpoint(o.context, o.ConfigurationAddNotificationEndpointHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/policies"] = policy.NewAddPolicy(o.context, o.PolicyAddPolicyHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/remote-buckets"] = bucket.NewAddRemoteBucket(o.context, o.BucketAddRemoteBucketHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/admin/tiers"] = tiering.NewAddTier(o.context, o.TieringAddTierHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/users"] = user.NewAddUser(o.context, o.UserAddUserHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/info"] = system.NewAdminInfo(o.context, o.SystemAdminInfoHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/arns"] = system.NewArnList(o.context, o.SystemArnListHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{name}"] = bucket.NewBucketInfo(o.context, o.BucketBucketInfoHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{name}/set-policy"] = bucket.NewBucketSetPolicy(o.context, o.BucketBucketSetPolicyHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/users-groups-bulk"] = user.NewBulkUpdateUsersGroups(o.context, o.UserBulkUpdateUsersGroupsHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/account/change-user-password"] = account.NewChangeUserPassword(o.context, o.AccountChangeUserPasswordHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/users/service-accounts"] = user.NewCheckUserServiceAccounts(o.context, o.UserCheckUserServiceAccountsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/configs/{name}"] = configuration.NewConfigInfo(o.context, o.ConfigurationConfigInfoHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/user/{name}/service-accounts"] = user.NewCreateAUserServiceAccount(o.context, o.UserCreateAUserServiceAccountHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets/{bucket_name}/events"] = bucket.NewCreateBucketEvent(o.context, o.BucketCreateBucketEventHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/idp/{type}"] = idp.NewCreateConfiguration(o.context, o.IdpCreateConfigurationHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/service-accounts"] = service_account.NewCreateServiceAccount(o.context, o.ServiceAccountCreateServiceAccountHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/user/{name}/service-account-credentials"] = user.NewCreateServiceAccountCredentials(o.context, o.UserCreateServiceAccountCredentialsHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/service-account-credentials"] = service_account.NewCreateServiceAccountCreds(o.context, o.ServiceAccountCreateServiceAccountCredsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/info/widgets/{widgetId}"] = system.NewDashboardWidgetDetails(o.context, o.SystemDashboardWidgetDetailsHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/bucket/{bucket}/access-rules"] = bucket.NewDeleteAccessRuleWithBucket(o.context, o.BucketDeleteAccessRuleWithBucketHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/buckets/{bucket_name}/delete-all-replication-rules"] = bucket.NewDeleteAllReplicationRules(o.context, o.BucketDeleteAllReplicationRulesHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/buckets/{name}"] = bucket.NewDeleteBucket(o.context, o.BucketDeleteBucketHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/buckets/{bucket_name}/events/{arn}"] = bucket.NewDeleteBucketEvent(o.context, o.BucketDeleteBucketEventHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/buckets/{bucket_name}/lifecycle/{lifecycle_id}"] = bucket.NewDeleteBucketLifecycleRule(o.context, o.BucketDeleteBucketLifecycleRuleHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/buckets/{bucket_name}/replication/{rule_id}"] = bucket.NewDeleteBucketReplicationRule(o.context, o.BucketDeleteBucketReplicationRuleHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/idp/{type}/{name}"] = idp.NewDeleteConfiguration(o.context, o.IdpDeleteConfigurationHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets/{bucket_name}/delete-objects"] = object.NewDeleteMultipleObjects(o.context, o.ObjectDeleteMultipleObjectsHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/service-accounts/delete-multi"] = service_account.NewDeleteMultipleServiceAccounts(o.context, o.ServiceAccountDeleteMultipleServiceAccountsHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/buckets/{bucket_name}/objects"] = object.NewDeleteObject(o.context, o.ObjectDeleteObjectHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/buckets/{bucket_name}/objects/retention"] = object.NewDeleteObjectRetention(o.context, o.ObjectDeleteObjectRetentionHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/remote-buckets/{source_bucket_name}/{arn}"] = bucket.NewDeleteRemoteBucket(o.context, o.BucketDeleteRemoteBucketHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/buckets/{bucket_name}/delete-selected-replication-rules"] = bucket.NewDeleteSelectedReplicationRules(o.context, o.BucketDeleteSelectedReplicationRulesHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/service-accounts/{access_key}"] = service_account.NewDeleteServiceAccount(o.context, o.ServiceAccountDeleteServiceAccountHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets/{bucket_name}/encryption/disable"] = bucket.NewDisableBucketEncryption(o.context, o.BucketDisableBucketEncryptionHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/objects/download"] = object.NewDownloadObject(o.context, o.ObjectDownloadObjectHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets/{bucket_name}/objects/download-multiple"] = object.NewDownloadMultipleObjects(o.context, o.ObjectDownloadMultipleObjectsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/download-shared-object/{url}"] = public.NewDownloadSharedObject(o.context, o.PublicDownloadSharedObjectHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/admin/tiers/{type}/{name}/credentials"] = tiering.NewEditTierCredentials(o.context, o.TieringEditTierCredentialsHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets/{bucket_name}/encryption/enable"] = bucket.NewEnableBucketEncryption(o.context, o.BucketEnableBucketEncryptionHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/configs/export"] = configuration.NewExportConfig(o.context, o.ConfigurationExportConfigHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/encryption/info"] = bucket.NewGetBucketEncryptionInfo(o.context, o.BucketGetBucketEncryptionInfoHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/lifecycle"] = bucket.NewGetBucketLifecycle(o.context, o.BucketGetBucketLifecycleHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/object-locking"] = bucket.NewGetBucketObjectLockingStatus(o.context, o.BucketGetBucketObjectLockingStatusHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{name}/quota"] = bucket.NewGetBucketQuota(o.context, o.BucketGetBucketQuotaHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/replication"] = bucket.NewGetBucketReplication(o.context, o.BucketGetBucketReplicationHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/replication/{rule_id}"] = bucket.NewGetBucketReplicationRule(o.context, o.BucketGetBucketReplicationRuleHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/retention"] = bucket.NewGetBucketRetentionConfig(o.context, o.BucketGetBucketRetentionConfigHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/rewind/{date}"] = bucket.NewGetBucketRewind(o.context, o.BucketGetBucketRewindHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/versioning"] = bucket.NewGetBucketVersioning(o.context, o.BucketGetBucketVersioningHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/idp/{type}/{name}"] = idp.NewGetConfiguration(o.context, o.IdpGetConfigurationHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/ldap-entities"] = idp.NewGetLDAPEntities(o.context, o.IdpGetLDAPEntitiesHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/max-share-exp"] = bucket.NewGetMaxShareLinkExp(o.context, o.BucketGetMaxShareLinkExpHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/objects/metadata"] = object.NewGetObjectMetadata(o.context, o.ObjectGetObjectMetadataHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/user/{name}/policies"] = policy.NewGetSAUserPolicy(o.context, o.PolicyGetSAUserPolicyHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/service-accounts/{access_key}"] = service_account.NewGetServiceAccount(o.context, o.ServiceAccountGetServiceAccountHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/site-replication"] = site_replication.NewGetSiteReplicationInfo(o.context, o.SiteReplicationGetSiteReplicationInfoHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/site-replication/status"] = site_replication.NewGetSiteReplicationStatus(o.context, o.SiteReplicationGetSiteReplicationStatusHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/tiers/{type}/{name}"] = tiering.NewGetTier(o.context, o.TieringGetTierHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/user/{name}"] = user.NewGetUserInfo(o.context, o.UserGetUserInfoHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/user/policy"] = policy.NewGetUserPolicy(o.context, o.PolicyGetUserPolicyHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/group/{name}"] = group.NewGroupInfo(o.context, o.GroupGroupInfoHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/inspect"] = inspect.NewInspect(o.context, o.InspectInspectHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/kms/apis"] = k_m_s.NewKMSAPIs(o.context, o.KmsKMSAPIsHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/kms/keys"] = k_m_s.NewKMSCreateKey(o.context, o.KmsKMSCreateKeyHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/kms/keys/{name}"] = k_m_s.NewKMSKeyStatus(o.context, o.KmsKMSKeyStatusHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/kms/keys"] = k_m_s.NewKMSListKeys(o.context, o.KmsKMSListKeysHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/kms/metrics"] = k_m_s.NewKMSMetrics(o.context, o.KmsKMSMetricsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/kms/status"] = k_m_s.NewKMSStatus(o.context, o.KmsKMSStatusHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/kms/version"] = k_m_s.NewKMSVersion(o.context, o.KmsKMSVersionHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/user/{name}/service-accounts"] = user.NewListAUserServiceAccounts(o.context, o.UserListAUserServiceAccountsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/bucket/{bucket}/access-rules"] = bucket.NewListAccessRulesWithBucket(o.context, o.BucketListAccessRulesWithBucketHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/events"] = bucket.NewListBucketEvents(o.context, o.BucketListBucketEventsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets"] = bucket.NewListBuckets(o.context, o.BucketListBucketsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/configs"] = configuration.NewListConfig(o.context, o.ConfigurationListConfigHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/idp/{type}"] = idp.NewListConfigurations(o.context, o.IdpListConfigurationsHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/list-external-buckets"] = bucket.NewListExternalBuckets(o.context, o.BucketListExternalBucketsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/groups"] = group.NewListGroups(o.context, o.GroupListGroupsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/policies/{policy}/groups"] = policy.NewListGroupsForPolicy(o.context, o.PolicyListGroupsForPolicyHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/nodes"] = system.NewListNodes(o.context, o.SystemListNodesHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/objects"] = object.NewListObjects(o.context, o.ObjectListObjectsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/policies"] = policy.NewListPolicies(o.context, o.PolicyListPoliciesHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/bucket-policy/{bucket}"] = bucket.NewListPoliciesWithBucket(o.context, o.BucketListPoliciesWithBucketHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/releases"] = release.NewListReleases(o.context, o.ReleaseListReleasesHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/remote-buckets"] = bucket.NewListRemoteBuckets(o.context, o.BucketListRemoteBucketsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/service-accounts"] = service_account.NewListUserServiceAccounts(o.context, o.ServiceAccountListUserServiceAccountsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/users"] = user.NewListUsers(o.context, o.UserListUsersHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/policies/{policy}/users"] = policy.NewListUsersForPolicy(o.context, o.PolicyListUsersForPolicyHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/bucket-users/{bucket}"] = bucket.NewListUsersWithAccessToBucket(o.context, o.BucketListUsersWithAccessToBucketHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/logs/search"] = logging.NewLogSearch(o.context, o.LoggingLogSearchHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/login"] = auth.NewLogin(o.context, o.AuthLoginHandler) 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"]["/logout"] = auth.NewLogout(o.context, o.AuthLogoutHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets"] = bucket.NewMakeBucket(o.context, o.BucketMakeBucketHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/notification_endpoints"] = configuration.NewNotificationEndpointList(o.context, o.ConfigurationNotificationEndpointListHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/policy/{name}"] = policy.NewPolicyInfo(o.context, o.PolicyPolicyInfoHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets/{bucket_name}/objects/upload"] = object.NewPostBucketsBucketNameObjectsUpload(o.context, o.ObjectPostBucketsBucketNameObjectsUploadHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/configs/import"] = configuration.NewPostConfigsImport(o.context, o.ConfigurationPostConfigsImportHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/profiling/start"] = profile.NewProfilingStart(o.context, o.ProfileProfilingStartHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/profiling/stop"] = profile.NewProfilingStop(o.context, o.ProfileProfilingStopHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{bucket_name}/tags"] = bucket.NewPutBucketTags(o.context, o.BucketPutBucketTagsHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{bucket_name}/objects/legalhold"] = object.NewPutObjectLegalHold(o.context, o.ObjectPutObjectLegalHoldHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{bucket_name}/objects/restore"] = object.NewPutObjectRestore(o.context, o.ObjectPutObjectRestoreHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{bucket_name}/objects/retention"] = object.NewPutObjectRetention(o.context, o.ObjectPutObjectRetentionHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{bucket_name}/objects/tags"] = object.NewPutObjectTags(o.context, o.ObjectPutObjectTagsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/remote-buckets/{name}"] = bucket.NewRemoteBucketDetails(o.context, o.BucketRemoteBucketDetailsHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/group/{name}"] = group.NewRemoveGroup(o.context, o.GroupRemoveGroupHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/policy/{name}"] = policy.NewRemovePolicy(o.context, o.PolicyRemovePolicyHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/admin/tiers/{name}/remove"] = tiering.NewRemoveTier(o.context, o.TieringRemoveTierHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/user/{name}"] = user.NewRemoveUser(o.context, o.UserRemoveUserHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/configs/{name}/reset"] = configuration.NewResetConfig(o.context, o.ConfigurationResetConfigHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/service/restart"] = service.NewRestartService(o.context, o.ServiceRestartServiceHandler) 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["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/bucket/{bucket}/access-rules"] = bucket.NewSetAccessRuleWithBucket(o.context, o.BucketSetAccessRuleWithBucketHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{name}/quota"] = bucket.NewSetBucketQuota(o.context, o.BucketSetBucketQuotaHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{bucket_name}/retention"] = bucket.NewSetBucketRetentionConfig(o.context, o.BucketSetBucketRetentionConfigHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{bucket_name}/versioning"] = bucket.NewSetBucketVersioning(o.context, o.BucketSetBucketVersioningHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/configs/{name}"] = configuration.NewSetConfig(o.context, o.ConfigurationSetConfigHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets-replication"] = bucket.NewSetMultiBucketReplication(o.context, o.BucketSetMultiBucketReplicationHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/set-policy"] = policy.NewSetPolicy(o.context, o.PolicySetPolicyHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/set-policy-multi"] = policy.NewSetPolicyMultiple(o.context, o.PolicySetPolicyMultipleHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/objects/share"] = object.NewShareObject(o.context, o.ObjectShareObjectHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/admin/site-replication"] = site_replication.NewSiteReplicationEdit(o.context, o.SiteReplicationSiteReplicationEditHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/admin/site-replication"] = site_replication.NewSiteReplicationInfoAdd(o.context, o.SiteReplicationSiteReplicationInfoAddHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/admin/site-replication"] = site_replication.NewSiteReplicationRemove(o.context, o.SiteReplicationSiteReplicationRemoveHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/tiers"] = tiering.NewTiersList(o.context, o.TieringTiersListHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/tiers/names"] = tiering.NewTiersListNames(o.context, o.TieringTiersListNamesHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{bucket_name}/lifecycle/{lifecycle_id}"] = bucket.NewUpdateBucketLifecycle(o.context, o.BucketUpdateBucketLifecycleHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/idp/{type}/{name}"] = idp.NewUpdateConfiguration(o.context, o.IdpUpdateConfigurationHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/group/{name}"] = group.NewUpdateGroup(o.context, o.GroupUpdateGroupHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/buckets/{bucket_name}/replication/{rule_id}"] = bucket.NewUpdateMultiBucketReplication(o.context, o.BucketUpdateMultiBucketReplicationHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/service-accounts/{access_key}"] = service_account.NewUpdateServiceAccount(o.context, o.ServiceAccountUpdateServiceAccountHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/user/{name}/groups"] = user.NewUpdateUserGroups(o.context, o.UserUpdateUserGroupsHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/user/{name}"] = user.NewUpdateUserInfo(o.context, o.UserUpdateUserInfoHandler) } // Serve creates a http handler to serve the API over HTTP // can be used directly in http.ListenAndServe(":8000", api.Serve(nil)) func (o *ConsoleAPI) 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 *ConsoleAPI) Init() { if len(o.handlers) == 0 { o.initHandlerCache() } } // RegisterConsumer allows you to add (or override) a consumer for a media type. func (o *ConsoleAPI) 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 *ConsoleAPI) RegisterProducer(mediaType string, producer runtime.Producer) { o.customProducers[mediaType] = producer } // AddMiddlewareFor adds a http middleware to existing handler func (o *ConsoleAPI) 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[um][path] = builder(h) } } ================================================ FILE: api/operations/group/add_group.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // AddGroupHandlerFunc turns a function with the right signature into a add group handler type AddGroupHandlerFunc func(AddGroupParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn AddGroupHandlerFunc) Handle(params AddGroupParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // AddGroupHandler interface for that can handle valid add group params type AddGroupHandler interface { Handle(AddGroupParams, *models.Principal) middleware.Responder } // NewAddGroup creates a new http.Handler for the add group operation func NewAddGroup(ctx *middleware.Context, handler AddGroupHandler) *AddGroup { return &AddGroup{Context: ctx, Handler: handler} } /* AddGroup swagger:route POST /groups Group addGroup Add Group */ type AddGroup struct { Context *middleware.Context Handler AddGroupHandler } func (o *AddGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewAddGroupParams() 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) } ================================================ FILE: api/operations/group/add_group_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( stderrors "errors" "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" ) // NewAddGroupParams creates a new AddGroupParams object // // There are no default values defined in the spec. func NewAddGroupParams() AddGroupParams { return AddGroupParams{} } // AddGroupParams contains all the bound params for the add group operation // typically these are obtained from a http.Request // // swagger:parameters AddGroup type AddGroupParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.AddGroupRequest } // 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 NewAddGroupParams() beforehand. func (o *AddGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.AddGroupRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/group/add_group_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // AddGroupCreatedCode is the HTTP code returned for type AddGroupCreated const AddGroupCreatedCode int = 201 /* AddGroupCreated A successful response. swagger:response addGroupCreated */ type AddGroupCreated struct { } // NewAddGroupCreated creates AddGroupCreated with default headers values func NewAddGroupCreated() *AddGroupCreated { return &AddGroupCreated{} } // WriteResponse to the client func (o *AddGroupCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(201) } /* AddGroupDefault Generic error response. swagger:response addGroupDefault */ type AddGroupDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewAddGroupDefault creates AddGroupDefault with default headers values func NewAddGroupDefault(code int) *AddGroupDefault { if code <= 0 { code = 500 } return &AddGroupDefault{ _statusCode: code, } } // WithStatusCode adds the status to the add group default response func (o *AddGroupDefault) WithStatusCode(code int) *AddGroupDefault { o._statusCode = code return o } // SetStatusCode sets the status to the add group default response func (o *AddGroupDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the add group default response func (o *AddGroupDefault) WithPayload(payload *models.APIError) *AddGroupDefault { o.Payload = payload return o } // SetPayload sets the payload to the add group default response func (o *AddGroupDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *AddGroupDefault) 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 } } } ================================================ FILE: api/operations/group/add_group_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "errors" "net/url" golangswaggerpaths "path" ) // AddGroupURL generates an URL for the add group operation type AddGroupURL 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 *AddGroupURL) WithBasePath(bp string) *AddGroupURL { 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 *AddGroupURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *AddGroupURL) Build() (*url.URL, error) { var _result url.URL var _path = "/groups" _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 *AddGroupURL) 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 *AddGroupURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *AddGroupURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on AddGroupURL") } if host == "" { return nil, errors.New("host is required for a full url on AddGroupURL") } 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 *AddGroupURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/group/group_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GroupInfoHandlerFunc turns a function with the right signature into a group info handler type GroupInfoHandlerFunc func(GroupInfoParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GroupInfoHandlerFunc) Handle(params GroupInfoParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GroupInfoHandler interface for that can handle valid group info params type GroupInfoHandler interface { Handle(GroupInfoParams, *models.Principal) middleware.Responder } // NewGroupInfo creates a new http.Handler for the group info operation func NewGroupInfo(ctx *middleware.Context, handler GroupInfoHandler) *GroupInfo { return &GroupInfo{Context: ctx, Handler: handler} } /* GroupInfo swagger:route GET /group/{name} Group groupInfo Group info */ type GroupInfo struct { Context *middleware.Context Handler GroupInfoHandler } func (o *GroupInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGroupInfoParams() 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) } ================================================ FILE: api/operations/group/group_info_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGroupInfoParams creates a new GroupInfoParams object // // There are no default values defined in the spec. func NewGroupInfoParams() GroupInfoParams { return GroupInfoParams{} } // GroupInfoParams contains all the bound params for the group info operation // typically these are obtained from a http.Request // // swagger:parameters GroupInfo type GroupInfoParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewGroupInfoParams() beforehand. func (o *GroupInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *GroupInfoParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/group/group_info_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GroupInfoOKCode is the HTTP code returned for type GroupInfoOK const GroupInfoOKCode int = 200 /* GroupInfoOK A successful response. swagger:response groupInfoOK */ type GroupInfoOK struct { /* In: Body */ Payload *models.Group `json:"body,omitempty"` } // NewGroupInfoOK creates GroupInfoOK with default headers values func NewGroupInfoOK() *GroupInfoOK { return &GroupInfoOK{} } // WithPayload adds the payload to the group info o k response func (o *GroupInfoOK) WithPayload(payload *models.Group) *GroupInfoOK { o.Payload = payload return o } // SetPayload sets the payload to the group info o k response func (o *GroupInfoOK) SetPayload(payload *models.Group) { o.Payload = payload } // WriteResponse to the client func (o *GroupInfoOK) 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 } } } /* GroupInfoDefault Generic error response. swagger:response groupInfoDefault */ type GroupInfoDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGroupInfoDefault creates GroupInfoDefault with default headers values func NewGroupInfoDefault(code int) *GroupInfoDefault { if code <= 0 { code = 500 } return &GroupInfoDefault{ _statusCode: code, } } // WithStatusCode adds the status to the group info default response func (o *GroupInfoDefault) WithStatusCode(code int) *GroupInfoDefault { o._statusCode = code return o } // SetStatusCode sets the status to the group info default response func (o *GroupInfoDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the group info default response func (o *GroupInfoDefault) WithPayload(payload *models.APIError) *GroupInfoDefault { o.Payload = payload return o } // SetPayload sets the payload to the group info default response func (o *GroupInfoDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GroupInfoDefault) 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 } } } ================================================ FILE: api/operations/group/group_info_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GroupInfoURL generates an URL for the group info operation type GroupInfoURL struct { Name 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 *GroupInfoURL) WithBasePath(bp string) *GroupInfoURL { 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 *GroupInfoURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GroupInfoURL) Build() (*url.URL, error) { var _result url.URL var _path = "/group/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on GroupInfoURL") } _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 *GroupInfoURL) 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 *GroupInfoURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GroupInfoURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GroupInfoURL") } if host == "" { return nil, errors.New("host is required for a full url on GroupInfoURL") } 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 *GroupInfoURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/group/list_groups.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListGroupsHandlerFunc turns a function with the right signature into a list groups handler type ListGroupsHandlerFunc func(ListGroupsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListGroupsHandlerFunc) Handle(params ListGroupsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListGroupsHandler interface for that can handle valid list groups params type ListGroupsHandler interface { Handle(ListGroupsParams, *models.Principal) middleware.Responder } // NewListGroups creates a new http.Handler for the list groups operation func NewListGroups(ctx *middleware.Context, handler ListGroupsHandler) *ListGroups { return &ListGroups{Context: ctx, Handler: handler} } /* ListGroups swagger:route GET /groups Group listGroups List Groups */ type ListGroups struct { Context *middleware.Context Handler ListGroupsHandler } func (o *ListGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListGroupsParams() 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) } ================================================ FILE: api/operations/group/list_groups_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group 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" ) // NewListGroupsParams creates a new ListGroupsParams object // with the default values initialized. func NewListGroupsParams() ListGroupsParams { var ( // initialize parameters with default values limitDefault = int32(20) offsetDefault = int32(0) ) return ListGroupsParams{ Limit: &limitDefault, Offset: &offsetDefault, } } // ListGroupsParams contains all the bound params for the list groups operation // typically these are obtained from a http.Request // // swagger:parameters ListGroups type ListGroupsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* In: query Default: 20 */ Limit *int32 /* In: query Default: 0 */ Offset *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 NewListGroupsParams() beforehand. func (o *ListGroupsParams) 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) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindLimit binds and validates parameter Limit from query. func (o *ListGroupsParams) 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 // Default values have been previously initialized by NewListGroupsParams() 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 *ListGroupsParams) 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 // Default values have been previously initialized by NewListGroupsParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("offset", "query", "int32", raw) } o.Offset = &value return nil } ================================================ FILE: api/operations/group/list_groups_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListGroupsOKCode is the HTTP code returned for type ListGroupsOK const ListGroupsOKCode int = 200 /* ListGroupsOK A successful response. swagger:response listGroupsOK */ type ListGroupsOK struct { /* In: Body */ Payload *models.ListGroupsResponse `json:"body,omitempty"` } // NewListGroupsOK creates ListGroupsOK with default headers values func NewListGroupsOK() *ListGroupsOK { return &ListGroupsOK{} } // WithPayload adds the payload to the list groups o k response func (o *ListGroupsOK) WithPayload(payload *models.ListGroupsResponse) *ListGroupsOK { o.Payload = payload return o } // SetPayload sets the payload to the list groups o k response func (o *ListGroupsOK) SetPayload(payload *models.ListGroupsResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListGroupsOK) 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 } } } /* ListGroupsDefault Generic error response. swagger:response listGroupsDefault */ type ListGroupsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListGroupsDefault creates ListGroupsDefault with default headers values func NewListGroupsDefault(code int) *ListGroupsDefault { if code <= 0 { code = 500 } return &ListGroupsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list groups default response func (o *ListGroupsDefault) WithStatusCode(code int) *ListGroupsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list groups default response func (o *ListGroupsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list groups default response func (o *ListGroupsDefault) WithPayload(payload *models.APIError) *ListGroupsDefault { o.Payload = payload return o } // SetPayload sets the payload to the list groups default response func (o *ListGroupsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListGroupsDefault) 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 } } } ================================================ FILE: api/operations/group/list_groups_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "errors" "net/url" golangswaggerpaths "path" "github.com/go-openapi/swag" ) // ListGroupsURL generates an URL for the list groups operation type ListGroupsURL struct { Limit *int32 Offset *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 *ListGroupsURL) WithBasePath(bp string) *ListGroupsURL { 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 *ListGroupsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListGroupsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/groups" _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) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListGroupsURL) 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 *ListGroupsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListGroupsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListGroupsURL") } if host == "" { return nil, errors.New("host is required for a full url on ListGroupsURL") } 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 *ListGroupsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/group/remove_group.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // RemoveGroupHandlerFunc turns a function with the right signature into a remove group handler type RemoveGroupHandlerFunc func(RemoveGroupParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn RemoveGroupHandlerFunc) Handle(params RemoveGroupParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // RemoveGroupHandler interface for that can handle valid remove group params type RemoveGroupHandler interface { Handle(RemoveGroupParams, *models.Principal) middleware.Responder } // NewRemoveGroup creates a new http.Handler for the remove group operation func NewRemoveGroup(ctx *middleware.Context, handler RemoveGroupHandler) *RemoveGroup { return &RemoveGroup{Context: ctx, Handler: handler} } /* RemoveGroup swagger:route DELETE /group/{name} Group removeGroup Remove group */ type RemoveGroup struct { Context *middleware.Context Handler RemoveGroupHandler } func (o *RemoveGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewRemoveGroupParams() 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) } ================================================ FILE: api/operations/group/remove_group_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewRemoveGroupParams creates a new RemoveGroupParams object // // There are no default values defined in the spec. func NewRemoveGroupParams() RemoveGroupParams { return RemoveGroupParams{} } // RemoveGroupParams contains all the bound params for the remove group operation // typically these are obtained from a http.Request // // swagger:parameters RemoveGroup type RemoveGroupParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewRemoveGroupParams() beforehand. func (o *RemoveGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *RemoveGroupParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/group/remove_group_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // RemoveGroupNoContentCode is the HTTP code returned for type RemoveGroupNoContent const RemoveGroupNoContentCode int = 204 /* RemoveGroupNoContent A successful response. swagger:response removeGroupNoContent */ type RemoveGroupNoContent struct { } // NewRemoveGroupNoContent creates RemoveGroupNoContent with default headers values func NewRemoveGroupNoContent() *RemoveGroupNoContent { return &RemoveGroupNoContent{} } // WriteResponse to the client func (o *RemoveGroupNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* RemoveGroupDefault Generic error response. swagger:response removeGroupDefault */ type RemoveGroupDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewRemoveGroupDefault creates RemoveGroupDefault with default headers values func NewRemoveGroupDefault(code int) *RemoveGroupDefault { if code <= 0 { code = 500 } return &RemoveGroupDefault{ _statusCode: code, } } // WithStatusCode adds the status to the remove group default response func (o *RemoveGroupDefault) WithStatusCode(code int) *RemoveGroupDefault { o._statusCode = code return o } // SetStatusCode sets the status to the remove group default response func (o *RemoveGroupDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the remove group default response func (o *RemoveGroupDefault) WithPayload(payload *models.APIError) *RemoveGroupDefault { o.Payload = payload return o } // SetPayload sets the payload to the remove group default response func (o *RemoveGroupDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *RemoveGroupDefault) 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 } } } ================================================ FILE: api/operations/group/remove_group_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // RemoveGroupURL generates an URL for the remove group operation type RemoveGroupURL struct { Name 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 *RemoveGroupURL) WithBasePath(bp string) *RemoveGroupURL { 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 *RemoveGroupURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *RemoveGroupURL) Build() (*url.URL, error) { var _result url.URL var _path = "/group/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on RemoveGroupURL") } _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 *RemoveGroupURL) 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 *RemoveGroupURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *RemoveGroupURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on RemoveGroupURL") } if host == "" { return nil, errors.New("host is required for a full url on RemoveGroupURL") } 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 *RemoveGroupURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/group/update_group.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // UpdateGroupHandlerFunc turns a function with the right signature into a update group handler type UpdateGroupHandlerFunc func(UpdateGroupParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn UpdateGroupHandlerFunc) Handle(params UpdateGroupParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // UpdateGroupHandler interface for that can handle valid update group params type UpdateGroupHandler interface { Handle(UpdateGroupParams, *models.Principal) middleware.Responder } // NewUpdateGroup creates a new http.Handler for the update group operation func NewUpdateGroup(ctx *middleware.Context, handler UpdateGroupHandler) *UpdateGroup { return &UpdateGroup{Context: ctx, Handler: handler} } /* UpdateGroup swagger:route PUT /group/{name} Group updateGroup Update Group Members or Status */ type UpdateGroup struct { Context *middleware.Context Handler UpdateGroupHandler } func (o *UpdateGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewUpdateGroupParams() 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) } ================================================ FILE: api/operations/group/update_group_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( stderrors "errors" "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" ) // NewUpdateGroupParams creates a new UpdateGroupParams object // // There are no default values defined in the spec. func NewUpdateGroupParams() UpdateGroupParams { return UpdateGroupParams{} } // UpdateGroupParams contains all the bound params for the update group operation // typically these are obtained from a http.Request // // swagger:parameters UpdateGroup type UpdateGroupParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.UpdateGroupRequest /* Required: true In: path */ Name 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 NewUpdateGroupParams() beforehand. func (o *UpdateGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.UpdateGroupRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *UpdateGroupParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/group/update_group_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // UpdateGroupOKCode is the HTTP code returned for type UpdateGroupOK const UpdateGroupOKCode int = 200 /* UpdateGroupOK A successful response. swagger:response updateGroupOK */ type UpdateGroupOK struct { /* In: Body */ Payload *models.Group `json:"body,omitempty"` } // NewUpdateGroupOK creates UpdateGroupOK with default headers values func NewUpdateGroupOK() *UpdateGroupOK { return &UpdateGroupOK{} } // WithPayload adds the payload to the update group o k response func (o *UpdateGroupOK) WithPayload(payload *models.Group) *UpdateGroupOK { o.Payload = payload return o } // SetPayload sets the payload to the update group o k response func (o *UpdateGroupOK) SetPayload(payload *models.Group) { o.Payload = payload } // WriteResponse to the client func (o *UpdateGroupOK) 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 } } } /* UpdateGroupDefault Generic error response. swagger:response updateGroupDefault */ type UpdateGroupDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewUpdateGroupDefault creates UpdateGroupDefault with default headers values func NewUpdateGroupDefault(code int) *UpdateGroupDefault { if code <= 0 { code = 500 } return &UpdateGroupDefault{ _statusCode: code, } } // WithStatusCode adds the status to the update group default response func (o *UpdateGroupDefault) WithStatusCode(code int) *UpdateGroupDefault { o._statusCode = code return o } // SetStatusCode sets the status to the update group default response func (o *UpdateGroupDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the update group default response func (o *UpdateGroupDefault) WithPayload(payload *models.APIError) *UpdateGroupDefault { o.Payload = payload return o } // SetPayload sets the payload to the update group default response func (o *UpdateGroupDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *UpdateGroupDefault) 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 } } } ================================================ FILE: api/operations/group/update_group_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package group import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // UpdateGroupURL generates an URL for the update group operation type UpdateGroupURL struct { Name 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 *UpdateGroupURL) WithBasePath(bp string) *UpdateGroupURL { 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 *UpdateGroupURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *UpdateGroupURL) Build() (*url.URL, error) { var _result url.URL var _path = "/group/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on UpdateGroupURL") } _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 *UpdateGroupURL) 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 *UpdateGroupURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *UpdateGroupURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on UpdateGroupURL") } if host == "" { return nil, errors.New("host is required for a full url on UpdateGroupURL") } 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 *UpdateGroupURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/idp/create_configuration.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // CreateConfigurationHandlerFunc turns a function with the right signature into a create configuration handler type CreateConfigurationHandlerFunc func(CreateConfigurationParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn CreateConfigurationHandlerFunc) Handle(params CreateConfigurationParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // CreateConfigurationHandler interface for that can handle valid create configuration params type CreateConfigurationHandler interface { Handle(CreateConfigurationParams, *models.Principal) middleware.Responder } // NewCreateConfiguration creates a new http.Handler for the create configuration operation func NewCreateConfiguration(ctx *middleware.Context, handler CreateConfigurationHandler) *CreateConfiguration { return &CreateConfiguration{Context: ctx, Handler: handler} } /* CreateConfiguration swagger:route POST /idp/{type} idp createConfiguration Create IDP Configuration */ type CreateConfiguration struct { Context *middleware.Context Handler CreateConfigurationHandler } func (o *CreateConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewCreateConfigurationParams() 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) } ================================================ FILE: api/operations/idp/create_configuration_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( stderrors "errors" "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" ) // NewCreateConfigurationParams creates a new CreateConfigurationParams object // // There are no default values defined in the spec. func NewCreateConfigurationParams() CreateConfigurationParams { return CreateConfigurationParams{} } // CreateConfigurationParams contains all the bound params for the create configuration operation // typically these are obtained from a http.Request // // swagger:parameters CreateConfiguration type CreateConfigurationParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.IdpServerConfiguration /*IDP Configuration Type Required: true In: path */ Type 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 NewCreateConfigurationParams() beforehand. func (o *CreateConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.IdpServerConfiguration if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rType, rhkType, _ := route.Params.GetOK("type") if err := o.bindType(rType, rhkType, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindType binds and validates parameter Type from path. func (o *CreateConfigurationParams) bindType(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.Type = raw return nil } ================================================ FILE: api/operations/idp/create_configuration_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // CreateConfigurationCreatedCode is the HTTP code returned for type CreateConfigurationCreated const CreateConfigurationCreatedCode int = 201 /* CreateConfigurationCreated A successful response. swagger:response createConfigurationCreated */ type CreateConfigurationCreated struct { /* In: Body */ Payload *models.SetIDPResponse `json:"body,omitempty"` } // NewCreateConfigurationCreated creates CreateConfigurationCreated with default headers values func NewCreateConfigurationCreated() *CreateConfigurationCreated { return &CreateConfigurationCreated{} } // WithPayload adds the payload to the create configuration created response func (o *CreateConfigurationCreated) WithPayload(payload *models.SetIDPResponse) *CreateConfigurationCreated { o.Payload = payload return o } // SetPayload sets the payload to the create configuration created response func (o *CreateConfigurationCreated) SetPayload(payload *models.SetIDPResponse) { o.Payload = payload } // WriteResponse to the client func (o *CreateConfigurationCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(201) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } } /* CreateConfigurationDefault Generic error response. swagger:response createConfigurationDefault */ type CreateConfigurationDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewCreateConfigurationDefault creates CreateConfigurationDefault with default headers values func NewCreateConfigurationDefault(code int) *CreateConfigurationDefault { if code <= 0 { code = 500 } return &CreateConfigurationDefault{ _statusCode: code, } } // WithStatusCode adds the status to the create configuration default response func (o *CreateConfigurationDefault) WithStatusCode(code int) *CreateConfigurationDefault { o._statusCode = code return o } // SetStatusCode sets the status to the create configuration default response func (o *CreateConfigurationDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the create configuration default response func (o *CreateConfigurationDefault) WithPayload(payload *models.APIError) *CreateConfigurationDefault { o.Payload = payload return o } // SetPayload sets the payload to the create configuration default response func (o *CreateConfigurationDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *CreateConfigurationDefault) 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 } } } ================================================ FILE: api/operations/idp/create_configuration_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // CreateConfigurationURL generates an URL for the create configuration operation type CreateConfigurationURL struct { Type 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 *CreateConfigurationURL) WithBasePath(bp string) *CreateConfigurationURL { 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 *CreateConfigurationURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *CreateConfigurationURL) Build() (*url.URL, error) { var _result url.URL var _path = "/idp/{type}" typeVar := o.Type if typeVar != "" { _path = strings.ReplaceAll(_path, "{type}", typeVar) } else { return nil, errors.New("type is required on CreateConfigurationURL") } _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 *CreateConfigurationURL) 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 *CreateConfigurationURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *CreateConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on CreateConfigurationURL") } if host == "" { return nil, errors.New("host is required for a full url on CreateConfigurationURL") } 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 *CreateConfigurationURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/idp/delete_configuration.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteConfigurationHandlerFunc turns a function with the right signature into a delete configuration handler type DeleteConfigurationHandlerFunc func(DeleteConfigurationParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteConfigurationHandlerFunc) Handle(params DeleteConfigurationParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteConfigurationHandler interface for that can handle valid delete configuration params type DeleteConfigurationHandler interface { Handle(DeleteConfigurationParams, *models.Principal) middleware.Responder } // NewDeleteConfiguration creates a new http.Handler for the delete configuration operation func NewDeleteConfiguration(ctx *middleware.Context, handler DeleteConfigurationHandler) *DeleteConfiguration { return &DeleteConfiguration{Context: ctx, Handler: handler} } /* DeleteConfiguration swagger:route DELETE /idp/{type}/{name} idp deleteConfiguration Delete IDP Configuration */ type DeleteConfiguration struct { Context *middleware.Context Handler DeleteConfigurationHandler } func (o *DeleteConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteConfigurationParams() 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) } ================================================ FILE: api/operations/idp/delete_configuration_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewDeleteConfigurationParams creates a new DeleteConfigurationParams object // // There are no default values defined in the spec. func NewDeleteConfigurationParams() DeleteConfigurationParams { return DeleteConfigurationParams{} } // DeleteConfigurationParams contains all the bound params for the delete configuration operation // typically these are obtained from a http.Request // // swagger:parameters DeleteConfiguration type DeleteConfigurationParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /*IDP Configuration Name Required: true In: path */ Name string /*IDP Configuration Type Required: true In: path */ Type 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 NewDeleteConfigurationParams() beforehand. func (o *DeleteConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } rType, rhkType, _ := route.Params.GetOK("type") if err := o.bindType(rType, rhkType, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *DeleteConfigurationParams) bindName(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.Name = raw return nil } // bindType binds and validates parameter Type from path. func (o *DeleteConfigurationParams) bindType(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.Type = raw return nil } ================================================ FILE: api/operations/idp/delete_configuration_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteConfigurationOKCode is the HTTP code returned for type DeleteConfigurationOK const DeleteConfigurationOKCode int = 200 /* DeleteConfigurationOK A successful response. swagger:response deleteConfigurationOK */ type DeleteConfigurationOK struct { /* In: Body */ Payload *models.SetIDPResponse `json:"body,omitempty"` } // NewDeleteConfigurationOK creates DeleteConfigurationOK with default headers values func NewDeleteConfigurationOK() *DeleteConfigurationOK { return &DeleteConfigurationOK{} } // WithPayload adds the payload to the delete configuration o k response func (o *DeleteConfigurationOK) WithPayload(payload *models.SetIDPResponse) *DeleteConfigurationOK { o.Payload = payload return o } // SetPayload sets the payload to the delete configuration o k response func (o *DeleteConfigurationOK) SetPayload(payload *models.SetIDPResponse) { o.Payload = payload } // WriteResponse to the client func (o *DeleteConfigurationOK) 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 } } } /* DeleteConfigurationDefault Generic error response. swagger:response deleteConfigurationDefault */ type DeleteConfigurationDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteConfigurationDefault creates DeleteConfigurationDefault with default headers values func NewDeleteConfigurationDefault(code int) *DeleteConfigurationDefault { if code <= 0 { code = 500 } return &DeleteConfigurationDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete configuration default response func (o *DeleteConfigurationDefault) WithStatusCode(code int) *DeleteConfigurationDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete configuration default response func (o *DeleteConfigurationDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete configuration default response func (o *DeleteConfigurationDefault) WithPayload(payload *models.APIError) *DeleteConfigurationDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete configuration default response func (o *DeleteConfigurationDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteConfigurationDefault) 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 } } } ================================================ FILE: api/operations/idp/delete_configuration_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteConfigurationURL generates an URL for the delete configuration operation type DeleteConfigurationURL struct { Name string Type 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 *DeleteConfigurationURL) WithBasePath(bp string) *DeleteConfigurationURL { 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 *DeleteConfigurationURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteConfigurationURL) Build() (*url.URL, error) { var _result url.URL var _path = "/idp/{type}/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on DeleteConfigurationURL") } typeVar := o.Type if typeVar != "" { _path = strings.ReplaceAll(_path, "{type}", typeVar) } else { return nil, errors.New("type is required on DeleteConfigurationURL") } _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 *DeleteConfigurationURL) 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 *DeleteConfigurationURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteConfigurationURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteConfigurationURL") } 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 *DeleteConfigurationURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/idp/get_configuration.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetConfigurationHandlerFunc turns a function with the right signature into a get configuration handler type GetConfigurationHandlerFunc func(GetConfigurationParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetConfigurationHandlerFunc) Handle(params GetConfigurationParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetConfigurationHandler interface for that can handle valid get configuration params type GetConfigurationHandler interface { Handle(GetConfigurationParams, *models.Principal) middleware.Responder } // NewGetConfiguration creates a new http.Handler for the get configuration operation func NewGetConfiguration(ctx *middleware.Context, handler GetConfigurationHandler) *GetConfiguration { return &GetConfiguration{Context: ctx, Handler: handler} } /* GetConfiguration swagger:route GET /idp/{type}/{name} idp getConfiguration Get IDP Configuration */ type GetConfiguration struct { Context *middleware.Context Handler GetConfigurationHandler } func (o *GetConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetConfigurationParams() 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) } ================================================ FILE: api/operations/idp/get_configuration_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetConfigurationParams creates a new GetConfigurationParams object // // There are no default values defined in the spec. func NewGetConfigurationParams() GetConfigurationParams { return GetConfigurationParams{} } // GetConfigurationParams contains all the bound params for the get configuration operation // typically these are obtained from a http.Request // // swagger:parameters GetConfiguration type GetConfigurationParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /*IDP Configuration Name Required: true In: path */ Name string /*IDP Configuration Type Required: true In: path */ Type 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 NewGetConfigurationParams() beforehand. func (o *GetConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } rType, rhkType, _ := route.Params.GetOK("type") if err := o.bindType(rType, rhkType, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *GetConfigurationParams) bindName(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.Name = raw return nil } // bindType binds and validates parameter Type from path. func (o *GetConfigurationParams) bindType(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.Type = raw return nil } ================================================ FILE: api/operations/idp/get_configuration_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetConfigurationOKCode is the HTTP code returned for type GetConfigurationOK const GetConfigurationOKCode int = 200 /* GetConfigurationOK A successful response. swagger:response getConfigurationOK */ type GetConfigurationOK struct { /* In: Body */ Payload *models.IdpServerConfiguration `json:"body,omitempty"` } // NewGetConfigurationOK creates GetConfigurationOK with default headers values func NewGetConfigurationOK() *GetConfigurationOK { return &GetConfigurationOK{} } // WithPayload adds the payload to the get configuration o k response func (o *GetConfigurationOK) WithPayload(payload *models.IdpServerConfiguration) *GetConfigurationOK { o.Payload = payload return o } // SetPayload sets the payload to the get configuration o k response func (o *GetConfigurationOK) SetPayload(payload *models.IdpServerConfiguration) { o.Payload = payload } // WriteResponse to the client func (o *GetConfigurationOK) 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 } } } /* GetConfigurationDefault Generic error response. swagger:response getConfigurationDefault */ type GetConfigurationDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetConfigurationDefault creates GetConfigurationDefault with default headers values func NewGetConfigurationDefault(code int) *GetConfigurationDefault { if code <= 0 { code = 500 } return &GetConfigurationDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get configuration default response func (o *GetConfigurationDefault) WithStatusCode(code int) *GetConfigurationDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get configuration default response func (o *GetConfigurationDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get configuration default response func (o *GetConfigurationDefault) WithPayload(payload *models.APIError) *GetConfigurationDefault { o.Payload = payload return o } // SetPayload sets the payload to the get configuration default response func (o *GetConfigurationDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetConfigurationDefault) 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 } } } ================================================ FILE: api/operations/idp/get_configuration_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetConfigurationURL generates an URL for the get configuration operation type GetConfigurationURL struct { Name string Type 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 *GetConfigurationURL) WithBasePath(bp string) *GetConfigurationURL { 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 *GetConfigurationURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetConfigurationURL) Build() (*url.URL, error) { var _result url.URL var _path = "/idp/{type}/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on GetConfigurationURL") } typeVar := o.Type if typeVar != "" { _path = strings.ReplaceAll(_path, "{type}", typeVar) } else { return nil, errors.New("type is required on GetConfigurationURL") } _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 *GetConfigurationURL) 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 *GetConfigurationURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetConfigurationURL") } if host == "" { return nil, errors.New("host is required for a full url on GetConfigurationURL") } 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 *GetConfigurationURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/idp/get_l_d_a_p_entities.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetLDAPEntitiesHandlerFunc turns a function with the right signature into a get l d a p entities handler type GetLDAPEntitiesHandlerFunc func(GetLDAPEntitiesParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetLDAPEntitiesHandlerFunc) Handle(params GetLDAPEntitiesParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetLDAPEntitiesHandler interface for that can handle valid get l d a p entities params type GetLDAPEntitiesHandler interface { Handle(GetLDAPEntitiesParams, *models.Principal) middleware.Responder } // NewGetLDAPEntities creates a new http.Handler for the get l d a p entities operation func NewGetLDAPEntities(ctx *middleware.Context, handler GetLDAPEntitiesHandler) *GetLDAPEntities { return &GetLDAPEntities{Context: ctx, Handler: handler} } /* GetLDAPEntities swagger:route POST /ldap-entities idp getLDAPEntities Get LDAP Entities */ type GetLDAPEntities struct { Context *middleware.Context Handler GetLDAPEntitiesHandler } func (o *GetLDAPEntities) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetLDAPEntitiesParams() 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) } ================================================ FILE: api/operations/idp/get_l_d_a_p_entities_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( stderrors "errors" "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" ) // NewGetLDAPEntitiesParams creates a new GetLDAPEntitiesParams object // // There are no default values defined in the spec. func NewGetLDAPEntitiesParams() GetLDAPEntitiesParams { return GetLDAPEntitiesParams{} } // GetLDAPEntitiesParams contains all the bound params for the get l d a p entities operation // typically these are obtained from a http.Request // // swagger:parameters GetLDAPEntities type GetLDAPEntitiesParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.LdapEntitiesRequest } // 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 NewGetLDAPEntitiesParams() beforehand. func (o *GetLDAPEntitiesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.LdapEntitiesRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/idp/get_l_d_a_p_entities_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetLDAPEntitiesOKCode is the HTTP code returned for type GetLDAPEntitiesOK const GetLDAPEntitiesOKCode int = 200 /* GetLDAPEntitiesOK A successful response. swagger:response getLDAPEntitiesOK */ type GetLDAPEntitiesOK struct { /* In: Body */ Payload *models.LdapEntities `json:"body,omitempty"` } // NewGetLDAPEntitiesOK creates GetLDAPEntitiesOK with default headers values func NewGetLDAPEntitiesOK() *GetLDAPEntitiesOK { return &GetLDAPEntitiesOK{} } // WithPayload adds the payload to the get l d a p entities o k response func (o *GetLDAPEntitiesOK) WithPayload(payload *models.LdapEntities) *GetLDAPEntitiesOK { o.Payload = payload return o } // SetPayload sets the payload to the get l d a p entities o k response func (o *GetLDAPEntitiesOK) SetPayload(payload *models.LdapEntities) { o.Payload = payload } // WriteResponse to the client func (o *GetLDAPEntitiesOK) 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 } } } /* GetLDAPEntitiesDefault Generic error response. swagger:response getLDAPEntitiesDefault */ type GetLDAPEntitiesDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetLDAPEntitiesDefault creates GetLDAPEntitiesDefault with default headers values func NewGetLDAPEntitiesDefault(code int) *GetLDAPEntitiesDefault { if code <= 0 { code = 500 } return &GetLDAPEntitiesDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get l d a p entities default response func (o *GetLDAPEntitiesDefault) WithStatusCode(code int) *GetLDAPEntitiesDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get l d a p entities default response func (o *GetLDAPEntitiesDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get l d a p entities default response func (o *GetLDAPEntitiesDefault) WithPayload(payload *models.APIError) *GetLDAPEntitiesDefault { o.Payload = payload return o } // SetPayload sets the payload to the get l d a p entities default response func (o *GetLDAPEntitiesDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetLDAPEntitiesDefault) 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 } } } ================================================ FILE: api/operations/idp/get_l_d_a_p_entities_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "errors" "net/url" golangswaggerpaths "path" ) // GetLDAPEntitiesURL generates an URL for the get l d a p entities operation type GetLDAPEntitiesURL 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 *GetLDAPEntitiesURL) WithBasePath(bp string) *GetLDAPEntitiesURL { 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 *GetLDAPEntitiesURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetLDAPEntitiesURL) Build() (*url.URL, error) { var _result url.URL var _path = "/ldap-entities" _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 *GetLDAPEntitiesURL) 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 *GetLDAPEntitiesURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetLDAPEntitiesURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetLDAPEntitiesURL") } if host == "" { return nil, errors.New("host is required for a full url on GetLDAPEntitiesURL") } 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 *GetLDAPEntitiesURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/idp/list_configurations.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListConfigurationsHandlerFunc turns a function with the right signature into a list configurations handler type ListConfigurationsHandlerFunc func(ListConfigurationsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListConfigurationsHandlerFunc) Handle(params ListConfigurationsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListConfigurationsHandler interface for that can handle valid list configurations params type ListConfigurationsHandler interface { Handle(ListConfigurationsParams, *models.Principal) middleware.Responder } // NewListConfigurations creates a new http.Handler for the list configurations operation func NewListConfigurations(ctx *middleware.Context, handler ListConfigurationsHandler) *ListConfigurations { return &ListConfigurations{Context: ctx, Handler: handler} } /* ListConfigurations swagger:route GET /idp/{type} idp listConfigurations List IDP Configurations */ type ListConfigurations struct { Context *middleware.Context Handler ListConfigurationsHandler } func (o *ListConfigurations) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListConfigurationsParams() 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) } ================================================ FILE: api/operations/idp/list_configurations_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewListConfigurationsParams creates a new ListConfigurationsParams object // // There are no default values defined in the spec. func NewListConfigurationsParams() ListConfigurationsParams { return ListConfigurationsParams{} } // ListConfigurationsParams contains all the bound params for the list configurations operation // typically these are obtained from a http.Request // // swagger:parameters ListConfigurations type ListConfigurationsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /*IDP Configuration Type Required: true In: path */ Type 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 NewListConfigurationsParams() beforehand. func (o *ListConfigurationsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rType, rhkType, _ := route.Params.GetOK("type") if err := o.bindType(rType, rhkType, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindType binds and validates parameter Type from path. func (o *ListConfigurationsParams) bindType(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.Type = raw return nil } ================================================ FILE: api/operations/idp/list_configurations_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListConfigurationsOKCode is the HTTP code returned for type ListConfigurationsOK const ListConfigurationsOKCode int = 200 /* ListConfigurationsOK A successful response. swagger:response listConfigurationsOK */ type ListConfigurationsOK struct { /* In: Body */ Payload *models.IdpListConfigurationsResponse `json:"body,omitempty"` } // NewListConfigurationsOK creates ListConfigurationsOK with default headers values func NewListConfigurationsOK() *ListConfigurationsOK { return &ListConfigurationsOK{} } // WithPayload adds the payload to the list configurations o k response func (o *ListConfigurationsOK) WithPayload(payload *models.IdpListConfigurationsResponse) *ListConfigurationsOK { o.Payload = payload return o } // SetPayload sets the payload to the list configurations o k response func (o *ListConfigurationsOK) SetPayload(payload *models.IdpListConfigurationsResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListConfigurationsOK) 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 } } } /* ListConfigurationsDefault Generic error response. swagger:response listConfigurationsDefault */ type ListConfigurationsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListConfigurationsDefault creates ListConfigurationsDefault with default headers values func NewListConfigurationsDefault(code int) *ListConfigurationsDefault { if code <= 0 { code = 500 } return &ListConfigurationsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list configurations default response func (o *ListConfigurationsDefault) WithStatusCode(code int) *ListConfigurationsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list configurations default response func (o *ListConfigurationsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list configurations default response func (o *ListConfigurationsDefault) WithPayload(payload *models.APIError) *ListConfigurationsDefault { o.Payload = payload return o } // SetPayload sets the payload to the list configurations default response func (o *ListConfigurationsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListConfigurationsDefault) 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 } } } ================================================ FILE: api/operations/idp/list_configurations_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // ListConfigurationsURL generates an URL for the list configurations operation type ListConfigurationsURL struct { Type 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 *ListConfigurationsURL) WithBasePath(bp string) *ListConfigurationsURL { 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 *ListConfigurationsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListConfigurationsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/idp/{type}" typeVar := o.Type if typeVar != "" { _path = strings.ReplaceAll(_path, "{type}", typeVar) } else { return nil, errors.New("type is required on ListConfigurationsURL") } _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 *ListConfigurationsURL) 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 *ListConfigurationsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListConfigurationsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListConfigurationsURL") } if host == "" { return nil, errors.New("host is required for a full url on ListConfigurationsURL") } 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 *ListConfigurationsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/idp/update_configuration.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // UpdateConfigurationHandlerFunc turns a function with the right signature into a update configuration handler type UpdateConfigurationHandlerFunc func(UpdateConfigurationParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn UpdateConfigurationHandlerFunc) Handle(params UpdateConfigurationParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // UpdateConfigurationHandler interface for that can handle valid update configuration params type UpdateConfigurationHandler interface { Handle(UpdateConfigurationParams, *models.Principal) middleware.Responder } // NewUpdateConfiguration creates a new http.Handler for the update configuration operation func NewUpdateConfiguration(ctx *middleware.Context, handler UpdateConfigurationHandler) *UpdateConfiguration { return &UpdateConfiguration{Context: ctx, Handler: handler} } /* UpdateConfiguration swagger:route PUT /idp/{type}/{name} idp updateConfiguration Update IDP Configuration */ type UpdateConfiguration struct { Context *middleware.Context Handler UpdateConfigurationHandler } func (o *UpdateConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewUpdateConfigurationParams() 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) } ================================================ FILE: api/operations/idp/update_configuration_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( stderrors "errors" "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" ) // NewUpdateConfigurationParams creates a new UpdateConfigurationParams object // // There are no default values defined in the spec. func NewUpdateConfigurationParams() UpdateConfigurationParams { return UpdateConfigurationParams{} } // UpdateConfigurationParams contains all the bound params for the update configuration operation // typically these are obtained from a http.Request // // swagger:parameters UpdateConfiguration type UpdateConfigurationParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.IdpServerConfiguration /*IDP Configuration Name Required: true In: path */ Name string /*IDP Configuration Type Required: true In: path */ Type 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 NewUpdateConfigurationParams() beforehand. func (o *UpdateConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.IdpServerConfiguration if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } rType, rhkType, _ := route.Params.GetOK("type") if err := o.bindType(rType, rhkType, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *UpdateConfigurationParams) bindName(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.Name = raw return nil } // bindType binds and validates parameter Type from path. func (o *UpdateConfigurationParams) bindType(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.Type = raw return nil } ================================================ FILE: api/operations/idp/update_configuration_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // UpdateConfigurationOKCode is the HTTP code returned for type UpdateConfigurationOK const UpdateConfigurationOKCode int = 200 /* UpdateConfigurationOK A successful response. swagger:response updateConfigurationOK */ type UpdateConfigurationOK struct { /* In: Body */ Payload *models.SetIDPResponse `json:"body,omitempty"` } // NewUpdateConfigurationOK creates UpdateConfigurationOK with default headers values func NewUpdateConfigurationOK() *UpdateConfigurationOK { return &UpdateConfigurationOK{} } // WithPayload adds the payload to the update configuration o k response func (o *UpdateConfigurationOK) WithPayload(payload *models.SetIDPResponse) *UpdateConfigurationOK { o.Payload = payload return o } // SetPayload sets the payload to the update configuration o k response func (o *UpdateConfigurationOK) SetPayload(payload *models.SetIDPResponse) { o.Payload = payload } // WriteResponse to the client func (o *UpdateConfigurationOK) 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 } } } /* UpdateConfigurationDefault Generic error response. swagger:response updateConfigurationDefault */ type UpdateConfigurationDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewUpdateConfigurationDefault creates UpdateConfigurationDefault with default headers values func NewUpdateConfigurationDefault(code int) *UpdateConfigurationDefault { if code <= 0 { code = 500 } return &UpdateConfigurationDefault{ _statusCode: code, } } // WithStatusCode adds the status to the update configuration default response func (o *UpdateConfigurationDefault) WithStatusCode(code int) *UpdateConfigurationDefault { o._statusCode = code return o } // SetStatusCode sets the status to the update configuration default response func (o *UpdateConfigurationDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the update configuration default response func (o *UpdateConfigurationDefault) WithPayload(payload *models.APIError) *UpdateConfigurationDefault { o.Payload = payload return o } // SetPayload sets the payload to the update configuration default response func (o *UpdateConfigurationDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *UpdateConfigurationDefault) 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 } } } ================================================ FILE: api/operations/idp/update_configuration_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package idp import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // UpdateConfigurationURL generates an URL for the update configuration operation type UpdateConfigurationURL struct { Name string Type 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 *UpdateConfigurationURL) WithBasePath(bp string) *UpdateConfigurationURL { 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 *UpdateConfigurationURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *UpdateConfigurationURL) Build() (*url.URL, error) { var _result url.URL var _path = "/idp/{type}/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on UpdateConfigurationURL") } typeVar := o.Type if typeVar != "" { _path = strings.ReplaceAll(_path, "{type}", typeVar) } else { return nil, errors.New("type is required on UpdateConfigurationURL") } _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 *UpdateConfigurationURL) 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 *UpdateConfigurationURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *UpdateConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on UpdateConfigurationURL") } if host == "" { return nil, errors.New("host is required for a full url on UpdateConfigurationURL") } 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 *UpdateConfigurationURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/inspect/inspect.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package inspect import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // InspectHandlerFunc turns a function with the right signature into a inspect handler type InspectHandlerFunc func(InspectParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn InspectHandlerFunc) Handle(params InspectParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // InspectHandler interface for that can handle valid inspect params type InspectHandler interface { Handle(InspectParams, *models.Principal) middleware.Responder } // NewInspect creates a new http.Handler for the inspect operation func NewInspect(ctx *middleware.Context, handler InspectHandler) *Inspect { return &Inspect{Context: ctx, Handler: handler} } /* Inspect swagger:route GET /admin/inspect Inspect inspect Inspect Files on Drive */ type Inspect struct { Context *middleware.Context Handler InspectHandler } func (o *Inspect) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewInspectParams() 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) } ================================================ FILE: api/operations/inspect/inspect_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package inspect 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" ) // NewInspectParams creates a new InspectParams object // // There are no default values defined in the spec. func NewInspectParams() InspectParams { return InspectParams{} } // InspectParams contains all the bound params for the inspect operation // typically these are obtained from a http.Request // // swagger:parameters Inspect type InspectParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* In: query */ Encrypt *bool /* Required: true In: query */ File string /* Required: true In: query */ Volume 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 NewInspectParams() beforehand. func (o *InspectParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) qEncrypt, qhkEncrypt, _ := qs.GetOK("encrypt") if err := o.bindEncrypt(qEncrypt, qhkEncrypt, route.Formats); err != nil { res = append(res, err) } qFile, qhkFile, _ := qs.GetOK("file") if err := o.bindFile(qFile, qhkFile, route.Formats); err != nil { res = append(res, err) } qVolume, qhkVolume, _ := qs.GetOK("volume") if err := o.bindVolume(qVolume, qhkVolume, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindEncrypt binds and validates parameter Encrypt from query. func (o *InspectParams) bindEncrypt(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.ConvertBool(raw) if err != nil { return errors.InvalidType("encrypt", "query", "bool", raw) } o.Encrypt = &value return nil } // bindFile binds and validates parameter File from query. func (o *InspectParams) bindFile(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("file", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("file", "query", raw); err != nil { return err } o.File = raw return nil } // bindVolume binds and validates parameter Volume from query. func (o *InspectParams) bindVolume(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("volume", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("volume", "query", raw); err != nil { return err } o.Volume = raw return nil } ================================================ FILE: api/operations/inspect/inspect_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package inspect import ( "io" "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // InspectOKCode is the HTTP code returned for type InspectOK const InspectOKCode int = 200 /* InspectOK A successful response. swagger:response inspectOK */ type InspectOK struct { /* In: Body */ Payload io.ReadCloser `json:"body,omitempty"` } // NewInspectOK creates InspectOK with default headers values func NewInspectOK() *InspectOK { return &InspectOK{} } // WithPayload adds the payload to the inspect o k response func (o *InspectOK) WithPayload(payload io.ReadCloser) *InspectOK { o.Payload = payload return o } // SetPayload sets the payload to the inspect o k response func (o *InspectOK) SetPayload(payload io.ReadCloser) { o.Payload = payload } // WriteResponse to the client func (o *InspectOK) 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 } } /* InspectDefault Generic error response. swagger:response inspectDefault */ type InspectDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewInspectDefault creates InspectDefault with default headers values func NewInspectDefault(code int) *InspectDefault { if code <= 0 { code = 500 } return &InspectDefault{ _statusCode: code, } } // WithStatusCode adds the status to the inspect default response func (o *InspectDefault) WithStatusCode(code int) *InspectDefault { o._statusCode = code return o } // SetStatusCode sets the status to the inspect default response func (o *InspectDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the inspect default response func (o *InspectDefault) WithPayload(payload *models.APIError) *InspectDefault { o.Payload = payload return o } // SetPayload sets the payload to the inspect default response func (o *InspectDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *InspectDefault) 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 } } } ================================================ FILE: api/operations/inspect/inspect_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package inspect import ( "errors" "net/url" golangswaggerpaths "path" "github.com/go-openapi/swag" ) // InspectURL generates an URL for the inspect operation type InspectURL struct { Encrypt *bool File string Volume 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 *InspectURL) WithBasePath(bp string) *InspectURL { 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 *InspectURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *InspectURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/inspect" _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var encryptQ string if o.Encrypt != nil { encryptQ = swag.FormatBool(*o.Encrypt) } if encryptQ != "" { qs.Set("encrypt", encryptQ) } fileQ := o.File if fileQ != "" { qs.Set("file", fileQ) } volumeQ := o.Volume if volumeQ != "" { qs.Set("volume", volumeQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *InspectURL) 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 *InspectURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *InspectURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on InspectURL") } if host == "" { return nil, errors.New("host is required for a full url on InspectURL") } 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 *InspectURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/k_m_s/k_m_s_apis.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // KMSAPIsHandlerFunc turns a function with the right signature into a k m s APIs handler type KMSAPIsHandlerFunc func(KMSAPIsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn KMSAPIsHandlerFunc) Handle(params KMSAPIsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // KMSAPIsHandler interface for that can handle valid k m s APIs params type KMSAPIsHandler interface { Handle(KMSAPIsParams, *models.Principal) middleware.Responder } // NewKMSAPIs creates a new http.Handler for the k m s APIs operation func NewKMSAPIs(ctx *middleware.Context, handler KMSAPIsHandler) *KMSAPIs { return &KMSAPIs{Context: ctx, Handler: handler} } /* KMSAPIs swagger:route GET /kms/apis KMS kMSApis KMS apis */ type KMSAPIs struct { Context *middleware.Context Handler KMSAPIsHandler } func (o *KMSAPIs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewKMSAPIsParams() 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) } ================================================ FILE: api/operations/k_m_s/k_m_s_apis_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewKMSAPIsParams creates a new KMSAPIsParams object // // There are no default values defined in the spec. func NewKMSAPIsParams() KMSAPIsParams { return KMSAPIsParams{} } // KMSAPIsParams contains all the bound params for the k m s APIs operation // typically these are obtained from a http.Request // // swagger:parameters KMSAPIs type KMSAPIsParams 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 NewKMSAPIsParams() beforehand. func (o *KMSAPIsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/k_m_s/k_m_s_apis_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // KMSApisOKCode is the HTTP code returned for type KMSApisOK const KMSApisOKCode int = 200 /* KMSApisOK A successful response. swagger:response kMSApisOK */ type KMSApisOK struct { /* In: Body */ Payload *models.KmsAPIsResponse `json:"body,omitempty"` } // NewKMSApisOK creates KMSApisOK with default headers values func NewKMSApisOK() *KMSApisOK { return &KMSApisOK{} } // WithPayload adds the payload to the k m s apis o k response func (o *KMSApisOK) WithPayload(payload *models.KmsAPIsResponse) *KMSApisOK { o.Payload = payload return o } // SetPayload sets the payload to the k m s apis o k response func (o *KMSApisOK) SetPayload(payload *models.KmsAPIsResponse) { o.Payload = payload } // WriteResponse to the client func (o *KMSApisOK) 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 } } } /* KMSAPIsDefault Generic error response. swagger:response kMSApisDefault */ type KMSAPIsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewKMSAPIsDefault creates KMSAPIsDefault with default headers values func NewKMSAPIsDefault(code int) *KMSAPIsDefault { if code <= 0 { code = 500 } return &KMSAPIsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the k m s APIs default response func (o *KMSAPIsDefault) WithStatusCode(code int) *KMSAPIsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the k m s APIs default response func (o *KMSAPIsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the k m s APIs default response func (o *KMSAPIsDefault) WithPayload(payload *models.APIError) *KMSAPIsDefault { o.Payload = payload return o } // SetPayload sets the payload to the k m s APIs default response func (o *KMSAPIsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *KMSAPIsDefault) 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 } } } ================================================ FILE: api/operations/k_m_s/k_m_s_apis_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "errors" "net/url" golangswaggerpaths "path" ) // KMSAPIsURL generates an URL for the k m s APIs operation type KMSAPIsURL 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 *KMSAPIsURL) WithBasePath(bp string) *KMSAPIsURL { 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 *KMSAPIsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *KMSAPIsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/kms/apis" _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 *KMSAPIsURL) 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 *KMSAPIsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *KMSAPIsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on KMSAPIsURL") } if host == "" { return nil, errors.New("host is required for a full url on KMSAPIsURL") } 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 *KMSAPIsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/k_m_s/k_m_s_create_key.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // KMSCreateKeyHandlerFunc turns a function with the right signature into a k m s create key handler type KMSCreateKeyHandlerFunc func(KMSCreateKeyParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn KMSCreateKeyHandlerFunc) Handle(params KMSCreateKeyParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // KMSCreateKeyHandler interface for that can handle valid k m s create key params type KMSCreateKeyHandler interface { Handle(KMSCreateKeyParams, *models.Principal) middleware.Responder } // NewKMSCreateKey creates a new http.Handler for the k m s create key operation func NewKMSCreateKey(ctx *middleware.Context, handler KMSCreateKeyHandler) *KMSCreateKey { return &KMSCreateKey{Context: ctx, Handler: handler} } /* KMSCreateKey swagger:route POST /kms/keys KMS kMSCreateKey KMS create key */ type KMSCreateKey struct { Context *middleware.Context Handler KMSCreateKeyHandler } func (o *KMSCreateKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewKMSCreateKeyParams() 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) } ================================================ FILE: api/operations/k_m_s/k_m_s_create_key_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( stderrors "errors" "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" ) // NewKMSCreateKeyParams creates a new KMSCreateKeyParams object // // There are no default values defined in the spec. func NewKMSCreateKeyParams() KMSCreateKeyParams { return KMSCreateKeyParams{} } // KMSCreateKeyParams contains all the bound params for the k m s create key operation // typically these are obtained from a http.Request // // swagger:parameters KMSCreateKey type KMSCreateKeyParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.KmsCreateKeyRequest } // 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 NewKMSCreateKeyParams() beforehand. func (o *KMSCreateKeyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.KmsCreateKeyRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/k_m_s/k_m_s_create_key_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // KMSCreateKeyCreatedCode is the HTTP code returned for type KMSCreateKeyCreated const KMSCreateKeyCreatedCode int = 201 /* KMSCreateKeyCreated A successful response. swagger:response kMSCreateKeyCreated */ type KMSCreateKeyCreated struct { } // NewKMSCreateKeyCreated creates KMSCreateKeyCreated with default headers values func NewKMSCreateKeyCreated() *KMSCreateKeyCreated { return &KMSCreateKeyCreated{} } // WriteResponse to the client func (o *KMSCreateKeyCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(201) } /* KMSCreateKeyDefault Generic error response. swagger:response kMSCreateKeyDefault */ type KMSCreateKeyDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewKMSCreateKeyDefault creates KMSCreateKeyDefault with default headers values func NewKMSCreateKeyDefault(code int) *KMSCreateKeyDefault { if code <= 0 { code = 500 } return &KMSCreateKeyDefault{ _statusCode: code, } } // WithStatusCode adds the status to the k m s create key default response func (o *KMSCreateKeyDefault) WithStatusCode(code int) *KMSCreateKeyDefault { o._statusCode = code return o } // SetStatusCode sets the status to the k m s create key default response func (o *KMSCreateKeyDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the k m s create key default response func (o *KMSCreateKeyDefault) WithPayload(payload *models.APIError) *KMSCreateKeyDefault { o.Payload = payload return o } // SetPayload sets the payload to the k m s create key default response func (o *KMSCreateKeyDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *KMSCreateKeyDefault) 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 } } } ================================================ FILE: api/operations/k_m_s/k_m_s_create_key_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "errors" "net/url" golangswaggerpaths "path" ) // KMSCreateKeyURL generates an URL for the k m s create key operation type KMSCreateKeyURL 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 *KMSCreateKeyURL) WithBasePath(bp string) *KMSCreateKeyURL { 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 *KMSCreateKeyURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *KMSCreateKeyURL) Build() (*url.URL, error) { var _result url.URL var _path = "/kms/keys" _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 *KMSCreateKeyURL) 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 *KMSCreateKeyURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *KMSCreateKeyURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on KMSCreateKeyURL") } if host == "" { return nil, errors.New("host is required for a full url on KMSCreateKeyURL") } 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 *KMSCreateKeyURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/k_m_s/k_m_s_key_status.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // KMSKeyStatusHandlerFunc turns a function with the right signature into a k m s key status handler type KMSKeyStatusHandlerFunc func(KMSKeyStatusParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn KMSKeyStatusHandlerFunc) Handle(params KMSKeyStatusParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // KMSKeyStatusHandler interface for that can handle valid k m s key status params type KMSKeyStatusHandler interface { Handle(KMSKeyStatusParams, *models.Principal) middleware.Responder } // NewKMSKeyStatus creates a new http.Handler for the k m s key status operation func NewKMSKeyStatus(ctx *middleware.Context, handler KMSKeyStatusHandler) *KMSKeyStatus { return &KMSKeyStatus{Context: ctx, Handler: handler} } /* KMSKeyStatus swagger:route GET /kms/keys/{name} KMS kMSKeyStatus KMS key status */ type KMSKeyStatus struct { Context *middleware.Context Handler KMSKeyStatusHandler } func (o *KMSKeyStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewKMSKeyStatusParams() 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) } ================================================ FILE: api/operations/k_m_s/k_m_s_key_status_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewKMSKeyStatusParams creates a new KMSKeyStatusParams object // // There are no default values defined in the spec. func NewKMSKeyStatusParams() KMSKeyStatusParams { return KMSKeyStatusParams{} } // KMSKeyStatusParams contains all the bound params for the k m s key status operation // typically these are obtained from a http.Request // // swagger:parameters KMSKeyStatus type KMSKeyStatusParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /*KMS key name Required: true In: path */ Name 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 NewKMSKeyStatusParams() beforehand. func (o *KMSKeyStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *KMSKeyStatusParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/k_m_s/k_m_s_key_status_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // KMSKeyStatusOKCode is the HTTP code returned for type KMSKeyStatusOK const KMSKeyStatusOKCode int = 200 /* KMSKeyStatusOK A successful response. swagger:response kMSKeyStatusOK */ type KMSKeyStatusOK struct { /* In: Body */ Payload *models.KmsKeyStatusResponse `json:"body,omitempty"` } // NewKMSKeyStatusOK creates KMSKeyStatusOK with default headers values func NewKMSKeyStatusOK() *KMSKeyStatusOK { return &KMSKeyStatusOK{} } // WithPayload adds the payload to the k m s key status o k response func (o *KMSKeyStatusOK) WithPayload(payload *models.KmsKeyStatusResponse) *KMSKeyStatusOK { o.Payload = payload return o } // SetPayload sets the payload to the k m s key status o k response func (o *KMSKeyStatusOK) SetPayload(payload *models.KmsKeyStatusResponse) { o.Payload = payload } // WriteResponse to the client func (o *KMSKeyStatusOK) 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 } } } /* KMSKeyStatusDefault Generic error response. swagger:response kMSKeyStatusDefault */ type KMSKeyStatusDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewKMSKeyStatusDefault creates KMSKeyStatusDefault with default headers values func NewKMSKeyStatusDefault(code int) *KMSKeyStatusDefault { if code <= 0 { code = 500 } return &KMSKeyStatusDefault{ _statusCode: code, } } // WithStatusCode adds the status to the k m s key status default response func (o *KMSKeyStatusDefault) WithStatusCode(code int) *KMSKeyStatusDefault { o._statusCode = code return o } // SetStatusCode sets the status to the k m s key status default response func (o *KMSKeyStatusDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the k m s key status default response func (o *KMSKeyStatusDefault) WithPayload(payload *models.APIError) *KMSKeyStatusDefault { o.Payload = payload return o } // SetPayload sets the payload to the k m s key status default response func (o *KMSKeyStatusDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *KMSKeyStatusDefault) 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 } } } ================================================ FILE: api/operations/k_m_s/k_m_s_key_status_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // KMSKeyStatusURL generates an URL for the k m s key status operation type KMSKeyStatusURL struct { Name 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 *KMSKeyStatusURL) WithBasePath(bp string) *KMSKeyStatusURL { 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 *KMSKeyStatusURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *KMSKeyStatusURL) Build() (*url.URL, error) { var _result url.URL var _path = "/kms/keys/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on KMSKeyStatusURL") } _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 *KMSKeyStatusURL) 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 *KMSKeyStatusURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *KMSKeyStatusURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on KMSKeyStatusURL") } if host == "" { return nil, errors.New("host is required for a full url on KMSKeyStatusURL") } 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 *KMSKeyStatusURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/k_m_s/k_m_s_list_keys.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // KMSListKeysHandlerFunc turns a function with the right signature into a k m s list keys handler type KMSListKeysHandlerFunc func(KMSListKeysParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn KMSListKeysHandlerFunc) Handle(params KMSListKeysParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // KMSListKeysHandler interface for that can handle valid k m s list keys params type KMSListKeysHandler interface { Handle(KMSListKeysParams, *models.Principal) middleware.Responder } // NewKMSListKeys creates a new http.Handler for the k m s list keys operation func NewKMSListKeys(ctx *middleware.Context, handler KMSListKeysHandler) *KMSListKeys { return &KMSListKeys{Context: ctx, Handler: handler} } /* KMSListKeys swagger:route GET /kms/keys KMS kMSListKeys KMS list keys */ type KMSListKeys struct { Context *middleware.Context Handler KMSListKeysHandler } func (o *KMSListKeys) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewKMSListKeysParams() 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) } ================================================ FILE: api/operations/k_m_s/k_m_s_list_keys_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewKMSListKeysParams creates a new KMSListKeysParams object // // There are no default values defined in the spec. func NewKMSListKeysParams() KMSListKeysParams { return KMSListKeysParams{} } // KMSListKeysParams contains all the bound params for the k m s list keys operation // typically these are obtained from a http.Request // // swagger:parameters KMSListKeys type KMSListKeysParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /*pattern to retrieve keys In: query */ Pattern *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 NewKMSListKeysParams() beforehand. func (o *KMSListKeysParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) qPattern, qhkPattern, _ := qs.GetOK("pattern") if err := o.bindPattern(qPattern, qhkPattern, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindPattern binds and validates parameter Pattern from query. func (o *KMSListKeysParams) bindPattern(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.Pattern = &raw return nil } ================================================ FILE: api/operations/k_m_s/k_m_s_list_keys_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // KMSListKeysOKCode is the HTTP code returned for type KMSListKeysOK const KMSListKeysOKCode int = 200 /* KMSListKeysOK A successful response. swagger:response kMSListKeysOK */ type KMSListKeysOK struct { /* In: Body */ Payload *models.KmsListKeysResponse `json:"body,omitempty"` } // NewKMSListKeysOK creates KMSListKeysOK with default headers values func NewKMSListKeysOK() *KMSListKeysOK { return &KMSListKeysOK{} } // WithPayload adds the payload to the k m s list keys o k response func (o *KMSListKeysOK) WithPayload(payload *models.KmsListKeysResponse) *KMSListKeysOK { o.Payload = payload return o } // SetPayload sets the payload to the k m s list keys o k response func (o *KMSListKeysOK) SetPayload(payload *models.KmsListKeysResponse) { o.Payload = payload } // WriteResponse to the client func (o *KMSListKeysOK) 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 } } } /* KMSListKeysDefault Generic error response. swagger:response kMSListKeysDefault */ type KMSListKeysDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewKMSListKeysDefault creates KMSListKeysDefault with default headers values func NewKMSListKeysDefault(code int) *KMSListKeysDefault { if code <= 0 { code = 500 } return &KMSListKeysDefault{ _statusCode: code, } } // WithStatusCode adds the status to the k m s list keys default response func (o *KMSListKeysDefault) WithStatusCode(code int) *KMSListKeysDefault { o._statusCode = code return o } // SetStatusCode sets the status to the k m s list keys default response func (o *KMSListKeysDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the k m s list keys default response func (o *KMSListKeysDefault) WithPayload(payload *models.APIError) *KMSListKeysDefault { o.Payload = payload return o } // SetPayload sets the payload to the k m s list keys default response func (o *KMSListKeysDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *KMSListKeysDefault) 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 } } } ================================================ FILE: api/operations/k_m_s/k_m_s_list_keys_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "errors" "net/url" golangswaggerpaths "path" ) // KMSListKeysURL generates an URL for the k m s list keys operation type KMSListKeysURL struct { Pattern *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 *KMSListKeysURL) WithBasePath(bp string) *KMSListKeysURL { 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 *KMSListKeysURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *KMSListKeysURL) Build() (*url.URL, error) { var _result url.URL var _path = "/kms/keys" _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var patternQ string if o.Pattern != nil { patternQ = *o.Pattern } if patternQ != "" { qs.Set("pattern", patternQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *KMSListKeysURL) 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 *KMSListKeysURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *KMSListKeysURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on KMSListKeysURL") } if host == "" { return nil, errors.New("host is required for a full url on KMSListKeysURL") } 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 *KMSListKeysURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/k_m_s/k_m_s_metrics.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // KMSMetricsHandlerFunc turns a function with the right signature into a k m s metrics handler type KMSMetricsHandlerFunc func(KMSMetricsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn KMSMetricsHandlerFunc) Handle(params KMSMetricsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // KMSMetricsHandler interface for that can handle valid k m s metrics params type KMSMetricsHandler interface { Handle(KMSMetricsParams, *models.Principal) middleware.Responder } // NewKMSMetrics creates a new http.Handler for the k m s metrics operation func NewKMSMetrics(ctx *middleware.Context, handler KMSMetricsHandler) *KMSMetrics { return &KMSMetrics{Context: ctx, Handler: handler} } /* KMSMetrics swagger:route GET /kms/metrics KMS kMSMetrics KMS metrics */ type KMSMetrics struct { Context *middleware.Context Handler KMSMetricsHandler } func (o *KMSMetrics) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewKMSMetricsParams() 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) } ================================================ FILE: api/operations/k_m_s/k_m_s_metrics_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewKMSMetricsParams creates a new KMSMetricsParams object // // There are no default values defined in the spec. func NewKMSMetricsParams() KMSMetricsParams { return KMSMetricsParams{} } // KMSMetricsParams contains all the bound params for the k m s metrics operation // typically these are obtained from a http.Request // // swagger:parameters KMSMetrics type KMSMetricsParams 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 NewKMSMetricsParams() beforehand. func (o *KMSMetricsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/k_m_s/k_m_s_metrics_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // KMSMetricsOKCode is the HTTP code returned for type KMSMetricsOK const KMSMetricsOKCode int = 200 /* KMSMetricsOK A successful response. swagger:response kMSMetricsOK */ type KMSMetricsOK struct { /* In: Body */ Payload *models.KmsMetricsResponse `json:"body,omitempty"` } // NewKMSMetricsOK creates KMSMetricsOK with default headers values func NewKMSMetricsOK() *KMSMetricsOK { return &KMSMetricsOK{} } // WithPayload adds the payload to the k m s metrics o k response func (o *KMSMetricsOK) WithPayload(payload *models.KmsMetricsResponse) *KMSMetricsOK { o.Payload = payload return o } // SetPayload sets the payload to the k m s metrics o k response func (o *KMSMetricsOK) SetPayload(payload *models.KmsMetricsResponse) { o.Payload = payload } // WriteResponse to the client func (o *KMSMetricsOK) 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 } } } /* KMSMetricsDefault Generic error response. swagger:response kMSMetricsDefault */ type KMSMetricsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewKMSMetricsDefault creates KMSMetricsDefault with default headers values func NewKMSMetricsDefault(code int) *KMSMetricsDefault { if code <= 0 { code = 500 } return &KMSMetricsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the k m s metrics default response func (o *KMSMetricsDefault) WithStatusCode(code int) *KMSMetricsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the k m s metrics default response func (o *KMSMetricsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the k m s metrics default response func (o *KMSMetricsDefault) WithPayload(payload *models.APIError) *KMSMetricsDefault { o.Payload = payload return o } // SetPayload sets the payload to the k m s metrics default response func (o *KMSMetricsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *KMSMetricsDefault) 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 } } } ================================================ FILE: api/operations/k_m_s/k_m_s_metrics_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "errors" "net/url" golangswaggerpaths "path" ) // KMSMetricsURL generates an URL for the k m s metrics operation type KMSMetricsURL 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 *KMSMetricsURL) WithBasePath(bp string) *KMSMetricsURL { 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 *KMSMetricsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *KMSMetricsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/kms/metrics" _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 *KMSMetricsURL) 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 *KMSMetricsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *KMSMetricsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on KMSMetricsURL") } if host == "" { return nil, errors.New("host is required for a full url on KMSMetricsURL") } 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 *KMSMetricsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/k_m_s/k_m_s_status.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // KMSStatusHandlerFunc turns a function with the right signature into a k m s status handler type KMSStatusHandlerFunc func(KMSStatusParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn KMSStatusHandlerFunc) Handle(params KMSStatusParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // KMSStatusHandler interface for that can handle valid k m s status params type KMSStatusHandler interface { Handle(KMSStatusParams, *models.Principal) middleware.Responder } // NewKMSStatus creates a new http.Handler for the k m s status operation func NewKMSStatus(ctx *middleware.Context, handler KMSStatusHandler) *KMSStatus { return &KMSStatus{Context: ctx, Handler: handler} } /* KMSStatus swagger:route GET /kms/status KMS kMSStatus KMS status */ type KMSStatus struct { Context *middleware.Context Handler KMSStatusHandler } func (o *KMSStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewKMSStatusParams() 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) } ================================================ FILE: api/operations/k_m_s/k_m_s_status_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewKMSStatusParams creates a new KMSStatusParams object // // There are no default values defined in the spec. func NewKMSStatusParams() KMSStatusParams { return KMSStatusParams{} } // KMSStatusParams contains all the bound params for the k m s status operation // typically these are obtained from a http.Request // // swagger:parameters KMSStatus type KMSStatusParams 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 NewKMSStatusParams() beforehand. func (o *KMSStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/k_m_s/k_m_s_status_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // KMSStatusOKCode is the HTTP code returned for type KMSStatusOK const KMSStatusOKCode int = 200 /* KMSStatusOK A successful response. swagger:response kMSStatusOK */ type KMSStatusOK struct { /* In: Body */ Payload *models.KmsStatusResponse `json:"body,omitempty"` } // NewKMSStatusOK creates KMSStatusOK with default headers values func NewKMSStatusOK() *KMSStatusOK { return &KMSStatusOK{} } // WithPayload adds the payload to the k m s status o k response func (o *KMSStatusOK) WithPayload(payload *models.KmsStatusResponse) *KMSStatusOK { o.Payload = payload return o } // SetPayload sets the payload to the k m s status o k response func (o *KMSStatusOK) SetPayload(payload *models.KmsStatusResponse) { o.Payload = payload } // WriteResponse to the client func (o *KMSStatusOK) 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 } } } /* KMSStatusDefault Generic error response. swagger:response kMSStatusDefault */ type KMSStatusDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewKMSStatusDefault creates KMSStatusDefault with default headers values func NewKMSStatusDefault(code int) *KMSStatusDefault { if code <= 0 { code = 500 } return &KMSStatusDefault{ _statusCode: code, } } // WithStatusCode adds the status to the k m s status default response func (o *KMSStatusDefault) WithStatusCode(code int) *KMSStatusDefault { o._statusCode = code return o } // SetStatusCode sets the status to the k m s status default response func (o *KMSStatusDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the k m s status default response func (o *KMSStatusDefault) WithPayload(payload *models.APIError) *KMSStatusDefault { o.Payload = payload return o } // SetPayload sets the payload to the k m s status default response func (o *KMSStatusDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *KMSStatusDefault) 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 } } } ================================================ FILE: api/operations/k_m_s/k_m_s_status_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "errors" "net/url" golangswaggerpaths "path" ) // KMSStatusURL generates an URL for the k m s status operation type KMSStatusURL 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 *KMSStatusURL) WithBasePath(bp string) *KMSStatusURL { 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 *KMSStatusURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *KMSStatusURL) Build() (*url.URL, error) { var _result url.URL var _path = "/kms/status" _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 *KMSStatusURL) 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 *KMSStatusURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *KMSStatusURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on KMSStatusURL") } if host == "" { return nil, errors.New("host is required for a full url on KMSStatusURL") } 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 *KMSStatusURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/k_m_s/k_m_s_version.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // KMSVersionHandlerFunc turns a function with the right signature into a k m s version handler type KMSVersionHandlerFunc func(KMSVersionParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn KMSVersionHandlerFunc) Handle(params KMSVersionParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // KMSVersionHandler interface for that can handle valid k m s version params type KMSVersionHandler interface { Handle(KMSVersionParams, *models.Principal) middleware.Responder } // NewKMSVersion creates a new http.Handler for the k m s version operation func NewKMSVersion(ctx *middleware.Context, handler KMSVersionHandler) *KMSVersion { return &KMSVersion{Context: ctx, Handler: handler} } /* KMSVersion swagger:route GET /kms/version KMS kMSVersion KMS version */ type KMSVersion struct { Context *middleware.Context Handler KMSVersionHandler } func (o *KMSVersion) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewKMSVersionParams() 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) } ================================================ FILE: api/operations/k_m_s/k_m_s_version_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewKMSVersionParams creates a new KMSVersionParams object // // There are no default values defined in the spec. func NewKMSVersionParams() KMSVersionParams { return KMSVersionParams{} } // KMSVersionParams contains all the bound params for the k m s version operation // typically these are obtained from a http.Request // // swagger:parameters KMSVersion type KMSVersionParams 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 NewKMSVersionParams() beforehand. func (o *KMSVersionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/k_m_s/k_m_s_version_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // KMSVersionOKCode is the HTTP code returned for type KMSVersionOK const KMSVersionOKCode int = 200 /* KMSVersionOK A successful response. swagger:response kMSVersionOK */ type KMSVersionOK struct { /* In: Body */ Payload *models.KmsVersionResponse `json:"body,omitempty"` } // NewKMSVersionOK creates KMSVersionOK with default headers values func NewKMSVersionOK() *KMSVersionOK { return &KMSVersionOK{} } // WithPayload adds the payload to the k m s version o k response func (o *KMSVersionOK) WithPayload(payload *models.KmsVersionResponse) *KMSVersionOK { o.Payload = payload return o } // SetPayload sets the payload to the k m s version o k response func (o *KMSVersionOK) SetPayload(payload *models.KmsVersionResponse) { o.Payload = payload } // WriteResponse to the client func (o *KMSVersionOK) 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 } } } /* KMSVersionDefault Generic error response. swagger:response kMSVersionDefault */ type KMSVersionDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewKMSVersionDefault creates KMSVersionDefault with default headers values func NewKMSVersionDefault(code int) *KMSVersionDefault { if code <= 0 { code = 500 } return &KMSVersionDefault{ _statusCode: code, } } // WithStatusCode adds the status to the k m s version default response func (o *KMSVersionDefault) WithStatusCode(code int) *KMSVersionDefault { o._statusCode = code return o } // SetStatusCode sets the status to the k m s version default response func (o *KMSVersionDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the k m s version default response func (o *KMSVersionDefault) WithPayload(payload *models.APIError) *KMSVersionDefault { o.Payload = payload return o } // SetPayload sets the payload to the k m s version default response func (o *KMSVersionDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *KMSVersionDefault) 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 } } } ================================================ FILE: api/operations/k_m_s/k_m_s_version_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package k_m_s import ( "errors" "net/url" golangswaggerpaths "path" ) // KMSVersionURL generates an URL for the k m s version operation type KMSVersionURL 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 *KMSVersionURL) WithBasePath(bp string) *KMSVersionURL { 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 *KMSVersionURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *KMSVersionURL) Build() (*url.URL, error) { var _result url.URL var _path = "/kms/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 *KMSVersionURL) 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 *KMSVersionURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *KMSVersionURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on KMSVersionURL") } if host == "" { return nil, errors.New("host is required for a full url on KMSVersionURL") } 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 *KMSVersionURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/logging/log_search.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package logging import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // LogSearchHandlerFunc turns a function with the right signature into a log search handler type LogSearchHandlerFunc func(LogSearchParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn LogSearchHandlerFunc) Handle(params LogSearchParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // LogSearchHandler interface for that can handle valid log search params type LogSearchHandler interface { Handle(LogSearchParams, *models.Principal) middleware.Responder } // NewLogSearch creates a new http.Handler for the log search operation func NewLogSearch(ctx *middleware.Context, handler LogSearchHandler) *LogSearch { return &LogSearch{Context: ctx, Handler: handler} } /* LogSearch swagger:route GET /logs/search Logging logSearch Search the logs */ type LogSearch struct { Context *middleware.Context Handler LogSearchHandler } func (o *LogSearch) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewLogSearchParams() 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) } ================================================ FILE: api/operations/logging/log_search_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package logging 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" ) // NewLogSearchParams creates a new LogSearchParams object // with the default values initialized. func NewLogSearchParams() LogSearchParams { var ( // initialize parameters with default values orderDefault = string("timeDesc") pageNoDefault = int32(0) pageSizeDefault = int32(10) ) return LogSearchParams{ Order: &orderDefault, PageNo: &pageNoDefault, PageSize: &pageSizeDefault, } } // LogSearchParams contains all the bound params for the log search operation // typically these are obtained from a http.Request // // swagger:parameters LogSearch type LogSearchParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /*Filter Parameters In: query Collection Format: multi */ Fp []string /* In: query Default: "timeDesc" */ Order *string /* In: query Default: 0 */ PageNo *int32 /* In: query Default: 10 */ PageSize *int32 /* In: query */ TimeEnd *string /* In: query */ TimeStart *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 NewLogSearchParams() beforehand. func (o *LogSearchParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) qFp, qhkFp, _ := qs.GetOK("fp") if err := o.bindFp(qFp, qhkFp, route.Formats); err != nil { res = append(res, err) } qOrder, qhkOrder, _ := qs.GetOK("order") if err := o.bindOrder(qOrder, qhkOrder, route.Formats); err != nil { res = append(res, err) } qPageNo, qhkPageNo, _ := qs.GetOK("pageNo") if err := o.bindPageNo(qPageNo, qhkPageNo, route.Formats); err != nil { res = append(res, err) } qPageSize, qhkPageSize, _ := qs.GetOK("pageSize") if err := o.bindPageSize(qPageSize, qhkPageSize, route.Formats); err != nil { res = append(res, err) } qTimeEnd, qhkTimeEnd, _ := qs.GetOK("timeEnd") if err := o.bindTimeEnd(qTimeEnd, qhkTimeEnd, route.Formats); err != nil { res = append(res, err) } qTimeStart, qhkTimeStart, _ := qs.GetOK("timeStart") if err := o.bindTimeStart(qTimeStart, qhkTimeStart, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindFp binds and validates array parameter Fp from query. // // Arrays are parsed according to CollectionFormat: "multi" (defaults to "csv" when empty). func (o *LogSearchParams) bindFp(rawData []string, hasKey bool, formats strfmt.Registry) error { // CollectionFormat: multi fpIC := rawData if len(fpIC) == 0 { return nil } var fpIR []string for _, fpIV := range fpIC { fpI := fpIV fpIR = append(fpIR, fpI) } o.Fp = fpIR return nil } // bindOrder binds and validates parameter Order from query. func (o *LogSearchParams) bindOrder(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 // Default values have been previously initialized by NewLogSearchParams() return nil } o.Order = &raw if err := o.validateOrder(formats); err != nil { return err } return nil } // validateOrder carries out validations for parameter Order func (o *LogSearchParams) validateOrder(formats strfmt.Registry) error { if err := validate.EnumCase("order", "query", *o.Order, []any{"timeDesc", "timeAsc"}, true); err != nil { return err } return nil } // bindPageNo binds and validates parameter PageNo from query. func (o *LogSearchParams) bindPageNo(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 // Default values have been previously initialized by NewLogSearchParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("pageNo", "query", "int32", raw) } o.PageNo = &value return nil } // bindPageSize binds and validates parameter PageSize from query. func (o *LogSearchParams) bindPageSize(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 // Default values have been previously initialized by NewLogSearchParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("pageSize", "query", "int32", raw) } o.PageSize = &value return nil } // bindTimeEnd binds and validates parameter TimeEnd from query. func (o *LogSearchParams) bindTimeEnd(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.TimeEnd = &raw return nil } // bindTimeStart binds and validates parameter TimeStart from query. func (o *LogSearchParams) bindTimeStart(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.TimeStart = &raw return nil } ================================================ FILE: api/operations/logging/log_search_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package logging import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // LogSearchOKCode is the HTTP code returned for type LogSearchOK const LogSearchOKCode int = 200 /* LogSearchOK A successful response. swagger:response logSearchOK */ type LogSearchOK struct { /* In: Body */ Payload *models.LogSearchResponse `json:"body,omitempty"` } // NewLogSearchOK creates LogSearchOK with default headers values func NewLogSearchOK() *LogSearchOK { return &LogSearchOK{} } // WithPayload adds the payload to the log search o k response func (o *LogSearchOK) WithPayload(payload *models.LogSearchResponse) *LogSearchOK { o.Payload = payload return o } // SetPayload sets the payload to the log search o k response func (o *LogSearchOK) SetPayload(payload *models.LogSearchResponse) { o.Payload = payload } // WriteResponse to the client func (o *LogSearchOK) 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 } } } /* LogSearchDefault Generic error response. swagger:response logSearchDefault */ type LogSearchDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewLogSearchDefault creates LogSearchDefault with default headers values func NewLogSearchDefault(code int) *LogSearchDefault { if code <= 0 { code = 500 } return &LogSearchDefault{ _statusCode: code, } } // WithStatusCode adds the status to the log search default response func (o *LogSearchDefault) WithStatusCode(code int) *LogSearchDefault { o._statusCode = code return o } // SetStatusCode sets the status to the log search default response func (o *LogSearchDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the log search default response func (o *LogSearchDefault) WithPayload(payload *models.APIError) *LogSearchDefault { o.Payload = payload return o } // SetPayload sets the payload to the log search default response func (o *LogSearchDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *LogSearchDefault) 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 } } } ================================================ FILE: api/operations/logging/log_search_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package logging import ( "errors" "net/url" golangswaggerpaths "path" "github.com/go-openapi/swag" ) // LogSearchURL generates an URL for the log search operation type LogSearchURL struct { Fp []string Order *string PageNo *int32 PageSize *int32 TimeEnd *string TimeStart *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 *LogSearchURL) WithBasePath(bp string) *LogSearchURL { 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 *LogSearchURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *LogSearchURL) Build() (*url.URL, error) { var _result url.URL var _path = "/logs/search" _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var fpIR []string for _, fpI := range o.Fp { fpIS := fpI if fpIS != "" { fpIR = append(fpIR, fpIS) } } fp := swag.JoinByFormat(fpIR, "multi") for _, qsv := range fp { qs.Add("fp", qsv) } var orderQ string if o.Order != nil { orderQ = *o.Order } if orderQ != "" { qs.Set("order", orderQ) } var pageNoQ string if o.PageNo != nil { pageNoQ = swag.FormatInt32(*o.PageNo) } if pageNoQ != "" { qs.Set("pageNo", pageNoQ) } var pageSizeQ string if o.PageSize != nil { pageSizeQ = swag.FormatInt32(*o.PageSize) } if pageSizeQ != "" { qs.Set("pageSize", pageSizeQ) } var timeEndQ string if o.TimeEnd != nil { timeEndQ = *o.TimeEnd } if timeEndQ != "" { qs.Set("timeEnd", timeEndQ) } var timeStartQ string if o.TimeStart != nil { timeStartQ = *o.TimeStart } if timeStartQ != "" { qs.Set("timeStart", timeStartQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *LogSearchURL) 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 *LogSearchURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *LogSearchURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on LogSearchURL") } if host == "" { return nil, errors.New("host is required for a full url on LogSearchURL") } 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 *LogSearchURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/delete_multiple_objects.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteMultipleObjectsHandlerFunc turns a function with the right signature into a delete multiple objects handler type DeleteMultipleObjectsHandlerFunc func(DeleteMultipleObjectsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteMultipleObjectsHandlerFunc) Handle(params DeleteMultipleObjectsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteMultipleObjectsHandler interface for that can handle valid delete multiple objects params type DeleteMultipleObjectsHandler interface { Handle(DeleteMultipleObjectsParams, *models.Principal) middleware.Responder } // NewDeleteMultipleObjects creates a new http.Handler for the delete multiple objects operation func NewDeleteMultipleObjects(ctx *middleware.Context, handler DeleteMultipleObjectsHandler) *DeleteMultipleObjects { return &DeleteMultipleObjects{Context: ctx, Handler: handler} } /* DeleteMultipleObjects swagger:route POST /buckets/{bucket_name}/delete-objects Object deleteMultipleObjects Delete Multiple Objects */ type DeleteMultipleObjects struct { Context *middleware.Context Handler DeleteMultipleObjectsHandler } func (o *DeleteMultipleObjects) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteMultipleObjectsParams() 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) } ================================================ FILE: api/operations/object/delete_multiple_objects_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( stderrors "errors" "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/swag" "github.com/minio/console/models" ) // NewDeleteMultipleObjectsParams creates a new DeleteMultipleObjectsParams object // // There are no default values defined in the spec. func NewDeleteMultipleObjectsParams() DeleteMultipleObjectsParams { return DeleteMultipleObjectsParams{} } // DeleteMultipleObjectsParams contains all the bound params for the delete multiple objects operation // typically these are obtained from a http.Request // // swagger:parameters DeleteMultipleObjects type DeleteMultipleObjectsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* In: query */ AllVersions *bool /* Required: true In: path */ BucketName string /* In: query */ Bypass *bool /* Required: true In: body */ Files []*models.DeleteFile } // 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 NewDeleteMultipleObjectsParams() beforehand. func (o *DeleteMultipleObjectsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) qAllVersions, qhkAllVersions, _ := qs.GetOK("all_versions") if err := o.bindAllVersions(qAllVersions, qhkAllVersions, route.Formats); err != nil { res = append(res, err) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qBypass, qhkBypass, _ := qs.GetOK("bypass") if err := o.bindBypass(qBypass, qhkBypass, route.Formats); err != nil { res = append(res, err) } if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body []*models.DeleteFile if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(err, io.EOF) { res = append(res, errors.Required("files", "body", "")) } else { res = append(res, errors.NewParseError("files", "body", "", err)) } } else { // validate array of body objects for i := range body { if body[i] == nil { continue } if err := body[i].Validate(route.Formats); err != nil { res = append(res, err) break } } if len(res) == 0 { o.Files = body } } } else { res = append(res, errors.Required("files", "body", "")) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindAllVersions binds and validates parameter AllVersions from query. func (o *DeleteMultipleObjectsParams) bindAllVersions(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.ConvertBool(raw) if err != nil { return errors.InvalidType("all_versions", "query", "bool", raw) } o.AllVersions = &value return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DeleteMultipleObjectsParams) bindBucketName(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.BucketName = raw return nil } // bindBypass binds and validates parameter Bypass from query. func (o *DeleteMultipleObjectsParams) bindBypass(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.ConvertBool(raw) if err != nil { return errors.InvalidType("bypass", "query", "bool", raw) } o.Bypass = &value return nil } ================================================ FILE: api/operations/object/delete_multiple_objects_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteMultipleObjectsOKCode is the HTTP code returned for type DeleteMultipleObjectsOK const DeleteMultipleObjectsOKCode int = 200 /* DeleteMultipleObjectsOK A successful response. swagger:response deleteMultipleObjectsOK */ type DeleteMultipleObjectsOK struct { } // NewDeleteMultipleObjectsOK creates DeleteMultipleObjectsOK with default headers values func NewDeleteMultipleObjectsOK() *DeleteMultipleObjectsOK { return &DeleteMultipleObjectsOK{} } // WriteResponse to the client func (o *DeleteMultipleObjectsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* DeleteMultipleObjectsDefault Generic error response. swagger:response deleteMultipleObjectsDefault */ type DeleteMultipleObjectsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteMultipleObjectsDefault creates DeleteMultipleObjectsDefault with default headers values func NewDeleteMultipleObjectsDefault(code int) *DeleteMultipleObjectsDefault { if code <= 0 { code = 500 } return &DeleteMultipleObjectsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete multiple objects default response func (o *DeleteMultipleObjectsDefault) WithStatusCode(code int) *DeleteMultipleObjectsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete multiple objects default response func (o *DeleteMultipleObjectsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete multiple objects default response func (o *DeleteMultipleObjectsDefault) WithPayload(payload *models.APIError) *DeleteMultipleObjectsDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete multiple objects default response func (o *DeleteMultipleObjectsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteMultipleObjectsDefault) 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 } } } ================================================ FILE: api/operations/object/delete_multiple_objects_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" "github.com/go-openapi/swag" ) // DeleteMultipleObjectsURL generates an URL for the delete multiple objects operation type DeleteMultipleObjectsURL struct { BucketName string AllVersions *bool Bypass *bool _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 *DeleteMultipleObjectsURL) WithBasePath(bp string) *DeleteMultipleObjectsURL { 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 *DeleteMultipleObjectsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteMultipleObjectsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/delete-objects" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DeleteMultipleObjectsURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var allVersionsQ string if o.AllVersions != nil { allVersionsQ = swag.FormatBool(*o.AllVersions) } if allVersionsQ != "" { qs.Set("all_versions", allVersionsQ) } var bypassQ string if o.Bypass != nil { bypassQ = swag.FormatBool(*o.Bypass) } if bypassQ != "" { qs.Set("bypass", bypassQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *DeleteMultipleObjectsURL) 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 *DeleteMultipleObjectsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteMultipleObjectsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteMultipleObjectsURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteMultipleObjectsURL") } 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 *DeleteMultipleObjectsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/delete_object.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteObjectHandlerFunc turns a function with the right signature into a delete object handler type DeleteObjectHandlerFunc func(DeleteObjectParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteObjectHandlerFunc) Handle(params DeleteObjectParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteObjectHandler interface for that can handle valid delete object params type DeleteObjectHandler interface { Handle(DeleteObjectParams, *models.Principal) middleware.Responder } // NewDeleteObject creates a new http.Handler for the delete object operation func NewDeleteObject(ctx *middleware.Context, handler DeleteObjectHandler) *DeleteObject { return &DeleteObject{Context: ctx, Handler: handler} } /* DeleteObject swagger:route DELETE /buckets/{bucket_name}/objects Object deleteObject Delete Object */ type DeleteObject struct { Context *middleware.Context Handler DeleteObjectHandler } func (o *DeleteObject) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteObjectParams() 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) } ================================================ FILE: api/operations/object/delete_object_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object 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" ) // NewDeleteObjectParams creates a new DeleteObjectParams object // // There are no default values defined in the spec. func NewDeleteObjectParams() DeleteObjectParams { return DeleteObjectParams{} } // DeleteObjectParams contains all the bound params for the delete object operation // typically these are obtained from a http.Request // // swagger:parameters DeleteObject type DeleteObjectParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* In: query */ AllVersions *bool /* Required: true In: path */ BucketName string /* In: query */ Bypass *bool /* In: query */ NonCurrentVersions *bool /* Required: true In: query */ Prefix string /* In: query */ Recursive *bool /* In: query */ VersionID *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 NewDeleteObjectParams() beforehand. func (o *DeleteObjectParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) qAllVersions, qhkAllVersions, _ := qs.GetOK("all_versions") if err := o.bindAllVersions(qAllVersions, qhkAllVersions, route.Formats); err != nil { res = append(res, err) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qBypass, qhkBypass, _ := qs.GetOK("bypass") if err := o.bindBypass(qBypass, qhkBypass, route.Formats); err != nil { res = append(res, err) } qNonCurrentVersions, qhkNonCurrentVersions, _ := qs.GetOK("non_current_versions") if err := o.bindNonCurrentVersions(qNonCurrentVersions, qhkNonCurrentVersions, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } qRecursive, qhkRecursive, _ := qs.GetOK("recursive") if err := o.bindRecursive(qRecursive, qhkRecursive, route.Formats); err != nil { res = append(res, err) } qVersionID, qhkVersionID, _ := qs.GetOK("version_id") if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindAllVersions binds and validates parameter AllVersions from query. func (o *DeleteObjectParams) bindAllVersions(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.ConvertBool(raw) if err != nil { return errors.InvalidType("all_versions", "query", "bool", raw) } o.AllVersions = &value return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DeleteObjectParams) bindBucketName(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.BucketName = raw return nil } // bindBypass binds and validates parameter Bypass from query. func (o *DeleteObjectParams) bindBypass(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.ConvertBool(raw) if err != nil { return errors.InvalidType("bypass", "query", "bool", raw) } o.Bypass = &value return nil } // bindNonCurrentVersions binds and validates parameter NonCurrentVersions from query. func (o *DeleteObjectParams) bindNonCurrentVersions(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.ConvertBool(raw) if err != nil { return errors.InvalidType("non_current_versions", "query", "bool", raw) } o.NonCurrentVersions = &value return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *DeleteObjectParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("prefix", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } o.Prefix = raw return nil } // bindRecursive binds and validates parameter Recursive from query. func (o *DeleteObjectParams) bindRecursive(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.ConvertBool(raw) if err != nil { return errors.InvalidType("recursive", "query", "bool", raw) } o.Recursive = &value return nil } // bindVersionID binds and validates parameter VersionID from query. func (o *DeleteObjectParams) bindVersionID(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.VersionID = &raw return nil } ================================================ FILE: api/operations/object/delete_object_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteObjectOKCode is the HTTP code returned for type DeleteObjectOK const DeleteObjectOKCode int = 200 /* DeleteObjectOK A successful response. swagger:response deleteObjectOK */ type DeleteObjectOK struct { } // NewDeleteObjectOK creates DeleteObjectOK with default headers values func NewDeleteObjectOK() *DeleteObjectOK { return &DeleteObjectOK{} } // WriteResponse to the client func (o *DeleteObjectOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* DeleteObjectDefault Generic error response. swagger:response deleteObjectDefault */ type DeleteObjectDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteObjectDefault creates DeleteObjectDefault with default headers values func NewDeleteObjectDefault(code int) *DeleteObjectDefault { if code <= 0 { code = 500 } return &DeleteObjectDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete object default response func (o *DeleteObjectDefault) WithStatusCode(code int) *DeleteObjectDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete object default response func (o *DeleteObjectDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete object default response func (o *DeleteObjectDefault) WithPayload(payload *models.APIError) *DeleteObjectDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete object default response func (o *DeleteObjectDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteObjectDefault) 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 } } } ================================================ FILE: api/operations/object/delete_object_retention.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteObjectRetentionHandlerFunc turns a function with the right signature into a delete object retention handler type DeleteObjectRetentionHandlerFunc func(DeleteObjectRetentionParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteObjectRetentionHandlerFunc) Handle(params DeleteObjectRetentionParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteObjectRetentionHandler interface for that can handle valid delete object retention params type DeleteObjectRetentionHandler interface { Handle(DeleteObjectRetentionParams, *models.Principal) middleware.Responder } // NewDeleteObjectRetention creates a new http.Handler for the delete object retention operation func NewDeleteObjectRetention(ctx *middleware.Context, handler DeleteObjectRetentionHandler) *DeleteObjectRetention { return &DeleteObjectRetention{Context: ctx, Handler: handler} } /* DeleteObjectRetention swagger:route DELETE /buckets/{bucket_name}/objects/retention Object deleteObjectRetention Delete Object retention from an object */ type DeleteObjectRetention struct { Context *middleware.Context Handler DeleteObjectRetentionHandler } func (o *DeleteObjectRetention) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteObjectRetentionParams() 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) } ================================================ FILE: api/operations/object/delete_object_retention_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object 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" ) // NewDeleteObjectRetentionParams creates a new DeleteObjectRetentionParams object // // There are no default values defined in the spec. func NewDeleteObjectRetentionParams() DeleteObjectRetentionParams { return DeleteObjectRetentionParams{} } // DeleteObjectRetentionParams contains all the bound params for the delete object retention operation // typically these are obtained from a http.Request // // swagger:parameters DeleteObjectRetention type DeleteObjectRetentionParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* Required: true In: query */ Prefix string /* Required: true In: query */ VersionID 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 NewDeleteObjectRetentionParams() beforehand. func (o *DeleteObjectRetentionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } qVersionID, qhkVersionID, _ := qs.GetOK("version_id") if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DeleteObjectRetentionParams) bindBucketName(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.BucketName = raw return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *DeleteObjectRetentionParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("prefix", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } o.Prefix = raw return nil } // bindVersionID binds and validates parameter VersionID from query. func (o *DeleteObjectRetentionParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("version_id", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } o.VersionID = raw return nil } ================================================ FILE: api/operations/object/delete_object_retention_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteObjectRetentionOKCode is the HTTP code returned for type DeleteObjectRetentionOK const DeleteObjectRetentionOKCode int = 200 /* DeleteObjectRetentionOK A successful response. swagger:response deleteObjectRetentionOK */ type DeleteObjectRetentionOK struct { } // NewDeleteObjectRetentionOK creates DeleteObjectRetentionOK with default headers values func NewDeleteObjectRetentionOK() *DeleteObjectRetentionOK { return &DeleteObjectRetentionOK{} } // WriteResponse to the client func (o *DeleteObjectRetentionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* DeleteObjectRetentionDefault Generic error response. swagger:response deleteObjectRetentionDefault */ type DeleteObjectRetentionDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteObjectRetentionDefault creates DeleteObjectRetentionDefault with default headers values func NewDeleteObjectRetentionDefault(code int) *DeleteObjectRetentionDefault { if code <= 0 { code = 500 } return &DeleteObjectRetentionDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete object retention default response func (o *DeleteObjectRetentionDefault) WithStatusCode(code int) *DeleteObjectRetentionDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete object retention default response func (o *DeleteObjectRetentionDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete object retention default response func (o *DeleteObjectRetentionDefault) WithPayload(payload *models.APIError) *DeleteObjectRetentionDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete object retention default response func (o *DeleteObjectRetentionDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteObjectRetentionDefault) 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 } } } ================================================ FILE: api/operations/object/delete_object_retention_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteObjectRetentionURL generates an URL for the delete object retention operation type DeleteObjectRetentionURL struct { BucketName string Prefix string VersionID 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 *DeleteObjectRetentionURL) WithBasePath(bp string) *DeleteObjectRetentionURL { 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 *DeleteObjectRetentionURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteObjectRetentionURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects/retention" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DeleteObjectRetentionURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) prefixQ := o.Prefix if prefixQ != "" { qs.Set("prefix", prefixQ) } versionIDQ := o.VersionID if versionIDQ != "" { qs.Set("version_id", versionIDQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *DeleteObjectRetentionURL) 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 *DeleteObjectRetentionURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteObjectRetentionURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteObjectRetentionURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteObjectRetentionURL") } 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 *DeleteObjectRetentionURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/delete_object_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" "github.com/go-openapi/swag" ) // DeleteObjectURL generates an URL for the delete object operation type DeleteObjectURL struct { BucketName string AllVersions *bool Bypass *bool NonCurrentVersions *bool Prefix string Recursive *bool VersionID *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 *DeleteObjectURL) WithBasePath(bp string) *DeleteObjectURL { 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 *DeleteObjectURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteObjectURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DeleteObjectURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var allVersionsQ string if o.AllVersions != nil { allVersionsQ = swag.FormatBool(*o.AllVersions) } if allVersionsQ != "" { qs.Set("all_versions", allVersionsQ) } var bypassQ string if o.Bypass != nil { bypassQ = swag.FormatBool(*o.Bypass) } if bypassQ != "" { qs.Set("bypass", bypassQ) } var nonCurrentVersionsQ string if o.NonCurrentVersions != nil { nonCurrentVersionsQ = swag.FormatBool(*o.NonCurrentVersions) } if nonCurrentVersionsQ != "" { qs.Set("non_current_versions", nonCurrentVersionsQ) } prefixQ := o.Prefix if prefixQ != "" { qs.Set("prefix", prefixQ) } var recursiveQ string if o.Recursive != nil { recursiveQ = swag.FormatBool(*o.Recursive) } if recursiveQ != "" { qs.Set("recursive", recursiveQ) } var versionIDQ string if o.VersionID != nil { versionIDQ = *o.VersionID } if versionIDQ != "" { qs.Set("version_id", versionIDQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *DeleteObjectURL) 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 *DeleteObjectURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteObjectURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteObjectURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteObjectURL") } 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 *DeleteObjectURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/download_multiple_objects.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DownloadMultipleObjectsHandlerFunc turns a function with the right signature into a download multiple objects handler type DownloadMultipleObjectsHandlerFunc func(DownloadMultipleObjectsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DownloadMultipleObjectsHandlerFunc) Handle(params DownloadMultipleObjectsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DownloadMultipleObjectsHandler interface for that can handle valid download multiple objects params type DownloadMultipleObjectsHandler interface { Handle(DownloadMultipleObjectsParams, *models.Principal) middleware.Responder } // NewDownloadMultipleObjects creates a new http.Handler for the download multiple objects operation func NewDownloadMultipleObjects(ctx *middleware.Context, handler DownloadMultipleObjectsHandler) *DownloadMultipleObjects { return &DownloadMultipleObjects{Context: ctx, Handler: handler} } /* DownloadMultipleObjects swagger:route POST /buckets/{bucket_name}/objects/download-multiple Object downloadMultipleObjects Download Multiple Objects */ type DownloadMultipleObjects struct { Context *middleware.Context Handler DownloadMultipleObjectsHandler } func (o *DownloadMultipleObjects) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDownloadMultipleObjectsParams() 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) } ================================================ FILE: api/operations/object/download_multiple_objects_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( stderrors "errors" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewDownloadMultipleObjectsParams creates a new DownloadMultipleObjectsParams object // // There are no default values defined in the spec. func NewDownloadMultipleObjectsParams() DownloadMultipleObjectsParams { return DownloadMultipleObjectsParams{} } // DownloadMultipleObjectsParams contains all the bound params for the download multiple objects operation // typically these are obtained from a http.Request // // swagger:parameters DownloadMultipleObjects type DownloadMultipleObjectsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* Required: true In: body */ ObjectList []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 NewDownloadMultipleObjectsParams() beforehand. func (o *DownloadMultipleObjectsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body []string if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(err, io.EOF) { res = append(res, errors.Required("objectList", "body", "")) } else { res = append(res, errors.NewParseError("objectList", "body", "", err)) } } else { // no validation required on inline body o.ObjectList = body } } else { res = append(res, errors.Required("objectList", "body", "")) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DownloadMultipleObjectsParams) bindBucketName(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.BucketName = raw return nil } ================================================ FILE: api/operations/object/download_multiple_objects_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "io" "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DownloadMultipleObjectsOKCode is the HTTP code returned for type DownloadMultipleObjectsOK const DownloadMultipleObjectsOKCode int = 200 /* DownloadMultipleObjectsOK A successful response. swagger:response downloadMultipleObjectsOK */ type DownloadMultipleObjectsOK struct { /* In: Body */ Payload io.ReadCloser `json:"body,omitempty"` } // NewDownloadMultipleObjectsOK creates DownloadMultipleObjectsOK with default headers values func NewDownloadMultipleObjectsOK() *DownloadMultipleObjectsOK { return &DownloadMultipleObjectsOK{} } // WithPayload adds the payload to the download multiple objects o k response func (o *DownloadMultipleObjectsOK) WithPayload(payload io.ReadCloser) *DownloadMultipleObjectsOK { o.Payload = payload return o } // SetPayload sets the payload to the download multiple objects o k response func (o *DownloadMultipleObjectsOK) SetPayload(payload io.ReadCloser) { o.Payload = payload } // WriteResponse to the client func (o *DownloadMultipleObjectsOK) 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 } } /* DownloadMultipleObjectsDefault Generic error response. swagger:response downloadMultipleObjectsDefault */ type DownloadMultipleObjectsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDownloadMultipleObjectsDefault creates DownloadMultipleObjectsDefault with default headers values func NewDownloadMultipleObjectsDefault(code int) *DownloadMultipleObjectsDefault { if code <= 0 { code = 500 } return &DownloadMultipleObjectsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the download multiple objects default response func (o *DownloadMultipleObjectsDefault) WithStatusCode(code int) *DownloadMultipleObjectsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the download multiple objects default response func (o *DownloadMultipleObjectsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the download multiple objects default response func (o *DownloadMultipleObjectsDefault) WithPayload(payload *models.APIError) *DownloadMultipleObjectsDefault { o.Payload = payload return o } // SetPayload sets the payload to the download multiple objects default response func (o *DownloadMultipleObjectsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DownloadMultipleObjectsDefault) 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 } } } ================================================ FILE: api/operations/object/download_multiple_objects_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DownloadMultipleObjectsURL generates an URL for the download multiple objects operation type DownloadMultipleObjectsURL struct { BucketName 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 *DownloadMultipleObjectsURL) WithBasePath(bp string) *DownloadMultipleObjectsURL { 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 *DownloadMultipleObjectsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DownloadMultipleObjectsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects/download-multiple" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DownloadMultipleObjectsURL") } _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 *DownloadMultipleObjectsURL) 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 *DownloadMultipleObjectsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DownloadMultipleObjectsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DownloadMultipleObjectsURL") } if host == "" { return nil, errors.New("host is required for a full url on DownloadMultipleObjectsURL") } 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 *DownloadMultipleObjectsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/download_object.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DownloadObjectHandlerFunc turns a function with the right signature into a download object handler type DownloadObjectHandlerFunc func(DownloadObjectParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DownloadObjectHandlerFunc) Handle(params DownloadObjectParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DownloadObjectHandler interface for that can handle valid download object params type DownloadObjectHandler interface { Handle(DownloadObjectParams, *models.Principal) middleware.Responder } // NewDownloadObject creates a new http.Handler for the download object operation func NewDownloadObject(ctx *middleware.Context, handler DownloadObjectHandler) *DownloadObject { return &DownloadObject{Context: ctx, Handler: handler} } /* DownloadObject swagger:route GET /buckets/{bucket_name}/objects/download Object downloadObject Download Object */ type DownloadObject struct { Context *middleware.Context Handler DownloadObjectHandler } func (o *DownloadObject) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDownloadObjectParams() 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) } ================================================ FILE: api/operations/object/download_object_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object 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" ) // NewDownloadObjectParams creates a new DownloadObjectParams object // with the default values initialized. func NewDownloadObjectParams() DownloadObjectParams { var ( // initialize parameters with default values overrideFileNameDefault = string("") previewDefault = bool(false) ) return DownloadObjectParams{ OverrideFileName: &overrideFileNameDefault, Preview: &previewDefault, } } // DownloadObjectParams contains all the bound params for the download object operation // typically these are obtained from a http.Request // // swagger:parameters Download Object type DownloadObjectParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* In: query Default: "" */ OverrideFileName *string /* Required: true In: query */ Prefix string /* In: query Default: false */ Preview *bool /* In: query */ VersionID *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 NewDownloadObjectParams() beforehand. func (o *DownloadObjectParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qOverrideFileName, qhkOverrideFileName, _ := qs.GetOK("override_file_name") if err := o.bindOverrideFileName(qOverrideFileName, qhkOverrideFileName, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } qPreview, qhkPreview, _ := qs.GetOK("preview") if err := o.bindPreview(qPreview, qhkPreview, route.Formats); err != nil { res = append(res, err) } qVersionID, qhkVersionID, _ := qs.GetOK("version_id") if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *DownloadObjectParams) bindBucketName(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.BucketName = raw return nil } // bindOverrideFileName binds and validates parameter OverrideFileName from query. func (o *DownloadObjectParams) bindOverrideFileName(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 // Default values have been previously initialized by NewDownloadObjectParams() return nil } o.OverrideFileName = &raw return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *DownloadObjectParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("prefix", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } o.Prefix = raw return nil } // bindPreview binds and validates parameter Preview from query. func (o *DownloadObjectParams) bindPreview(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 // Default values have been previously initialized by NewDownloadObjectParams() return nil } value, err := swag.ConvertBool(raw) if err != nil { return errors.InvalidType("preview", "query", "bool", raw) } o.Preview = &value return nil } // bindVersionID binds and validates parameter VersionID from query. func (o *DownloadObjectParams) bindVersionID(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.VersionID = &raw return nil } ================================================ FILE: api/operations/object/download_object_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "io" "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DownloadObjectOKCode is the HTTP code returned for type DownloadObjectOK const DownloadObjectOKCode int = 200 /* DownloadObjectOK A successful response. swagger:response downloadObjectOK */ type DownloadObjectOK struct { /* In: Body */ Payload io.ReadCloser `json:"body,omitempty"` } // NewDownloadObjectOK creates DownloadObjectOK with default headers values func NewDownloadObjectOK() *DownloadObjectOK { return &DownloadObjectOK{} } // WithPayload adds the payload to the download object o k response func (o *DownloadObjectOK) WithPayload(payload io.ReadCloser) *DownloadObjectOK { o.Payload = payload return o } // SetPayload sets the payload to the download object o k response func (o *DownloadObjectOK) SetPayload(payload io.ReadCloser) { o.Payload = payload } // WriteResponse to the client func (o *DownloadObjectOK) 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 } } /* DownloadObjectDefault Generic error response. swagger:response downloadObjectDefault */ type DownloadObjectDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDownloadObjectDefault creates DownloadObjectDefault with default headers values func NewDownloadObjectDefault(code int) *DownloadObjectDefault { if code <= 0 { code = 500 } return &DownloadObjectDefault{ _statusCode: code, } } // WithStatusCode adds the status to the download object default response func (o *DownloadObjectDefault) WithStatusCode(code int) *DownloadObjectDefault { o._statusCode = code return o } // SetStatusCode sets the status to the download object default response func (o *DownloadObjectDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the download object default response func (o *DownloadObjectDefault) WithPayload(payload *models.APIError) *DownloadObjectDefault { o.Payload = payload return o } // SetPayload sets the payload to the download object default response func (o *DownloadObjectDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DownloadObjectDefault) 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 } } } ================================================ FILE: api/operations/object/download_object_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" "github.com/go-openapi/swag" ) // DownloadObjectURL generates an URL for the download object operation type DownloadObjectURL struct { BucketName string OverrideFileName *string Prefix string Preview *bool VersionID *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 *DownloadObjectURL) WithBasePath(bp string) *DownloadObjectURL { 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 *DownloadObjectURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DownloadObjectURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects/download" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on DownloadObjectURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var overrideFileNameQ string if o.OverrideFileName != nil { overrideFileNameQ = *o.OverrideFileName } if overrideFileNameQ != "" { qs.Set("override_file_name", overrideFileNameQ) } prefixQ := o.Prefix if prefixQ != "" { qs.Set("prefix", prefixQ) } var previewQ string if o.Preview != nil { previewQ = swag.FormatBool(*o.Preview) } if previewQ != "" { qs.Set("preview", previewQ) } var versionIDQ string if o.VersionID != nil { versionIDQ = *o.VersionID } if versionIDQ != "" { qs.Set("version_id", versionIDQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *DownloadObjectURL) 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 *DownloadObjectURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DownloadObjectURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DownloadObjectURL") } if host == "" { return nil, errors.New("host is required for a full url on DownloadObjectURL") } 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 *DownloadObjectURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/get_object_metadata.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetObjectMetadataHandlerFunc turns a function with the right signature into a get object metadata handler type GetObjectMetadataHandlerFunc func(GetObjectMetadataParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetObjectMetadataHandlerFunc) Handle(params GetObjectMetadataParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetObjectMetadataHandler interface for that can handle valid get object metadata params type GetObjectMetadataHandler interface { Handle(GetObjectMetadataParams, *models.Principal) middleware.Responder } // NewGetObjectMetadata creates a new http.Handler for the get object metadata operation func NewGetObjectMetadata(ctx *middleware.Context, handler GetObjectMetadataHandler) *GetObjectMetadata { return &GetObjectMetadata{Context: ctx, Handler: handler} } /* GetObjectMetadata swagger:route GET /buckets/{bucket_name}/objects/metadata Object getObjectMetadata Gets the metadata of an object */ type GetObjectMetadata struct { Context *middleware.Context Handler GetObjectMetadataHandler } func (o *GetObjectMetadata) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetObjectMetadataParams() 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) } ================================================ FILE: api/operations/object/get_object_metadata_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object 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" ) // NewGetObjectMetadataParams creates a new GetObjectMetadataParams object // // There are no default values defined in the spec. func NewGetObjectMetadataParams() GetObjectMetadataParams { return GetObjectMetadataParams{} } // GetObjectMetadataParams contains all the bound params for the get object metadata operation // typically these are obtained from a http.Request // // swagger:parameters GetObjectMetadata type GetObjectMetadataParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* Required: true In: query */ Prefix string /* In: query */ VersionID *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 NewGetObjectMetadataParams() beforehand. func (o *GetObjectMetadataParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } qVersionID, qhkVersionID, _ := qs.GetOK("versionID") if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *GetObjectMetadataParams) bindBucketName(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.BucketName = raw return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *GetObjectMetadataParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("prefix", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } o.Prefix = raw return nil } // bindVersionID binds and validates parameter VersionID from query. func (o *GetObjectMetadataParams) bindVersionID(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.VersionID = &raw return nil } ================================================ FILE: api/operations/object/get_object_metadata_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetObjectMetadataOKCode is the HTTP code returned for type GetObjectMetadataOK const GetObjectMetadataOKCode int = 200 /* GetObjectMetadataOK A successful response. swagger:response getObjectMetadataOK */ type GetObjectMetadataOK struct { /* In: Body */ Payload *models.Metadata `json:"body,omitempty"` } // NewGetObjectMetadataOK creates GetObjectMetadataOK with default headers values func NewGetObjectMetadataOK() *GetObjectMetadataOK { return &GetObjectMetadataOK{} } // WithPayload adds the payload to the get object metadata o k response func (o *GetObjectMetadataOK) WithPayload(payload *models.Metadata) *GetObjectMetadataOK { o.Payload = payload return o } // SetPayload sets the payload to the get object metadata o k response func (o *GetObjectMetadataOK) SetPayload(payload *models.Metadata) { o.Payload = payload } // WriteResponse to the client func (o *GetObjectMetadataOK) 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 } } } /* GetObjectMetadataDefault Generic error response. swagger:response getObjectMetadataDefault */ type GetObjectMetadataDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetObjectMetadataDefault creates GetObjectMetadataDefault with default headers values func NewGetObjectMetadataDefault(code int) *GetObjectMetadataDefault { if code <= 0 { code = 500 } return &GetObjectMetadataDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get object metadata default response func (o *GetObjectMetadataDefault) WithStatusCode(code int) *GetObjectMetadataDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get object metadata default response func (o *GetObjectMetadataDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get object metadata default response func (o *GetObjectMetadataDefault) WithPayload(payload *models.APIError) *GetObjectMetadataDefault { o.Payload = payload return o } // SetPayload sets the payload to the get object metadata default response func (o *GetObjectMetadataDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetObjectMetadataDefault) 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 } } } ================================================ FILE: api/operations/object/get_object_metadata_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetObjectMetadataURL generates an URL for the get object metadata operation type GetObjectMetadataURL struct { BucketName string Prefix string VersionID *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 *GetObjectMetadataURL) WithBasePath(bp string) *GetObjectMetadataURL { 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 *GetObjectMetadataURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetObjectMetadataURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects/metadata" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on GetObjectMetadataURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) prefixQ := o.Prefix if prefixQ != "" { qs.Set("prefix", prefixQ) } var versionIDQ string if o.VersionID != nil { versionIDQ = *o.VersionID } if versionIDQ != "" { qs.Set("versionID", versionIDQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *GetObjectMetadataURL) 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 *GetObjectMetadataURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetObjectMetadataURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetObjectMetadataURL") } if host == "" { return nil, errors.New("host is required for a full url on GetObjectMetadataURL") } 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 *GetObjectMetadataURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/list_objects.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListObjectsHandlerFunc turns a function with the right signature into a list objects handler type ListObjectsHandlerFunc func(ListObjectsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListObjectsHandlerFunc) Handle(params ListObjectsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListObjectsHandler interface for that can handle valid list objects params type ListObjectsHandler interface { Handle(ListObjectsParams, *models.Principal) middleware.Responder } // NewListObjects creates a new http.Handler for the list objects operation func NewListObjects(ctx *middleware.Context, handler ListObjectsHandler) *ListObjects { return &ListObjects{Context: ctx, Handler: handler} } /* ListObjects swagger:route GET /buckets/{bucket_name}/objects Object listObjects List Objects */ type ListObjects struct { Context *middleware.Context Handler ListObjectsHandler } func (o *ListObjects) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListObjectsParams() 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) } ================================================ FILE: api/operations/object/list_objects_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object 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" ) // NewListObjectsParams creates a new ListObjectsParams object // with the default values initialized. func NewListObjectsParams() ListObjectsParams { var ( // initialize parameters with default values limitDefault = int32(20) ) return ListObjectsParams{ Limit: &limitDefault, } } // ListObjectsParams contains all the bound params for the list objects operation // typically these are obtained from a http.Request // // swagger:parameters ListObjects type ListObjectsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* In: query Default: 20 */ Limit *int32 /* In: query */ Prefix *string /* In: query */ Recursive *bool /* In: query */ WithMetadata *bool /* In: query */ WithVersions *bool } // 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 NewListObjectsParams() beforehand. func (o *ListObjectsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qLimit, qhkLimit, _ := qs.GetOK("limit") if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } qRecursive, qhkRecursive, _ := qs.GetOK("recursive") if err := o.bindRecursive(qRecursive, qhkRecursive, route.Formats); err != nil { res = append(res, err) } qWithMetadata, qhkWithMetadata, _ := qs.GetOK("with_metadata") if err := o.bindWithMetadata(qWithMetadata, qhkWithMetadata, route.Formats); err != nil { res = append(res, err) } qWithVersions, qhkWithVersions, _ := qs.GetOK("with_versions") if err := o.bindWithVersions(qWithVersions, qhkWithVersions, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *ListObjectsParams) bindBucketName(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.BucketName = raw return nil } // bindLimit binds and validates parameter Limit from query. func (o *ListObjectsParams) 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 // Default values have been previously initialized by NewListObjectsParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("limit", "query", "int32", raw) } o.Limit = &value return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *ListObjectsParams) bindPrefix(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.Prefix = &raw return nil } // bindRecursive binds and validates parameter Recursive from query. func (o *ListObjectsParams) bindRecursive(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.ConvertBool(raw) if err != nil { return errors.InvalidType("recursive", "query", "bool", raw) } o.Recursive = &value return nil } // bindWithMetadata binds and validates parameter WithMetadata from query. func (o *ListObjectsParams) bindWithMetadata(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.ConvertBool(raw) if err != nil { return errors.InvalidType("with_metadata", "query", "bool", raw) } o.WithMetadata = &value return nil } // bindWithVersions binds and validates parameter WithVersions from query. func (o *ListObjectsParams) bindWithVersions(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.ConvertBool(raw) if err != nil { return errors.InvalidType("with_versions", "query", "bool", raw) } o.WithVersions = &value return nil } ================================================ FILE: api/operations/object/list_objects_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListObjectsOKCode is the HTTP code returned for type ListObjectsOK const ListObjectsOKCode int = 200 /* ListObjectsOK A successful response. swagger:response listObjectsOK */ type ListObjectsOK struct { /* In: Body */ Payload *models.ListObjectsResponse `json:"body,omitempty"` } // NewListObjectsOK creates ListObjectsOK with default headers values func NewListObjectsOK() *ListObjectsOK { return &ListObjectsOK{} } // WithPayload adds the payload to the list objects o k response func (o *ListObjectsOK) WithPayload(payload *models.ListObjectsResponse) *ListObjectsOK { o.Payload = payload return o } // SetPayload sets the payload to the list objects o k response func (o *ListObjectsOK) SetPayload(payload *models.ListObjectsResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListObjectsOK) 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 } } } /* ListObjectsDefault Generic error response. swagger:response listObjectsDefault */ type ListObjectsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListObjectsDefault creates ListObjectsDefault with default headers values func NewListObjectsDefault(code int) *ListObjectsDefault { if code <= 0 { code = 500 } return &ListObjectsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list objects default response func (o *ListObjectsDefault) WithStatusCode(code int) *ListObjectsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list objects default response func (o *ListObjectsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list objects default response func (o *ListObjectsDefault) WithPayload(payload *models.APIError) *ListObjectsDefault { o.Payload = payload return o } // SetPayload sets the payload to the list objects default response func (o *ListObjectsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListObjectsDefault) 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 } } } ================================================ FILE: api/operations/object/list_objects_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" "github.com/go-openapi/swag" ) // ListObjectsURL generates an URL for the list objects operation type ListObjectsURL struct { BucketName string Limit *int32 Prefix *string Recursive *bool WithMetadata *bool WithVersions *bool _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 *ListObjectsURL) WithBasePath(bp string) *ListObjectsURL { 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 *ListObjectsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListObjectsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on ListObjectsURL") } _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 prefixQ string if o.Prefix != nil { prefixQ = *o.Prefix } if prefixQ != "" { qs.Set("prefix", prefixQ) } var recursiveQ string if o.Recursive != nil { recursiveQ = swag.FormatBool(*o.Recursive) } if recursiveQ != "" { qs.Set("recursive", recursiveQ) } var withMetadataQ string if o.WithMetadata != nil { withMetadataQ = swag.FormatBool(*o.WithMetadata) } if withMetadataQ != "" { qs.Set("with_metadata", withMetadataQ) } var withVersionsQ string if o.WithVersions != nil { withVersionsQ = swag.FormatBool(*o.WithVersions) } if withVersionsQ != "" { qs.Set("with_versions", withVersionsQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListObjectsURL) 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 *ListObjectsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListObjectsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListObjectsURL") } if host == "" { return nil, errors.New("host is required for a full url on ListObjectsURL") } 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 *ListObjectsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/post_buckets_bucket_name_objects_upload.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // PostBucketsBucketNameObjectsUploadHandlerFunc turns a function with the right signature into a post buckets bucket name objects upload handler type PostBucketsBucketNameObjectsUploadHandlerFunc func(PostBucketsBucketNameObjectsUploadParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn PostBucketsBucketNameObjectsUploadHandlerFunc) Handle(params PostBucketsBucketNameObjectsUploadParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // PostBucketsBucketNameObjectsUploadHandler interface for that can handle valid post buckets bucket name objects upload params type PostBucketsBucketNameObjectsUploadHandler interface { Handle(PostBucketsBucketNameObjectsUploadParams, *models.Principal) middleware.Responder } // NewPostBucketsBucketNameObjectsUpload creates a new http.Handler for the post buckets bucket name objects upload operation func NewPostBucketsBucketNameObjectsUpload(ctx *middleware.Context, handler PostBucketsBucketNameObjectsUploadHandler) *PostBucketsBucketNameObjectsUpload { return &PostBucketsBucketNameObjectsUpload{Context: ctx, Handler: handler} } /* PostBucketsBucketNameObjectsUpload swagger:route POST /buckets/{bucket_name}/objects/upload Object postBucketsBucketNameObjectsUpload Uploads an Object. */ type PostBucketsBucketNameObjectsUpload struct { Context *middleware.Context Handler PostBucketsBucketNameObjectsUploadHandler } func (o *PostBucketsBucketNameObjectsUpload) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewPostBucketsBucketNameObjectsUploadParams() 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) } ================================================ FILE: api/operations/object/post_buckets_bucket_name_objects_upload_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewPostBucketsBucketNameObjectsUploadParams creates a new PostBucketsBucketNameObjectsUploadParams object // // There are no default values defined in the spec. func NewPostBucketsBucketNameObjectsUploadParams() PostBucketsBucketNameObjectsUploadParams { return PostBucketsBucketNameObjectsUploadParams{} } // PostBucketsBucketNameObjectsUploadParams contains all the bound params for the post buckets bucket name objects upload operation // typically these are obtained from a http.Request // // swagger:parameters PostBucketsBucketNameObjectsUpload type PostBucketsBucketNameObjectsUploadParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* In: query */ Prefix *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 NewPostBucketsBucketNameObjectsUploadParams() beforehand. func (o *PostBucketsBucketNameObjectsUploadParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *PostBucketsBucketNameObjectsUploadParams) bindBucketName(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.BucketName = raw return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *PostBucketsBucketNameObjectsUploadParams) bindPrefix(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.Prefix = &raw return nil } ================================================ FILE: api/operations/object/post_buckets_bucket_name_objects_upload_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // PostBucketsBucketNameObjectsUploadOKCode is the HTTP code returned for type PostBucketsBucketNameObjectsUploadOK const PostBucketsBucketNameObjectsUploadOKCode int = 200 /* PostBucketsBucketNameObjectsUploadOK A successful response. swagger:response postBucketsBucketNameObjectsUploadOK */ type PostBucketsBucketNameObjectsUploadOK struct { } // NewPostBucketsBucketNameObjectsUploadOK creates PostBucketsBucketNameObjectsUploadOK with default headers values func NewPostBucketsBucketNameObjectsUploadOK() *PostBucketsBucketNameObjectsUploadOK { return &PostBucketsBucketNameObjectsUploadOK{} } // WriteResponse to the client func (o *PostBucketsBucketNameObjectsUploadOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* PostBucketsBucketNameObjectsUploadDefault Generic error response. swagger:response postBucketsBucketNameObjectsUploadDefault */ type PostBucketsBucketNameObjectsUploadDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewPostBucketsBucketNameObjectsUploadDefault creates PostBucketsBucketNameObjectsUploadDefault with default headers values func NewPostBucketsBucketNameObjectsUploadDefault(code int) *PostBucketsBucketNameObjectsUploadDefault { if code <= 0 { code = 500 } return &PostBucketsBucketNameObjectsUploadDefault{ _statusCode: code, } } // WithStatusCode adds the status to the post buckets bucket name objects upload default response func (o *PostBucketsBucketNameObjectsUploadDefault) WithStatusCode(code int) *PostBucketsBucketNameObjectsUploadDefault { o._statusCode = code return o } // SetStatusCode sets the status to the post buckets bucket name objects upload default response func (o *PostBucketsBucketNameObjectsUploadDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the post buckets bucket name objects upload default response func (o *PostBucketsBucketNameObjectsUploadDefault) WithPayload(payload *models.APIError) *PostBucketsBucketNameObjectsUploadDefault { o.Payload = payload return o } // SetPayload sets the payload to the post buckets bucket name objects upload default response func (o *PostBucketsBucketNameObjectsUploadDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *PostBucketsBucketNameObjectsUploadDefault) 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 } } } ================================================ FILE: api/operations/object/post_buckets_bucket_name_objects_upload_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // PostBucketsBucketNameObjectsUploadURL generates an URL for the post buckets bucket name objects upload operation type PostBucketsBucketNameObjectsUploadURL struct { BucketName string Prefix *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 *PostBucketsBucketNameObjectsUploadURL) WithBasePath(bp string) *PostBucketsBucketNameObjectsUploadURL { 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 *PostBucketsBucketNameObjectsUploadURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *PostBucketsBucketNameObjectsUploadURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects/upload" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on PostBucketsBucketNameObjectsUploadURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var prefixQ string if o.Prefix != nil { prefixQ = *o.Prefix } if prefixQ != "" { qs.Set("prefix", prefixQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *PostBucketsBucketNameObjectsUploadURL) 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 *PostBucketsBucketNameObjectsUploadURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *PostBucketsBucketNameObjectsUploadURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on PostBucketsBucketNameObjectsUploadURL") } if host == "" { return nil, errors.New("host is required for a full url on PostBucketsBucketNameObjectsUploadURL") } 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 *PostBucketsBucketNameObjectsUploadURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/put_object_legal_hold.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // PutObjectLegalHoldHandlerFunc turns a function with the right signature into a put object legal hold handler type PutObjectLegalHoldHandlerFunc func(PutObjectLegalHoldParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn PutObjectLegalHoldHandlerFunc) Handle(params PutObjectLegalHoldParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // PutObjectLegalHoldHandler interface for that can handle valid put object legal hold params type PutObjectLegalHoldHandler interface { Handle(PutObjectLegalHoldParams, *models.Principal) middleware.Responder } // NewPutObjectLegalHold creates a new http.Handler for the put object legal hold operation func NewPutObjectLegalHold(ctx *middleware.Context, handler PutObjectLegalHoldHandler) *PutObjectLegalHold { return &PutObjectLegalHold{Context: ctx, Handler: handler} } /* PutObjectLegalHold swagger:route PUT /buckets/{bucket_name}/objects/legalhold Object putObjectLegalHold Put Object's legalhold status */ type PutObjectLegalHold struct { Context *middleware.Context Handler PutObjectLegalHoldHandler } func (o *PutObjectLegalHold) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewPutObjectLegalHoldParams() 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) } ================================================ FILE: api/operations/object/put_object_legal_hold_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( stderrors "errors" "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" ) // NewPutObjectLegalHoldParams creates a new PutObjectLegalHoldParams object // // There are no default values defined in the spec. func NewPutObjectLegalHoldParams() PutObjectLegalHoldParams { return PutObjectLegalHoldParams{} } // PutObjectLegalHoldParams contains all the bound params for the put object legal hold operation // typically these are obtained from a http.Request // // swagger:parameters PutObjectLegalHold type PutObjectLegalHoldParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.PutObjectLegalHoldRequest /* Required: true In: path */ BucketName string /* Required: true In: query */ Prefix string /* Required: true In: query */ VersionID 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 NewPutObjectLegalHoldParams() beforehand. func (o *PutObjectLegalHoldParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.PutObjectLegalHoldRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } qVersionID, qhkVersionID, _ := qs.GetOK("version_id") if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *PutObjectLegalHoldParams) bindBucketName(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.BucketName = raw return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *PutObjectLegalHoldParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("prefix", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } o.Prefix = raw return nil } // bindVersionID binds and validates parameter VersionID from query. func (o *PutObjectLegalHoldParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("version_id", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } o.VersionID = raw return nil } ================================================ FILE: api/operations/object/put_object_legal_hold_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // PutObjectLegalHoldOKCode is the HTTP code returned for type PutObjectLegalHoldOK const PutObjectLegalHoldOKCode int = 200 /* PutObjectLegalHoldOK A successful response. swagger:response putObjectLegalHoldOK */ type PutObjectLegalHoldOK struct { } // NewPutObjectLegalHoldOK creates PutObjectLegalHoldOK with default headers values func NewPutObjectLegalHoldOK() *PutObjectLegalHoldOK { return &PutObjectLegalHoldOK{} } // WriteResponse to the client func (o *PutObjectLegalHoldOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* PutObjectLegalHoldDefault Generic error response. swagger:response putObjectLegalHoldDefault */ type PutObjectLegalHoldDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewPutObjectLegalHoldDefault creates PutObjectLegalHoldDefault with default headers values func NewPutObjectLegalHoldDefault(code int) *PutObjectLegalHoldDefault { if code <= 0 { code = 500 } return &PutObjectLegalHoldDefault{ _statusCode: code, } } // WithStatusCode adds the status to the put object legal hold default response func (o *PutObjectLegalHoldDefault) WithStatusCode(code int) *PutObjectLegalHoldDefault { o._statusCode = code return o } // SetStatusCode sets the status to the put object legal hold default response func (o *PutObjectLegalHoldDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the put object legal hold default response func (o *PutObjectLegalHoldDefault) WithPayload(payload *models.APIError) *PutObjectLegalHoldDefault { o.Payload = payload return o } // SetPayload sets the payload to the put object legal hold default response func (o *PutObjectLegalHoldDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *PutObjectLegalHoldDefault) 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 } } } ================================================ FILE: api/operations/object/put_object_legal_hold_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // PutObjectLegalHoldURL generates an URL for the put object legal hold operation type PutObjectLegalHoldURL struct { BucketName string Prefix string VersionID 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 *PutObjectLegalHoldURL) WithBasePath(bp string) *PutObjectLegalHoldURL { 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 *PutObjectLegalHoldURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *PutObjectLegalHoldURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects/legalhold" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on PutObjectLegalHoldURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) prefixQ := o.Prefix if prefixQ != "" { qs.Set("prefix", prefixQ) } versionIDQ := o.VersionID if versionIDQ != "" { qs.Set("version_id", versionIDQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *PutObjectLegalHoldURL) 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 *PutObjectLegalHoldURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *PutObjectLegalHoldURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on PutObjectLegalHoldURL") } if host == "" { return nil, errors.New("host is required for a full url on PutObjectLegalHoldURL") } 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 *PutObjectLegalHoldURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/put_object_restore.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // PutObjectRestoreHandlerFunc turns a function with the right signature into a put object restore handler type PutObjectRestoreHandlerFunc func(PutObjectRestoreParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn PutObjectRestoreHandlerFunc) Handle(params PutObjectRestoreParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // PutObjectRestoreHandler interface for that can handle valid put object restore params type PutObjectRestoreHandler interface { Handle(PutObjectRestoreParams, *models.Principal) middleware.Responder } // NewPutObjectRestore creates a new http.Handler for the put object restore operation func NewPutObjectRestore(ctx *middleware.Context, handler PutObjectRestoreHandler) *PutObjectRestore { return &PutObjectRestore{Context: ctx, Handler: handler} } /* PutObjectRestore swagger:route PUT /buckets/{bucket_name}/objects/restore Object putObjectRestore Restore Object to a selected version */ type PutObjectRestore struct { Context *middleware.Context Handler PutObjectRestoreHandler } func (o *PutObjectRestore) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewPutObjectRestoreParams() 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) } ================================================ FILE: api/operations/object/put_object_restore_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object 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" ) // NewPutObjectRestoreParams creates a new PutObjectRestoreParams object // // There are no default values defined in the spec. func NewPutObjectRestoreParams() PutObjectRestoreParams { return PutObjectRestoreParams{} } // PutObjectRestoreParams contains all the bound params for the put object restore operation // typically these are obtained from a http.Request // // swagger:parameters PutObjectRestore type PutObjectRestoreParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* Required: true In: query */ Prefix string /* Required: true In: query */ VersionID 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 NewPutObjectRestoreParams() beforehand. func (o *PutObjectRestoreParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } qVersionID, qhkVersionID, _ := qs.GetOK("version_id") if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *PutObjectRestoreParams) bindBucketName(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.BucketName = raw return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *PutObjectRestoreParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("prefix", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } o.Prefix = raw return nil } // bindVersionID binds and validates parameter VersionID from query. func (o *PutObjectRestoreParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("version_id", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } o.VersionID = raw return nil } ================================================ FILE: api/operations/object/put_object_restore_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // PutObjectRestoreOKCode is the HTTP code returned for type PutObjectRestoreOK const PutObjectRestoreOKCode int = 200 /* PutObjectRestoreOK A successful response. swagger:response putObjectRestoreOK */ type PutObjectRestoreOK struct { } // NewPutObjectRestoreOK creates PutObjectRestoreOK with default headers values func NewPutObjectRestoreOK() *PutObjectRestoreOK { return &PutObjectRestoreOK{} } // WriteResponse to the client func (o *PutObjectRestoreOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* PutObjectRestoreDefault Generic error response. swagger:response putObjectRestoreDefault */ type PutObjectRestoreDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewPutObjectRestoreDefault creates PutObjectRestoreDefault with default headers values func NewPutObjectRestoreDefault(code int) *PutObjectRestoreDefault { if code <= 0 { code = 500 } return &PutObjectRestoreDefault{ _statusCode: code, } } // WithStatusCode adds the status to the put object restore default response func (o *PutObjectRestoreDefault) WithStatusCode(code int) *PutObjectRestoreDefault { o._statusCode = code return o } // SetStatusCode sets the status to the put object restore default response func (o *PutObjectRestoreDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the put object restore default response func (o *PutObjectRestoreDefault) WithPayload(payload *models.APIError) *PutObjectRestoreDefault { o.Payload = payload return o } // SetPayload sets the payload to the put object restore default response func (o *PutObjectRestoreDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *PutObjectRestoreDefault) 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 } } } ================================================ FILE: api/operations/object/put_object_restore_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // PutObjectRestoreURL generates an URL for the put object restore operation type PutObjectRestoreURL struct { BucketName string Prefix string VersionID 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 *PutObjectRestoreURL) WithBasePath(bp string) *PutObjectRestoreURL { 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 *PutObjectRestoreURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *PutObjectRestoreURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects/restore" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on PutObjectRestoreURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) prefixQ := o.Prefix if prefixQ != "" { qs.Set("prefix", prefixQ) } versionIDQ := o.VersionID if versionIDQ != "" { qs.Set("version_id", versionIDQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *PutObjectRestoreURL) 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 *PutObjectRestoreURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *PutObjectRestoreURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on PutObjectRestoreURL") } if host == "" { return nil, errors.New("host is required for a full url on PutObjectRestoreURL") } 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 *PutObjectRestoreURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/put_object_retention.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // PutObjectRetentionHandlerFunc turns a function with the right signature into a put object retention handler type PutObjectRetentionHandlerFunc func(PutObjectRetentionParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn PutObjectRetentionHandlerFunc) Handle(params PutObjectRetentionParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // PutObjectRetentionHandler interface for that can handle valid put object retention params type PutObjectRetentionHandler interface { Handle(PutObjectRetentionParams, *models.Principal) middleware.Responder } // NewPutObjectRetention creates a new http.Handler for the put object retention operation func NewPutObjectRetention(ctx *middleware.Context, handler PutObjectRetentionHandler) *PutObjectRetention { return &PutObjectRetention{Context: ctx, Handler: handler} } /* PutObjectRetention swagger:route PUT /buckets/{bucket_name}/objects/retention Object putObjectRetention Put Object's retention status */ type PutObjectRetention struct { Context *middleware.Context Handler PutObjectRetentionHandler } func (o *PutObjectRetention) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewPutObjectRetentionParams() 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) } ================================================ FILE: api/operations/object/put_object_retention_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( stderrors "errors" "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" ) // NewPutObjectRetentionParams creates a new PutObjectRetentionParams object // // There are no default values defined in the spec. func NewPutObjectRetentionParams() PutObjectRetentionParams { return PutObjectRetentionParams{} } // PutObjectRetentionParams contains all the bound params for the put object retention operation // typically these are obtained from a http.Request // // swagger:parameters PutObjectRetention type PutObjectRetentionParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.PutObjectRetentionRequest /* Required: true In: path */ BucketName string /* Required: true In: query */ Prefix string /* Required: true In: query */ VersionID 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 NewPutObjectRetentionParams() beforehand. func (o *PutObjectRetentionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.PutObjectRetentionRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } qVersionID, qhkVersionID, _ := qs.GetOK("version_id") if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *PutObjectRetentionParams) bindBucketName(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.BucketName = raw return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *PutObjectRetentionParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("prefix", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } o.Prefix = raw return nil } // bindVersionID binds and validates parameter VersionID from query. func (o *PutObjectRetentionParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("version_id", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } o.VersionID = raw return nil } ================================================ FILE: api/operations/object/put_object_retention_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // PutObjectRetentionOKCode is the HTTP code returned for type PutObjectRetentionOK const PutObjectRetentionOKCode int = 200 /* PutObjectRetentionOK A successful response. swagger:response putObjectRetentionOK */ type PutObjectRetentionOK struct { } // NewPutObjectRetentionOK creates PutObjectRetentionOK with default headers values func NewPutObjectRetentionOK() *PutObjectRetentionOK { return &PutObjectRetentionOK{} } // WriteResponse to the client func (o *PutObjectRetentionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* PutObjectRetentionDefault Generic error response. swagger:response putObjectRetentionDefault */ type PutObjectRetentionDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewPutObjectRetentionDefault creates PutObjectRetentionDefault with default headers values func NewPutObjectRetentionDefault(code int) *PutObjectRetentionDefault { if code <= 0 { code = 500 } return &PutObjectRetentionDefault{ _statusCode: code, } } // WithStatusCode adds the status to the put object retention default response func (o *PutObjectRetentionDefault) WithStatusCode(code int) *PutObjectRetentionDefault { o._statusCode = code return o } // SetStatusCode sets the status to the put object retention default response func (o *PutObjectRetentionDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the put object retention default response func (o *PutObjectRetentionDefault) WithPayload(payload *models.APIError) *PutObjectRetentionDefault { o.Payload = payload return o } // SetPayload sets the payload to the put object retention default response func (o *PutObjectRetentionDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *PutObjectRetentionDefault) 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 } } } ================================================ FILE: api/operations/object/put_object_retention_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // PutObjectRetentionURL generates an URL for the put object retention operation type PutObjectRetentionURL struct { BucketName string Prefix string VersionID 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 *PutObjectRetentionURL) WithBasePath(bp string) *PutObjectRetentionURL { 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 *PutObjectRetentionURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *PutObjectRetentionURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects/retention" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on PutObjectRetentionURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) prefixQ := o.Prefix if prefixQ != "" { qs.Set("prefix", prefixQ) } versionIDQ := o.VersionID if versionIDQ != "" { qs.Set("version_id", versionIDQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *PutObjectRetentionURL) 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 *PutObjectRetentionURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *PutObjectRetentionURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on PutObjectRetentionURL") } if host == "" { return nil, errors.New("host is required for a full url on PutObjectRetentionURL") } 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 *PutObjectRetentionURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/put_object_tags.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // PutObjectTagsHandlerFunc turns a function with the right signature into a put object tags handler type PutObjectTagsHandlerFunc func(PutObjectTagsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn PutObjectTagsHandlerFunc) Handle(params PutObjectTagsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // PutObjectTagsHandler interface for that can handle valid put object tags params type PutObjectTagsHandler interface { Handle(PutObjectTagsParams, *models.Principal) middleware.Responder } // NewPutObjectTags creates a new http.Handler for the put object tags operation func NewPutObjectTags(ctx *middleware.Context, handler PutObjectTagsHandler) *PutObjectTags { return &PutObjectTags{Context: ctx, Handler: handler} } /* PutObjectTags swagger:route PUT /buckets/{bucket_name}/objects/tags Object putObjectTags Put Object's tags */ type PutObjectTags struct { Context *middleware.Context Handler PutObjectTagsHandler } func (o *PutObjectTags) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewPutObjectTagsParams() 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) } ================================================ FILE: api/operations/object/put_object_tags_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( stderrors "errors" "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" ) // NewPutObjectTagsParams creates a new PutObjectTagsParams object // // There are no default values defined in the spec. func NewPutObjectTagsParams() PutObjectTagsParams { return PutObjectTagsParams{} } // PutObjectTagsParams contains all the bound params for the put object tags operation // typically these are obtained from a http.Request // // swagger:parameters PutObjectTags type PutObjectTagsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.PutObjectTagsRequest /* Required: true In: path */ BucketName string /* Required: true In: query */ Prefix string /* Required: true In: query */ VersionID 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 NewPutObjectTagsParams() beforehand. func (o *PutObjectTagsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.PutObjectTagsRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } qVersionID, qhkVersionID, _ := qs.GetOK("version_id") if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *PutObjectTagsParams) bindBucketName(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.BucketName = raw return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *PutObjectTagsParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("prefix", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } o.Prefix = raw return nil } // bindVersionID binds and validates parameter VersionID from query. func (o *PutObjectTagsParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("version_id", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } o.VersionID = raw return nil } ================================================ FILE: api/operations/object/put_object_tags_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // PutObjectTagsOKCode is the HTTP code returned for type PutObjectTagsOK const PutObjectTagsOKCode int = 200 /* PutObjectTagsOK A successful response. swagger:response putObjectTagsOK */ type PutObjectTagsOK struct { } // NewPutObjectTagsOK creates PutObjectTagsOK with default headers values func NewPutObjectTagsOK() *PutObjectTagsOK { return &PutObjectTagsOK{} } // WriteResponse to the client func (o *PutObjectTagsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* PutObjectTagsDefault Generic error response. swagger:response putObjectTagsDefault */ type PutObjectTagsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewPutObjectTagsDefault creates PutObjectTagsDefault with default headers values func NewPutObjectTagsDefault(code int) *PutObjectTagsDefault { if code <= 0 { code = 500 } return &PutObjectTagsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the put object tags default response func (o *PutObjectTagsDefault) WithStatusCode(code int) *PutObjectTagsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the put object tags default response func (o *PutObjectTagsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the put object tags default response func (o *PutObjectTagsDefault) WithPayload(payload *models.APIError) *PutObjectTagsDefault { o.Payload = payload return o } // SetPayload sets the payload to the put object tags default response func (o *PutObjectTagsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *PutObjectTagsDefault) 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 } } } ================================================ FILE: api/operations/object/put_object_tags_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // PutObjectTagsURL generates an URL for the put object tags operation type PutObjectTagsURL struct { BucketName string Prefix string VersionID 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 *PutObjectTagsURL) WithBasePath(bp string) *PutObjectTagsURL { 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 *PutObjectTagsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *PutObjectTagsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects/tags" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on PutObjectTagsURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) prefixQ := o.Prefix if prefixQ != "" { qs.Set("prefix", prefixQ) } versionIDQ := o.VersionID if versionIDQ != "" { qs.Set("version_id", versionIDQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *PutObjectTagsURL) 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 *PutObjectTagsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *PutObjectTagsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on PutObjectTagsURL") } if host == "" { return nil, errors.New("host is required for a full url on PutObjectTagsURL") } 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 *PutObjectTagsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/object/share_object.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ShareObjectHandlerFunc turns a function with the right signature into a share object handler type ShareObjectHandlerFunc func(ShareObjectParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ShareObjectHandlerFunc) Handle(params ShareObjectParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ShareObjectHandler interface for that can handle valid share object params type ShareObjectHandler interface { Handle(ShareObjectParams, *models.Principal) middleware.Responder } // NewShareObject creates a new http.Handler for the share object operation func NewShareObject(ctx *middleware.Context, handler ShareObjectHandler) *ShareObject { return &ShareObject{Context: ctx, Handler: handler} } /* ShareObject swagger:route GET /buckets/{bucket_name}/objects/share Object shareObject Shares an Object on a url */ type ShareObject struct { Context *middleware.Context Handler ShareObjectHandler } func (o *ShareObject) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewShareObjectParams() 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) } ================================================ FILE: api/operations/object/share_object_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object 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" ) // NewShareObjectParams creates a new ShareObjectParams object // // There are no default values defined in the spec. func NewShareObjectParams() ShareObjectParams { return ShareObjectParams{} } // ShareObjectParams contains all the bound params for the share object operation // typically these are obtained from a http.Request // // swagger:parameters ShareObject type ShareObjectParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ BucketName string /* In: query */ Expires *string /* Required: true In: query */ Prefix string /* In: query */ ToggleURL *bool /* Required: true In: query */ VersionID 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 NewShareObjectParams() beforehand. func (o *ShareObjectParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } qExpires, qhkExpires, _ := qs.GetOK("expires") if err := o.bindExpires(qExpires, qhkExpires, route.Formats); err != nil { res = append(res, err) } qPrefix, qhkPrefix, _ := qs.GetOK("prefix") if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } qToggleURL, qhkToggleURL, _ := qs.GetOK("toggle_url") if err := o.bindToggleURL(qToggleURL, qhkToggleURL, route.Formats); err != nil { res = append(res, err) } qVersionID, qhkVersionID, _ := qs.GetOK("version_id") if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBucketName binds and validates parameter BucketName from path. func (o *ShareObjectParams) bindBucketName(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.BucketName = raw return nil } // bindExpires binds and validates parameter Expires from query. func (o *ShareObjectParams) bindExpires(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.Expires = &raw return nil } // bindPrefix binds and validates parameter Prefix from query. func (o *ShareObjectParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("prefix", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } o.Prefix = raw return nil } // bindToggleURL binds and validates parameter ToggleURL from query. func (o *ShareObjectParams) bindToggleURL(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.ConvertBool(raw) if err != nil { return errors.InvalidType("toggle_url", "query", "bool", raw) } o.ToggleURL = &value return nil } // bindVersionID binds and validates parameter VersionID from query. func (o *ShareObjectParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("version_id", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } o.VersionID = raw return nil } ================================================ FILE: api/operations/object/share_object_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ShareObjectOKCode is the HTTP code returned for type ShareObjectOK const ShareObjectOKCode int = 200 /* ShareObjectOK A successful response. swagger:response shareObjectOK */ type ShareObjectOK struct { /* In: Body */ Payload string `json:"body,omitempty"` } // NewShareObjectOK creates ShareObjectOK with default headers values func NewShareObjectOK() *ShareObjectOK { return &ShareObjectOK{} } // WithPayload adds the payload to the share object o k response func (o *ShareObjectOK) WithPayload(payload string) *ShareObjectOK { o.Payload = payload return o } // SetPayload sets the payload to the share object o k response func (o *ShareObjectOK) SetPayload(payload string) { o.Payload = payload } // WriteResponse to the client func (o *ShareObjectOK) 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 } } /* ShareObjectDefault Generic error response. swagger:response shareObjectDefault */ type ShareObjectDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewShareObjectDefault creates ShareObjectDefault with default headers values func NewShareObjectDefault(code int) *ShareObjectDefault { if code <= 0 { code = 500 } return &ShareObjectDefault{ _statusCode: code, } } // WithStatusCode adds the status to the share object default response func (o *ShareObjectDefault) WithStatusCode(code int) *ShareObjectDefault { o._statusCode = code return o } // SetStatusCode sets the status to the share object default response func (o *ShareObjectDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the share object default response func (o *ShareObjectDefault) WithPayload(payload *models.APIError) *ShareObjectDefault { o.Payload = payload return o } // SetPayload sets the payload to the share object default response func (o *ShareObjectDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ShareObjectDefault) 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 } } } ================================================ FILE: api/operations/object/share_object_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package object import ( "errors" "net/url" golangswaggerpaths "path" "strings" "github.com/go-openapi/swag" ) // ShareObjectURL generates an URL for the share object operation type ShareObjectURL struct { BucketName string Expires *string Prefix string ToggleURL *bool VersionID 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 *ShareObjectURL) WithBasePath(bp string) *ShareObjectURL { 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 *ShareObjectURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ShareObjectURL) Build() (*url.URL, error) { var _result url.URL var _path = "/buckets/{bucket_name}/objects/share" bucketName := o.BucketName if bucketName != "" { _path = strings.ReplaceAll(_path, "{bucket_name}", bucketName) } else { return nil, errors.New("bucketName is required on ShareObjectURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var expiresQ string if o.Expires != nil { expiresQ = *o.Expires } if expiresQ != "" { qs.Set("expires", expiresQ) } prefixQ := o.Prefix if prefixQ != "" { qs.Set("prefix", prefixQ) } var toggleURLQ string if o.ToggleURL != nil { toggleURLQ = swag.FormatBool(*o.ToggleURL) } if toggleURLQ != "" { qs.Set("toggle_url", toggleURLQ) } versionIDQ := o.VersionID if versionIDQ != "" { qs.Set("version_id", versionIDQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ShareObjectURL) 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 *ShareObjectURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ShareObjectURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ShareObjectURL") } if host == "" { return nil, errors.New("host is required for a full url on ShareObjectURL") } 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 *ShareObjectURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/policy/add_policy.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // AddPolicyHandlerFunc turns a function with the right signature into a add policy handler type AddPolicyHandlerFunc func(AddPolicyParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn AddPolicyHandlerFunc) Handle(params AddPolicyParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // AddPolicyHandler interface for that can handle valid add policy params type AddPolicyHandler interface { Handle(AddPolicyParams, *models.Principal) middleware.Responder } // NewAddPolicy creates a new http.Handler for the add policy operation func NewAddPolicy(ctx *middleware.Context, handler AddPolicyHandler) *AddPolicy { return &AddPolicy{Context: ctx, Handler: handler} } /* AddPolicy swagger:route POST /policies Policy addPolicy Add Policy */ type AddPolicy struct { Context *middleware.Context Handler AddPolicyHandler } func (o *AddPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewAddPolicyParams() 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) } ================================================ FILE: api/operations/policy/add_policy_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( stderrors "errors" "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" ) // NewAddPolicyParams creates a new AddPolicyParams object // // There are no default values defined in the spec. func NewAddPolicyParams() AddPolicyParams { return AddPolicyParams{} } // AddPolicyParams contains all the bound params for the add policy operation // typically these are obtained from a http.Request // // swagger:parameters AddPolicy type AddPolicyParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.AddPolicyRequest } // 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 NewAddPolicyParams() beforehand. func (o *AddPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.AddPolicyRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/policy/add_policy_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // AddPolicyCreatedCode is the HTTP code returned for type AddPolicyCreated const AddPolicyCreatedCode int = 201 /* AddPolicyCreated A successful response. swagger:response addPolicyCreated */ type AddPolicyCreated struct { /* In: Body */ Payload *models.Policy `json:"body,omitempty"` } // NewAddPolicyCreated creates AddPolicyCreated with default headers values func NewAddPolicyCreated() *AddPolicyCreated { return &AddPolicyCreated{} } // WithPayload adds the payload to the add policy created response func (o *AddPolicyCreated) WithPayload(payload *models.Policy) *AddPolicyCreated { o.Payload = payload return o } // SetPayload sets the payload to the add policy created response func (o *AddPolicyCreated) SetPayload(payload *models.Policy) { o.Payload = payload } // WriteResponse to the client func (o *AddPolicyCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(201) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } } /* AddPolicyDefault Generic error response. swagger:response addPolicyDefault */ type AddPolicyDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewAddPolicyDefault creates AddPolicyDefault with default headers values func NewAddPolicyDefault(code int) *AddPolicyDefault { if code <= 0 { code = 500 } return &AddPolicyDefault{ _statusCode: code, } } // WithStatusCode adds the status to the add policy default response func (o *AddPolicyDefault) WithStatusCode(code int) *AddPolicyDefault { o._statusCode = code return o } // SetStatusCode sets the status to the add policy default response func (o *AddPolicyDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the add policy default response func (o *AddPolicyDefault) WithPayload(payload *models.APIError) *AddPolicyDefault { o.Payload = payload return o } // SetPayload sets the payload to the add policy default response func (o *AddPolicyDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *AddPolicyDefault) 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 } } } ================================================ FILE: api/operations/policy/add_policy_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "errors" "net/url" golangswaggerpaths "path" ) // AddPolicyURL generates an URL for the add policy operation type AddPolicyURL 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 *AddPolicyURL) WithBasePath(bp string) *AddPolicyURL { 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 *AddPolicyURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *AddPolicyURL) Build() (*url.URL, error) { var _result url.URL var _path = "/policies" _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 *AddPolicyURL) 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 *AddPolicyURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *AddPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on AddPolicyURL") } if host == "" { return nil, errors.New("host is required for a full url on AddPolicyURL") } 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 *AddPolicyURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/policy/get_s_a_user_policy.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetSAUserPolicyHandlerFunc turns a function with the right signature into a get s a user policy handler type GetSAUserPolicyHandlerFunc func(GetSAUserPolicyParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetSAUserPolicyHandlerFunc) Handle(params GetSAUserPolicyParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetSAUserPolicyHandler interface for that can handle valid get s a user policy params type GetSAUserPolicyHandler interface { Handle(GetSAUserPolicyParams, *models.Principal) middleware.Responder } // NewGetSAUserPolicy creates a new http.Handler for the get s a user policy operation func NewGetSAUserPolicy(ctx *middleware.Context, handler GetSAUserPolicyHandler) *GetSAUserPolicy { return &GetSAUserPolicy{Context: ctx, Handler: handler} } /* GetSAUserPolicy swagger:route GET /user/{name}/policies Policy getSAUserPolicy returns policies assigned for a specified user */ type GetSAUserPolicy struct { Context *middleware.Context Handler GetSAUserPolicyHandler } func (o *GetSAUserPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetSAUserPolicyParams() 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) } ================================================ FILE: api/operations/policy/get_s_a_user_policy_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetSAUserPolicyParams creates a new GetSAUserPolicyParams object // // There are no default values defined in the spec. func NewGetSAUserPolicyParams() GetSAUserPolicyParams { return GetSAUserPolicyParams{} } // GetSAUserPolicyParams contains all the bound params for the get s a user policy operation // typically these are obtained from a http.Request // // swagger:parameters GetSAUserPolicy type GetSAUserPolicyParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewGetSAUserPolicyParams() beforehand. func (o *GetSAUserPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *GetSAUserPolicyParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/policy/get_s_a_user_policy_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetSAUserPolicyOKCode is the HTTP code returned for type GetSAUserPolicyOK const GetSAUserPolicyOKCode int = 200 /* GetSAUserPolicyOK A successful response. swagger:response getSAUserPolicyOK */ type GetSAUserPolicyOK struct { /* In: Body */ Payload *models.AUserPolicyResponse `json:"body,omitempty"` } // NewGetSAUserPolicyOK creates GetSAUserPolicyOK with default headers values func NewGetSAUserPolicyOK() *GetSAUserPolicyOK { return &GetSAUserPolicyOK{} } // WithPayload adds the payload to the get s a user policy o k response func (o *GetSAUserPolicyOK) WithPayload(payload *models.AUserPolicyResponse) *GetSAUserPolicyOK { o.Payload = payload return o } // SetPayload sets the payload to the get s a user policy o k response func (o *GetSAUserPolicyOK) SetPayload(payload *models.AUserPolicyResponse) { o.Payload = payload } // WriteResponse to the client func (o *GetSAUserPolicyOK) 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 } } } /* GetSAUserPolicyDefault Generic error response. swagger:response getSAUserPolicyDefault */ type GetSAUserPolicyDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetSAUserPolicyDefault creates GetSAUserPolicyDefault with default headers values func NewGetSAUserPolicyDefault(code int) *GetSAUserPolicyDefault { if code <= 0 { code = 500 } return &GetSAUserPolicyDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get s a user policy default response func (o *GetSAUserPolicyDefault) WithStatusCode(code int) *GetSAUserPolicyDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get s a user policy default response func (o *GetSAUserPolicyDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get s a user policy default response func (o *GetSAUserPolicyDefault) WithPayload(payload *models.APIError) *GetSAUserPolicyDefault { o.Payload = payload return o } // SetPayload sets the payload to the get s a user policy default response func (o *GetSAUserPolicyDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetSAUserPolicyDefault) 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 } } } ================================================ FILE: api/operations/policy/get_s_a_user_policy_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetSAUserPolicyURL generates an URL for the get s a user policy operation type GetSAUserPolicyURL struct { Name 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 *GetSAUserPolicyURL) WithBasePath(bp string) *GetSAUserPolicyURL { 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 *GetSAUserPolicyURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetSAUserPolicyURL) Build() (*url.URL, error) { var _result url.URL var _path = "/user/{name}/policies" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on GetSAUserPolicyURL") } _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 *GetSAUserPolicyURL) 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 *GetSAUserPolicyURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetSAUserPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetSAUserPolicyURL") } if host == "" { return nil, errors.New("host is required for a full url on GetSAUserPolicyURL") } 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 *GetSAUserPolicyURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/policy/get_user_policy.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetUserPolicyHandlerFunc turns a function with the right signature into a get user policy handler type GetUserPolicyHandlerFunc func(GetUserPolicyParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetUserPolicyHandlerFunc) Handle(params GetUserPolicyParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetUserPolicyHandler interface for that can handle valid get user policy params type GetUserPolicyHandler interface { Handle(GetUserPolicyParams, *models.Principal) middleware.Responder } // NewGetUserPolicy creates a new http.Handler for the get user policy operation func NewGetUserPolicy(ctx *middleware.Context, handler GetUserPolicyHandler) *GetUserPolicy { return &GetUserPolicy{Context: ctx, Handler: handler} } /* GetUserPolicy swagger:route GET /user/policy Policy getUserPolicy returns policies for logged in user */ type GetUserPolicy struct { Context *middleware.Context Handler GetUserPolicyHandler } func (o *GetUserPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetUserPolicyParams() 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) } ================================================ FILE: api/operations/policy/get_user_policy_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewGetUserPolicyParams creates a new GetUserPolicyParams object // // There are no default values defined in the spec. func NewGetUserPolicyParams() GetUserPolicyParams { return GetUserPolicyParams{} } // GetUserPolicyParams contains all the bound params for the get user policy operation // typically these are obtained from a http.Request // // swagger:parameters GetUserPolicy type GetUserPolicyParams 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 NewGetUserPolicyParams() beforehand. func (o *GetUserPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/policy/get_user_policy_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetUserPolicyOKCode is the HTTP code returned for type GetUserPolicyOK const GetUserPolicyOKCode int = 200 /* GetUserPolicyOK A successful response. swagger:response getUserPolicyOK */ type GetUserPolicyOK struct { /* In: Body */ Payload string `json:"body,omitempty"` } // NewGetUserPolicyOK creates GetUserPolicyOK with default headers values func NewGetUserPolicyOK() *GetUserPolicyOK { return &GetUserPolicyOK{} } // WithPayload adds the payload to the get user policy o k response func (o *GetUserPolicyOK) WithPayload(payload string) *GetUserPolicyOK { o.Payload = payload return o } // SetPayload sets the payload to the get user policy o k response func (o *GetUserPolicyOK) SetPayload(payload string) { o.Payload = payload } // WriteResponse to the client func (o *GetUserPolicyOK) 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 } } /* GetUserPolicyDefault Generic error response. swagger:response getUserPolicyDefault */ type GetUserPolicyDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetUserPolicyDefault creates GetUserPolicyDefault with default headers values func NewGetUserPolicyDefault(code int) *GetUserPolicyDefault { if code <= 0 { code = 500 } return &GetUserPolicyDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get user policy default response func (o *GetUserPolicyDefault) WithStatusCode(code int) *GetUserPolicyDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get user policy default response func (o *GetUserPolicyDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get user policy default response func (o *GetUserPolicyDefault) WithPayload(payload *models.APIError) *GetUserPolicyDefault { o.Payload = payload return o } // SetPayload sets the payload to the get user policy default response func (o *GetUserPolicyDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetUserPolicyDefault) 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 } } } ================================================ FILE: api/operations/policy/get_user_policy_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "errors" "net/url" golangswaggerpaths "path" ) // GetUserPolicyURL generates an URL for the get user policy operation type GetUserPolicyURL 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 *GetUserPolicyURL) WithBasePath(bp string) *GetUserPolicyURL { 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 *GetUserPolicyURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetUserPolicyURL) Build() (*url.URL, error) { var _result url.URL var _path = "/user/policy" _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 *GetUserPolicyURL) 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 *GetUserPolicyURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetUserPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetUserPolicyURL") } if host == "" { return nil, errors.New("host is required for a full url on GetUserPolicyURL") } 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 *GetUserPolicyURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/policy/list_groups_for_policy.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListGroupsForPolicyHandlerFunc turns a function with the right signature into a list groups for policy handler type ListGroupsForPolicyHandlerFunc func(ListGroupsForPolicyParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListGroupsForPolicyHandlerFunc) Handle(params ListGroupsForPolicyParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListGroupsForPolicyHandler interface for that can handle valid list groups for policy params type ListGroupsForPolicyHandler interface { Handle(ListGroupsForPolicyParams, *models.Principal) middleware.Responder } // NewListGroupsForPolicy creates a new http.Handler for the list groups for policy operation func NewListGroupsForPolicy(ctx *middleware.Context, handler ListGroupsForPolicyHandler) *ListGroupsForPolicy { return &ListGroupsForPolicy{Context: ctx, Handler: handler} } /* ListGroupsForPolicy swagger:route GET /policies/{policy}/groups Policy listGroupsForPolicy List Groups for a Policy */ type ListGroupsForPolicy struct { Context *middleware.Context Handler ListGroupsForPolicyHandler } func (o *ListGroupsForPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListGroupsForPolicyParams() 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) } ================================================ FILE: api/operations/policy/list_groups_for_policy_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewListGroupsForPolicyParams creates a new ListGroupsForPolicyParams object // // There are no default values defined in the spec. func NewListGroupsForPolicyParams() ListGroupsForPolicyParams { return ListGroupsForPolicyParams{} } // ListGroupsForPolicyParams contains all the bound params for the list groups for policy operation // typically these are obtained from a http.Request // // swagger:parameters ListGroupsForPolicy type ListGroupsForPolicyParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Policy 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 NewListGroupsForPolicyParams() beforehand. func (o *ListGroupsForPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rPolicy, rhkPolicy, _ := route.Params.GetOK("policy") if err := o.bindPolicy(rPolicy, rhkPolicy, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindPolicy binds and validates parameter Policy from path. func (o *ListGroupsForPolicyParams) bindPolicy(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.Policy = raw return nil } ================================================ FILE: api/operations/policy/list_groups_for_policy_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListGroupsForPolicyOKCode is the HTTP code returned for type ListGroupsForPolicyOK const ListGroupsForPolicyOKCode int = 200 /* ListGroupsForPolicyOK A successful response. swagger:response listGroupsForPolicyOK */ type ListGroupsForPolicyOK struct { /* In: Body */ Payload []string `json:"body,omitempty"` } // NewListGroupsForPolicyOK creates ListGroupsForPolicyOK with default headers values func NewListGroupsForPolicyOK() *ListGroupsForPolicyOK { return &ListGroupsForPolicyOK{} } // WithPayload adds the payload to the list groups for policy o k response func (o *ListGroupsForPolicyOK) WithPayload(payload []string) *ListGroupsForPolicyOK { o.Payload = payload return o } // SetPayload sets the payload to the list groups for policy o k response func (o *ListGroupsForPolicyOK) SetPayload(payload []string) { o.Payload = payload } // WriteResponse to the client func (o *ListGroupsForPolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(200) payload := o.Payload if payload == nil { // return empty array payload = make([]string, 0, 50) } if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } /* ListGroupsForPolicyDefault Generic error response. swagger:response listGroupsForPolicyDefault */ type ListGroupsForPolicyDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListGroupsForPolicyDefault creates ListGroupsForPolicyDefault with default headers values func NewListGroupsForPolicyDefault(code int) *ListGroupsForPolicyDefault { if code <= 0 { code = 500 } return &ListGroupsForPolicyDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list groups for policy default response func (o *ListGroupsForPolicyDefault) WithStatusCode(code int) *ListGroupsForPolicyDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list groups for policy default response func (o *ListGroupsForPolicyDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list groups for policy default response func (o *ListGroupsForPolicyDefault) WithPayload(payload *models.APIError) *ListGroupsForPolicyDefault { o.Payload = payload return o } // SetPayload sets the payload to the list groups for policy default response func (o *ListGroupsForPolicyDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListGroupsForPolicyDefault) 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 } } } ================================================ FILE: api/operations/policy/list_groups_for_policy_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // ListGroupsForPolicyURL generates an URL for the list groups for policy operation type ListGroupsForPolicyURL struct { Policy 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 *ListGroupsForPolicyURL) WithBasePath(bp string) *ListGroupsForPolicyURL { 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 *ListGroupsForPolicyURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListGroupsForPolicyURL) Build() (*url.URL, error) { var _result url.URL var _path = "/policies/{policy}/groups" policy := o.Policy if policy != "" { _path = strings.ReplaceAll(_path, "{policy}", policy) } else { return nil, errors.New("policy is required on ListGroupsForPolicyURL") } _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 *ListGroupsForPolicyURL) 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 *ListGroupsForPolicyURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListGroupsForPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListGroupsForPolicyURL") } if host == "" { return nil, errors.New("host is required for a full url on ListGroupsForPolicyURL") } 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 *ListGroupsForPolicyURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/policy/list_policies.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListPoliciesHandlerFunc turns a function with the right signature into a list policies handler type ListPoliciesHandlerFunc func(ListPoliciesParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListPoliciesHandlerFunc) Handle(params ListPoliciesParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListPoliciesHandler interface for that can handle valid list policies params type ListPoliciesHandler interface { Handle(ListPoliciesParams, *models.Principal) middleware.Responder } // NewListPolicies creates a new http.Handler for the list policies operation func NewListPolicies(ctx *middleware.Context, handler ListPoliciesHandler) *ListPolicies { return &ListPolicies{Context: ctx, Handler: handler} } /* ListPolicies swagger:route GET /policies Policy listPolicies List Policies */ type ListPolicies struct { Context *middleware.Context Handler ListPoliciesHandler } func (o *ListPolicies) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListPoliciesParams() 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) } ================================================ FILE: api/operations/policy/list_policies_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy 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" ) // NewListPoliciesParams creates a new ListPoliciesParams object // with the default values initialized. func NewListPoliciesParams() ListPoliciesParams { var ( // initialize parameters with default values limitDefault = int32(20) offsetDefault = int32(0) ) return ListPoliciesParams{ Limit: &limitDefault, Offset: &offsetDefault, } } // ListPoliciesParams contains all the bound params for the list policies operation // typically these are obtained from a http.Request // // swagger:parameters ListPolicies type ListPoliciesParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* In: query Default: 20 */ Limit *int32 /* In: query Default: 0 */ Offset *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 NewListPoliciesParams() beforehand. func (o *ListPoliciesParams) 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) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindLimit binds and validates parameter Limit from query. func (o *ListPoliciesParams) 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 // Default values have been previously initialized by NewListPoliciesParams() 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 *ListPoliciesParams) 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 // Default values have been previously initialized by NewListPoliciesParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("offset", "query", "int32", raw) } o.Offset = &value return nil } ================================================ FILE: api/operations/policy/list_policies_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListPoliciesOKCode is the HTTP code returned for type ListPoliciesOK const ListPoliciesOKCode int = 200 /* ListPoliciesOK A successful response. swagger:response listPoliciesOK */ type ListPoliciesOK struct { /* In: Body */ Payload *models.ListPoliciesResponse `json:"body,omitempty"` } // NewListPoliciesOK creates ListPoliciesOK with default headers values func NewListPoliciesOK() *ListPoliciesOK { return &ListPoliciesOK{} } // WithPayload adds the payload to the list policies o k response func (o *ListPoliciesOK) WithPayload(payload *models.ListPoliciesResponse) *ListPoliciesOK { o.Payload = payload return o } // SetPayload sets the payload to the list policies o k response func (o *ListPoliciesOK) SetPayload(payload *models.ListPoliciesResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListPoliciesOK) 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 } } } /* ListPoliciesDefault Generic error response. swagger:response listPoliciesDefault */ type ListPoliciesDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListPoliciesDefault creates ListPoliciesDefault with default headers values func NewListPoliciesDefault(code int) *ListPoliciesDefault { if code <= 0 { code = 500 } return &ListPoliciesDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list policies default response func (o *ListPoliciesDefault) WithStatusCode(code int) *ListPoliciesDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list policies default response func (o *ListPoliciesDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list policies default response func (o *ListPoliciesDefault) WithPayload(payload *models.APIError) *ListPoliciesDefault { o.Payload = payload return o } // SetPayload sets the payload to the list policies default response func (o *ListPoliciesDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListPoliciesDefault) 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 } } } ================================================ FILE: api/operations/policy/list_policies_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "errors" "net/url" golangswaggerpaths "path" "github.com/go-openapi/swag" ) // ListPoliciesURL generates an URL for the list policies operation type ListPoliciesURL struct { Limit *int32 Offset *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 *ListPoliciesURL) WithBasePath(bp string) *ListPoliciesURL { 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 *ListPoliciesURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListPoliciesURL) Build() (*url.URL, error) { var _result url.URL var _path = "/policies" _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) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListPoliciesURL) 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 *ListPoliciesURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListPoliciesURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListPoliciesURL") } if host == "" { return nil, errors.New("host is required for a full url on ListPoliciesURL") } 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 *ListPoliciesURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/policy/list_users_for_policy.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListUsersForPolicyHandlerFunc turns a function with the right signature into a list users for policy handler type ListUsersForPolicyHandlerFunc func(ListUsersForPolicyParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListUsersForPolicyHandlerFunc) Handle(params ListUsersForPolicyParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListUsersForPolicyHandler interface for that can handle valid list users for policy params type ListUsersForPolicyHandler interface { Handle(ListUsersForPolicyParams, *models.Principal) middleware.Responder } // NewListUsersForPolicy creates a new http.Handler for the list users for policy operation func NewListUsersForPolicy(ctx *middleware.Context, handler ListUsersForPolicyHandler) *ListUsersForPolicy { return &ListUsersForPolicy{Context: ctx, Handler: handler} } /* ListUsersForPolicy swagger:route GET /policies/{policy}/users Policy listUsersForPolicy List Users for a Policy */ type ListUsersForPolicy struct { Context *middleware.Context Handler ListUsersForPolicyHandler } func (o *ListUsersForPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListUsersForPolicyParams() 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) } ================================================ FILE: api/operations/policy/list_users_for_policy_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewListUsersForPolicyParams creates a new ListUsersForPolicyParams object // // There are no default values defined in the spec. func NewListUsersForPolicyParams() ListUsersForPolicyParams { return ListUsersForPolicyParams{} } // ListUsersForPolicyParams contains all the bound params for the list users for policy operation // typically these are obtained from a http.Request // // swagger:parameters ListUsersForPolicy type ListUsersForPolicyParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Policy 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 NewListUsersForPolicyParams() beforehand. func (o *ListUsersForPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rPolicy, rhkPolicy, _ := route.Params.GetOK("policy") if err := o.bindPolicy(rPolicy, rhkPolicy, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindPolicy binds and validates parameter Policy from path. func (o *ListUsersForPolicyParams) bindPolicy(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.Policy = raw return nil } ================================================ FILE: api/operations/policy/list_users_for_policy_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListUsersForPolicyOKCode is the HTTP code returned for type ListUsersForPolicyOK const ListUsersForPolicyOKCode int = 200 /* ListUsersForPolicyOK A successful response. swagger:response listUsersForPolicyOK */ type ListUsersForPolicyOK struct { /* In: Body */ Payload []string `json:"body,omitempty"` } // NewListUsersForPolicyOK creates ListUsersForPolicyOK with default headers values func NewListUsersForPolicyOK() *ListUsersForPolicyOK { return &ListUsersForPolicyOK{} } // WithPayload adds the payload to the list users for policy o k response func (o *ListUsersForPolicyOK) WithPayload(payload []string) *ListUsersForPolicyOK { o.Payload = payload return o } // SetPayload sets the payload to the list users for policy o k response func (o *ListUsersForPolicyOK) SetPayload(payload []string) { o.Payload = payload } // WriteResponse to the client func (o *ListUsersForPolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(200) payload := o.Payload if payload == nil { // return empty array payload = make([]string, 0, 50) } if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } /* ListUsersForPolicyDefault Generic error response. swagger:response listUsersForPolicyDefault */ type ListUsersForPolicyDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListUsersForPolicyDefault creates ListUsersForPolicyDefault with default headers values func NewListUsersForPolicyDefault(code int) *ListUsersForPolicyDefault { if code <= 0 { code = 500 } return &ListUsersForPolicyDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list users for policy default response func (o *ListUsersForPolicyDefault) WithStatusCode(code int) *ListUsersForPolicyDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list users for policy default response func (o *ListUsersForPolicyDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list users for policy default response func (o *ListUsersForPolicyDefault) WithPayload(payload *models.APIError) *ListUsersForPolicyDefault { o.Payload = payload return o } // SetPayload sets the payload to the list users for policy default response func (o *ListUsersForPolicyDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListUsersForPolicyDefault) 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 } } } ================================================ FILE: api/operations/policy/list_users_for_policy_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // ListUsersForPolicyURL generates an URL for the list users for policy operation type ListUsersForPolicyURL struct { Policy 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 *ListUsersForPolicyURL) WithBasePath(bp string) *ListUsersForPolicyURL { 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 *ListUsersForPolicyURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListUsersForPolicyURL) Build() (*url.URL, error) { var _result url.URL var _path = "/policies/{policy}/users" policy := o.Policy if policy != "" { _path = strings.ReplaceAll(_path, "{policy}", policy) } else { return nil, errors.New("policy is required on ListUsersForPolicyURL") } _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 *ListUsersForPolicyURL) 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 *ListUsersForPolicyURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListUsersForPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListUsersForPolicyURL") } if host == "" { return nil, errors.New("host is required for a full url on ListUsersForPolicyURL") } 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 *ListUsersForPolicyURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/policy/policy_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // PolicyInfoHandlerFunc turns a function with the right signature into a policy info handler type PolicyInfoHandlerFunc func(PolicyInfoParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn PolicyInfoHandlerFunc) Handle(params PolicyInfoParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // PolicyInfoHandler interface for that can handle valid policy info params type PolicyInfoHandler interface { Handle(PolicyInfoParams, *models.Principal) middleware.Responder } // NewPolicyInfo creates a new http.Handler for the policy info operation func NewPolicyInfo(ctx *middleware.Context, handler PolicyInfoHandler) *PolicyInfo { return &PolicyInfo{Context: ctx, Handler: handler} } /* PolicyInfo swagger:route GET /policy/{name} Policy policyInfo Policy info */ type PolicyInfo struct { Context *middleware.Context Handler PolicyInfoHandler } func (o *PolicyInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewPolicyInfoParams() 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) } ================================================ FILE: api/operations/policy/policy_info_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewPolicyInfoParams creates a new PolicyInfoParams object // // There are no default values defined in the spec. func NewPolicyInfoParams() PolicyInfoParams { return PolicyInfoParams{} } // PolicyInfoParams contains all the bound params for the policy info operation // typically these are obtained from a http.Request // // swagger:parameters PolicyInfo type PolicyInfoParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewPolicyInfoParams() beforehand. func (o *PolicyInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *PolicyInfoParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/policy/policy_info_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // PolicyInfoOKCode is the HTTP code returned for type PolicyInfoOK const PolicyInfoOKCode int = 200 /* PolicyInfoOK A successful response. swagger:response policyInfoOK */ type PolicyInfoOK struct { /* In: Body */ Payload *models.Policy `json:"body,omitempty"` } // NewPolicyInfoOK creates PolicyInfoOK with default headers values func NewPolicyInfoOK() *PolicyInfoOK { return &PolicyInfoOK{} } // WithPayload adds the payload to the policy info o k response func (o *PolicyInfoOK) WithPayload(payload *models.Policy) *PolicyInfoOK { o.Payload = payload return o } // SetPayload sets the payload to the policy info o k response func (o *PolicyInfoOK) SetPayload(payload *models.Policy) { o.Payload = payload } // WriteResponse to the client func (o *PolicyInfoOK) 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 } } } /* PolicyInfoDefault Generic error response. swagger:response policyInfoDefault */ type PolicyInfoDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewPolicyInfoDefault creates PolicyInfoDefault with default headers values func NewPolicyInfoDefault(code int) *PolicyInfoDefault { if code <= 0 { code = 500 } return &PolicyInfoDefault{ _statusCode: code, } } // WithStatusCode adds the status to the policy info default response func (o *PolicyInfoDefault) WithStatusCode(code int) *PolicyInfoDefault { o._statusCode = code return o } // SetStatusCode sets the status to the policy info default response func (o *PolicyInfoDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the policy info default response func (o *PolicyInfoDefault) WithPayload(payload *models.APIError) *PolicyInfoDefault { o.Payload = payload return o } // SetPayload sets the payload to the policy info default response func (o *PolicyInfoDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *PolicyInfoDefault) 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 } } } ================================================ FILE: api/operations/policy/policy_info_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // PolicyInfoURL generates an URL for the policy info operation type PolicyInfoURL struct { Name 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 *PolicyInfoURL) WithBasePath(bp string) *PolicyInfoURL { 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 *PolicyInfoURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *PolicyInfoURL) Build() (*url.URL, error) { var _result url.URL var _path = "/policy/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on PolicyInfoURL") } _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 *PolicyInfoURL) 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 *PolicyInfoURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *PolicyInfoURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on PolicyInfoURL") } if host == "" { return nil, errors.New("host is required for a full url on PolicyInfoURL") } 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 *PolicyInfoURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/policy/remove_policy.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // RemovePolicyHandlerFunc turns a function with the right signature into a remove policy handler type RemovePolicyHandlerFunc func(RemovePolicyParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn RemovePolicyHandlerFunc) Handle(params RemovePolicyParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // RemovePolicyHandler interface for that can handle valid remove policy params type RemovePolicyHandler interface { Handle(RemovePolicyParams, *models.Principal) middleware.Responder } // NewRemovePolicy creates a new http.Handler for the remove policy operation func NewRemovePolicy(ctx *middleware.Context, handler RemovePolicyHandler) *RemovePolicy { return &RemovePolicy{Context: ctx, Handler: handler} } /* RemovePolicy swagger:route DELETE /policy/{name} Policy removePolicy Remove policy */ type RemovePolicy struct { Context *middleware.Context Handler RemovePolicyHandler } func (o *RemovePolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewRemovePolicyParams() 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) } ================================================ FILE: api/operations/policy/remove_policy_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewRemovePolicyParams creates a new RemovePolicyParams object // // There are no default values defined in the spec. func NewRemovePolicyParams() RemovePolicyParams { return RemovePolicyParams{} } // RemovePolicyParams contains all the bound params for the remove policy operation // typically these are obtained from a http.Request // // swagger:parameters RemovePolicy type RemovePolicyParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewRemovePolicyParams() beforehand. func (o *RemovePolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *RemovePolicyParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/policy/remove_policy_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // RemovePolicyNoContentCode is the HTTP code returned for type RemovePolicyNoContent const RemovePolicyNoContentCode int = 204 /* RemovePolicyNoContent A successful response. swagger:response removePolicyNoContent */ type RemovePolicyNoContent struct { } // NewRemovePolicyNoContent creates RemovePolicyNoContent with default headers values func NewRemovePolicyNoContent() *RemovePolicyNoContent { return &RemovePolicyNoContent{} } // WriteResponse to the client func (o *RemovePolicyNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* RemovePolicyDefault Generic error response. swagger:response removePolicyDefault */ type RemovePolicyDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewRemovePolicyDefault creates RemovePolicyDefault with default headers values func NewRemovePolicyDefault(code int) *RemovePolicyDefault { if code <= 0 { code = 500 } return &RemovePolicyDefault{ _statusCode: code, } } // WithStatusCode adds the status to the remove policy default response func (o *RemovePolicyDefault) WithStatusCode(code int) *RemovePolicyDefault { o._statusCode = code return o } // SetStatusCode sets the status to the remove policy default response func (o *RemovePolicyDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the remove policy default response func (o *RemovePolicyDefault) WithPayload(payload *models.APIError) *RemovePolicyDefault { o.Payload = payload return o } // SetPayload sets the payload to the remove policy default response func (o *RemovePolicyDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *RemovePolicyDefault) 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 } } } ================================================ FILE: api/operations/policy/remove_policy_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // RemovePolicyURL generates an URL for the remove policy operation type RemovePolicyURL struct { Name 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 *RemovePolicyURL) WithBasePath(bp string) *RemovePolicyURL { 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 *RemovePolicyURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *RemovePolicyURL) Build() (*url.URL, error) { var _result url.URL var _path = "/policy/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on RemovePolicyURL") } _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 *RemovePolicyURL) 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 *RemovePolicyURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *RemovePolicyURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on RemovePolicyURL") } if host == "" { return nil, errors.New("host is required for a full url on RemovePolicyURL") } 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 *RemovePolicyURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/policy/set_policy.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SetPolicyHandlerFunc turns a function with the right signature into a set policy handler type SetPolicyHandlerFunc func(SetPolicyParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SetPolicyHandlerFunc) Handle(params SetPolicyParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SetPolicyHandler interface for that can handle valid set policy params type SetPolicyHandler interface { Handle(SetPolicyParams, *models.Principal) middleware.Responder } // NewSetPolicy creates a new http.Handler for the set policy operation func NewSetPolicy(ctx *middleware.Context, handler SetPolicyHandler) *SetPolicy { return &SetPolicy{Context: ctx, Handler: handler} } /* SetPolicy swagger:route PUT /set-policy Policy setPolicy Set policy */ type SetPolicy struct { Context *middleware.Context Handler SetPolicyHandler } func (o *SetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSetPolicyParams() 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) } ================================================ FILE: api/operations/policy/set_policy_multiple.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SetPolicyMultipleHandlerFunc turns a function with the right signature into a set policy multiple handler type SetPolicyMultipleHandlerFunc func(SetPolicyMultipleParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SetPolicyMultipleHandlerFunc) Handle(params SetPolicyMultipleParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SetPolicyMultipleHandler interface for that can handle valid set policy multiple params type SetPolicyMultipleHandler interface { Handle(SetPolicyMultipleParams, *models.Principal) middleware.Responder } // NewSetPolicyMultiple creates a new http.Handler for the set policy multiple operation func NewSetPolicyMultiple(ctx *middleware.Context, handler SetPolicyMultipleHandler) *SetPolicyMultiple { return &SetPolicyMultiple{Context: ctx, Handler: handler} } /* SetPolicyMultiple swagger:route PUT /set-policy-multi Policy setPolicyMultiple Set policy to multiple users/groups */ type SetPolicyMultiple struct { Context *middleware.Context Handler SetPolicyMultipleHandler } func (o *SetPolicyMultiple) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSetPolicyMultipleParams() 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) } ================================================ FILE: api/operations/policy/set_policy_multiple_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( stderrors "errors" "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" ) // NewSetPolicyMultipleParams creates a new SetPolicyMultipleParams object // // There are no default values defined in the spec. func NewSetPolicyMultipleParams() SetPolicyMultipleParams { return SetPolicyMultipleParams{} } // SetPolicyMultipleParams contains all the bound params for the set policy multiple operation // typically these are obtained from a http.Request // // swagger:parameters SetPolicyMultiple type SetPolicyMultipleParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.SetPolicyMultipleNameRequest } // 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 NewSetPolicyMultipleParams() beforehand. func (o *SetPolicyMultipleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.SetPolicyMultipleNameRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/policy/set_policy_multiple_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SetPolicyMultipleNoContentCode is the HTTP code returned for type SetPolicyMultipleNoContent const SetPolicyMultipleNoContentCode int = 204 /* SetPolicyMultipleNoContent A successful response. swagger:response setPolicyMultipleNoContent */ type SetPolicyMultipleNoContent struct { } // NewSetPolicyMultipleNoContent creates SetPolicyMultipleNoContent with default headers values func NewSetPolicyMultipleNoContent() *SetPolicyMultipleNoContent { return &SetPolicyMultipleNoContent{} } // WriteResponse to the client func (o *SetPolicyMultipleNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* SetPolicyMultipleDefault Generic error response. swagger:response setPolicyMultipleDefault */ type SetPolicyMultipleDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSetPolicyMultipleDefault creates SetPolicyMultipleDefault with default headers values func NewSetPolicyMultipleDefault(code int) *SetPolicyMultipleDefault { if code <= 0 { code = 500 } return &SetPolicyMultipleDefault{ _statusCode: code, } } // WithStatusCode adds the status to the set policy multiple default response func (o *SetPolicyMultipleDefault) WithStatusCode(code int) *SetPolicyMultipleDefault { o._statusCode = code return o } // SetStatusCode sets the status to the set policy multiple default response func (o *SetPolicyMultipleDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the set policy multiple default response func (o *SetPolicyMultipleDefault) WithPayload(payload *models.APIError) *SetPolicyMultipleDefault { o.Payload = payload return o } // SetPayload sets the payload to the set policy multiple default response func (o *SetPolicyMultipleDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SetPolicyMultipleDefault) 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 } } } ================================================ FILE: api/operations/policy/set_policy_multiple_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "errors" "net/url" golangswaggerpaths "path" ) // SetPolicyMultipleURL generates an URL for the set policy multiple operation type SetPolicyMultipleURL 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 *SetPolicyMultipleURL) WithBasePath(bp string) *SetPolicyMultipleURL { 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 *SetPolicyMultipleURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SetPolicyMultipleURL) Build() (*url.URL, error) { var _result url.URL var _path = "/set-policy-multi" _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 *SetPolicyMultipleURL) 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 *SetPolicyMultipleURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SetPolicyMultipleURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SetPolicyMultipleURL") } if host == "" { return nil, errors.New("host is required for a full url on SetPolicyMultipleURL") } 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 *SetPolicyMultipleURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/policy/set_policy_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( stderrors "errors" "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" ) // NewSetPolicyParams creates a new SetPolicyParams object // // There are no default values defined in the spec. func NewSetPolicyParams() SetPolicyParams { return SetPolicyParams{} } // SetPolicyParams contains all the bound params for the set policy operation // typically these are obtained from a http.Request // // swagger:parameters SetPolicy type SetPolicyParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.SetPolicyNameRequest } // 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 NewSetPolicyParams() beforehand. func (o *SetPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.SetPolicyNameRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/policy/set_policy_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SetPolicyNoContentCode is the HTTP code returned for type SetPolicyNoContent const SetPolicyNoContentCode int = 204 /* SetPolicyNoContent A successful response. swagger:response setPolicyNoContent */ type SetPolicyNoContent struct { } // NewSetPolicyNoContent creates SetPolicyNoContent with default headers values func NewSetPolicyNoContent() *SetPolicyNoContent { return &SetPolicyNoContent{} } // WriteResponse to the client func (o *SetPolicyNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* SetPolicyDefault Generic error response. swagger:response setPolicyDefault */ type SetPolicyDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSetPolicyDefault creates SetPolicyDefault with default headers values func NewSetPolicyDefault(code int) *SetPolicyDefault { if code <= 0 { code = 500 } return &SetPolicyDefault{ _statusCode: code, } } // WithStatusCode adds the status to the set policy default response func (o *SetPolicyDefault) WithStatusCode(code int) *SetPolicyDefault { o._statusCode = code return o } // SetStatusCode sets the status to the set policy default response func (o *SetPolicyDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the set policy default response func (o *SetPolicyDefault) WithPayload(payload *models.APIError) *SetPolicyDefault { o.Payload = payload return o } // SetPayload sets the payload to the set policy default response func (o *SetPolicyDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SetPolicyDefault) 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 } } } ================================================ FILE: api/operations/policy/set_policy_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package policy import ( "errors" "net/url" golangswaggerpaths "path" ) // SetPolicyURL generates an URL for the set policy operation type SetPolicyURL 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 *SetPolicyURL) WithBasePath(bp string) *SetPolicyURL { 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 *SetPolicyURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SetPolicyURL) Build() (*url.URL, error) { var _result url.URL var _path = "/set-policy" _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 *SetPolicyURL) 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 *SetPolicyURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SetPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SetPolicyURL") } if host == "" { return nil, errors.New("host is required for a full url on SetPolicyURL") } 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 *SetPolicyURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/profile/profiling_start.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package profile import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ProfilingStartHandlerFunc turns a function with the right signature into a profiling start handler type ProfilingStartHandlerFunc func(ProfilingStartParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ProfilingStartHandlerFunc) Handle(params ProfilingStartParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ProfilingStartHandler interface for that can handle valid profiling start params type ProfilingStartHandler interface { Handle(ProfilingStartParams, *models.Principal) middleware.Responder } // NewProfilingStart creates a new http.Handler for the profiling start operation func NewProfilingStart(ctx *middleware.Context, handler ProfilingStartHandler) *ProfilingStart { return &ProfilingStart{Context: ctx, Handler: handler} } /* ProfilingStart swagger:route POST /profiling/start Profile profilingStart Start recording profile data */ type ProfilingStart struct { Context *middleware.Context Handler ProfilingStartHandler } func (o *ProfilingStart) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewProfilingStartParams() 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) } ================================================ FILE: api/operations/profile/profiling_start_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package profile import ( stderrors "errors" "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" ) // NewProfilingStartParams creates a new ProfilingStartParams object // // There are no default values defined in the spec. func NewProfilingStartParams() ProfilingStartParams { return ProfilingStartParams{} } // ProfilingStartParams contains all the bound params for the profiling start operation // typically these are obtained from a http.Request // // swagger:parameters ProfilingStart type ProfilingStartParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.ProfilingStartRequest } // 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 NewProfilingStartParams() beforehand. func (o *ProfilingStartParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.ProfilingStartRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/profile/profiling_start_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package profile import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ProfilingStartCreatedCode is the HTTP code returned for type ProfilingStartCreated const ProfilingStartCreatedCode int = 201 /* ProfilingStartCreated A successful response. swagger:response profilingStartCreated */ type ProfilingStartCreated struct { /* In: Body */ Payload *models.StartProfilingList `json:"body,omitempty"` } // NewProfilingStartCreated creates ProfilingStartCreated with default headers values func NewProfilingStartCreated() *ProfilingStartCreated { return &ProfilingStartCreated{} } // WithPayload adds the payload to the profiling start created response func (o *ProfilingStartCreated) WithPayload(payload *models.StartProfilingList) *ProfilingStartCreated { o.Payload = payload return o } // SetPayload sets the payload to the profiling start created response func (o *ProfilingStartCreated) SetPayload(payload *models.StartProfilingList) { o.Payload = payload } // WriteResponse to the client func (o *ProfilingStartCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(201) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } } /* ProfilingStartDefault Generic error response. swagger:response profilingStartDefault */ type ProfilingStartDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewProfilingStartDefault creates ProfilingStartDefault with default headers values func NewProfilingStartDefault(code int) *ProfilingStartDefault { if code <= 0 { code = 500 } return &ProfilingStartDefault{ _statusCode: code, } } // WithStatusCode adds the status to the profiling start default response func (o *ProfilingStartDefault) WithStatusCode(code int) *ProfilingStartDefault { o._statusCode = code return o } // SetStatusCode sets the status to the profiling start default response func (o *ProfilingStartDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the profiling start default response func (o *ProfilingStartDefault) WithPayload(payload *models.APIError) *ProfilingStartDefault { o.Payload = payload return o } // SetPayload sets the payload to the profiling start default response func (o *ProfilingStartDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ProfilingStartDefault) 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 } } } ================================================ FILE: api/operations/profile/profiling_start_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package profile import ( "errors" "net/url" golangswaggerpaths "path" ) // ProfilingStartURL generates an URL for the profiling start operation type ProfilingStartURL 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 *ProfilingStartURL) WithBasePath(bp string) *ProfilingStartURL { 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 *ProfilingStartURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ProfilingStartURL) Build() (*url.URL, error) { var _result url.URL var _path = "/profiling/start" _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 *ProfilingStartURL) 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 *ProfilingStartURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ProfilingStartURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ProfilingStartURL") } if host == "" { return nil, errors.New("host is required for a full url on ProfilingStartURL") } 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 *ProfilingStartURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/profile/profiling_stop.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package profile import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ProfilingStopHandlerFunc turns a function with the right signature into a profiling stop handler type ProfilingStopHandlerFunc func(ProfilingStopParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ProfilingStopHandlerFunc) Handle(params ProfilingStopParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ProfilingStopHandler interface for that can handle valid profiling stop params type ProfilingStopHandler interface { Handle(ProfilingStopParams, *models.Principal) middleware.Responder } // NewProfilingStop creates a new http.Handler for the profiling stop operation func NewProfilingStop(ctx *middleware.Context, handler ProfilingStopHandler) *ProfilingStop { return &ProfilingStop{Context: ctx, Handler: handler} } /* ProfilingStop swagger:route POST /profiling/stop Profile profilingStop Stop and download profile data */ type ProfilingStop struct { Context *middleware.Context Handler ProfilingStopHandler } func (o *ProfilingStop) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewProfilingStopParams() 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) } ================================================ FILE: api/operations/profile/profiling_stop_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package profile import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewProfilingStopParams creates a new ProfilingStopParams object // // There are no default values defined in the spec. func NewProfilingStopParams() ProfilingStopParams { return ProfilingStopParams{} } // ProfilingStopParams contains all the bound params for the profiling stop operation // typically these are obtained from a http.Request // // swagger:parameters ProfilingStop type ProfilingStopParams 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 NewProfilingStopParams() beforehand. func (o *ProfilingStopParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/profile/profiling_stop_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package profile import ( "io" "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ProfilingStopCreatedCode is the HTTP code returned for type ProfilingStopCreated const ProfilingStopCreatedCode int = 201 /* ProfilingStopCreated A successful response. swagger:response profilingStopCreated */ type ProfilingStopCreated struct { /* In: Body */ Payload io.ReadCloser `json:"body,omitempty"` } // NewProfilingStopCreated creates ProfilingStopCreated with default headers values func NewProfilingStopCreated() *ProfilingStopCreated { return &ProfilingStopCreated{} } // WithPayload adds the payload to the profiling stop created response func (o *ProfilingStopCreated) WithPayload(payload io.ReadCloser) *ProfilingStopCreated { o.Payload = payload return o } // SetPayload sets the payload to the profiling stop created response func (o *ProfilingStopCreated) SetPayload(payload io.ReadCloser) { o.Payload = payload } // WriteResponse to the client func (o *ProfilingStopCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(201) payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } /* ProfilingStopDefault Generic error response. swagger:response profilingStopDefault */ type ProfilingStopDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewProfilingStopDefault creates ProfilingStopDefault with default headers values func NewProfilingStopDefault(code int) *ProfilingStopDefault { if code <= 0 { code = 500 } return &ProfilingStopDefault{ _statusCode: code, } } // WithStatusCode adds the status to the profiling stop default response func (o *ProfilingStopDefault) WithStatusCode(code int) *ProfilingStopDefault { o._statusCode = code return o } // SetStatusCode sets the status to the profiling stop default response func (o *ProfilingStopDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the profiling stop default response func (o *ProfilingStopDefault) WithPayload(payload *models.APIError) *ProfilingStopDefault { o.Payload = payload return o } // SetPayload sets the payload to the profiling stop default response func (o *ProfilingStopDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ProfilingStopDefault) 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 } } } ================================================ FILE: api/operations/profile/profiling_stop_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package profile import ( "errors" "net/url" golangswaggerpaths "path" ) // ProfilingStopURL generates an URL for the profiling stop operation type ProfilingStopURL 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 *ProfilingStopURL) WithBasePath(bp string) *ProfilingStopURL { 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 *ProfilingStopURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ProfilingStopURL) Build() (*url.URL, error) { var _result url.URL var _path = "/profiling/stop" _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 *ProfilingStopURL) 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 *ProfilingStopURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ProfilingStopURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ProfilingStopURL") } if host == "" { return nil, errors.New("host is required for a full url on ProfilingStopURL") } 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 *ProfilingStopURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/public/download_shared_object.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package public import ( "net/http" "github.com/go-openapi/runtime/middleware" ) // DownloadSharedObjectHandlerFunc turns a function with the right signature into a download shared object handler type DownloadSharedObjectHandlerFunc func(DownloadSharedObjectParams) middleware.Responder // Handle executing the request and returning a response func (fn DownloadSharedObjectHandlerFunc) Handle(params DownloadSharedObjectParams) middleware.Responder { return fn(params) } // DownloadSharedObjectHandler interface for that can handle valid download shared object params type DownloadSharedObjectHandler interface { Handle(DownloadSharedObjectParams) middleware.Responder } // NewDownloadSharedObject creates a new http.Handler for the download shared object operation func NewDownloadSharedObject(ctx *middleware.Context, handler DownloadSharedObjectHandler) *DownloadSharedObject { return &DownloadSharedObject{Context: ctx, Handler: handler} } /* DownloadSharedObject swagger:route GET /download-shared-object/{url} Public downloadSharedObject Downloads an object from a presigned url */ type DownloadSharedObject struct { Context *middleware.Context Handler DownloadSharedObjectHandler } func (o *DownloadSharedObject) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDownloadSharedObjectParams() 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) } ================================================ FILE: api/operations/public/download_shared_object_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package public import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewDownloadSharedObjectParams creates a new DownloadSharedObjectParams object // // There are no default values defined in the spec. func NewDownloadSharedObjectParams() DownloadSharedObjectParams { return DownloadSharedObjectParams{} } // DownloadSharedObjectParams contains all the bound params for the download shared object operation // typically these are obtained from a http.Request // // swagger:parameters DownloadSharedObject type DownloadSharedObjectParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ URL 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 NewDownloadSharedObjectParams() beforehand. func (o *DownloadSharedObjectParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rURL, rhkURL, _ := route.Params.GetOK("url") if err := o.bindURL(rURL, rhkURL, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindURL binds and validates parameter URL from path. func (o *DownloadSharedObjectParams) bindURL(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.URL = raw return nil } ================================================ FILE: api/operations/public/download_shared_object_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package public import ( "io" "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DownloadSharedObjectOKCode is the HTTP code returned for type DownloadSharedObjectOK const DownloadSharedObjectOKCode int = 200 /* DownloadSharedObjectOK A successful response. swagger:response downloadSharedObjectOK */ type DownloadSharedObjectOK struct { /* In: Body */ Payload io.ReadCloser `json:"body,omitempty"` } // NewDownloadSharedObjectOK creates DownloadSharedObjectOK with default headers values func NewDownloadSharedObjectOK() *DownloadSharedObjectOK { return &DownloadSharedObjectOK{} } // WithPayload adds the payload to the download shared object o k response func (o *DownloadSharedObjectOK) WithPayload(payload io.ReadCloser) *DownloadSharedObjectOK { o.Payload = payload return o } // SetPayload sets the payload to the download shared object o k response func (o *DownloadSharedObjectOK) SetPayload(payload io.ReadCloser) { o.Payload = payload } // WriteResponse to the client func (o *DownloadSharedObjectOK) 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 } } /* DownloadSharedObjectDefault Generic error response. swagger:response downloadSharedObjectDefault */ type DownloadSharedObjectDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDownloadSharedObjectDefault creates DownloadSharedObjectDefault with default headers values func NewDownloadSharedObjectDefault(code int) *DownloadSharedObjectDefault { if code <= 0 { code = 500 } return &DownloadSharedObjectDefault{ _statusCode: code, } } // WithStatusCode adds the status to the download shared object default response func (o *DownloadSharedObjectDefault) WithStatusCode(code int) *DownloadSharedObjectDefault { o._statusCode = code return o } // SetStatusCode sets the status to the download shared object default response func (o *DownloadSharedObjectDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the download shared object default response func (o *DownloadSharedObjectDefault) WithPayload(payload *models.APIError) *DownloadSharedObjectDefault { o.Payload = payload return o } // SetPayload sets the payload to the download shared object default response func (o *DownloadSharedObjectDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DownloadSharedObjectDefault) 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 } } } ================================================ FILE: api/operations/public/download_shared_object_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package public import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DownloadSharedObjectURL generates an URL for the download shared object operation type DownloadSharedObjectURL struct { URL 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 *DownloadSharedObjectURL) WithBasePath(bp string) *DownloadSharedObjectURL { 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 *DownloadSharedObjectURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DownloadSharedObjectURL) Build() (*url.URL, error) { var _result url.URL var _path = "/download-shared-object/{url}" url := o.URL if url != "" { _path = strings.ReplaceAll(_path, "{url}", url) } else { return nil, errors.New("url is required on DownloadSharedObjectURL") } _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 *DownloadSharedObjectURL) 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 *DownloadSharedObjectURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DownloadSharedObjectURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DownloadSharedObjectURL") } if host == "" { return nil, errors.New("host is required for a full url on DownloadSharedObjectURL") } 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 *DownloadSharedObjectURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/release/list_releases.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package release import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListReleasesHandlerFunc turns a function with the right signature into a list releases handler type ListReleasesHandlerFunc func(ListReleasesParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListReleasesHandlerFunc) Handle(params ListReleasesParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListReleasesHandler interface for that can handle valid list releases params type ListReleasesHandler interface { Handle(ListReleasesParams, *models.Principal) middleware.Responder } // NewListReleases creates a new http.Handler for the list releases operation func NewListReleases(ctx *middleware.Context, handler ListReleasesHandler) *ListReleases { return &ListReleases{Context: ctx, Handler: handler} } /* ListReleases swagger:route GET /releases release listReleases Get repo releases for a given version */ type ListReleases struct { Context *middleware.Context Handler ListReleasesHandler } func (o *ListReleases) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListReleasesParams() 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) } ================================================ FILE: api/operations/release/list_releases_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package release 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" ) // NewListReleasesParams creates a new ListReleasesParams object // // There are no default values defined in the spec. func NewListReleasesParams() ListReleasesParams { return ListReleasesParams{} } // ListReleasesParams contains all the bound params for the list releases operation // typically these are obtained from a http.Request // // swagger:parameters ListReleases type ListReleasesParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /*Current Release In: query */ Current *string /*filter releases In: query */ Filter *string /*repo name Required: true In: query */ Repo string /*search content In: query */ Search *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 NewListReleasesParams() beforehand. func (o *ListReleasesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) qCurrent, qhkCurrent, _ := qs.GetOK("current") if err := o.bindCurrent(qCurrent, qhkCurrent, route.Formats); err != nil { res = append(res, err) } qFilter, qhkFilter, _ := qs.GetOK("filter") if err := o.bindFilter(qFilter, qhkFilter, route.Formats); err != nil { res = append(res, err) } qRepo, qhkRepo, _ := qs.GetOK("repo") if err := o.bindRepo(qRepo, qhkRepo, route.Formats); err != nil { res = append(res, err) } qSearch, qhkSearch, _ := qs.GetOK("search") if err := o.bindSearch(qSearch, qhkSearch, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindCurrent binds and validates parameter Current from query. func (o *ListReleasesParams) bindCurrent(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.Current = &raw return nil } // bindFilter binds and validates parameter Filter from query. func (o *ListReleasesParams) bindFilter(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.Filter = &raw return nil } // bindRepo binds and validates parameter Repo from query. func (o *ListReleasesParams) bindRepo(rawData []string, hasKey bool, formats strfmt.Registry) error { if !hasKey { return errors.Required("repo", "query", rawData) } var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // AllowEmptyValue: false if err := validate.RequiredString("repo", "query", raw); err != nil { return err } o.Repo = raw return nil } // bindSearch binds and validates parameter Search from query. func (o *ListReleasesParams) bindSearch(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.Search = &raw return nil } ================================================ FILE: api/operations/release/list_releases_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package release import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListReleasesOKCode is the HTTP code returned for type ListReleasesOK const ListReleasesOKCode int = 200 /* ListReleasesOK A successful response. swagger:response listReleasesOK */ type ListReleasesOK struct { /* In: Body */ Payload *models.ReleaseListResponse `json:"body,omitempty"` } // NewListReleasesOK creates ListReleasesOK with default headers values func NewListReleasesOK() *ListReleasesOK { return &ListReleasesOK{} } // WithPayload adds the payload to the list releases o k response func (o *ListReleasesOK) WithPayload(payload *models.ReleaseListResponse) *ListReleasesOK { o.Payload = payload return o } // SetPayload sets the payload to the list releases o k response func (o *ListReleasesOK) SetPayload(payload *models.ReleaseListResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListReleasesOK) 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 } } } /* ListReleasesDefault Generic error response. swagger:response listReleasesDefault */ type ListReleasesDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListReleasesDefault creates ListReleasesDefault with default headers values func NewListReleasesDefault(code int) *ListReleasesDefault { if code <= 0 { code = 500 } return &ListReleasesDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list releases default response func (o *ListReleasesDefault) WithStatusCode(code int) *ListReleasesDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list releases default response func (o *ListReleasesDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list releases default response func (o *ListReleasesDefault) WithPayload(payload *models.APIError) *ListReleasesDefault { o.Payload = payload return o } // SetPayload sets the payload to the list releases default response func (o *ListReleasesDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListReleasesDefault) 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 } } } ================================================ FILE: api/operations/release/list_releases_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package release import ( "errors" "net/url" golangswaggerpaths "path" ) // ListReleasesURL generates an URL for the list releases operation type ListReleasesURL struct { Current *string Filter *string Repo string Search *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 *ListReleasesURL) WithBasePath(bp string) *ListReleasesURL { 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 *ListReleasesURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListReleasesURL) Build() (*url.URL, error) { var _result url.URL var _path = "/releases" _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var currentQ string if o.Current != nil { currentQ = *o.Current } if currentQ != "" { qs.Set("current", currentQ) } var filterQ string if o.Filter != nil { filterQ = *o.Filter } if filterQ != "" { qs.Set("filter", filterQ) } repoQ := o.Repo if repoQ != "" { qs.Set("repo", repoQ) } var searchQ string if o.Search != nil { searchQ = *o.Search } if searchQ != "" { qs.Set("search", searchQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListReleasesURL) 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 *ListReleasesURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListReleasesURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListReleasesURL") } if host == "" { return nil, errors.New("host is required for a full url on ListReleasesURL") } 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 *ListReleasesURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/service/restart_service.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // RestartServiceHandlerFunc turns a function with the right signature into a restart service handler type RestartServiceHandlerFunc func(RestartServiceParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn RestartServiceHandlerFunc) Handle(params RestartServiceParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // RestartServiceHandler interface for that can handle valid restart service params type RestartServiceHandler interface { Handle(RestartServiceParams, *models.Principal) middleware.Responder } // NewRestartService creates a new http.Handler for the restart service operation func NewRestartService(ctx *middleware.Context, handler RestartServiceHandler) *RestartService { return &RestartService{Context: ctx, Handler: handler} } /* RestartService swagger:route POST /service/restart Service restartService Restart Service */ type RestartService struct { Context *middleware.Context Handler RestartServiceHandler } func (o *RestartService) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewRestartServiceParams() 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) } ================================================ FILE: api/operations/service/restart_service_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewRestartServiceParams creates a new RestartServiceParams object // // There are no default values defined in the spec. func NewRestartServiceParams() RestartServiceParams { return RestartServiceParams{} } // RestartServiceParams contains all the bound params for the restart service operation // typically these are obtained from a http.Request // // swagger:parameters RestartService type RestartServiceParams 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 NewRestartServiceParams() beforehand. func (o *RestartServiceParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/service/restart_service_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // RestartServiceNoContentCode is the HTTP code returned for type RestartServiceNoContent const RestartServiceNoContentCode int = 204 /* RestartServiceNoContent A successful response. swagger:response restartServiceNoContent */ type RestartServiceNoContent struct { } // NewRestartServiceNoContent creates RestartServiceNoContent with default headers values func NewRestartServiceNoContent() *RestartServiceNoContent { return &RestartServiceNoContent{} } // WriteResponse to the client func (o *RestartServiceNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* RestartServiceDefault Generic error response. swagger:response restartServiceDefault */ type RestartServiceDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewRestartServiceDefault creates RestartServiceDefault with default headers values func NewRestartServiceDefault(code int) *RestartServiceDefault { if code <= 0 { code = 500 } return &RestartServiceDefault{ _statusCode: code, } } // WithStatusCode adds the status to the restart service default response func (o *RestartServiceDefault) WithStatusCode(code int) *RestartServiceDefault { o._statusCode = code return o } // SetStatusCode sets the status to the restart service default response func (o *RestartServiceDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the restart service default response func (o *RestartServiceDefault) WithPayload(payload *models.APIError) *RestartServiceDefault { o.Payload = payload return o } // SetPayload sets the payload to the restart service default response func (o *RestartServiceDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *RestartServiceDefault) 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 } } } ================================================ FILE: api/operations/service/restart_service_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service import ( "errors" "net/url" golangswaggerpaths "path" ) // RestartServiceURL generates an URL for the restart service operation type RestartServiceURL 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 *RestartServiceURL) WithBasePath(bp string) *RestartServiceURL { 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 *RestartServiceURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *RestartServiceURL) Build() (*url.URL, error) { var _result url.URL var _path = "/service/restart" _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 *RestartServiceURL) 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 *RestartServiceURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *RestartServiceURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on RestartServiceURL") } if host == "" { return nil, errors.New("host is required for a full url on RestartServiceURL") } 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 *RestartServiceURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/service_account/create_service_account.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // CreateServiceAccountHandlerFunc turns a function with the right signature into a create service account handler type CreateServiceAccountHandlerFunc func(CreateServiceAccountParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn CreateServiceAccountHandlerFunc) Handle(params CreateServiceAccountParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // CreateServiceAccountHandler interface for that can handle valid create service account params type CreateServiceAccountHandler interface { Handle(CreateServiceAccountParams, *models.Principal) middleware.Responder } // NewCreateServiceAccount creates a new http.Handler for the create service account operation func NewCreateServiceAccount(ctx *middleware.Context, handler CreateServiceAccountHandler) *CreateServiceAccount { return &CreateServiceAccount{Context: ctx, Handler: handler} } /* CreateServiceAccount swagger:route POST /service-accounts ServiceAccount createServiceAccount Create Service Account */ type CreateServiceAccount struct { Context *middleware.Context Handler CreateServiceAccountHandler } func (o *CreateServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewCreateServiceAccountParams() 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) } ================================================ FILE: api/operations/service_account/create_service_account_creds.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // CreateServiceAccountCredsHandlerFunc turns a function with the right signature into a create service account creds handler type CreateServiceAccountCredsHandlerFunc func(CreateServiceAccountCredsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn CreateServiceAccountCredsHandlerFunc) Handle(params CreateServiceAccountCredsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // CreateServiceAccountCredsHandler interface for that can handle valid create service account creds params type CreateServiceAccountCredsHandler interface { Handle(CreateServiceAccountCredsParams, *models.Principal) middleware.Responder } // NewCreateServiceAccountCreds creates a new http.Handler for the create service account creds operation func NewCreateServiceAccountCreds(ctx *middleware.Context, handler CreateServiceAccountCredsHandler) *CreateServiceAccountCreds { return &CreateServiceAccountCreds{Context: ctx, Handler: handler} } /* CreateServiceAccountCreds swagger:route POST /service-account-credentials ServiceAccount createServiceAccountCreds Create Service Account With Credentials */ type CreateServiceAccountCreds struct { Context *middleware.Context Handler CreateServiceAccountCredsHandler } func (o *CreateServiceAccountCreds) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewCreateServiceAccountCredsParams() 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) } ================================================ FILE: api/operations/service_account/create_service_account_creds_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( stderrors "errors" "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" ) // NewCreateServiceAccountCredsParams creates a new CreateServiceAccountCredsParams object // // There are no default values defined in the spec. func NewCreateServiceAccountCredsParams() CreateServiceAccountCredsParams { return CreateServiceAccountCredsParams{} } // CreateServiceAccountCredsParams contains all the bound params for the create service account creds operation // typically these are obtained from a http.Request // // swagger:parameters CreateServiceAccountCreds type CreateServiceAccountCredsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.ServiceAccountRequestCreds } // 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 NewCreateServiceAccountCredsParams() beforehand. func (o *CreateServiceAccountCredsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.ServiceAccountRequestCreds if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/service_account/create_service_account_creds_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // CreateServiceAccountCredsCreatedCode is the HTTP code returned for type CreateServiceAccountCredsCreated const CreateServiceAccountCredsCreatedCode int = 201 /* CreateServiceAccountCredsCreated A successful response. swagger:response createServiceAccountCredsCreated */ type CreateServiceAccountCredsCreated struct { /* In: Body */ Payload *models.ServiceAccountCreds `json:"body,omitempty"` } // NewCreateServiceAccountCredsCreated creates CreateServiceAccountCredsCreated with default headers values func NewCreateServiceAccountCredsCreated() *CreateServiceAccountCredsCreated { return &CreateServiceAccountCredsCreated{} } // WithPayload adds the payload to the create service account creds created response func (o *CreateServiceAccountCredsCreated) WithPayload(payload *models.ServiceAccountCreds) *CreateServiceAccountCredsCreated { o.Payload = payload return o } // SetPayload sets the payload to the create service account creds created response func (o *CreateServiceAccountCredsCreated) SetPayload(payload *models.ServiceAccountCreds) { o.Payload = payload } // WriteResponse to the client func (o *CreateServiceAccountCredsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(201) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } } /* CreateServiceAccountCredsDefault Generic error response. swagger:response createServiceAccountCredsDefault */ type CreateServiceAccountCredsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewCreateServiceAccountCredsDefault creates CreateServiceAccountCredsDefault with default headers values func NewCreateServiceAccountCredsDefault(code int) *CreateServiceAccountCredsDefault { if code <= 0 { code = 500 } return &CreateServiceAccountCredsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the create service account creds default response func (o *CreateServiceAccountCredsDefault) WithStatusCode(code int) *CreateServiceAccountCredsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the create service account creds default response func (o *CreateServiceAccountCredsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the create service account creds default response func (o *CreateServiceAccountCredsDefault) WithPayload(payload *models.APIError) *CreateServiceAccountCredsDefault { o.Payload = payload return o } // SetPayload sets the payload to the create service account creds default response func (o *CreateServiceAccountCredsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *CreateServiceAccountCredsDefault) 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 } } } ================================================ FILE: api/operations/service_account/create_service_account_creds_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "errors" "net/url" golangswaggerpaths "path" ) // CreateServiceAccountCredsURL generates an URL for the create service account creds operation type CreateServiceAccountCredsURL 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 *CreateServiceAccountCredsURL) WithBasePath(bp string) *CreateServiceAccountCredsURL { 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 *CreateServiceAccountCredsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *CreateServiceAccountCredsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/service-account-credentials" _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 *CreateServiceAccountCredsURL) 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 *CreateServiceAccountCredsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *CreateServiceAccountCredsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on CreateServiceAccountCredsURL") } if host == "" { return nil, errors.New("host is required for a full url on CreateServiceAccountCredsURL") } 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 *CreateServiceAccountCredsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/service_account/create_service_account_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( stderrors "errors" "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" ) // NewCreateServiceAccountParams creates a new CreateServiceAccountParams object // // There are no default values defined in the spec. func NewCreateServiceAccountParams() CreateServiceAccountParams { return CreateServiceAccountParams{} } // CreateServiceAccountParams contains all the bound params for the create service account operation // typically these are obtained from a http.Request // // swagger:parameters CreateServiceAccount type CreateServiceAccountParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.ServiceAccountRequest } // 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 NewCreateServiceAccountParams() beforehand. func (o *CreateServiceAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.ServiceAccountRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/service_account/create_service_account_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // CreateServiceAccountCreatedCode is the HTTP code returned for type CreateServiceAccountCreated const CreateServiceAccountCreatedCode int = 201 /* CreateServiceAccountCreated A successful response. swagger:response createServiceAccountCreated */ type CreateServiceAccountCreated struct { /* In: Body */ Payload *models.ServiceAccountCreds `json:"body,omitempty"` } // NewCreateServiceAccountCreated creates CreateServiceAccountCreated with default headers values func NewCreateServiceAccountCreated() *CreateServiceAccountCreated { return &CreateServiceAccountCreated{} } // WithPayload adds the payload to the create service account created response func (o *CreateServiceAccountCreated) WithPayload(payload *models.ServiceAccountCreds) *CreateServiceAccountCreated { o.Payload = payload return o } // SetPayload sets the payload to the create service account created response func (o *CreateServiceAccountCreated) SetPayload(payload *models.ServiceAccountCreds) { o.Payload = payload } // WriteResponse to the client func (o *CreateServiceAccountCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(201) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } } /* CreateServiceAccountDefault Generic error response. swagger:response createServiceAccountDefault */ type CreateServiceAccountDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewCreateServiceAccountDefault creates CreateServiceAccountDefault with default headers values func NewCreateServiceAccountDefault(code int) *CreateServiceAccountDefault { if code <= 0 { code = 500 } return &CreateServiceAccountDefault{ _statusCode: code, } } // WithStatusCode adds the status to the create service account default response func (o *CreateServiceAccountDefault) WithStatusCode(code int) *CreateServiceAccountDefault { o._statusCode = code return o } // SetStatusCode sets the status to the create service account default response func (o *CreateServiceAccountDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the create service account default response func (o *CreateServiceAccountDefault) WithPayload(payload *models.APIError) *CreateServiceAccountDefault { o.Payload = payload return o } // SetPayload sets the payload to the create service account default response func (o *CreateServiceAccountDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *CreateServiceAccountDefault) 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 } } } ================================================ FILE: api/operations/service_account/create_service_account_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "errors" "net/url" golangswaggerpaths "path" ) // CreateServiceAccountURL generates an URL for the create service account operation type CreateServiceAccountURL 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 *CreateServiceAccountURL) WithBasePath(bp string) *CreateServiceAccountURL { 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 *CreateServiceAccountURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *CreateServiceAccountURL) Build() (*url.URL, error) { var _result url.URL var _path = "/service-accounts" _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 *CreateServiceAccountURL) 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 *CreateServiceAccountURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *CreateServiceAccountURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on CreateServiceAccountURL") } if host == "" { return nil, errors.New("host is required for a full url on CreateServiceAccountURL") } 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 *CreateServiceAccountURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/service_account/delete_multiple_service_accounts.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteMultipleServiceAccountsHandlerFunc turns a function with the right signature into a delete multiple service accounts handler type DeleteMultipleServiceAccountsHandlerFunc func(DeleteMultipleServiceAccountsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteMultipleServiceAccountsHandlerFunc) Handle(params DeleteMultipleServiceAccountsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteMultipleServiceAccountsHandler interface for that can handle valid delete multiple service accounts params type DeleteMultipleServiceAccountsHandler interface { Handle(DeleteMultipleServiceAccountsParams, *models.Principal) middleware.Responder } // NewDeleteMultipleServiceAccounts creates a new http.Handler for the delete multiple service accounts operation func NewDeleteMultipleServiceAccounts(ctx *middleware.Context, handler DeleteMultipleServiceAccountsHandler) *DeleteMultipleServiceAccounts { return &DeleteMultipleServiceAccounts{Context: ctx, Handler: handler} } /* DeleteMultipleServiceAccounts swagger:route DELETE /service-accounts/delete-multi ServiceAccount deleteMultipleServiceAccounts Delete Multiple Service Accounts */ type DeleteMultipleServiceAccounts struct { Context *middleware.Context Handler DeleteMultipleServiceAccountsHandler } func (o *DeleteMultipleServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteMultipleServiceAccountsParams() 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) } ================================================ FILE: api/operations/service_account/delete_multiple_service_accounts_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( stderrors "errors" "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" ) // NewDeleteMultipleServiceAccountsParams creates a new DeleteMultipleServiceAccountsParams object // // There are no default values defined in the spec. func NewDeleteMultipleServiceAccountsParams() DeleteMultipleServiceAccountsParams { return DeleteMultipleServiceAccountsParams{} } // DeleteMultipleServiceAccountsParams contains all the bound params for the delete multiple service accounts operation // typically these are obtained from a http.Request // // swagger:parameters DeleteMultipleServiceAccounts type DeleteMultipleServiceAccountsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ SelectedSA models.SelectedSAs } // 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 NewDeleteMultipleServiceAccountsParams() beforehand. func (o *DeleteMultipleServiceAccountsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.SelectedSAs if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(err, io.EOF) { res = append(res, errors.Required("selectedSA", "body", "")) } else { res = append(res, errors.NewParseError("selectedSA", "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.SelectedSA = body } } } else { res = append(res, errors.Required("selectedSA", "body", "")) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/service_account/delete_multiple_service_accounts_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteMultipleServiceAccountsNoContentCode is the HTTP code returned for type DeleteMultipleServiceAccountsNoContent const DeleteMultipleServiceAccountsNoContentCode int = 204 /* DeleteMultipleServiceAccountsNoContent A successful response. swagger:response deleteMultipleServiceAccountsNoContent */ type DeleteMultipleServiceAccountsNoContent struct { } // NewDeleteMultipleServiceAccountsNoContent creates DeleteMultipleServiceAccountsNoContent with default headers values func NewDeleteMultipleServiceAccountsNoContent() *DeleteMultipleServiceAccountsNoContent { return &DeleteMultipleServiceAccountsNoContent{} } // WriteResponse to the client func (o *DeleteMultipleServiceAccountsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* DeleteMultipleServiceAccountsDefault Generic error response. swagger:response deleteMultipleServiceAccountsDefault */ type DeleteMultipleServiceAccountsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteMultipleServiceAccountsDefault creates DeleteMultipleServiceAccountsDefault with default headers values func NewDeleteMultipleServiceAccountsDefault(code int) *DeleteMultipleServiceAccountsDefault { if code <= 0 { code = 500 } return &DeleteMultipleServiceAccountsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete multiple service accounts default response func (o *DeleteMultipleServiceAccountsDefault) WithStatusCode(code int) *DeleteMultipleServiceAccountsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete multiple service accounts default response func (o *DeleteMultipleServiceAccountsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete multiple service accounts default response func (o *DeleteMultipleServiceAccountsDefault) WithPayload(payload *models.APIError) *DeleteMultipleServiceAccountsDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete multiple service accounts default response func (o *DeleteMultipleServiceAccountsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteMultipleServiceAccountsDefault) 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 } } } ================================================ FILE: api/operations/service_account/delete_multiple_service_accounts_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "errors" "net/url" golangswaggerpaths "path" ) // DeleteMultipleServiceAccountsURL generates an URL for the delete multiple service accounts operation type DeleteMultipleServiceAccountsURL 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 *DeleteMultipleServiceAccountsURL) WithBasePath(bp string) *DeleteMultipleServiceAccountsURL { 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 *DeleteMultipleServiceAccountsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteMultipleServiceAccountsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/service-accounts/delete-multi" _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 *DeleteMultipleServiceAccountsURL) 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 *DeleteMultipleServiceAccountsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteMultipleServiceAccountsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteMultipleServiceAccountsURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteMultipleServiceAccountsURL") } 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 *DeleteMultipleServiceAccountsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/service_account/delete_service_account.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DeleteServiceAccountHandlerFunc turns a function with the right signature into a delete service account handler type DeleteServiceAccountHandlerFunc func(DeleteServiceAccountParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DeleteServiceAccountHandlerFunc) Handle(params DeleteServiceAccountParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DeleteServiceAccountHandler interface for that can handle valid delete service account params type DeleteServiceAccountHandler interface { Handle(DeleteServiceAccountParams, *models.Principal) middleware.Responder } // NewDeleteServiceAccount creates a new http.Handler for the delete service account operation func NewDeleteServiceAccount(ctx *middleware.Context, handler DeleteServiceAccountHandler) *DeleteServiceAccount { return &DeleteServiceAccount{Context: ctx, Handler: handler} } /* DeleteServiceAccount swagger:route DELETE /service-accounts/{access_key} ServiceAccount deleteServiceAccount Delete Service Account */ type DeleteServiceAccount struct { Context *middleware.Context Handler DeleteServiceAccountHandler } func (o *DeleteServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDeleteServiceAccountParams() 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) } ================================================ FILE: api/operations/service_account/delete_service_account_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewDeleteServiceAccountParams creates a new DeleteServiceAccountParams object // // There are no default values defined in the spec. func NewDeleteServiceAccountParams() DeleteServiceAccountParams { return DeleteServiceAccountParams{} } // DeleteServiceAccountParams contains all the bound params for the delete service account operation // typically these are obtained from a http.Request // // swagger:parameters DeleteServiceAccount type DeleteServiceAccountParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ AccessKey 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 NewDeleteServiceAccountParams() beforehand. func (o *DeleteServiceAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rAccessKey, rhkAccessKey, _ := route.Params.GetOK("access_key") if err := o.bindAccessKey(rAccessKey, rhkAccessKey, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindAccessKey binds and validates parameter AccessKey from path. func (o *DeleteServiceAccountParams) bindAccessKey(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.AccessKey = raw return nil } ================================================ FILE: api/operations/service_account/delete_service_account_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DeleteServiceAccountNoContentCode is the HTTP code returned for type DeleteServiceAccountNoContent const DeleteServiceAccountNoContentCode int = 204 /* DeleteServiceAccountNoContent A successful response. swagger:response deleteServiceAccountNoContent */ type DeleteServiceAccountNoContent struct { } // NewDeleteServiceAccountNoContent creates DeleteServiceAccountNoContent with default headers values func NewDeleteServiceAccountNoContent() *DeleteServiceAccountNoContent { return &DeleteServiceAccountNoContent{} } // WriteResponse to the client func (o *DeleteServiceAccountNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* DeleteServiceAccountDefault Generic error response. swagger:response deleteServiceAccountDefault */ type DeleteServiceAccountDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDeleteServiceAccountDefault creates DeleteServiceAccountDefault with default headers values func NewDeleteServiceAccountDefault(code int) *DeleteServiceAccountDefault { if code <= 0 { code = 500 } return &DeleteServiceAccountDefault{ _statusCode: code, } } // WithStatusCode adds the status to the delete service account default response func (o *DeleteServiceAccountDefault) WithStatusCode(code int) *DeleteServiceAccountDefault { o._statusCode = code return o } // SetStatusCode sets the status to the delete service account default response func (o *DeleteServiceAccountDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the delete service account default response func (o *DeleteServiceAccountDefault) WithPayload(payload *models.APIError) *DeleteServiceAccountDefault { o.Payload = payload return o } // SetPayload sets the payload to the delete service account default response func (o *DeleteServiceAccountDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DeleteServiceAccountDefault) 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 } } } ================================================ FILE: api/operations/service_account/delete_service_account_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // DeleteServiceAccountURL generates an URL for the delete service account operation type DeleteServiceAccountURL struct { AccessKey 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 *DeleteServiceAccountURL) WithBasePath(bp string) *DeleteServiceAccountURL { 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 *DeleteServiceAccountURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DeleteServiceAccountURL) Build() (*url.URL, error) { var _result url.URL var _path = "/service-accounts/{access_key}" accessKey := o.AccessKey if accessKey != "" { _path = strings.ReplaceAll(_path, "{access_key}", accessKey) } else { return nil, errors.New("accessKey is required on DeleteServiceAccountURL") } _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 *DeleteServiceAccountURL) 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 *DeleteServiceAccountURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DeleteServiceAccountURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DeleteServiceAccountURL") } if host == "" { return nil, errors.New("host is required for a full url on DeleteServiceAccountURL") } 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 *DeleteServiceAccountURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/service_account/get_service_account.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetServiceAccountHandlerFunc turns a function with the right signature into a get service account handler type GetServiceAccountHandlerFunc func(GetServiceAccountParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetServiceAccountHandlerFunc) Handle(params GetServiceAccountParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetServiceAccountHandler interface for that can handle valid get service account params type GetServiceAccountHandler interface { Handle(GetServiceAccountParams, *models.Principal) middleware.Responder } // NewGetServiceAccount creates a new http.Handler for the get service account operation func NewGetServiceAccount(ctx *middleware.Context, handler GetServiceAccountHandler) *GetServiceAccount { return &GetServiceAccount{Context: ctx, Handler: handler} } /* GetServiceAccount swagger:route GET /service-accounts/{access_key} ServiceAccount getServiceAccount Get Service Account */ type GetServiceAccount struct { Context *middleware.Context Handler GetServiceAccountHandler } func (o *GetServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetServiceAccountParams() 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) } ================================================ FILE: api/operations/service_account/get_service_account_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetServiceAccountParams creates a new GetServiceAccountParams object // // There are no default values defined in the spec. func NewGetServiceAccountParams() GetServiceAccountParams { return GetServiceAccountParams{} } // GetServiceAccountParams contains all the bound params for the get service account operation // typically these are obtained from a http.Request // // swagger:parameters GetServiceAccount type GetServiceAccountParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ AccessKey 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 NewGetServiceAccountParams() beforehand. func (o *GetServiceAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rAccessKey, rhkAccessKey, _ := route.Params.GetOK("access_key") if err := o.bindAccessKey(rAccessKey, rhkAccessKey, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindAccessKey binds and validates parameter AccessKey from path. func (o *GetServiceAccountParams) bindAccessKey(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.AccessKey = raw return nil } ================================================ FILE: api/operations/service_account/get_service_account_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetServiceAccountOKCode is the HTTP code returned for type GetServiceAccountOK const GetServiceAccountOKCode int = 200 /* GetServiceAccountOK A successful response. swagger:response getServiceAccountOK */ type GetServiceAccountOK struct { /* In: Body */ Payload *models.ServiceAccount `json:"body,omitempty"` } // NewGetServiceAccountOK creates GetServiceAccountOK with default headers values func NewGetServiceAccountOK() *GetServiceAccountOK { return &GetServiceAccountOK{} } // WithPayload adds the payload to the get service account o k response func (o *GetServiceAccountOK) WithPayload(payload *models.ServiceAccount) *GetServiceAccountOK { o.Payload = payload return o } // SetPayload sets the payload to the get service account o k response func (o *GetServiceAccountOK) SetPayload(payload *models.ServiceAccount) { o.Payload = payload } // WriteResponse to the client func (o *GetServiceAccountOK) 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 } } } /* GetServiceAccountDefault Generic error response. swagger:response getServiceAccountDefault */ type GetServiceAccountDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetServiceAccountDefault creates GetServiceAccountDefault with default headers values func NewGetServiceAccountDefault(code int) *GetServiceAccountDefault { if code <= 0 { code = 500 } return &GetServiceAccountDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get service account default response func (o *GetServiceAccountDefault) WithStatusCode(code int) *GetServiceAccountDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get service account default response func (o *GetServiceAccountDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get service account default response func (o *GetServiceAccountDefault) WithPayload(payload *models.APIError) *GetServiceAccountDefault { o.Payload = payload return o } // SetPayload sets the payload to the get service account default response func (o *GetServiceAccountDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetServiceAccountDefault) 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 } } } ================================================ FILE: api/operations/service_account/get_service_account_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetServiceAccountURL generates an URL for the get service account operation type GetServiceAccountURL struct { AccessKey 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 *GetServiceAccountURL) WithBasePath(bp string) *GetServiceAccountURL { 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 *GetServiceAccountURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetServiceAccountURL) Build() (*url.URL, error) { var _result url.URL var _path = "/service-accounts/{access_key}" accessKey := o.AccessKey if accessKey != "" { _path = strings.ReplaceAll(_path, "{access_key}", accessKey) } else { return nil, errors.New("accessKey is required on GetServiceAccountURL") } _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 *GetServiceAccountURL) 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 *GetServiceAccountURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetServiceAccountURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetServiceAccountURL") } if host == "" { return nil, errors.New("host is required for a full url on GetServiceAccountURL") } 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 *GetServiceAccountURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/service_account/list_user_service_accounts.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListUserServiceAccountsHandlerFunc turns a function with the right signature into a list user service accounts handler type ListUserServiceAccountsHandlerFunc func(ListUserServiceAccountsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListUserServiceAccountsHandlerFunc) Handle(params ListUserServiceAccountsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListUserServiceAccountsHandler interface for that can handle valid list user service accounts params type ListUserServiceAccountsHandler interface { Handle(ListUserServiceAccountsParams, *models.Principal) middleware.Responder } // NewListUserServiceAccounts creates a new http.Handler for the list user service accounts operation func NewListUserServiceAccounts(ctx *middleware.Context, handler ListUserServiceAccountsHandler) *ListUserServiceAccounts { return &ListUserServiceAccounts{Context: ctx, Handler: handler} } /* ListUserServiceAccounts swagger:route GET /service-accounts ServiceAccount listUserServiceAccounts List User's Service Accounts */ type ListUserServiceAccounts struct { Context *middleware.Context Handler ListUserServiceAccountsHandler } func (o *ListUserServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListUserServiceAccountsParams() 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) } ================================================ FILE: api/operations/service_account/list_user_service_accounts_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account 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" ) // NewListUserServiceAccountsParams creates a new ListUserServiceAccountsParams object // with the default values initialized. func NewListUserServiceAccountsParams() ListUserServiceAccountsParams { var ( // initialize parameters with default values limitDefault = int32(20) offsetDefault = int32(0) ) return ListUserServiceAccountsParams{ Limit: &limitDefault, Offset: &offsetDefault, } } // ListUserServiceAccountsParams contains all the bound params for the list user service accounts operation // typically these are obtained from a http.Request // // swagger:parameters ListUserServiceAccounts type ListUserServiceAccountsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* In: query Default: 20 */ Limit *int32 /* In: query Default: 0 */ Offset *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 NewListUserServiceAccountsParams() beforehand. func (o *ListUserServiceAccountsParams) 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) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindLimit binds and validates parameter Limit from query. func (o *ListUserServiceAccountsParams) 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 // Default values have been previously initialized by NewListUserServiceAccountsParams() 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 *ListUserServiceAccountsParams) 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 // Default values have been previously initialized by NewListUserServiceAccountsParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("offset", "query", "int32", raw) } o.Offset = &value return nil } ================================================ FILE: api/operations/service_account/list_user_service_accounts_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListUserServiceAccountsOKCode is the HTTP code returned for type ListUserServiceAccountsOK const ListUserServiceAccountsOKCode int = 200 /* ListUserServiceAccountsOK A successful response. swagger:response listUserServiceAccountsOK */ type ListUserServiceAccountsOK struct { /* In: Body */ Payload models.ServiceAccounts `json:"body,omitempty"` } // NewListUserServiceAccountsOK creates ListUserServiceAccountsOK with default headers values func NewListUserServiceAccountsOK() *ListUserServiceAccountsOK { return &ListUserServiceAccountsOK{} } // WithPayload adds the payload to the list user service accounts o k response func (o *ListUserServiceAccountsOK) WithPayload(payload models.ServiceAccounts) *ListUserServiceAccountsOK { o.Payload = payload return o } // SetPayload sets the payload to the list user service accounts o k response func (o *ListUserServiceAccountsOK) SetPayload(payload models.ServiceAccounts) { o.Payload = payload } // WriteResponse to the client func (o *ListUserServiceAccountsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(200) payload := o.Payload if payload == nil { // return empty array payload = models.ServiceAccounts{} } if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } /* ListUserServiceAccountsDefault Generic error response. swagger:response listUserServiceAccountsDefault */ type ListUserServiceAccountsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListUserServiceAccountsDefault creates ListUserServiceAccountsDefault with default headers values func NewListUserServiceAccountsDefault(code int) *ListUserServiceAccountsDefault { if code <= 0 { code = 500 } return &ListUserServiceAccountsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list user service accounts default response func (o *ListUserServiceAccountsDefault) WithStatusCode(code int) *ListUserServiceAccountsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list user service accounts default response func (o *ListUserServiceAccountsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list user service accounts default response func (o *ListUserServiceAccountsDefault) WithPayload(payload *models.APIError) *ListUserServiceAccountsDefault { o.Payload = payload return o } // SetPayload sets the payload to the list user service accounts default response func (o *ListUserServiceAccountsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListUserServiceAccountsDefault) 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 } } } ================================================ FILE: api/operations/service_account/list_user_service_accounts_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "errors" "net/url" golangswaggerpaths "path" "github.com/go-openapi/swag" ) // ListUserServiceAccountsURL generates an URL for the list user service accounts operation type ListUserServiceAccountsURL struct { Limit *int32 Offset *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 *ListUserServiceAccountsURL) WithBasePath(bp string) *ListUserServiceAccountsURL { 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 *ListUserServiceAccountsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListUserServiceAccountsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/service-accounts" _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) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListUserServiceAccountsURL) 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 *ListUserServiceAccountsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListUserServiceAccountsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListUserServiceAccountsURL") } if host == "" { return nil, errors.New("host is required for a full url on ListUserServiceAccountsURL") } 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 *ListUserServiceAccountsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/service_account/update_service_account.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // UpdateServiceAccountHandlerFunc turns a function with the right signature into a update service account handler type UpdateServiceAccountHandlerFunc func(UpdateServiceAccountParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn UpdateServiceAccountHandlerFunc) Handle(params UpdateServiceAccountParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // UpdateServiceAccountHandler interface for that can handle valid update service account params type UpdateServiceAccountHandler interface { Handle(UpdateServiceAccountParams, *models.Principal) middleware.Responder } // NewUpdateServiceAccount creates a new http.Handler for the update service account operation func NewUpdateServiceAccount(ctx *middleware.Context, handler UpdateServiceAccountHandler) *UpdateServiceAccount { return &UpdateServiceAccount{Context: ctx, Handler: handler} } /* UpdateServiceAccount swagger:route PUT /service-accounts/{access_key} ServiceAccount updateServiceAccount Set Service Account Policy */ type UpdateServiceAccount struct { Context *middleware.Context Handler UpdateServiceAccountHandler } func (o *UpdateServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewUpdateServiceAccountParams() 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) } ================================================ FILE: api/operations/service_account/update_service_account_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( stderrors "errors" "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" ) // NewUpdateServiceAccountParams creates a new UpdateServiceAccountParams object // // There are no default values defined in the spec. func NewUpdateServiceAccountParams() UpdateServiceAccountParams { return UpdateServiceAccountParams{} } // UpdateServiceAccountParams contains all the bound params for the update service account operation // typically these are obtained from a http.Request // // swagger:parameters UpdateServiceAccount type UpdateServiceAccountParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ AccessKey string /* Required: true In: body */ Body *models.UpdateServiceAccountRequest } // 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 NewUpdateServiceAccountParams() beforehand. func (o *UpdateServiceAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rAccessKey, rhkAccessKey, _ := route.Params.GetOK("access_key") if err := o.bindAccessKey(rAccessKey, rhkAccessKey, route.Formats); err != nil { res = append(res, err) } if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.UpdateServiceAccountRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } // bindAccessKey binds and validates parameter AccessKey from path. func (o *UpdateServiceAccountParams) bindAccessKey(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.AccessKey = raw return nil } ================================================ FILE: api/operations/service_account/update_service_account_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // UpdateServiceAccountOKCode is the HTTP code returned for type UpdateServiceAccountOK const UpdateServiceAccountOKCode int = 200 /* UpdateServiceAccountOK A successful response. swagger:response updateServiceAccountOK */ type UpdateServiceAccountOK struct { } // NewUpdateServiceAccountOK creates UpdateServiceAccountOK with default headers values func NewUpdateServiceAccountOK() *UpdateServiceAccountOK { return &UpdateServiceAccountOK{} } // WriteResponse to the client func (o *UpdateServiceAccountOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* UpdateServiceAccountDefault Generic error response. swagger:response updateServiceAccountDefault */ type UpdateServiceAccountDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewUpdateServiceAccountDefault creates UpdateServiceAccountDefault with default headers values func NewUpdateServiceAccountDefault(code int) *UpdateServiceAccountDefault { if code <= 0 { code = 500 } return &UpdateServiceAccountDefault{ _statusCode: code, } } // WithStatusCode adds the status to the update service account default response func (o *UpdateServiceAccountDefault) WithStatusCode(code int) *UpdateServiceAccountDefault { o._statusCode = code return o } // SetStatusCode sets the status to the update service account default response func (o *UpdateServiceAccountDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the update service account default response func (o *UpdateServiceAccountDefault) WithPayload(payload *models.APIError) *UpdateServiceAccountDefault { o.Payload = payload return o } // SetPayload sets the payload to the update service account default response func (o *UpdateServiceAccountDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *UpdateServiceAccountDefault) 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 } } } ================================================ FILE: api/operations/service_account/update_service_account_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package service_account import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // UpdateServiceAccountURL generates an URL for the update service account operation type UpdateServiceAccountURL struct { AccessKey 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 *UpdateServiceAccountURL) WithBasePath(bp string) *UpdateServiceAccountURL { 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 *UpdateServiceAccountURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *UpdateServiceAccountURL) Build() (*url.URL, error) { var _result url.URL var _path = "/service-accounts/{access_key}" accessKey := o.AccessKey if accessKey != "" { _path = strings.ReplaceAll(_path, "{access_key}", accessKey) } else { return nil, errors.New("accessKey is required on UpdateServiceAccountURL") } _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 *UpdateServiceAccountURL) 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 *UpdateServiceAccountURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *UpdateServiceAccountURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on UpdateServiceAccountURL") } if host == "" { return nil, errors.New("host is required for a full url on UpdateServiceAccountURL") } 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 *UpdateServiceAccountURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/site_replication/get_site_replication_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetSiteReplicationInfoHandlerFunc turns a function with the right signature into a get site replication info handler type GetSiteReplicationInfoHandlerFunc func(GetSiteReplicationInfoParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetSiteReplicationInfoHandlerFunc) Handle(params GetSiteReplicationInfoParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetSiteReplicationInfoHandler interface for that can handle valid get site replication info params type GetSiteReplicationInfoHandler interface { Handle(GetSiteReplicationInfoParams, *models.Principal) middleware.Responder } // NewGetSiteReplicationInfo creates a new http.Handler for the get site replication info operation func NewGetSiteReplicationInfo(ctx *middleware.Context, handler GetSiteReplicationInfoHandler) *GetSiteReplicationInfo { return &GetSiteReplicationInfo{Context: ctx, Handler: handler} } /* GetSiteReplicationInfo swagger:route GET /admin/site-replication SiteReplication getSiteReplicationInfo Get list of Replication Sites */ type GetSiteReplicationInfo struct { Context *middleware.Context Handler GetSiteReplicationInfoHandler } func (o *GetSiteReplicationInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetSiteReplicationInfoParams() 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) } ================================================ FILE: api/operations/site_replication/get_site_replication_info_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewGetSiteReplicationInfoParams creates a new GetSiteReplicationInfoParams object // // There are no default values defined in the spec. func NewGetSiteReplicationInfoParams() GetSiteReplicationInfoParams { return GetSiteReplicationInfoParams{} } // GetSiteReplicationInfoParams contains all the bound params for the get site replication info operation // typically these are obtained from a http.Request // // swagger:parameters GetSiteReplicationInfo type GetSiteReplicationInfoParams 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 NewGetSiteReplicationInfoParams() beforehand. func (o *GetSiteReplicationInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/site_replication/get_site_replication_info_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetSiteReplicationInfoOKCode is the HTTP code returned for type GetSiteReplicationInfoOK const GetSiteReplicationInfoOKCode int = 200 /* GetSiteReplicationInfoOK A successful response. swagger:response getSiteReplicationInfoOK */ type GetSiteReplicationInfoOK struct { /* In: Body */ Payload *models.SiteReplicationInfoResponse `json:"body,omitempty"` } // NewGetSiteReplicationInfoOK creates GetSiteReplicationInfoOK with default headers values func NewGetSiteReplicationInfoOK() *GetSiteReplicationInfoOK { return &GetSiteReplicationInfoOK{} } // WithPayload adds the payload to the get site replication info o k response func (o *GetSiteReplicationInfoOK) WithPayload(payload *models.SiteReplicationInfoResponse) *GetSiteReplicationInfoOK { o.Payload = payload return o } // SetPayload sets the payload to the get site replication info o k response func (o *GetSiteReplicationInfoOK) SetPayload(payload *models.SiteReplicationInfoResponse) { o.Payload = payload } // WriteResponse to the client func (o *GetSiteReplicationInfoOK) 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 } } } /* GetSiteReplicationInfoDefault Generic error response. swagger:response getSiteReplicationInfoDefault */ type GetSiteReplicationInfoDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetSiteReplicationInfoDefault creates GetSiteReplicationInfoDefault with default headers values func NewGetSiteReplicationInfoDefault(code int) *GetSiteReplicationInfoDefault { if code <= 0 { code = 500 } return &GetSiteReplicationInfoDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get site replication info default response func (o *GetSiteReplicationInfoDefault) WithStatusCode(code int) *GetSiteReplicationInfoDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get site replication info default response func (o *GetSiteReplicationInfoDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get site replication info default response func (o *GetSiteReplicationInfoDefault) WithPayload(payload *models.APIError) *GetSiteReplicationInfoDefault { o.Payload = payload return o } // SetPayload sets the payload to the get site replication info default response func (o *GetSiteReplicationInfoDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetSiteReplicationInfoDefault) 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 } } } ================================================ FILE: api/operations/site_replication/get_site_replication_info_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "errors" "net/url" golangswaggerpaths "path" ) // GetSiteReplicationInfoURL generates an URL for the get site replication info operation type GetSiteReplicationInfoURL 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 *GetSiteReplicationInfoURL) WithBasePath(bp string) *GetSiteReplicationInfoURL { 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 *GetSiteReplicationInfoURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetSiteReplicationInfoURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/site-replication" _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 *GetSiteReplicationInfoURL) 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 *GetSiteReplicationInfoURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetSiteReplicationInfoURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetSiteReplicationInfoURL") } if host == "" { return nil, errors.New("host is required for a full url on GetSiteReplicationInfoURL") } 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 *GetSiteReplicationInfoURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/site_replication/get_site_replication_status.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetSiteReplicationStatusHandlerFunc turns a function with the right signature into a get site replication status handler type GetSiteReplicationStatusHandlerFunc func(GetSiteReplicationStatusParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetSiteReplicationStatusHandlerFunc) Handle(params GetSiteReplicationStatusParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetSiteReplicationStatusHandler interface for that can handle valid get site replication status params type GetSiteReplicationStatusHandler interface { Handle(GetSiteReplicationStatusParams, *models.Principal) middleware.Responder } // NewGetSiteReplicationStatus creates a new http.Handler for the get site replication status operation func NewGetSiteReplicationStatus(ctx *middleware.Context, handler GetSiteReplicationStatusHandler) *GetSiteReplicationStatus { return &GetSiteReplicationStatus{Context: ctx, Handler: handler} } /* GetSiteReplicationStatus swagger:route GET /admin/site-replication/status SiteReplication getSiteReplicationStatus Display overall site replication status */ type GetSiteReplicationStatus struct { Context *middleware.Context Handler GetSiteReplicationStatusHandler } func (o *GetSiteReplicationStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetSiteReplicationStatusParams() 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) } ================================================ FILE: api/operations/site_replication/get_site_replication_status_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication 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" ) // NewGetSiteReplicationStatusParams creates a new GetSiteReplicationStatusParams object // with the default values initialized. func NewGetSiteReplicationStatusParams() GetSiteReplicationStatusParams { var ( // initialize parameters with default values bucketsDefault = bool(true) groupsDefault = bool(true) policiesDefault = bool(true) usersDefault = bool(true) ) return GetSiteReplicationStatusParams{ Buckets: &bucketsDefault, Groups: &groupsDefault, Policies: &policiesDefault, Users: &usersDefault, } } // GetSiteReplicationStatusParams contains all the bound params for the get site replication status operation // typically these are obtained from a http.Request // // swagger:parameters GetSiteReplicationStatus type GetSiteReplicationStatusParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /*Include Bucket stats In: query Default: true */ Buckets *bool /*Entity Type to lookup In: query */ EntityType *string /*Entity Value to lookup In: query */ EntityValue *string /*Include Group stats In: query Default: true */ Groups *bool /*Include Policies stats In: query Default: true */ Policies *bool /*Include Policies stats In: query Default: true */ Users *bool } // 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 NewGetSiteReplicationStatusParams() beforehand. func (o *GetSiteReplicationStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) qBuckets, qhkBuckets, _ := qs.GetOK("buckets") if err := o.bindBuckets(qBuckets, qhkBuckets, route.Formats); err != nil { res = append(res, err) } qEntityType, qhkEntityType, _ := qs.GetOK("entityType") if err := o.bindEntityType(qEntityType, qhkEntityType, route.Formats); err != nil { res = append(res, err) } qEntityValue, qhkEntityValue, _ := qs.GetOK("entityValue") if err := o.bindEntityValue(qEntityValue, qhkEntityValue, route.Formats); err != nil { res = append(res, err) } qGroups, qhkGroups, _ := qs.GetOK("groups") if err := o.bindGroups(qGroups, qhkGroups, route.Formats); err != nil { res = append(res, err) } qPolicies, qhkPolicies, _ := qs.GetOK("policies") if err := o.bindPolicies(qPolicies, qhkPolicies, route.Formats); err != nil { res = append(res, err) } qUsers, qhkUsers, _ := qs.GetOK("users") if err := o.bindUsers(qUsers, qhkUsers, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindBuckets binds and validates parameter Buckets from query. func (o *GetSiteReplicationStatusParams) bindBuckets(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 // Default values have been previously initialized by NewGetSiteReplicationStatusParams() return nil } value, err := swag.ConvertBool(raw) if err != nil { return errors.InvalidType("buckets", "query", "bool", raw) } o.Buckets = &value return nil } // bindEntityType binds and validates parameter EntityType from query. func (o *GetSiteReplicationStatusParams) bindEntityType(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.EntityType = &raw return nil } // bindEntityValue binds and validates parameter EntityValue from query. func (o *GetSiteReplicationStatusParams) bindEntityValue(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.EntityValue = &raw return nil } // bindGroups binds and validates parameter Groups from query. func (o *GetSiteReplicationStatusParams) bindGroups(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 // Default values have been previously initialized by NewGetSiteReplicationStatusParams() return nil } value, err := swag.ConvertBool(raw) if err != nil { return errors.InvalidType("groups", "query", "bool", raw) } o.Groups = &value return nil } // bindPolicies binds and validates parameter Policies from query. func (o *GetSiteReplicationStatusParams) bindPolicies(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 // Default values have been previously initialized by NewGetSiteReplicationStatusParams() return nil } value, err := swag.ConvertBool(raw) if err != nil { return errors.InvalidType("policies", "query", "bool", raw) } o.Policies = &value return nil } // bindUsers binds and validates parameter Users from query. func (o *GetSiteReplicationStatusParams) bindUsers(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 // Default values have been previously initialized by NewGetSiteReplicationStatusParams() return nil } value, err := swag.ConvertBool(raw) if err != nil { return errors.InvalidType("users", "query", "bool", raw) } o.Users = &value return nil } ================================================ FILE: api/operations/site_replication/get_site_replication_status_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetSiteReplicationStatusOKCode is the HTTP code returned for type GetSiteReplicationStatusOK const GetSiteReplicationStatusOKCode int = 200 /* GetSiteReplicationStatusOK A successful response. swagger:response getSiteReplicationStatusOK */ type GetSiteReplicationStatusOK struct { /* In: Body */ Payload *models.SiteReplicationStatusResponse `json:"body,omitempty"` } // NewGetSiteReplicationStatusOK creates GetSiteReplicationStatusOK with default headers values func NewGetSiteReplicationStatusOK() *GetSiteReplicationStatusOK { return &GetSiteReplicationStatusOK{} } // WithPayload adds the payload to the get site replication status o k response func (o *GetSiteReplicationStatusOK) WithPayload(payload *models.SiteReplicationStatusResponse) *GetSiteReplicationStatusOK { o.Payload = payload return o } // SetPayload sets the payload to the get site replication status o k response func (o *GetSiteReplicationStatusOK) SetPayload(payload *models.SiteReplicationStatusResponse) { o.Payload = payload } // WriteResponse to the client func (o *GetSiteReplicationStatusOK) 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 } } } /* GetSiteReplicationStatusDefault Generic error response. swagger:response getSiteReplicationStatusDefault */ type GetSiteReplicationStatusDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetSiteReplicationStatusDefault creates GetSiteReplicationStatusDefault with default headers values func NewGetSiteReplicationStatusDefault(code int) *GetSiteReplicationStatusDefault { if code <= 0 { code = 500 } return &GetSiteReplicationStatusDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get site replication status default response func (o *GetSiteReplicationStatusDefault) WithStatusCode(code int) *GetSiteReplicationStatusDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get site replication status default response func (o *GetSiteReplicationStatusDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get site replication status default response func (o *GetSiteReplicationStatusDefault) WithPayload(payload *models.APIError) *GetSiteReplicationStatusDefault { o.Payload = payload return o } // SetPayload sets the payload to the get site replication status default response func (o *GetSiteReplicationStatusDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetSiteReplicationStatusDefault) 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 } } } ================================================ FILE: api/operations/site_replication/get_site_replication_status_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "errors" "net/url" golangswaggerpaths "path" "github.com/go-openapi/swag" ) // GetSiteReplicationStatusURL generates an URL for the get site replication status operation type GetSiteReplicationStatusURL struct { Buckets *bool EntityType *string EntityValue *string Groups *bool Policies *bool Users *bool _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 *GetSiteReplicationStatusURL) WithBasePath(bp string) *GetSiteReplicationStatusURL { 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 *GetSiteReplicationStatusURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetSiteReplicationStatusURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/site-replication/status" _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var bucketsQ string if o.Buckets != nil { bucketsQ = swag.FormatBool(*o.Buckets) } if bucketsQ != "" { qs.Set("buckets", bucketsQ) } var entityTypeQ string if o.EntityType != nil { entityTypeQ = *o.EntityType } if entityTypeQ != "" { qs.Set("entityType", entityTypeQ) } var entityValueQ string if o.EntityValue != nil { entityValueQ = *o.EntityValue } if entityValueQ != "" { qs.Set("entityValue", entityValueQ) } var groupsQ string if o.Groups != nil { groupsQ = swag.FormatBool(*o.Groups) } if groupsQ != "" { qs.Set("groups", groupsQ) } var policiesQ string if o.Policies != nil { policiesQ = swag.FormatBool(*o.Policies) } if policiesQ != "" { qs.Set("policies", policiesQ) } var usersQ string if o.Users != nil { usersQ = swag.FormatBool(*o.Users) } if usersQ != "" { qs.Set("users", usersQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *GetSiteReplicationStatusURL) 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 *GetSiteReplicationStatusURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetSiteReplicationStatusURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetSiteReplicationStatusURL") } if host == "" { return nil, errors.New("host is required for a full url on GetSiteReplicationStatusURL") } 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 *GetSiteReplicationStatusURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/site_replication/site_replication_edit.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SiteReplicationEditHandlerFunc turns a function with the right signature into a site replication edit handler type SiteReplicationEditHandlerFunc func(SiteReplicationEditParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SiteReplicationEditHandlerFunc) Handle(params SiteReplicationEditParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SiteReplicationEditHandler interface for that can handle valid site replication edit params type SiteReplicationEditHandler interface { Handle(SiteReplicationEditParams, *models.Principal) middleware.Responder } // NewSiteReplicationEdit creates a new http.Handler for the site replication edit operation func NewSiteReplicationEdit(ctx *middleware.Context, handler SiteReplicationEditHandler) *SiteReplicationEdit { return &SiteReplicationEdit{Context: ctx, Handler: handler} } /* SiteReplicationEdit swagger:route PUT /admin/site-replication SiteReplication siteReplicationEdit Edit a Replication Site */ type SiteReplicationEdit struct { Context *middleware.Context Handler SiteReplicationEditHandler } func (o *SiteReplicationEdit) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSiteReplicationEditParams() 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) } ================================================ FILE: api/operations/site_replication/site_replication_edit_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( stderrors "errors" "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" ) // NewSiteReplicationEditParams creates a new SiteReplicationEditParams object // // There are no default values defined in the spec. func NewSiteReplicationEditParams() SiteReplicationEditParams { return SiteReplicationEditParams{} } // SiteReplicationEditParams contains all the bound params for the site replication edit operation // typically these are obtained from a http.Request // // swagger:parameters SiteReplicationEdit type SiteReplicationEditParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.PeerInfo } // 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 NewSiteReplicationEditParams() beforehand. func (o *SiteReplicationEditParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.PeerInfo if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/site_replication/site_replication_edit_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SiteReplicationEditOKCode is the HTTP code returned for type SiteReplicationEditOK const SiteReplicationEditOKCode int = 200 /* SiteReplicationEditOK A successful response. swagger:response siteReplicationEditOK */ type SiteReplicationEditOK struct { /* In: Body */ Payload *models.PeerSiteEditResponse `json:"body,omitempty"` } // NewSiteReplicationEditOK creates SiteReplicationEditOK with default headers values func NewSiteReplicationEditOK() *SiteReplicationEditOK { return &SiteReplicationEditOK{} } // WithPayload adds the payload to the site replication edit o k response func (o *SiteReplicationEditOK) WithPayload(payload *models.PeerSiteEditResponse) *SiteReplicationEditOK { o.Payload = payload return o } // SetPayload sets the payload to the site replication edit o k response func (o *SiteReplicationEditOK) SetPayload(payload *models.PeerSiteEditResponse) { o.Payload = payload } // WriteResponse to the client func (o *SiteReplicationEditOK) 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 } } } /* SiteReplicationEditDefault Generic error response. swagger:response siteReplicationEditDefault */ type SiteReplicationEditDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSiteReplicationEditDefault creates SiteReplicationEditDefault with default headers values func NewSiteReplicationEditDefault(code int) *SiteReplicationEditDefault { if code <= 0 { code = 500 } return &SiteReplicationEditDefault{ _statusCode: code, } } // WithStatusCode adds the status to the site replication edit default response func (o *SiteReplicationEditDefault) WithStatusCode(code int) *SiteReplicationEditDefault { o._statusCode = code return o } // SetStatusCode sets the status to the site replication edit default response func (o *SiteReplicationEditDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the site replication edit default response func (o *SiteReplicationEditDefault) WithPayload(payload *models.APIError) *SiteReplicationEditDefault { o.Payload = payload return o } // SetPayload sets the payload to the site replication edit default response func (o *SiteReplicationEditDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SiteReplicationEditDefault) 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 } } } ================================================ FILE: api/operations/site_replication/site_replication_edit_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "errors" "net/url" golangswaggerpaths "path" ) // SiteReplicationEditURL generates an URL for the site replication edit operation type SiteReplicationEditURL 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 *SiteReplicationEditURL) WithBasePath(bp string) *SiteReplicationEditURL { 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 *SiteReplicationEditURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SiteReplicationEditURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/site-replication" _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 *SiteReplicationEditURL) 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 *SiteReplicationEditURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SiteReplicationEditURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SiteReplicationEditURL") } if host == "" { return nil, errors.New("host is required for a full url on SiteReplicationEditURL") } 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 *SiteReplicationEditURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/site_replication/site_replication_info_add.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SiteReplicationInfoAddHandlerFunc turns a function with the right signature into a site replication info add handler type SiteReplicationInfoAddHandlerFunc func(SiteReplicationInfoAddParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SiteReplicationInfoAddHandlerFunc) Handle(params SiteReplicationInfoAddParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SiteReplicationInfoAddHandler interface for that can handle valid site replication info add params type SiteReplicationInfoAddHandler interface { Handle(SiteReplicationInfoAddParams, *models.Principal) middleware.Responder } // NewSiteReplicationInfoAdd creates a new http.Handler for the site replication info add operation func NewSiteReplicationInfoAdd(ctx *middleware.Context, handler SiteReplicationInfoAddHandler) *SiteReplicationInfoAdd { return &SiteReplicationInfoAdd{Context: ctx, Handler: handler} } /* SiteReplicationInfoAdd swagger:route POST /admin/site-replication SiteReplication siteReplicationInfoAdd Add a Replication Site */ type SiteReplicationInfoAdd struct { Context *middleware.Context Handler SiteReplicationInfoAddHandler } func (o *SiteReplicationInfoAdd) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSiteReplicationInfoAddParams() 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) } ================================================ FILE: api/operations/site_replication/site_replication_info_add_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( stderrors "errors" "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" ) // NewSiteReplicationInfoAddParams creates a new SiteReplicationInfoAddParams object // // There are no default values defined in the spec. func NewSiteReplicationInfoAddParams() SiteReplicationInfoAddParams { return SiteReplicationInfoAddParams{} } // SiteReplicationInfoAddParams contains all the bound params for the site replication info add operation // typically these are obtained from a http.Request // // swagger:parameters SiteReplicationInfoAdd type SiteReplicationInfoAddParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body models.SiteReplicationAddRequest } // 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 NewSiteReplicationInfoAddParams() beforehand. func (o *SiteReplicationInfoAddParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.SiteReplicationAddRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/site_replication/site_replication_info_add_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SiteReplicationInfoAddOKCode is the HTTP code returned for type SiteReplicationInfoAddOK const SiteReplicationInfoAddOKCode int = 200 /* SiteReplicationInfoAddOK A successful response. swagger:response siteReplicationInfoAddOK */ type SiteReplicationInfoAddOK struct { /* In: Body */ Payload *models.SiteReplicationAddResponse `json:"body,omitempty"` } // NewSiteReplicationInfoAddOK creates SiteReplicationInfoAddOK with default headers values func NewSiteReplicationInfoAddOK() *SiteReplicationInfoAddOK { return &SiteReplicationInfoAddOK{} } // WithPayload adds the payload to the site replication info add o k response func (o *SiteReplicationInfoAddOK) WithPayload(payload *models.SiteReplicationAddResponse) *SiteReplicationInfoAddOK { o.Payload = payload return o } // SetPayload sets the payload to the site replication info add o k response func (o *SiteReplicationInfoAddOK) SetPayload(payload *models.SiteReplicationAddResponse) { o.Payload = payload } // WriteResponse to the client func (o *SiteReplicationInfoAddOK) 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 } } } /* SiteReplicationInfoAddDefault Generic error response. swagger:response siteReplicationInfoAddDefault */ type SiteReplicationInfoAddDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSiteReplicationInfoAddDefault creates SiteReplicationInfoAddDefault with default headers values func NewSiteReplicationInfoAddDefault(code int) *SiteReplicationInfoAddDefault { if code <= 0 { code = 500 } return &SiteReplicationInfoAddDefault{ _statusCode: code, } } // WithStatusCode adds the status to the site replication info add default response func (o *SiteReplicationInfoAddDefault) WithStatusCode(code int) *SiteReplicationInfoAddDefault { o._statusCode = code return o } // SetStatusCode sets the status to the site replication info add default response func (o *SiteReplicationInfoAddDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the site replication info add default response func (o *SiteReplicationInfoAddDefault) WithPayload(payload *models.APIError) *SiteReplicationInfoAddDefault { o.Payload = payload return o } // SetPayload sets the payload to the site replication info add default response func (o *SiteReplicationInfoAddDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SiteReplicationInfoAddDefault) 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 } } } ================================================ FILE: api/operations/site_replication/site_replication_info_add_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "errors" "net/url" golangswaggerpaths "path" ) // SiteReplicationInfoAddURL generates an URL for the site replication info add operation type SiteReplicationInfoAddURL 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 *SiteReplicationInfoAddURL) WithBasePath(bp string) *SiteReplicationInfoAddURL { 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 *SiteReplicationInfoAddURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SiteReplicationInfoAddURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/site-replication" _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 *SiteReplicationInfoAddURL) 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 *SiteReplicationInfoAddURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SiteReplicationInfoAddURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SiteReplicationInfoAddURL") } if host == "" { return nil, errors.New("host is required for a full url on SiteReplicationInfoAddURL") } 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 *SiteReplicationInfoAddURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/site_replication/site_replication_remove.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // SiteReplicationRemoveHandlerFunc turns a function with the right signature into a site replication remove handler type SiteReplicationRemoveHandlerFunc func(SiteReplicationRemoveParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn SiteReplicationRemoveHandlerFunc) Handle(params SiteReplicationRemoveParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // SiteReplicationRemoveHandler interface for that can handle valid site replication remove params type SiteReplicationRemoveHandler interface { Handle(SiteReplicationRemoveParams, *models.Principal) middleware.Responder } // NewSiteReplicationRemove creates a new http.Handler for the site replication remove operation func NewSiteReplicationRemove(ctx *middleware.Context, handler SiteReplicationRemoveHandler) *SiteReplicationRemove { return &SiteReplicationRemove{Context: ctx, Handler: handler} } /* SiteReplicationRemove swagger:route DELETE /admin/site-replication SiteReplication siteReplicationRemove Remove a Replication Site */ type SiteReplicationRemove struct { Context *middleware.Context Handler SiteReplicationRemoveHandler } func (o *SiteReplicationRemove) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewSiteReplicationRemoveParams() 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) } ================================================ FILE: api/operations/site_replication/site_replication_remove_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( stderrors "errors" "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" ) // NewSiteReplicationRemoveParams creates a new SiteReplicationRemoveParams object // // There are no default values defined in the spec. func NewSiteReplicationRemoveParams() SiteReplicationRemoveParams { return SiteReplicationRemoveParams{} } // SiteReplicationRemoveParams contains all the bound params for the site replication remove operation // typically these are obtained from a http.Request // // swagger:parameters SiteReplicationRemove type SiteReplicationRemoveParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.PeerInfoRemove } // 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 NewSiteReplicationRemoveParams() beforehand. func (o *SiteReplicationRemoveParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.PeerInfoRemove if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/site_replication/site_replication_remove_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // SiteReplicationRemoveNoContentCode is the HTTP code returned for type SiteReplicationRemoveNoContent const SiteReplicationRemoveNoContentCode int = 204 /* SiteReplicationRemoveNoContent A successful response. swagger:response siteReplicationRemoveNoContent */ type SiteReplicationRemoveNoContent struct { /* In: Body */ Payload *models.PeerSiteRemoveResponse `json:"body,omitempty"` } // NewSiteReplicationRemoveNoContent creates SiteReplicationRemoveNoContent with default headers values func NewSiteReplicationRemoveNoContent() *SiteReplicationRemoveNoContent { return &SiteReplicationRemoveNoContent{} } // WithPayload adds the payload to the site replication remove no content response func (o *SiteReplicationRemoveNoContent) WithPayload(payload *models.PeerSiteRemoveResponse) *SiteReplicationRemoveNoContent { o.Payload = payload return o } // SetPayload sets the payload to the site replication remove no content response func (o *SiteReplicationRemoveNoContent) SetPayload(payload *models.PeerSiteRemoveResponse) { o.Payload = payload } // WriteResponse to the client func (o *SiteReplicationRemoveNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(204) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } } /* SiteReplicationRemoveDefault Generic error response. swagger:response siteReplicationRemoveDefault */ type SiteReplicationRemoveDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewSiteReplicationRemoveDefault creates SiteReplicationRemoveDefault with default headers values func NewSiteReplicationRemoveDefault(code int) *SiteReplicationRemoveDefault { if code <= 0 { code = 500 } return &SiteReplicationRemoveDefault{ _statusCode: code, } } // WithStatusCode adds the status to the site replication remove default response func (o *SiteReplicationRemoveDefault) WithStatusCode(code int) *SiteReplicationRemoveDefault { o._statusCode = code return o } // SetStatusCode sets the status to the site replication remove default response func (o *SiteReplicationRemoveDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the site replication remove default response func (o *SiteReplicationRemoveDefault) WithPayload(payload *models.APIError) *SiteReplicationRemoveDefault { o.Payload = payload return o } // SetPayload sets the payload to the site replication remove default response func (o *SiteReplicationRemoveDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *SiteReplicationRemoveDefault) 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 } } } ================================================ FILE: api/operations/site_replication/site_replication_remove_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package site_replication import ( "errors" "net/url" golangswaggerpaths "path" ) // SiteReplicationRemoveURL generates an URL for the site replication remove operation type SiteReplicationRemoveURL 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 *SiteReplicationRemoveURL) WithBasePath(bp string) *SiteReplicationRemoveURL { 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 *SiteReplicationRemoveURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *SiteReplicationRemoveURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/site-replication" _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 *SiteReplicationRemoveURL) 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 *SiteReplicationRemoveURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *SiteReplicationRemoveURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on SiteReplicationRemoveURL") } if host == "" { return nil, errors.New("host is required for a full url on SiteReplicationRemoveURL") } 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 *SiteReplicationRemoveURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/system/admin_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // AdminInfoHandlerFunc turns a function with the right signature into a admin info handler type AdminInfoHandlerFunc func(AdminInfoParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn AdminInfoHandlerFunc) Handle(params AdminInfoParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // AdminInfoHandler interface for that can handle valid admin info params type AdminInfoHandler interface { Handle(AdminInfoParams, *models.Principal) middleware.Responder } // NewAdminInfo creates a new http.Handler for the admin info operation func NewAdminInfo(ctx *middleware.Context, handler AdminInfoHandler) *AdminInfo { return &AdminInfo{Context: ctx, Handler: handler} } /* AdminInfo swagger:route GET /admin/info System adminInfo Returns information about the deployment */ type AdminInfo struct { Context *middleware.Context Handler AdminInfoHandler } func (o *AdminInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewAdminInfoParams() 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) } ================================================ FILE: api/operations/system/admin_info_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system 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" ) // NewAdminInfoParams creates a new AdminInfoParams object // with the default values initialized. func NewAdminInfoParams() AdminInfoParams { var ( // initialize parameters with default values defaultOnlyDefault = bool(false) ) return AdminInfoParams{ DefaultOnly: &defaultOnlyDefault, } } // AdminInfoParams contains all the bound params for the admin info operation // typically these are obtained from a http.Request // // swagger:parameters AdminInfo type AdminInfoParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* In: query Default: false */ DefaultOnly *bool } // 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 NewAdminInfoParams() beforehand. func (o *AdminInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) qDefaultOnly, qhkDefaultOnly, _ := qs.GetOK("defaultOnly") if err := o.bindDefaultOnly(qDefaultOnly, qhkDefaultOnly, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindDefaultOnly binds and validates parameter DefaultOnly from query. func (o *AdminInfoParams) bindDefaultOnly(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 // Default values have been previously initialized by NewAdminInfoParams() return nil } value, err := swag.ConvertBool(raw) if err != nil { return errors.InvalidType("defaultOnly", "query", "bool", raw) } o.DefaultOnly = &value return nil } ================================================ FILE: api/operations/system/admin_info_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // AdminInfoOKCode is the HTTP code returned for type AdminInfoOK const AdminInfoOKCode int = 200 /* AdminInfoOK A successful response. swagger:response adminInfoOK */ type AdminInfoOK struct { /* In: Body */ Payload *models.AdminInfoResponse `json:"body,omitempty"` } // NewAdminInfoOK creates AdminInfoOK with default headers values func NewAdminInfoOK() *AdminInfoOK { return &AdminInfoOK{} } // WithPayload adds the payload to the admin info o k response func (o *AdminInfoOK) WithPayload(payload *models.AdminInfoResponse) *AdminInfoOK { o.Payload = payload return o } // SetPayload sets the payload to the admin info o k response func (o *AdminInfoOK) SetPayload(payload *models.AdminInfoResponse) { o.Payload = payload } // WriteResponse to the client func (o *AdminInfoOK) 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 } } } /* AdminInfoDefault Generic error response. swagger:response adminInfoDefault */ type AdminInfoDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewAdminInfoDefault creates AdminInfoDefault with default headers values func NewAdminInfoDefault(code int) *AdminInfoDefault { if code <= 0 { code = 500 } return &AdminInfoDefault{ _statusCode: code, } } // WithStatusCode adds the status to the admin info default response func (o *AdminInfoDefault) WithStatusCode(code int) *AdminInfoDefault { o._statusCode = code return o } // SetStatusCode sets the status to the admin info default response func (o *AdminInfoDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the admin info default response func (o *AdminInfoDefault) WithPayload(payload *models.APIError) *AdminInfoDefault { o.Payload = payload return o } // SetPayload sets the payload to the admin info default response func (o *AdminInfoDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *AdminInfoDefault) 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 } } } ================================================ FILE: api/operations/system/admin_info_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "errors" "net/url" golangswaggerpaths "path" "github.com/go-openapi/swag" ) // AdminInfoURL generates an URL for the admin info operation type AdminInfoURL struct { DefaultOnly *bool _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 *AdminInfoURL) WithBasePath(bp string) *AdminInfoURL { 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 *AdminInfoURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *AdminInfoURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/info" _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var defaultOnlyQ string if o.DefaultOnly != nil { defaultOnlyQ = swag.FormatBool(*o.DefaultOnly) } if defaultOnlyQ != "" { qs.Set("defaultOnly", defaultOnlyQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *AdminInfoURL) 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 *AdminInfoURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *AdminInfoURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on AdminInfoURL") } if host == "" { return nil, errors.New("host is required for a full url on AdminInfoURL") } 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 *AdminInfoURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/system/arn_list.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ArnListHandlerFunc turns a function with the right signature into a arn list handler type ArnListHandlerFunc func(ArnListParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ArnListHandlerFunc) Handle(params ArnListParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ArnListHandler interface for that can handle valid arn list params type ArnListHandler interface { Handle(ArnListParams, *models.Principal) middleware.Responder } // NewArnList creates a new http.Handler for the arn list operation func NewArnList(ctx *middleware.Context, handler ArnListHandler) *ArnList { return &ArnList{Context: ctx, Handler: handler} } /* ArnList swagger:route GET /admin/arns System arnList Returns a list of active ARNs in the instance */ type ArnList struct { Context *middleware.Context Handler ArnListHandler } func (o *ArnList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewArnListParams() 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) } ================================================ FILE: api/operations/system/arn_list_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewArnListParams creates a new ArnListParams object // // There are no default values defined in the spec. func NewArnListParams() ArnListParams { return ArnListParams{} } // ArnListParams contains all the bound params for the arn list operation // typically these are obtained from a http.Request // // swagger:parameters ArnList type ArnListParams 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 NewArnListParams() beforehand. func (o *ArnListParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/system/arn_list_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ArnListOKCode is the HTTP code returned for type ArnListOK const ArnListOKCode int = 200 /* ArnListOK A successful response. swagger:response arnListOK */ type ArnListOK struct { /* In: Body */ Payload *models.ArnsResponse `json:"body,omitempty"` } // NewArnListOK creates ArnListOK with default headers values func NewArnListOK() *ArnListOK { return &ArnListOK{} } // WithPayload adds the payload to the arn list o k response func (o *ArnListOK) WithPayload(payload *models.ArnsResponse) *ArnListOK { o.Payload = payload return o } // SetPayload sets the payload to the arn list o k response func (o *ArnListOK) SetPayload(payload *models.ArnsResponse) { o.Payload = payload } // WriteResponse to the client func (o *ArnListOK) 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 } } } /* ArnListDefault Generic error response. swagger:response arnListDefault */ type ArnListDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewArnListDefault creates ArnListDefault with default headers values func NewArnListDefault(code int) *ArnListDefault { if code <= 0 { code = 500 } return &ArnListDefault{ _statusCode: code, } } // WithStatusCode adds the status to the arn list default response func (o *ArnListDefault) WithStatusCode(code int) *ArnListDefault { o._statusCode = code return o } // SetStatusCode sets the status to the arn list default response func (o *ArnListDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the arn list default response func (o *ArnListDefault) WithPayload(payload *models.APIError) *ArnListDefault { o.Payload = payload return o } // SetPayload sets the payload to the arn list default response func (o *ArnListDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ArnListDefault) 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 } } } ================================================ FILE: api/operations/system/arn_list_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "errors" "net/url" golangswaggerpaths "path" ) // ArnListURL generates an URL for the arn list operation type ArnListURL 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 *ArnListURL) WithBasePath(bp string) *ArnListURL { 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 *ArnListURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ArnListURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/arns" _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 *ArnListURL) 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 *ArnListURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ArnListURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ArnListURL") } if host == "" { return nil, errors.New("host is required for a full url on ArnListURL") } 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 *ArnListURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/system/dashboard_widget_details.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // DashboardWidgetDetailsHandlerFunc turns a function with the right signature into a dashboard widget details handler type DashboardWidgetDetailsHandlerFunc func(DashboardWidgetDetailsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn DashboardWidgetDetailsHandlerFunc) Handle(params DashboardWidgetDetailsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // DashboardWidgetDetailsHandler interface for that can handle valid dashboard widget details params type DashboardWidgetDetailsHandler interface { Handle(DashboardWidgetDetailsParams, *models.Principal) middleware.Responder } // NewDashboardWidgetDetails creates a new http.Handler for the dashboard widget details operation func NewDashboardWidgetDetails(ctx *middleware.Context, handler DashboardWidgetDetailsHandler) *DashboardWidgetDetails { return &DashboardWidgetDetails{Context: ctx, Handler: handler} } /* DashboardWidgetDetails swagger:route GET /admin/info/widgets/{widgetId} System dashboardWidgetDetails Returns information about the deployment */ type DashboardWidgetDetails struct { Context *middleware.Context Handler DashboardWidgetDetailsHandler } func (o *DashboardWidgetDetails) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewDashboardWidgetDetailsParams() 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) } ================================================ FILE: api/operations/system/dashboard_widget_details_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system 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" ) // NewDashboardWidgetDetailsParams creates a new DashboardWidgetDetailsParams object // // There are no default values defined in the spec. func NewDashboardWidgetDetailsParams() DashboardWidgetDetailsParams { return DashboardWidgetDetailsParams{} } // DashboardWidgetDetailsParams contains all the bound params for the dashboard widget details operation // typically these are obtained from a http.Request // // swagger:parameters DashboardWidgetDetails type DashboardWidgetDetailsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* In: query */ End *int64 /* In: query */ Start *int64 /* In: query */ Step *int32 /* Required: true In: path */ WidgetID 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 NewDashboardWidgetDetailsParams() beforehand. func (o *DashboardWidgetDetailsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r qs := runtime.Values(r.URL.Query()) qEnd, qhkEnd, _ := qs.GetOK("end") if err := o.bindEnd(qEnd, qhkEnd, route.Formats); err != nil { res = append(res, err) } qStart, qhkStart, _ := qs.GetOK("start") if err := o.bindStart(qStart, qhkStart, route.Formats); err != nil { res = append(res, err) } qStep, qhkStep, _ := qs.GetOK("step") if err := o.bindStep(qStep, qhkStep, route.Formats); err != nil { res = append(res, err) } rWidgetID, rhkWidgetID, _ := route.Params.GetOK("widgetId") if err := o.bindWidgetID(rWidgetID, rhkWidgetID, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindEnd binds and validates parameter End from query. func (o *DashboardWidgetDetailsParams) bindEnd(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.ConvertInt64(raw) if err != nil { return errors.InvalidType("end", "query", "int64", raw) } o.End = &value return nil } // bindStart binds and validates parameter Start from query. func (o *DashboardWidgetDetailsParams) bindStart(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.ConvertInt64(raw) if err != nil { return errors.InvalidType("start", "query", "int64", raw) } o.Start = &value return nil } // bindStep binds and validates parameter Step from query. func (o *DashboardWidgetDetailsParams) bindStep(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("step", "query", "int32", raw) } o.Step = &value return nil } // bindWidgetID binds and validates parameter WidgetID from path. func (o *DashboardWidgetDetailsParams) bindWidgetID(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.ConvertInt32(raw) if err != nil { return errors.InvalidType("widgetId", "path", "int32", raw) } o.WidgetID = value return nil } ================================================ FILE: api/operations/system/dashboard_widget_details_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // DashboardWidgetDetailsOKCode is the HTTP code returned for type DashboardWidgetDetailsOK const DashboardWidgetDetailsOKCode int = 200 /* DashboardWidgetDetailsOK A successful response. swagger:response dashboardWidgetDetailsOK */ type DashboardWidgetDetailsOK struct { /* In: Body */ Payload *models.WidgetDetails `json:"body,omitempty"` } // NewDashboardWidgetDetailsOK creates DashboardWidgetDetailsOK with default headers values func NewDashboardWidgetDetailsOK() *DashboardWidgetDetailsOK { return &DashboardWidgetDetailsOK{} } // WithPayload adds the payload to the dashboard widget details o k response func (o *DashboardWidgetDetailsOK) WithPayload(payload *models.WidgetDetails) *DashboardWidgetDetailsOK { o.Payload = payload return o } // SetPayload sets the payload to the dashboard widget details o k response func (o *DashboardWidgetDetailsOK) SetPayload(payload *models.WidgetDetails) { o.Payload = payload } // WriteResponse to the client func (o *DashboardWidgetDetailsOK) 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 } } } /* DashboardWidgetDetailsDefault Generic error response. swagger:response dashboardWidgetDetailsDefault */ type DashboardWidgetDetailsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewDashboardWidgetDetailsDefault creates DashboardWidgetDetailsDefault with default headers values func NewDashboardWidgetDetailsDefault(code int) *DashboardWidgetDetailsDefault { if code <= 0 { code = 500 } return &DashboardWidgetDetailsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the dashboard widget details default response func (o *DashboardWidgetDetailsDefault) WithStatusCode(code int) *DashboardWidgetDetailsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the dashboard widget details default response func (o *DashboardWidgetDetailsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the dashboard widget details default response func (o *DashboardWidgetDetailsDefault) WithPayload(payload *models.APIError) *DashboardWidgetDetailsDefault { o.Payload = payload return o } // SetPayload sets the payload to the dashboard widget details default response func (o *DashboardWidgetDetailsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *DashboardWidgetDetailsDefault) 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 } } } ================================================ FILE: api/operations/system/dashboard_widget_details_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "errors" "net/url" golangswaggerpaths "path" "strings" "github.com/go-openapi/swag" ) // DashboardWidgetDetailsURL generates an URL for the dashboard widget details operation type DashboardWidgetDetailsURL struct { WidgetID int32 End *int64 Start *int64 Step *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 *DashboardWidgetDetailsURL) WithBasePath(bp string) *DashboardWidgetDetailsURL { 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 *DashboardWidgetDetailsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *DashboardWidgetDetailsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/info/widgets/{widgetId}" widgetID := swag.FormatInt32(o.WidgetID) if widgetID != "" { _path = strings.ReplaceAll(_path, "{widgetId}", widgetID) } else { return nil, errors.New("widgetId is required on DashboardWidgetDetailsURL") } _basePath := o._basePath if _basePath == "" { _basePath = "/api/v1" } _result.Path = golangswaggerpaths.Join(_basePath, _path) qs := make(url.Values) var endQ string if o.End != nil { endQ = swag.FormatInt64(*o.End) } if endQ != "" { qs.Set("end", endQ) } var startQ string if o.Start != nil { startQ = swag.FormatInt64(*o.Start) } if startQ != "" { qs.Set("start", startQ) } var stepQ string if o.Step != nil { stepQ = swag.FormatInt32(*o.Step) } if stepQ != "" { qs.Set("step", stepQ) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *DashboardWidgetDetailsURL) 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 *DashboardWidgetDetailsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *DashboardWidgetDetailsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on DashboardWidgetDetailsURL") } if host == "" { return nil, errors.New("host is required for a full url on DashboardWidgetDetailsURL") } 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 *DashboardWidgetDetailsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/system/list_nodes.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListNodesHandlerFunc turns a function with the right signature into a list nodes handler type ListNodesHandlerFunc func(ListNodesParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListNodesHandlerFunc) Handle(params ListNodesParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListNodesHandler interface for that can handle valid list nodes params type ListNodesHandler interface { Handle(ListNodesParams, *models.Principal) middleware.Responder } // NewListNodes creates a new http.Handler for the list nodes operation func NewListNodes(ctx *middleware.Context, handler ListNodesHandler) *ListNodes { return &ListNodes{Context: ctx, Handler: handler} } /* ListNodes swagger:route GET /nodes System listNodes Lists Nodes */ type ListNodes struct { Context *middleware.Context Handler ListNodesHandler } func (o *ListNodes) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListNodesParams() 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) } ================================================ FILE: api/operations/system/list_nodes_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewListNodesParams creates a new ListNodesParams object // // There are no default values defined in the spec. func NewListNodesParams() ListNodesParams { return ListNodesParams{} } // ListNodesParams contains all the bound params for the list nodes operation // typically these are obtained from a http.Request // // swagger:parameters ListNodes type ListNodesParams 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 NewListNodesParams() beforehand. func (o *ListNodesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/system/list_nodes_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListNodesOKCode is the HTTP code returned for type ListNodesOK const ListNodesOKCode int = 200 /* ListNodesOK A successful response. swagger:response listNodesOK */ type ListNodesOK struct { /* In: Body */ Payload []string `json:"body,omitempty"` } // NewListNodesOK creates ListNodesOK with default headers values func NewListNodesOK() *ListNodesOK { return &ListNodesOK{} } // WithPayload adds the payload to the list nodes o k response func (o *ListNodesOK) WithPayload(payload []string) *ListNodesOK { o.Payload = payload return o } // SetPayload sets the payload to the list nodes o k response func (o *ListNodesOK) SetPayload(payload []string) { o.Payload = payload } // WriteResponse to the client func (o *ListNodesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(200) payload := o.Payload if payload == nil { // return empty array payload = make([]string, 0, 50) } if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } /* ListNodesDefault Generic error response. swagger:response listNodesDefault */ type ListNodesDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListNodesDefault creates ListNodesDefault with default headers values func NewListNodesDefault(code int) *ListNodesDefault { if code <= 0 { code = 500 } return &ListNodesDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list nodes default response func (o *ListNodesDefault) WithStatusCode(code int) *ListNodesDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list nodes default response func (o *ListNodesDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list nodes default response func (o *ListNodesDefault) WithPayload(payload *models.APIError) *ListNodesDefault { o.Payload = payload return o } // SetPayload sets the payload to the list nodes default response func (o *ListNodesDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListNodesDefault) 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 } } } ================================================ FILE: api/operations/system/list_nodes_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package system import ( "errors" "net/url" golangswaggerpaths "path" ) // ListNodesURL generates an URL for the list nodes operation type ListNodesURL 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 *ListNodesURL) WithBasePath(bp string) *ListNodesURL { 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 *ListNodesURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListNodesURL) Build() (*url.URL, error) { var _result url.URL var _path = "/nodes" _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 *ListNodesURL) 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 *ListNodesURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListNodesURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListNodesURL") } if host == "" { return nil, errors.New("host is required for a full url on ListNodesURL") } 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 *ListNodesURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/tiering/add_tier.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // AddTierHandlerFunc turns a function with the right signature into a add tier handler type AddTierHandlerFunc func(AddTierParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn AddTierHandlerFunc) Handle(params AddTierParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // AddTierHandler interface for that can handle valid add tier params type AddTierHandler interface { Handle(AddTierParams, *models.Principal) middleware.Responder } // NewAddTier creates a new http.Handler for the add tier operation func NewAddTier(ctx *middleware.Context, handler AddTierHandler) *AddTier { return &AddTier{Context: ctx, Handler: handler} } /* AddTier swagger:route POST /admin/tiers Tiering addTier Allows to configure a new tier */ type AddTier struct { Context *middleware.Context Handler AddTierHandler } func (o *AddTier) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewAddTierParams() 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) } ================================================ FILE: api/operations/tiering/add_tier_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( stderrors "errors" "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" ) // NewAddTierParams creates a new AddTierParams object // // There are no default values defined in the spec. func NewAddTierParams() AddTierParams { return AddTierParams{} } // AddTierParams contains all the bound params for the add tier operation // typically these are obtained from a http.Request // // swagger:parameters AddTier type AddTierParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.Tier } // 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 NewAddTierParams() beforehand. func (o *AddTierParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.Tier if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/tiering/add_tier_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // AddTierCreatedCode is the HTTP code returned for type AddTierCreated const AddTierCreatedCode int = 201 /* AddTierCreated A successful response. swagger:response addTierCreated */ type AddTierCreated struct { } // NewAddTierCreated creates AddTierCreated with default headers values func NewAddTierCreated() *AddTierCreated { return &AddTierCreated{} } // WriteResponse to the client func (o *AddTierCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(201) } /* AddTierDefault Generic error response. swagger:response addTierDefault */ type AddTierDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewAddTierDefault creates AddTierDefault with default headers values func NewAddTierDefault(code int) *AddTierDefault { if code <= 0 { code = 500 } return &AddTierDefault{ _statusCode: code, } } // WithStatusCode adds the status to the add tier default response func (o *AddTierDefault) WithStatusCode(code int) *AddTierDefault { o._statusCode = code return o } // SetStatusCode sets the status to the add tier default response func (o *AddTierDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the add tier default response func (o *AddTierDefault) WithPayload(payload *models.APIError) *AddTierDefault { o.Payload = payload return o } // SetPayload sets the payload to the add tier default response func (o *AddTierDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *AddTierDefault) 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 } } } ================================================ FILE: api/operations/tiering/add_tier_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "errors" "net/url" golangswaggerpaths "path" ) // AddTierURL generates an URL for the add tier operation type AddTierURL 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 *AddTierURL) WithBasePath(bp string) *AddTierURL { 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 *AddTierURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *AddTierURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/tiers" _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 *AddTierURL) 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 *AddTierURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *AddTierURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on AddTierURL") } if host == "" { return nil, errors.New("host is required for a full url on AddTierURL") } 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 *AddTierURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/tiering/edit_tier_credentials.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // EditTierCredentialsHandlerFunc turns a function with the right signature into a edit tier credentials handler type EditTierCredentialsHandlerFunc func(EditTierCredentialsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn EditTierCredentialsHandlerFunc) Handle(params EditTierCredentialsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // EditTierCredentialsHandler interface for that can handle valid edit tier credentials params type EditTierCredentialsHandler interface { Handle(EditTierCredentialsParams, *models.Principal) middleware.Responder } // NewEditTierCredentials creates a new http.Handler for the edit tier credentials operation func NewEditTierCredentials(ctx *middleware.Context, handler EditTierCredentialsHandler) *EditTierCredentials { return &EditTierCredentials{Context: ctx, Handler: handler} } /* EditTierCredentials swagger:route PUT /admin/tiers/{type}/{name}/credentials Tiering editTierCredentials Edit Tier Credentials */ type EditTierCredentials struct { Context *middleware.Context Handler EditTierCredentialsHandler } func (o *EditTierCredentials) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewEditTierCredentialsParams() 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) } ================================================ FILE: api/operations/tiering/edit_tier_credentials_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( stderrors "errors" "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" ) // NewEditTierCredentialsParams creates a new EditTierCredentialsParams object // // There are no default values defined in the spec. func NewEditTierCredentialsParams() EditTierCredentialsParams { return EditTierCredentialsParams{} } // EditTierCredentialsParams contains all the bound params for the edit tier credentials operation // typically these are obtained from a http.Request // // swagger:parameters EditTierCredentials type EditTierCredentialsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.TierCredentialsRequest /* Required: true In: path */ Name string /* Required: true In: path */ Type 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 NewEditTierCredentialsParams() beforehand. func (o *EditTierCredentialsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.TierCredentialsRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } rType, rhkType, _ := route.Params.GetOK("type") if err := o.bindType(rType, rhkType, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *EditTierCredentialsParams) bindName(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.Name = raw return nil } // bindType binds and validates parameter Type from path. func (o *EditTierCredentialsParams) bindType(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.Type = raw if err := o.validateType(formats); err != nil { return err } return nil } // validateType carries out validations for parameter Type func (o *EditTierCredentialsParams) validateType(formats strfmt.Registry) error { if err := validate.EnumCase("type", "path", o.Type, []any{"s3", "gcs", "azure", "minio"}, true); err != nil { return err } return nil } ================================================ FILE: api/operations/tiering/edit_tier_credentials_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // EditTierCredentialsOKCode is the HTTP code returned for type EditTierCredentialsOK const EditTierCredentialsOKCode int = 200 /* EditTierCredentialsOK A successful response. swagger:response editTierCredentialsOK */ type EditTierCredentialsOK struct { } // NewEditTierCredentialsOK creates EditTierCredentialsOK with default headers values func NewEditTierCredentialsOK() *EditTierCredentialsOK { return &EditTierCredentialsOK{} } // WriteResponse to the client func (o *EditTierCredentialsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* EditTierCredentialsDefault Generic error response. swagger:response editTierCredentialsDefault */ type EditTierCredentialsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewEditTierCredentialsDefault creates EditTierCredentialsDefault with default headers values func NewEditTierCredentialsDefault(code int) *EditTierCredentialsDefault { if code <= 0 { code = 500 } return &EditTierCredentialsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the edit tier credentials default response func (o *EditTierCredentialsDefault) WithStatusCode(code int) *EditTierCredentialsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the edit tier credentials default response func (o *EditTierCredentialsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the edit tier credentials default response func (o *EditTierCredentialsDefault) WithPayload(payload *models.APIError) *EditTierCredentialsDefault { o.Payload = payload return o } // SetPayload sets the payload to the edit tier credentials default response func (o *EditTierCredentialsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *EditTierCredentialsDefault) 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 } } } ================================================ FILE: api/operations/tiering/edit_tier_credentials_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // EditTierCredentialsURL generates an URL for the edit tier credentials operation type EditTierCredentialsURL struct { Name string Type 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 *EditTierCredentialsURL) WithBasePath(bp string) *EditTierCredentialsURL { 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 *EditTierCredentialsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *EditTierCredentialsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/tiers/{type}/{name}/credentials" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on EditTierCredentialsURL") } typeVar := o.Type if typeVar != "" { _path = strings.ReplaceAll(_path, "{type}", typeVar) } else { return nil, errors.New("type is required on EditTierCredentialsURL") } _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 *EditTierCredentialsURL) 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 *EditTierCredentialsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *EditTierCredentialsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on EditTierCredentialsURL") } if host == "" { return nil, errors.New("host is required for a full url on EditTierCredentialsURL") } 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 *EditTierCredentialsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/tiering/get_tier.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetTierHandlerFunc turns a function with the right signature into a get tier handler type GetTierHandlerFunc func(GetTierParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetTierHandlerFunc) Handle(params GetTierParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetTierHandler interface for that can handle valid get tier params type GetTierHandler interface { Handle(GetTierParams, *models.Principal) middleware.Responder } // NewGetTier creates a new http.Handler for the get tier operation func NewGetTier(ctx *middleware.Context, handler GetTierHandler) *GetTier { return &GetTier{Context: ctx, Handler: handler} } /* GetTier swagger:route GET /admin/tiers/{type}/{name} Tiering getTier Get Tier */ type GetTier struct { Context *middleware.Context Handler GetTierHandler } func (o *GetTier) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetTierParams() 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) } ================================================ FILE: api/operations/tiering/get_tier_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // NewGetTierParams creates a new GetTierParams object // // There are no default values defined in the spec. func NewGetTierParams() GetTierParams { return GetTierParams{} } // GetTierParams contains all the bound params for the get tier operation // typically these are obtained from a http.Request // // swagger:parameters GetTier type GetTierParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name string /* Required: true In: path */ Type 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 NewGetTierParams() beforehand. func (o *GetTierParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } rType, rhkType, _ := route.Params.GetOK("type") if err := o.bindType(rType, rhkType, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *GetTierParams) bindName(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.Name = raw return nil } // bindType binds and validates parameter Type from path. func (o *GetTierParams) bindType(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.Type = raw if err := o.validateType(formats); err != nil { return err } return nil } // validateType carries out validations for parameter Type func (o *GetTierParams) validateType(formats strfmt.Registry) error { if err := validate.EnumCase("type", "path", o.Type, []any{"s3", "gcs", "azure", "minio"}, true); err != nil { return err } return nil } ================================================ FILE: api/operations/tiering/get_tier_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetTierOKCode is the HTTP code returned for type GetTierOK const GetTierOKCode int = 200 /* GetTierOK A successful response. swagger:response getTierOK */ type GetTierOK struct { /* In: Body */ Payload *models.Tier `json:"body,omitempty"` } // NewGetTierOK creates GetTierOK with default headers values func NewGetTierOK() *GetTierOK { return &GetTierOK{} } // WithPayload adds the payload to the get tier o k response func (o *GetTierOK) WithPayload(payload *models.Tier) *GetTierOK { o.Payload = payload return o } // SetPayload sets the payload to the get tier o k response func (o *GetTierOK) SetPayload(payload *models.Tier) { o.Payload = payload } // WriteResponse to the client func (o *GetTierOK) 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 } } } /* GetTierDefault Generic error response. swagger:response getTierDefault */ type GetTierDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetTierDefault creates GetTierDefault with default headers values func NewGetTierDefault(code int) *GetTierDefault { if code <= 0 { code = 500 } return &GetTierDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get tier default response func (o *GetTierDefault) WithStatusCode(code int) *GetTierDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get tier default response func (o *GetTierDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get tier default response func (o *GetTierDefault) WithPayload(payload *models.APIError) *GetTierDefault { o.Payload = payload return o } // SetPayload sets the payload to the get tier default response func (o *GetTierDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetTierDefault) 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 } } } ================================================ FILE: api/operations/tiering/get_tier_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetTierURL generates an URL for the get tier operation type GetTierURL struct { Name string Type 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 *GetTierURL) WithBasePath(bp string) *GetTierURL { 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 *GetTierURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetTierURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/tiers/{type}/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on GetTierURL") } typeVar := o.Type if typeVar != "" { _path = strings.ReplaceAll(_path, "{type}", typeVar) } else { return nil, errors.New("type is required on GetTierURL") } _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 *GetTierURL) 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 *GetTierURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetTierURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetTierURL") } if host == "" { return nil, errors.New("host is required for a full url on GetTierURL") } 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 *GetTierURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/tiering/remove_tier.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // RemoveTierHandlerFunc turns a function with the right signature into a remove tier handler type RemoveTierHandlerFunc func(RemoveTierParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn RemoveTierHandlerFunc) Handle(params RemoveTierParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // RemoveTierHandler interface for that can handle valid remove tier params type RemoveTierHandler interface { Handle(RemoveTierParams, *models.Principal) middleware.Responder } // NewRemoveTier creates a new http.Handler for the remove tier operation func NewRemoveTier(ctx *middleware.Context, handler RemoveTierHandler) *RemoveTier { return &RemoveTier{Context: ctx, Handler: handler} } /* RemoveTier swagger:route DELETE /admin/tiers/{name}/remove Tiering removeTier Remove Tier */ type RemoveTier struct { Context *middleware.Context Handler RemoveTierHandler } func (o *RemoveTier) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewRemoveTierParams() 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) } ================================================ FILE: api/operations/tiering/remove_tier_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewRemoveTierParams creates a new RemoveTierParams object // // There are no default values defined in the spec. func NewRemoveTierParams() RemoveTierParams { return RemoveTierParams{} } // RemoveTierParams contains all the bound params for the remove tier operation // typically these are obtained from a http.Request // // swagger:parameters RemoveTier type RemoveTierParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewRemoveTierParams() beforehand. func (o *RemoveTierParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *RemoveTierParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/tiering/remove_tier_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // RemoveTierNoContentCode is the HTTP code returned for type RemoveTierNoContent const RemoveTierNoContentCode int = 204 /* RemoveTierNoContent A successful response. swagger:response removeTierNoContent */ type RemoveTierNoContent struct { } // NewRemoveTierNoContent creates RemoveTierNoContent with default headers values func NewRemoveTierNoContent() *RemoveTierNoContent { return &RemoveTierNoContent{} } // WriteResponse to the client func (o *RemoveTierNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* RemoveTierDefault Generic error response. swagger:response removeTierDefault */ type RemoveTierDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewRemoveTierDefault creates RemoveTierDefault with default headers values func NewRemoveTierDefault(code int) *RemoveTierDefault { if code <= 0 { code = 500 } return &RemoveTierDefault{ _statusCode: code, } } // WithStatusCode adds the status to the remove tier default response func (o *RemoveTierDefault) WithStatusCode(code int) *RemoveTierDefault { o._statusCode = code return o } // SetStatusCode sets the status to the remove tier default response func (o *RemoveTierDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the remove tier default response func (o *RemoveTierDefault) WithPayload(payload *models.APIError) *RemoveTierDefault { o.Payload = payload return o } // SetPayload sets the payload to the remove tier default response func (o *RemoveTierDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *RemoveTierDefault) 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 } } } ================================================ FILE: api/operations/tiering/remove_tier_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // RemoveTierURL generates an URL for the remove tier operation type RemoveTierURL struct { Name 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 *RemoveTierURL) WithBasePath(bp string) *RemoveTierURL { 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 *RemoveTierURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *RemoveTierURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/tiers/{name}/remove" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on RemoveTierURL") } _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 *RemoveTierURL) 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 *RemoveTierURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *RemoveTierURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on RemoveTierURL") } if host == "" { return nil, errors.New("host is required for a full url on RemoveTierURL") } 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 *RemoveTierURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/tiering/tiers_list.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // TiersListHandlerFunc turns a function with the right signature into a tiers list handler type TiersListHandlerFunc func(TiersListParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn TiersListHandlerFunc) Handle(params TiersListParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // TiersListHandler interface for that can handle valid tiers list params type TiersListHandler interface { Handle(TiersListParams, *models.Principal) middleware.Responder } // NewTiersList creates a new http.Handler for the tiers list operation func NewTiersList(ctx *middleware.Context, handler TiersListHandler) *TiersList { return &TiersList{Context: ctx, Handler: handler} } /* TiersList swagger:route GET /admin/tiers Tiering tiersList Returns a list of tiers for ilm */ type TiersList struct { Context *middleware.Context Handler TiersListHandler } func (o *TiersList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewTiersListParams() 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) } ================================================ FILE: api/operations/tiering/tiers_list_names.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // TiersListNamesHandlerFunc turns a function with the right signature into a tiers list names handler type TiersListNamesHandlerFunc func(TiersListNamesParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn TiersListNamesHandlerFunc) Handle(params TiersListNamesParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // TiersListNamesHandler interface for that can handle valid tiers list names params type TiersListNamesHandler interface { Handle(TiersListNamesParams, *models.Principal) middleware.Responder } // NewTiersListNames creates a new http.Handler for the tiers list names operation func NewTiersListNames(ctx *middleware.Context, handler TiersListNamesHandler) *TiersListNames { return &TiersListNames{Context: ctx, Handler: handler} } /* TiersListNames swagger:route GET /admin/tiers/names Tiering tiersListNames Returns a list of tiers' names for ilm */ type TiersListNames struct { Context *middleware.Context Handler TiersListNamesHandler } func (o *TiersListNames) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewTiersListNamesParams() 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) } ================================================ FILE: api/operations/tiering/tiers_list_names_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewTiersListNamesParams creates a new TiersListNamesParams object // // There are no default values defined in the spec. func NewTiersListNamesParams() TiersListNamesParams { return TiersListNamesParams{} } // TiersListNamesParams contains all the bound params for the tiers list names operation // typically these are obtained from a http.Request // // swagger:parameters TiersListNames type TiersListNamesParams 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 NewTiersListNamesParams() beforehand. func (o *TiersListNamesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/tiering/tiers_list_names_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // TiersListNamesOKCode is the HTTP code returned for type TiersListNamesOK const TiersListNamesOKCode int = 200 /* TiersListNamesOK A successful response. swagger:response tiersListNamesOK */ type TiersListNamesOK struct { /* In: Body */ Payload *models.TiersNameListResponse `json:"body,omitempty"` } // NewTiersListNamesOK creates TiersListNamesOK with default headers values func NewTiersListNamesOK() *TiersListNamesOK { return &TiersListNamesOK{} } // WithPayload adds the payload to the tiers list names o k response func (o *TiersListNamesOK) WithPayload(payload *models.TiersNameListResponse) *TiersListNamesOK { o.Payload = payload return o } // SetPayload sets the payload to the tiers list names o k response func (o *TiersListNamesOK) SetPayload(payload *models.TiersNameListResponse) { o.Payload = payload } // WriteResponse to the client func (o *TiersListNamesOK) 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 } } } /* TiersListNamesDefault Generic error response. swagger:response tiersListNamesDefault */ type TiersListNamesDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewTiersListNamesDefault creates TiersListNamesDefault with default headers values func NewTiersListNamesDefault(code int) *TiersListNamesDefault { if code <= 0 { code = 500 } return &TiersListNamesDefault{ _statusCode: code, } } // WithStatusCode adds the status to the tiers list names default response func (o *TiersListNamesDefault) WithStatusCode(code int) *TiersListNamesDefault { o._statusCode = code return o } // SetStatusCode sets the status to the tiers list names default response func (o *TiersListNamesDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the tiers list names default response func (o *TiersListNamesDefault) WithPayload(payload *models.APIError) *TiersListNamesDefault { o.Payload = payload return o } // SetPayload sets the payload to the tiers list names default response func (o *TiersListNamesDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *TiersListNamesDefault) 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 } } } ================================================ FILE: api/operations/tiering/tiers_list_names_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "errors" "net/url" golangswaggerpaths "path" ) // TiersListNamesURL generates an URL for the tiers list names operation type TiersListNamesURL 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 *TiersListNamesURL) WithBasePath(bp string) *TiersListNamesURL { 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 *TiersListNamesURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *TiersListNamesURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/tiers/names" _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 *TiersListNamesURL) 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 *TiersListNamesURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *TiersListNamesURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on TiersListNamesURL") } if host == "" { return nil, errors.New("host is required for a full url on TiersListNamesURL") } 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 *TiersListNamesURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/tiering/tiers_list_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" ) // NewTiersListParams creates a new TiersListParams object // // There are no default values defined in the spec. func NewTiersListParams() TiersListParams { return TiersListParams{} } // TiersListParams contains all the bound params for the tiers list operation // typically these are obtained from a http.Request // // swagger:parameters TiersList type TiersListParams 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 NewTiersListParams() beforehand. func (o *TiersListParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/tiering/tiers_list_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // TiersListOKCode is the HTTP code returned for type TiersListOK const TiersListOKCode int = 200 /* TiersListOK A successful response. swagger:response tiersListOK */ type TiersListOK struct { /* In: Body */ Payload *models.TierListResponse `json:"body,omitempty"` } // NewTiersListOK creates TiersListOK with default headers values func NewTiersListOK() *TiersListOK { return &TiersListOK{} } // WithPayload adds the payload to the tiers list o k response func (o *TiersListOK) WithPayload(payload *models.TierListResponse) *TiersListOK { o.Payload = payload return o } // SetPayload sets the payload to the tiers list o k response func (o *TiersListOK) SetPayload(payload *models.TierListResponse) { o.Payload = payload } // WriteResponse to the client func (o *TiersListOK) 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 } } } /* TiersListDefault Generic error response. swagger:response tiersListDefault */ type TiersListDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewTiersListDefault creates TiersListDefault with default headers values func NewTiersListDefault(code int) *TiersListDefault { if code <= 0 { code = 500 } return &TiersListDefault{ _statusCode: code, } } // WithStatusCode adds the status to the tiers list default response func (o *TiersListDefault) WithStatusCode(code int) *TiersListDefault { o._statusCode = code return o } // SetStatusCode sets the status to the tiers list default response func (o *TiersListDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the tiers list default response func (o *TiersListDefault) WithPayload(payload *models.APIError) *TiersListDefault { o.Payload = payload return o } // SetPayload sets the payload to the tiers list default response func (o *TiersListDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *TiersListDefault) 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 } } } ================================================ FILE: api/operations/tiering/tiers_list_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package tiering import ( "errors" "net/url" golangswaggerpaths "path" ) // TiersListURL generates an URL for the tiers list operation type TiersListURL 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 *TiersListURL) WithBasePath(bp string) *TiersListURL { 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 *TiersListURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *TiersListURL) Build() (*url.URL, error) { var _result url.URL var _path = "/admin/tiers" _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 *TiersListURL) 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 *TiersListURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *TiersListURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on TiersListURL") } if host == "" { return nil, errors.New("host is required for a full url on TiersListURL") } 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 *TiersListURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/add_user.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // AddUserHandlerFunc turns a function with the right signature into a add user handler type AddUserHandlerFunc func(AddUserParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn AddUserHandlerFunc) Handle(params AddUserParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // AddUserHandler interface for that can handle valid add user params type AddUserHandler interface { Handle(AddUserParams, *models.Principal) middleware.Responder } // NewAddUser creates a new http.Handler for the add user operation func NewAddUser(ctx *middleware.Context, handler AddUserHandler) *AddUser { return &AddUser{Context: ctx, Handler: handler} } /* AddUser swagger:route POST /users User addUser Add User */ type AddUser struct { Context *middleware.Context Handler AddUserHandler } func (o *AddUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewAddUserParams() 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) } ================================================ FILE: api/operations/user/add_user_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( stderrors "errors" "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" ) // NewAddUserParams creates a new AddUserParams object // // There are no default values defined in the spec. func NewAddUserParams() AddUserParams { return AddUserParams{} } // AddUserParams contains all the bound params for the add user operation // typically these are obtained from a http.Request // // swagger:parameters AddUser type AddUserParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.AddUserRequest } // 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 NewAddUserParams() beforehand. func (o *AddUserParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.AddUserRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/user/add_user_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // AddUserCreatedCode is the HTTP code returned for type AddUserCreated const AddUserCreatedCode int = 201 /* AddUserCreated A successful response. swagger:response addUserCreated */ type AddUserCreated struct { /* In: Body */ Payload *models.User `json:"body,omitempty"` } // NewAddUserCreated creates AddUserCreated with default headers values func NewAddUserCreated() *AddUserCreated { return &AddUserCreated{} } // WithPayload adds the payload to the add user created response func (o *AddUserCreated) WithPayload(payload *models.User) *AddUserCreated { o.Payload = payload return o } // SetPayload sets the payload to the add user created response func (o *AddUserCreated) SetPayload(payload *models.User) { o.Payload = payload } // WriteResponse to the client func (o *AddUserCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(201) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } } /* AddUserDefault Generic error response. swagger:response addUserDefault */ type AddUserDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewAddUserDefault creates AddUserDefault with default headers values func NewAddUserDefault(code int) *AddUserDefault { if code <= 0 { code = 500 } return &AddUserDefault{ _statusCode: code, } } // WithStatusCode adds the status to the add user default response func (o *AddUserDefault) WithStatusCode(code int) *AddUserDefault { o._statusCode = code return o } // SetStatusCode sets the status to the add user default response func (o *AddUserDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the add user default response func (o *AddUserDefault) WithPayload(payload *models.APIError) *AddUserDefault { o.Payload = payload return o } // SetPayload sets the payload to the add user default response func (o *AddUserDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *AddUserDefault) 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 } } } ================================================ FILE: api/operations/user/add_user_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" ) // AddUserURL generates an URL for the add user operation type AddUserURL 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 *AddUserURL) WithBasePath(bp string) *AddUserURL { 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 *AddUserURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *AddUserURL) Build() (*url.URL, error) { var _result url.URL var _path = "/users" _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 *AddUserURL) 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 *AddUserURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *AddUserURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on AddUserURL") } if host == "" { return nil, errors.New("host is required for a full url on AddUserURL") } 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 *AddUserURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/bulk_update_users_groups.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // BulkUpdateUsersGroupsHandlerFunc turns a function with the right signature into a bulk update users groups handler type BulkUpdateUsersGroupsHandlerFunc func(BulkUpdateUsersGroupsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn BulkUpdateUsersGroupsHandlerFunc) Handle(params BulkUpdateUsersGroupsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // BulkUpdateUsersGroupsHandler interface for that can handle valid bulk update users groups params type BulkUpdateUsersGroupsHandler interface { Handle(BulkUpdateUsersGroupsParams, *models.Principal) middleware.Responder } // NewBulkUpdateUsersGroups creates a new http.Handler for the bulk update users groups operation func NewBulkUpdateUsersGroups(ctx *middleware.Context, handler BulkUpdateUsersGroupsHandler) *BulkUpdateUsersGroups { return &BulkUpdateUsersGroups{Context: ctx, Handler: handler} } /* BulkUpdateUsersGroups swagger:route PUT /users-groups-bulk User bulkUpdateUsersGroups Bulk functionality to Add Users to Groups */ type BulkUpdateUsersGroups struct { Context *middleware.Context Handler BulkUpdateUsersGroupsHandler } func (o *BulkUpdateUsersGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewBulkUpdateUsersGroupsParams() 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) } ================================================ FILE: api/operations/user/bulk_update_users_groups_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( stderrors "errors" "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" ) // NewBulkUpdateUsersGroupsParams creates a new BulkUpdateUsersGroupsParams object // // There are no default values defined in the spec. func NewBulkUpdateUsersGroupsParams() BulkUpdateUsersGroupsParams { return BulkUpdateUsersGroupsParams{} } // BulkUpdateUsersGroupsParams contains all the bound params for the bulk update users groups operation // typically these are obtained from a http.Request // // swagger:parameters BulkUpdateUsersGroups type BulkUpdateUsersGroupsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.BulkUserGroups } // 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 NewBulkUpdateUsersGroupsParams() beforehand. func (o *BulkUpdateUsersGroupsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.BulkUserGroups if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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 } ================================================ FILE: api/operations/user/bulk_update_users_groups_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // BulkUpdateUsersGroupsOKCode is the HTTP code returned for type BulkUpdateUsersGroupsOK const BulkUpdateUsersGroupsOKCode int = 200 /* BulkUpdateUsersGroupsOK A successful response. swagger:response bulkUpdateUsersGroupsOK */ type BulkUpdateUsersGroupsOK struct { } // NewBulkUpdateUsersGroupsOK creates BulkUpdateUsersGroupsOK with default headers values func NewBulkUpdateUsersGroupsOK() *BulkUpdateUsersGroupsOK { return &BulkUpdateUsersGroupsOK{} } // WriteResponse to the client func (o *BulkUpdateUsersGroupsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(200) } /* BulkUpdateUsersGroupsDefault Generic error response. swagger:response bulkUpdateUsersGroupsDefault */ type BulkUpdateUsersGroupsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewBulkUpdateUsersGroupsDefault creates BulkUpdateUsersGroupsDefault with default headers values func NewBulkUpdateUsersGroupsDefault(code int) *BulkUpdateUsersGroupsDefault { if code <= 0 { code = 500 } return &BulkUpdateUsersGroupsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the bulk update users groups default response func (o *BulkUpdateUsersGroupsDefault) WithStatusCode(code int) *BulkUpdateUsersGroupsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the bulk update users groups default response func (o *BulkUpdateUsersGroupsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the bulk update users groups default response func (o *BulkUpdateUsersGroupsDefault) WithPayload(payload *models.APIError) *BulkUpdateUsersGroupsDefault { o.Payload = payload return o } // SetPayload sets the payload to the bulk update users groups default response func (o *BulkUpdateUsersGroupsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *BulkUpdateUsersGroupsDefault) 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 } } } ================================================ FILE: api/operations/user/bulk_update_users_groups_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" ) // BulkUpdateUsersGroupsURL generates an URL for the bulk update users groups operation type BulkUpdateUsersGroupsURL 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 *BulkUpdateUsersGroupsURL) WithBasePath(bp string) *BulkUpdateUsersGroupsURL { 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 *BulkUpdateUsersGroupsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *BulkUpdateUsersGroupsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/users-groups-bulk" _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 *BulkUpdateUsersGroupsURL) 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 *BulkUpdateUsersGroupsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *BulkUpdateUsersGroupsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on BulkUpdateUsersGroupsURL") } if host == "" { return nil, errors.New("host is required for a full url on BulkUpdateUsersGroupsURL") } 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 *BulkUpdateUsersGroupsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/check_user_service_accounts.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // CheckUserServiceAccountsHandlerFunc turns a function with the right signature into a check user service accounts handler type CheckUserServiceAccountsHandlerFunc func(CheckUserServiceAccountsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn CheckUserServiceAccountsHandlerFunc) Handle(params CheckUserServiceAccountsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // CheckUserServiceAccountsHandler interface for that can handle valid check user service accounts params type CheckUserServiceAccountsHandler interface { Handle(CheckUserServiceAccountsParams, *models.Principal) middleware.Responder } // NewCheckUserServiceAccounts creates a new http.Handler for the check user service accounts operation func NewCheckUserServiceAccounts(ctx *middleware.Context, handler CheckUserServiceAccountsHandler) *CheckUserServiceAccounts { return &CheckUserServiceAccounts{Context: ctx, Handler: handler} } /* CheckUserServiceAccounts swagger:route POST /users/service-accounts User checkUserServiceAccounts Check number of service accounts for each user specified */ type CheckUserServiceAccounts struct { Context *middleware.Context Handler CheckUserServiceAccountsHandler } func (o *CheckUserServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewCheckUserServiceAccountsParams() 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) } ================================================ FILE: api/operations/user/check_user_service_accounts_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( stderrors "errors" "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" ) // NewCheckUserServiceAccountsParams creates a new CheckUserServiceAccountsParams object // // There are no default values defined in the spec. func NewCheckUserServiceAccountsParams() CheckUserServiceAccountsParams { return CheckUserServiceAccountsParams{} } // CheckUserServiceAccountsParams contains all the bound params for the check user service accounts operation // typically these are obtained from a http.Request // // swagger:parameters CheckUserServiceAccounts type CheckUserServiceAccountsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ SelectedUsers models.SelectedUsers } // 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 NewCheckUserServiceAccountsParams() beforehand. func (o *CheckUserServiceAccountsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.SelectedUsers if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(err, io.EOF) { res = append(res, errors.Required("selectedUsers", "body", "")) } else { res = append(res, errors.NewParseError("selectedUsers", "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.SelectedUsers = body } } } else { res = append(res, errors.Required("selectedUsers", "body", "")) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: api/operations/user/check_user_service_accounts_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // CheckUserServiceAccountsOKCode is the HTTP code returned for type CheckUserServiceAccountsOK const CheckUserServiceAccountsOKCode int = 200 /* CheckUserServiceAccountsOK A successful response. swagger:response checkUserServiceAccountsOK */ type CheckUserServiceAccountsOK struct { /* In: Body */ Payload *models.UserServiceAccountSummary `json:"body,omitempty"` } // NewCheckUserServiceAccountsOK creates CheckUserServiceAccountsOK with default headers values func NewCheckUserServiceAccountsOK() *CheckUserServiceAccountsOK { return &CheckUserServiceAccountsOK{} } // WithPayload adds the payload to the check user service accounts o k response func (o *CheckUserServiceAccountsOK) WithPayload(payload *models.UserServiceAccountSummary) *CheckUserServiceAccountsOK { o.Payload = payload return o } // SetPayload sets the payload to the check user service accounts o k response func (o *CheckUserServiceAccountsOK) SetPayload(payload *models.UserServiceAccountSummary) { o.Payload = payload } // WriteResponse to the client func (o *CheckUserServiceAccountsOK) 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 } } } /* CheckUserServiceAccountsDefault Generic error response. swagger:response checkUserServiceAccountsDefault */ type CheckUserServiceAccountsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewCheckUserServiceAccountsDefault creates CheckUserServiceAccountsDefault with default headers values func NewCheckUserServiceAccountsDefault(code int) *CheckUserServiceAccountsDefault { if code <= 0 { code = 500 } return &CheckUserServiceAccountsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the check user service accounts default response func (o *CheckUserServiceAccountsDefault) WithStatusCode(code int) *CheckUserServiceAccountsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the check user service accounts default response func (o *CheckUserServiceAccountsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the check user service accounts default response func (o *CheckUserServiceAccountsDefault) WithPayload(payload *models.APIError) *CheckUserServiceAccountsDefault { o.Payload = payload return o } // SetPayload sets the payload to the check user service accounts default response func (o *CheckUserServiceAccountsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *CheckUserServiceAccountsDefault) 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 } } } ================================================ FILE: api/operations/user/check_user_service_accounts_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" ) // CheckUserServiceAccountsURL generates an URL for the check user service accounts operation type CheckUserServiceAccountsURL 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 *CheckUserServiceAccountsURL) WithBasePath(bp string) *CheckUserServiceAccountsURL { 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 *CheckUserServiceAccountsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *CheckUserServiceAccountsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/users/service-accounts" _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 *CheckUserServiceAccountsURL) 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 *CheckUserServiceAccountsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *CheckUserServiceAccountsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on CheckUserServiceAccountsURL") } if host == "" { return nil, errors.New("host is required for a full url on CheckUserServiceAccountsURL") } 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 *CheckUserServiceAccountsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/create_a_user_service_account.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // CreateAUserServiceAccountHandlerFunc turns a function with the right signature into a create a user service account handler type CreateAUserServiceAccountHandlerFunc func(CreateAUserServiceAccountParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn CreateAUserServiceAccountHandlerFunc) Handle(params CreateAUserServiceAccountParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // CreateAUserServiceAccountHandler interface for that can handle valid create a user service account params type CreateAUserServiceAccountHandler interface { Handle(CreateAUserServiceAccountParams, *models.Principal) middleware.Responder } // NewCreateAUserServiceAccount creates a new http.Handler for the create a user service account operation func NewCreateAUserServiceAccount(ctx *middleware.Context, handler CreateAUserServiceAccountHandler) *CreateAUserServiceAccount { return &CreateAUserServiceAccount{Context: ctx, Handler: handler} } /* CreateAUserServiceAccount swagger:route POST /user/{name}/service-accounts User createAUserServiceAccount Create Service Account for User */ type CreateAUserServiceAccount struct { Context *middleware.Context Handler CreateAUserServiceAccountHandler } func (o *CreateAUserServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewCreateAUserServiceAccountParams() 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) } ================================================ FILE: api/operations/user/create_a_user_service_account_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( stderrors "errors" "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" ) // NewCreateAUserServiceAccountParams creates a new CreateAUserServiceAccountParams object // // There are no default values defined in the spec. func NewCreateAUserServiceAccountParams() CreateAUserServiceAccountParams { return CreateAUserServiceAccountParams{} } // CreateAUserServiceAccountParams contains all the bound params for the create a user service account operation // typically these are obtained from a http.Request // // swagger:parameters CreateAUserServiceAccount type CreateAUserServiceAccountParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.ServiceAccountRequest /* Required: true In: path */ Name 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 NewCreateAUserServiceAccountParams() beforehand. func (o *CreateAUserServiceAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.ServiceAccountRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *CreateAUserServiceAccountParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/user/create_a_user_service_account_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // CreateAUserServiceAccountCreatedCode is the HTTP code returned for type CreateAUserServiceAccountCreated const CreateAUserServiceAccountCreatedCode int = 201 /* CreateAUserServiceAccountCreated A successful response. swagger:response createAUserServiceAccountCreated */ type CreateAUserServiceAccountCreated struct { /* In: Body */ Payload *models.ServiceAccountCreds `json:"body,omitempty"` } // NewCreateAUserServiceAccountCreated creates CreateAUserServiceAccountCreated with default headers values func NewCreateAUserServiceAccountCreated() *CreateAUserServiceAccountCreated { return &CreateAUserServiceAccountCreated{} } // WithPayload adds the payload to the create a user service account created response func (o *CreateAUserServiceAccountCreated) WithPayload(payload *models.ServiceAccountCreds) *CreateAUserServiceAccountCreated { o.Payload = payload return o } // SetPayload sets the payload to the create a user service account created response func (o *CreateAUserServiceAccountCreated) SetPayload(payload *models.ServiceAccountCreds) { o.Payload = payload } // WriteResponse to the client func (o *CreateAUserServiceAccountCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(201) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } } /* CreateAUserServiceAccountDefault Generic error response. swagger:response createAUserServiceAccountDefault */ type CreateAUserServiceAccountDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewCreateAUserServiceAccountDefault creates CreateAUserServiceAccountDefault with default headers values func NewCreateAUserServiceAccountDefault(code int) *CreateAUserServiceAccountDefault { if code <= 0 { code = 500 } return &CreateAUserServiceAccountDefault{ _statusCode: code, } } // WithStatusCode adds the status to the create a user service account default response func (o *CreateAUserServiceAccountDefault) WithStatusCode(code int) *CreateAUserServiceAccountDefault { o._statusCode = code return o } // SetStatusCode sets the status to the create a user service account default response func (o *CreateAUserServiceAccountDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the create a user service account default response func (o *CreateAUserServiceAccountDefault) WithPayload(payload *models.APIError) *CreateAUserServiceAccountDefault { o.Payload = payload return o } // SetPayload sets the payload to the create a user service account default response func (o *CreateAUserServiceAccountDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *CreateAUserServiceAccountDefault) 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 } } } ================================================ FILE: api/operations/user/create_a_user_service_account_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // CreateAUserServiceAccountURL generates an URL for the create a user service account operation type CreateAUserServiceAccountURL struct { Name 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 *CreateAUserServiceAccountURL) WithBasePath(bp string) *CreateAUserServiceAccountURL { 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 *CreateAUserServiceAccountURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *CreateAUserServiceAccountURL) Build() (*url.URL, error) { var _result url.URL var _path = "/user/{name}/service-accounts" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on CreateAUserServiceAccountURL") } _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 *CreateAUserServiceAccountURL) 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 *CreateAUserServiceAccountURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *CreateAUserServiceAccountURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on CreateAUserServiceAccountURL") } if host == "" { return nil, errors.New("host is required for a full url on CreateAUserServiceAccountURL") } 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 *CreateAUserServiceAccountURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/create_service_account_credentials.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // CreateServiceAccountCredentialsHandlerFunc turns a function with the right signature into a create service account credentials handler type CreateServiceAccountCredentialsHandlerFunc func(CreateServiceAccountCredentialsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn CreateServiceAccountCredentialsHandlerFunc) Handle(params CreateServiceAccountCredentialsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // CreateServiceAccountCredentialsHandler interface for that can handle valid create service account credentials params type CreateServiceAccountCredentialsHandler interface { Handle(CreateServiceAccountCredentialsParams, *models.Principal) middleware.Responder } // NewCreateServiceAccountCredentials creates a new http.Handler for the create service account credentials operation func NewCreateServiceAccountCredentials(ctx *middleware.Context, handler CreateServiceAccountCredentialsHandler) *CreateServiceAccountCredentials { return &CreateServiceAccountCredentials{Context: ctx, Handler: handler} } /* CreateServiceAccountCredentials swagger:route POST /user/{name}/service-account-credentials User createServiceAccountCredentials Create Service Account for User With Credentials */ type CreateServiceAccountCredentials struct { Context *middleware.Context Handler CreateServiceAccountCredentialsHandler } func (o *CreateServiceAccountCredentials) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewCreateServiceAccountCredentialsParams() 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) } ================================================ FILE: api/operations/user/create_service_account_credentials_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( stderrors "errors" "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" ) // NewCreateServiceAccountCredentialsParams creates a new CreateServiceAccountCredentialsParams object // // There are no default values defined in the spec. func NewCreateServiceAccountCredentialsParams() CreateServiceAccountCredentialsParams { return CreateServiceAccountCredentialsParams{} } // CreateServiceAccountCredentialsParams contains all the bound params for the create service account credentials operation // typically these are obtained from a http.Request // // swagger:parameters CreateServiceAccountCredentials type CreateServiceAccountCredentialsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.ServiceAccountRequestCreds /* Required: true In: path */ Name 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 NewCreateServiceAccountCredentialsParams() beforehand. func (o *CreateServiceAccountCredentialsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.ServiceAccountRequestCreds if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *CreateServiceAccountCredentialsParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/user/create_service_account_credentials_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // CreateServiceAccountCredentialsCreatedCode is the HTTP code returned for type CreateServiceAccountCredentialsCreated const CreateServiceAccountCredentialsCreatedCode int = 201 /* CreateServiceAccountCredentialsCreated A successful response. swagger:response createServiceAccountCredentialsCreated */ type CreateServiceAccountCredentialsCreated struct { /* In: Body */ Payload *models.ServiceAccountCreds `json:"body,omitempty"` } // NewCreateServiceAccountCredentialsCreated creates CreateServiceAccountCredentialsCreated with default headers values func NewCreateServiceAccountCredentialsCreated() *CreateServiceAccountCredentialsCreated { return &CreateServiceAccountCredentialsCreated{} } // WithPayload adds the payload to the create service account credentials created response func (o *CreateServiceAccountCredentialsCreated) WithPayload(payload *models.ServiceAccountCreds) *CreateServiceAccountCredentialsCreated { o.Payload = payload return o } // SetPayload sets the payload to the create service account credentials created response func (o *CreateServiceAccountCredentialsCreated) SetPayload(payload *models.ServiceAccountCreds) { o.Payload = payload } // WriteResponse to the client func (o *CreateServiceAccountCredentialsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(201) if o.Payload != nil { payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } } /* CreateServiceAccountCredentialsDefault Generic error response. swagger:response createServiceAccountCredentialsDefault */ type CreateServiceAccountCredentialsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewCreateServiceAccountCredentialsDefault creates CreateServiceAccountCredentialsDefault with default headers values func NewCreateServiceAccountCredentialsDefault(code int) *CreateServiceAccountCredentialsDefault { if code <= 0 { code = 500 } return &CreateServiceAccountCredentialsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the create service account credentials default response func (o *CreateServiceAccountCredentialsDefault) WithStatusCode(code int) *CreateServiceAccountCredentialsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the create service account credentials default response func (o *CreateServiceAccountCredentialsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the create service account credentials default response func (o *CreateServiceAccountCredentialsDefault) WithPayload(payload *models.APIError) *CreateServiceAccountCredentialsDefault { o.Payload = payload return o } // SetPayload sets the payload to the create service account credentials default response func (o *CreateServiceAccountCredentialsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *CreateServiceAccountCredentialsDefault) 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 } } } ================================================ FILE: api/operations/user/create_service_account_credentials_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // CreateServiceAccountCredentialsURL generates an URL for the create service account credentials operation type CreateServiceAccountCredentialsURL struct { Name 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 *CreateServiceAccountCredentialsURL) WithBasePath(bp string) *CreateServiceAccountCredentialsURL { 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 *CreateServiceAccountCredentialsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *CreateServiceAccountCredentialsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/user/{name}/service-account-credentials" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on CreateServiceAccountCredentialsURL") } _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 *CreateServiceAccountCredentialsURL) 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 *CreateServiceAccountCredentialsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *CreateServiceAccountCredentialsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on CreateServiceAccountCredentialsURL") } if host == "" { return nil, errors.New("host is required for a full url on CreateServiceAccountCredentialsURL") } 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 *CreateServiceAccountCredentialsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/get_user_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // GetUserInfoHandlerFunc turns a function with the right signature into a get user info handler type GetUserInfoHandlerFunc func(GetUserInfoParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn GetUserInfoHandlerFunc) Handle(params GetUserInfoParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // GetUserInfoHandler interface for that can handle valid get user info params type GetUserInfoHandler interface { Handle(GetUserInfoParams, *models.Principal) middleware.Responder } // NewGetUserInfo creates a new http.Handler for the get user info operation func NewGetUserInfo(ctx *middleware.Context, handler GetUserInfoHandler) *GetUserInfo { return &GetUserInfo{Context: ctx, Handler: handler} } /* GetUserInfo swagger:route GET /user/{name} User getUserInfo Get User Info */ type GetUserInfo struct { Context *middleware.Context Handler GetUserInfoHandler } func (o *GetUserInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewGetUserInfoParams() 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) } ================================================ FILE: api/operations/user/get_user_info_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewGetUserInfoParams creates a new GetUserInfoParams object // // There are no default values defined in the spec. func NewGetUserInfoParams() GetUserInfoParams { return GetUserInfoParams{} } // GetUserInfoParams contains all the bound params for the get user info operation // typically these are obtained from a http.Request // // swagger:parameters GetUserInfo type GetUserInfoParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewGetUserInfoParams() beforehand. func (o *GetUserInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *GetUserInfoParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/user/get_user_info_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // GetUserInfoOKCode is the HTTP code returned for type GetUserInfoOK const GetUserInfoOKCode int = 200 /* GetUserInfoOK A successful response. swagger:response getUserInfoOK */ type GetUserInfoOK struct { /* In: Body */ Payload *models.User `json:"body,omitempty"` } // NewGetUserInfoOK creates GetUserInfoOK with default headers values func NewGetUserInfoOK() *GetUserInfoOK { return &GetUserInfoOK{} } // WithPayload adds the payload to the get user info o k response func (o *GetUserInfoOK) WithPayload(payload *models.User) *GetUserInfoOK { o.Payload = payload return o } // SetPayload sets the payload to the get user info o k response func (o *GetUserInfoOK) SetPayload(payload *models.User) { o.Payload = payload } // WriteResponse to the client func (o *GetUserInfoOK) 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 } } } /* GetUserInfoDefault Generic error response. swagger:response getUserInfoDefault */ type GetUserInfoDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewGetUserInfoDefault creates GetUserInfoDefault with default headers values func NewGetUserInfoDefault(code int) *GetUserInfoDefault { if code <= 0 { code = 500 } return &GetUserInfoDefault{ _statusCode: code, } } // WithStatusCode adds the status to the get user info default response func (o *GetUserInfoDefault) WithStatusCode(code int) *GetUserInfoDefault { o._statusCode = code return o } // SetStatusCode sets the status to the get user info default response func (o *GetUserInfoDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the get user info default response func (o *GetUserInfoDefault) WithPayload(payload *models.APIError) *GetUserInfoDefault { o.Payload = payload return o } // SetPayload sets the payload to the get user info default response func (o *GetUserInfoDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *GetUserInfoDefault) 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 } } } ================================================ FILE: api/operations/user/get_user_info_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // GetUserInfoURL generates an URL for the get user info operation type GetUserInfoURL struct { Name 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 *GetUserInfoURL) WithBasePath(bp string) *GetUserInfoURL { 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 *GetUserInfoURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *GetUserInfoURL) Build() (*url.URL, error) { var _result url.URL var _path = "/user/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on GetUserInfoURL") } _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 *GetUserInfoURL) 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 *GetUserInfoURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *GetUserInfoURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on GetUserInfoURL") } if host == "" { return nil, errors.New("host is required for a full url on GetUserInfoURL") } 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 *GetUserInfoURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/list_a_user_service_accounts.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListAUserServiceAccountsHandlerFunc turns a function with the right signature into a list a user service accounts handler type ListAUserServiceAccountsHandlerFunc func(ListAUserServiceAccountsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListAUserServiceAccountsHandlerFunc) Handle(params ListAUserServiceAccountsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListAUserServiceAccountsHandler interface for that can handle valid list a user service accounts params type ListAUserServiceAccountsHandler interface { Handle(ListAUserServiceAccountsParams, *models.Principal) middleware.Responder } // NewListAUserServiceAccounts creates a new http.Handler for the list a user service accounts operation func NewListAUserServiceAccounts(ctx *middleware.Context, handler ListAUserServiceAccountsHandler) *ListAUserServiceAccounts { return &ListAUserServiceAccounts{Context: ctx, Handler: handler} } /* ListAUserServiceAccounts swagger:route GET /user/{name}/service-accounts User listAUserServiceAccounts returns a list of service accounts for a user */ type ListAUserServiceAccounts struct { Context *middleware.Context Handler ListAUserServiceAccountsHandler } func (o *ListAUserServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListAUserServiceAccountsParams() 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) } ================================================ FILE: api/operations/user/list_a_user_service_accounts_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewListAUserServiceAccountsParams creates a new ListAUserServiceAccountsParams object // // There are no default values defined in the spec. func NewListAUserServiceAccountsParams() ListAUserServiceAccountsParams { return ListAUserServiceAccountsParams{} } // ListAUserServiceAccountsParams contains all the bound params for the list a user service accounts operation // typically these are obtained from a http.Request // // swagger:parameters ListAUserServiceAccounts type ListAUserServiceAccountsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewListAUserServiceAccountsParams() beforehand. func (o *ListAUserServiceAccountsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *ListAUserServiceAccountsParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/user/list_a_user_service_accounts_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListAUserServiceAccountsOKCode is the HTTP code returned for type ListAUserServiceAccountsOK const ListAUserServiceAccountsOKCode int = 200 /* ListAUserServiceAccountsOK A successful response. swagger:response listAUserServiceAccountsOK */ type ListAUserServiceAccountsOK struct { /* In: Body */ Payload models.ServiceAccounts `json:"body,omitempty"` } // NewListAUserServiceAccountsOK creates ListAUserServiceAccountsOK with default headers values func NewListAUserServiceAccountsOK() *ListAUserServiceAccountsOK { return &ListAUserServiceAccountsOK{} } // WithPayload adds the payload to the list a user service accounts o k response func (o *ListAUserServiceAccountsOK) WithPayload(payload models.ServiceAccounts) *ListAUserServiceAccountsOK { o.Payload = payload return o } // SetPayload sets the payload to the list a user service accounts o k response func (o *ListAUserServiceAccountsOK) SetPayload(payload models.ServiceAccounts) { o.Payload = payload } // WriteResponse to the client func (o *ListAUserServiceAccountsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(200) payload := o.Payload if payload == nil { // return empty array payload = models.ServiceAccounts{} } if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } /* ListAUserServiceAccountsDefault Generic error response. swagger:response listAUserServiceAccountsDefault */ type ListAUserServiceAccountsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListAUserServiceAccountsDefault creates ListAUserServiceAccountsDefault with default headers values func NewListAUserServiceAccountsDefault(code int) *ListAUserServiceAccountsDefault { if code <= 0 { code = 500 } return &ListAUserServiceAccountsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list a user service accounts default response func (o *ListAUserServiceAccountsDefault) WithStatusCode(code int) *ListAUserServiceAccountsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list a user service accounts default response func (o *ListAUserServiceAccountsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list a user service accounts default response func (o *ListAUserServiceAccountsDefault) WithPayload(payload *models.APIError) *ListAUserServiceAccountsDefault { o.Payload = payload return o } // SetPayload sets the payload to the list a user service accounts default response func (o *ListAUserServiceAccountsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListAUserServiceAccountsDefault) 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 } } } ================================================ FILE: api/operations/user/list_a_user_service_accounts_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // ListAUserServiceAccountsURL generates an URL for the list a user service accounts operation type ListAUserServiceAccountsURL struct { Name 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 *ListAUserServiceAccountsURL) WithBasePath(bp string) *ListAUserServiceAccountsURL { 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 *ListAUserServiceAccountsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListAUserServiceAccountsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/user/{name}/service-accounts" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on ListAUserServiceAccountsURL") } _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 *ListAUserServiceAccountsURL) 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 *ListAUserServiceAccountsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListAUserServiceAccountsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListAUserServiceAccountsURL") } if host == "" { return nil, errors.New("host is required for a full url on ListAUserServiceAccountsURL") } 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 *ListAUserServiceAccountsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/list_users.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // ListUsersHandlerFunc turns a function with the right signature into a list users handler type ListUsersHandlerFunc func(ListUsersParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn ListUsersHandlerFunc) Handle(params ListUsersParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // ListUsersHandler interface for that can handle valid list users params type ListUsersHandler interface { Handle(ListUsersParams, *models.Principal) middleware.Responder } // NewListUsers creates a new http.Handler for the list users operation func NewListUsers(ctx *middleware.Context, handler ListUsersHandler) *ListUsers { return &ListUsers{Context: ctx, Handler: handler} } /* ListUsers swagger:route GET /users User listUsers List Users */ type ListUsers struct { Context *middleware.Context Handler ListUsersHandler } func (o *ListUsers) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewListUsersParams() 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) } ================================================ FILE: api/operations/user/list_users_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 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" ) // NewListUsersParams creates a new ListUsersParams object // with the default values initialized. func NewListUsersParams() ListUsersParams { var ( // initialize parameters with default values limitDefault = int32(20) offsetDefault = int32(0) ) return ListUsersParams{ Limit: &limitDefault, Offset: &offsetDefault, } } // ListUsersParams contains all the bound params for the list users operation // typically these are obtained from a http.Request // // swagger:parameters ListUsers type ListUsersParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* In: query Default: 20 */ Limit *int32 /* In: query Default: 0 */ Offset *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 NewListUsersParams() beforehand. func (o *ListUsersParams) 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) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindLimit binds and validates parameter Limit from query. func (o *ListUsersParams) 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 // Default values have been previously initialized by NewListUsersParams() 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 *ListUsersParams) 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 // Default values have been previously initialized by NewListUsersParams() return nil } value, err := swag.ConvertInt32(raw) if err != nil { return errors.InvalidType("offset", "query", "int32", raw) } o.Offset = &value return nil } ================================================ FILE: api/operations/user/list_users_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // ListUsersOKCode is the HTTP code returned for type ListUsersOK const ListUsersOKCode int = 200 /* ListUsersOK A successful response. swagger:response listUsersOK */ type ListUsersOK struct { /* In: Body */ Payload *models.ListUsersResponse `json:"body,omitempty"` } // NewListUsersOK creates ListUsersOK with default headers values func NewListUsersOK() *ListUsersOK { return &ListUsersOK{} } // WithPayload adds the payload to the list users o k response func (o *ListUsersOK) WithPayload(payload *models.ListUsersResponse) *ListUsersOK { o.Payload = payload return o } // SetPayload sets the payload to the list users o k response func (o *ListUsersOK) SetPayload(payload *models.ListUsersResponse) { o.Payload = payload } // WriteResponse to the client func (o *ListUsersOK) 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 } } } /* ListUsersDefault Generic error response. swagger:response listUsersDefault */ type ListUsersDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewListUsersDefault creates ListUsersDefault with default headers values func NewListUsersDefault(code int) *ListUsersDefault { if code <= 0 { code = 500 } return &ListUsersDefault{ _statusCode: code, } } // WithStatusCode adds the status to the list users default response func (o *ListUsersDefault) WithStatusCode(code int) *ListUsersDefault { o._statusCode = code return o } // SetStatusCode sets the status to the list users default response func (o *ListUsersDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the list users default response func (o *ListUsersDefault) WithPayload(payload *models.APIError) *ListUsersDefault { o.Payload = payload return o } // SetPayload sets the payload to the list users default response func (o *ListUsersDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *ListUsersDefault) 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 } } } ================================================ FILE: api/operations/user/list_users_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" "github.com/go-openapi/swag" ) // ListUsersURL generates an URL for the list users operation type ListUsersURL struct { Limit *int32 Offset *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 *ListUsersURL) WithBasePath(bp string) *ListUsersURL { 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 *ListUsersURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *ListUsersURL) Build() (*url.URL, error) { var _result url.URL var _path = "/users" _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) } _result.RawQuery = qs.Encode() return &_result, nil } // Must is a helper function to panic when the url builder returns an error func (o *ListUsersURL) 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 *ListUsersURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *ListUsersURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on ListUsersURL") } if host == "" { return nil, errors.New("host is required for a full url on ListUsersURL") } 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 *ListUsersURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/remove_user.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // RemoveUserHandlerFunc turns a function with the right signature into a remove user handler type RemoveUserHandlerFunc func(RemoveUserParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn RemoveUserHandlerFunc) Handle(params RemoveUserParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // RemoveUserHandler interface for that can handle valid remove user params type RemoveUserHandler interface { Handle(RemoveUserParams, *models.Principal) middleware.Responder } // NewRemoveUser creates a new http.Handler for the remove user operation func NewRemoveUser(ctx *middleware.Context, handler RemoveUserHandler) *RemoveUser { return &RemoveUser{Context: ctx, Handler: handler} } /* RemoveUser swagger:route DELETE /user/{name} User removeUser Remove user */ type RemoveUser struct { Context *middleware.Context Handler RemoveUserHandler } func (o *RemoveUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewRemoveUserParams() 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) } ================================================ FILE: api/operations/user/remove_user_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" ) // NewRemoveUserParams creates a new RemoveUserParams object // // There are no default values defined in the spec. func NewRemoveUserParams() RemoveUserParams { return RemoveUserParams{} } // RemoveUserParams contains all the bound params for the remove user operation // typically these are obtained from a http.Request // // swagger:parameters RemoveUser type RemoveUserParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: path */ Name 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 NewRemoveUserParams() beforehand. func (o *RemoveUserParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *RemoveUserParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/user/remove_user_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // RemoveUserNoContentCode is the HTTP code returned for type RemoveUserNoContent const RemoveUserNoContentCode int = 204 /* RemoveUserNoContent A successful response. swagger:response removeUserNoContent */ type RemoveUserNoContent struct { } // NewRemoveUserNoContent creates RemoveUserNoContent with default headers values func NewRemoveUserNoContent() *RemoveUserNoContent { return &RemoveUserNoContent{} } // WriteResponse to the client func (o *RemoveUserNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses rw.WriteHeader(204) } /* RemoveUserDefault Generic error response. swagger:response removeUserDefault */ type RemoveUserDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewRemoveUserDefault creates RemoveUserDefault with default headers values func NewRemoveUserDefault(code int) *RemoveUserDefault { if code <= 0 { code = 500 } return &RemoveUserDefault{ _statusCode: code, } } // WithStatusCode adds the status to the remove user default response func (o *RemoveUserDefault) WithStatusCode(code int) *RemoveUserDefault { o._statusCode = code return o } // SetStatusCode sets the status to the remove user default response func (o *RemoveUserDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the remove user default response func (o *RemoveUserDefault) WithPayload(payload *models.APIError) *RemoveUserDefault { o.Payload = payload return o } // SetPayload sets the payload to the remove user default response func (o *RemoveUserDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *RemoveUserDefault) 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 } } } ================================================ FILE: api/operations/user/remove_user_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // RemoveUserURL generates an URL for the remove user operation type RemoveUserURL struct { Name 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 *RemoveUserURL) WithBasePath(bp string) *RemoveUserURL { 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 *RemoveUserURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *RemoveUserURL) Build() (*url.URL, error) { var _result url.URL var _path = "/user/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on RemoveUserURL") } _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 *RemoveUserURL) 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 *RemoveUserURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *RemoveUserURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on RemoveUserURL") } if host == "" { return nil, errors.New("host is required for a full url on RemoveUserURL") } 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 *RemoveUserURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/update_user_groups.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // UpdateUserGroupsHandlerFunc turns a function with the right signature into a update user groups handler type UpdateUserGroupsHandlerFunc func(UpdateUserGroupsParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn UpdateUserGroupsHandlerFunc) Handle(params UpdateUserGroupsParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // UpdateUserGroupsHandler interface for that can handle valid update user groups params type UpdateUserGroupsHandler interface { Handle(UpdateUserGroupsParams, *models.Principal) middleware.Responder } // NewUpdateUserGroups creates a new http.Handler for the update user groups operation func NewUpdateUserGroups(ctx *middleware.Context, handler UpdateUserGroupsHandler) *UpdateUserGroups { return &UpdateUserGroups{Context: ctx, Handler: handler} } /* UpdateUserGroups swagger:route PUT /user/{name}/groups User updateUserGroups Update Groups for a user */ type UpdateUserGroups struct { Context *middleware.Context Handler UpdateUserGroupsHandler } func (o *UpdateUserGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewUpdateUserGroupsParams() 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) } ================================================ FILE: api/operations/user/update_user_groups_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( stderrors "errors" "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" ) // NewUpdateUserGroupsParams creates a new UpdateUserGroupsParams object // // There are no default values defined in the spec. func NewUpdateUserGroupsParams() UpdateUserGroupsParams { return UpdateUserGroupsParams{} } // UpdateUserGroupsParams contains all the bound params for the update user groups operation // typically these are obtained from a http.Request // // swagger:parameters UpdateUserGroups type UpdateUserGroupsParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.UpdateUserGroups /* Required: true In: path */ Name 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 NewUpdateUserGroupsParams() beforehand. func (o *UpdateUserGroupsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.UpdateUserGroups if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *UpdateUserGroupsParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/user/update_user_groups_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // UpdateUserGroupsOKCode is the HTTP code returned for type UpdateUserGroupsOK const UpdateUserGroupsOKCode int = 200 /* UpdateUserGroupsOK A successful response. swagger:response updateUserGroupsOK */ type UpdateUserGroupsOK struct { /* In: Body */ Payload *models.User `json:"body,omitempty"` } // NewUpdateUserGroupsOK creates UpdateUserGroupsOK with default headers values func NewUpdateUserGroupsOK() *UpdateUserGroupsOK { return &UpdateUserGroupsOK{} } // WithPayload adds the payload to the update user groups o k response func (o *UpdateUserGroupsOK) WithPayload(payload *models.User) *UpdateUserGroupsOK { o.Payload = payload return o } // SetPayload sets the payload to the update user groups o k response func (o *UpdateUserGroupsOK) SetPayload(payload *models.User) { o.Payload = payload } // WriteResponse to the client func (o *UpdateUserGroupsOK) 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 } } } /* UpdateUserGroupsDefault Generic error response. swagger:response updateUserGroupsDefault */ type UpdateUserGroupsDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewUpdateUserGroupsDefault creates UpdateUserGroupsDefault with default headers values func NewUpdateUserGroupsDefault(code int) *UpdateUserGroupsDefault { if code <= 0 { code = 500 } return &UpdateUserGroupsDefault{ _statusCode: code, } } // WithStatusCode adds the status to the update user groups default response func (o *UpdateUserGroupsDefault) WithStatusCode(code int) *UpdateUserGroupsDefault { o._statusCode = code return o } // SetStatusCode sets the status to the update user groups default response func (o *UpdateUserGroupsDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the update user groups default response func (o *UpdateUserGroupsDefault) WithPayload(payload *models.APIError) *UpdateUserGroupsDefault { o.Payload = payload return o } // SetPayload sets the payload to the update user groups default response func (o *UpdateUserGroupsDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *UpdateUserGroupsDefault) 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 } } } ================================================ FILE: api/operations/user/update_user_groups_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // UpdateUserGroupsURL generates an URL for the update user groups operation type UpdateUserGroupsURL struct { Name 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 *UpdateUserGroupsURL) WithBasePath(bp string) *UpdateUserGroupsURL { 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 *UpdateUserGroupsURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *UpdateUserGroupsURL) Build() (*url.URL, error) { var _result url.URL var _path = "/user/{name}/groups" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on UpdateUserGroupsURL") } _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 *UpdateUserGroupsURL) 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 *UpdateUserGroupsURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *UpdateUserGroupsURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on UpdateUserGroupsURL") } if host == "" { return nil, errors.New("host is required for a full url on UpdateUserGroupsURL") } 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 *UpdateUserGroupsURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/operations/user/update_user_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/models" ) // UpdateUserInfoHandlerFunc turns a function with the right signature into a update user info handler type UpdateUserInfoHandlerFunc func(UpdateUserInfoParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response func (fn UpdateUserInfoHandlerFunc) Handle(params UpdateUserInfoParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } // UpdateUserInfoHandler interface for that can handle valid update user info params type UpdateUserInfoHandler interface { Handle(UpdateUserInfoParams, *models.Principal) middleware.Responder } // NewUpdateUserInfo creates a new http.Handler for the update user info operation func NewUpdateUserInfo(ctx *middleware.Context, handler UpdateUserInfoHandler) *UpdateUserInfo { return &UpdateUserInfo{Context: ctx, Handler: handler} } /* UpdateUserInfo swagger:route PUT /user/{name} User updateUserInfo Update User Info */ type UpdateUserInfo struct { Context *middleware.Context Handler UpdateUserInfoHandler } func (o *UpdateUserInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } var Params = NewUpdateUserInfoParams() 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) } ================================================ FILE: api/operations/user/update_user_info_parameters.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( stderrors "errors" "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" ) // NewUpdateUserInfoParams creates a new UpdateUserInfoParams object // // There are no default values defined in the spec. func NewUpdateUserInfoParams() UpdateUserInfoParams { return UpdateUserInfoParams{} } // UpdateUserInfoParams contains all the bound params for the update user info operation // typically these are obtained from a http.Request // // swagger:parameters UpdateUserInfo type UpdateUserInfoParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` /* Required: true In: body */ Body *models.UpdateUser /* Required: true In: path */ Name 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 NewUpdateUserInfoParams() beforehand. func (o *UpdateUserInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer func() { _ = r.Body.Close() }() var body models.UpdateUser if err := route.Consumer.Consume(r.Body, &body); err != nil { if stderrors.Is(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", "")) } rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindName binds and validates parameter Name from path. func (o *UpdateUserInfoParams) bindName(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.Name = raw return nil } ================================================ FILE: api/operations/user/update_user_info_responses.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "net/http" "github.com/go-openapi/runtime" "github.com/minio/console/models" ) // UpdateUserInfoOKCode is the HTTP code returned for type UpdateUserInfoOK const UpdateUserInfoOKCode int = 200 /* UpdateUserInfoOK A successful response. swagger:response updateUserInfoOK */ type UpdateUserInfoOK struct { /* In: Body */ Payload *models.User `json:"body,omitempty"` } // NewUpdateUserInfoOK creates UpdateUserInfoOK with default headers values func NewUpdateUserInfoOK() *UpdateUserInfoOK { return &UpdateUserInfoOK{} } // WithPayload adds the payload to the update user info o k response func (o *UpdateUserInfoOK) WithPayload(payload *models.User) *UpdateUserInfoOK { o.Payload = payload return o } // SetPayload sets the payload to the update user info o k response func (o *UpdateUserInfoOK) SetPayload(payload *models.User) { o.Payload = payload } // WriteResponse to the client func (o *UpdateUserInfoOK) 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 } } } /* UpdateUserInfoDefault Generic error response. swagger:response updateUserInfoDefault */ type UpdateUserInfoDefault struct { _statusCode int /* In: Body */ Payload *models.APIError `json:"body,omitempty"` } // NewUpdateUserInfoDefault creates UpdateUserInfoDefault with default headers values func NewUpdateUserInfoDefault(code int) *UpdateUserInfoDefault { if code <= 0 { code = 500 } return &UpdateUserInfoDefault{ _statusCode: code, } } // WithStatusCode adds the status to the update user info default response func (o *UpdateUserInfoDefault) WithStatusCode(code int) *UpdateUserInfoDefault { o._statusCode = code return o } // SetStatusCode sets the status to the update user info default response func (o *UpdateUserInfoDefault) SetStatusCode(code int) { o._statusCode = code } // WithPayload adds the payload to the update user info default response func (o *UpdateUserInfoDefault) WithPayload(payload *models.APIError) *UpdateUserInfoDefault { o.Payload = payload return o } // SetPayload sets the payload to the update user info default response func (o *UpdateUserInfoDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client func (o *UpdateUserInfoDefault) 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 } } } ================================================ FILE: api/operations/user/update_user_info_urlbuilder.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "errors" "net/url" golangswaggerpaths "path" "strings" ) // UpdateUserInfoURL generates an URL for the update user info operation type UpdateUserInfoURL struct { Name 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 *UpdateUserInfoURL) WithBasePath(bp string) *UpdateUserInfoURL { 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 *UpdateUserInfoURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string func (o *UpdateUserInfoURL) Build() (*url.URL, error) { var _result url.URL var _path = "/user/{name}" name := o.Name if name != "" { _path = strings.ReplaceAll(_path, "{name}", name) } else { return nil, errors.New("name is required on UpdateUserInfoURL") } _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 *UpdateUserInfoURL) 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 *UpdateUserInfoURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string func (o *UpdateUserInfoURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { return nil, errors.New("scheme is required for a full url on UpdateUserInfoURL") } if host == "" { return nil, errors.New("host is required for a full url on UpdateUserInfoURL") } 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 *UpdateUserInfoURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } ================================================ FILE: api/policy/policies.go ================================================ // 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 policy import ( "bytes" "encoding/json" "fmt" "github.com/minio/madmin-go/v3" ) // ReplacePolicyVariables replaces known variables from policies with known values func ReplacePolicyVariables(claims map[string]interface{}, accountInfo *madmin.AccountInfo) json.RawMessage { // AWS Variables rawPolicy := bytes.ReplaceAll(accountInfo.Policy, []byte("${aws:username}"), []byte(accountInfo.AccountName)) rawPolicy = bytes.ReplaceAll(rawPolicy, []byte("${aws:userid}"), []byte(accountInfo.AccountName)) // JWT Variables rawPolicy = replaceJwtVariables(rawPolicy, claims) // LDAP Variables rawPolicy = replaceLDAPVariables(rawPolicy, claims) return rawPolicy } func replaceJwtVariables(rawPolicy []byte, claims map[string]interface{}) json.RawMessage { // list of valid JWT fields we will replace in policy if they are in the response jwtFields := []string{ "sub", "iss", "aud", "jti", "upn", "name", "groups", "given_name", "family_name", "middle_name", "nickname", "preferred_username", "profile", "picture", "website", "email", "gender", "birthdate", "phone_number", "address", "scope", "client_id", } // check which fields are in the claims and replace as variable by casting the value to string for _, field := range jwtFields { if val, ok := claims[field]; ok { variable := fmt.Sprintf("${jwt:%s}", field) rawPolicy = bytes.ReplaceAll(rawPolicy, []byte(variable), []byte(fmt.Sprintf("%v", val))) } } return rawPolicy } // ReplacePolicyVariables replaces known variables from policies with known values func replaceLDAPVariables(rawPolicy []byte, claims map[string]interface{}) json.RawMessage { // replace ${ldap:user} if val, ok := claims["ldapUser"]; ok { rawPolicy = bytes.ReplaceAll(rawPolicy, []byte("${ldap:user}"), []byte(fmt.Sprintf("%v", val))) } // replace ${ldap:username} if val, ok := claims["ldapUsername"]; ok { rawPolicy = bytes.ReplaceAll(rawPolicy, []byte("${ldap:username}"), []byte(fmt.Sprintf("%v", val))) } return rawPolicy } ================================================ FILE: api/policy/policies_test.go ================================================ // 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 policy import ( "bytes" "reflect" "testing" "github.com/minio/madmin-go/v3" minioIAMPolicy "github.com/minio/pkg/v3/policy" ) func TestReplacePolicyVariables(t *testing.T) { type args struct { claims map[string]interface{} accountInfo *madmin.AccountInfo } tests := []struct { name string args args want string wantErr bool }{ { name: "Bad Policy", args: args{ claims: nil, accountInfo: &madmin.AccountInfo{ AccountName: "test", Server: madmin.BackendInfo{}, Policy: []byte(""), Buckets: nil, }, }, want: "", wantErr: true, }, { name: "Replace basic AWS", args: args{ claims: nil, accountInfo: &madmin.AccountInfo{ AccountName: "test", Server: madmin.BackendInfo{}, Policy: []byte(`{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::${aws:username}", "arn:aws:s3:::${aws:userid}" ] } ] }`), Buckets: nil, }, }, want: `{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::test", "arn:aws:s3:::test" ] } ] }`, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { got := ReplacePolicyVariables(tt.args.claims, tt.args.accountInfo) policy, err := minioIAMPolicy.ParseConfig(bytes.NewReader(got)) if (err != nil) != tt.wantErr { t.Errorf("ReplacePolicyVariables() error = %v, wantErr %v", err, tt.wantErr) } wantPolicy, err := minioIAMPolicy.ParseConfig(bytes.NewReader([]byte(tt.want))) if (err != nil) != tt.wantErr { t.Errorf("ReplacePolicyVariables() error = %v, wantErr %v", err, tt.wantErr) } if !reflect.DeepEqual(policy, wantPolicy) { t.Errorf("ReplacePolicyVariables() = %s, want %v", got, tt.want) } }) } } ================================================ FILE: api/public_objects.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2024 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package api import ( "encoding/base64" "fmt" "io" "net/http" "net/url" "strings" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/swag" "github.com/minio/console/api/operations" "github.com/minio/console/api/operations/public" xnet "github.com/minio/pkg/v3/net" ) func registerPublicObjectsHandlers(api *operations.ConsoleAPI) { api.PublicDownloadSharedObjectHandler = public.DownloadSharedObjectHandlerFunc(func(params public.DownloadSharedObjectParams) middleware.Responder { resp, err := getDownloadPublicObjectResponse(params) if err != nil { return public.NewDownloadSharedObjectDefault(err.Code).WithPayload(err.APIError) } return resp }) } func getDownloadPublicObjectResponse(params public.DownloadSharedObjectParams) (middleware.Responder, *CodedAPIError) { ctx := params.HTTPRequest.Context() inputURLDecoded, err := decodeMinIOStringURL(params.URL) if err != nil { return nil, ErrorWithContext(ctx, err) } if inputURLDecoded == nil { return nil, ErrorWithContext(ctx, ErrDefault, fmt.Errorf("decoded url is null")) } req, err := http.NewRequest(http.MethodGet, *inputURLDecoded, nil) if err != nil { return nil, ErrorWithContext(ctx, err) } clnt := PrepareConsoleHTTPClient(getClientIP(params.HTTPRequest)) resp, err := clnt.Do(req) if err != nil { return nil, ErrorWithContext(ctx, err) } return middleware.ResponderFunc(func(rw http.ResponseWriter, _ runtime.Producer) { defer resp.Body.Close() if resp.StatusCode != http.StatusOK { http.Error(rw, resp.Status, resp.StatusCode) return } urlObj, err := url.Parse(*inputURLDecoded) if err != nil { http.Error(rw, "Internal Server Error", http.StatusInternalServerError) return } // Add the filename _, objectName := url2BucketAndObject(urlObj) escapedName := url.PathEscape(objectName) rw.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", escapedName)) _, err = io.Copy(rw, resp.Body) if err != nil { http.Error(rw, "Internal Server Error", http.StatusInternalServerError) return } }), nil } // decodeMinIOStringURL decodes url and validates is a MinIO url endpoint func decodeMinIOStringURL(inputURL string) (*string, error) { decodedURL, err := base64.RawURLEncoding.DecodeString(inputURL) if err != nil { return nil, err } // Validate input URL parsedURL, err := xnet.ParseHTTPURL(string(decodedURL)) if err != nil { return nil, err } // Ensure incoming url points to MinIO Server minIOHost := getMinIOEndpoint() if parsedURL.Host != minIOHost { return nil, ErrForbidden } return swag.String(string(decodedURL)), nil } func url2BucketAndObject(u *url.URL) (bucketName, objectName string) { tokens := splitStr(u.Path, "/", 3) return tokens[1], tokens[2] } // splitStr splits a string into n parts, empty strings are added // if we are not able to reach n elements func splitStr(path, sep string, n int) []string { splits := strings.SplitN(path, sep, n) // Add empty strings if we found elements less than nr for i := n - len(splits); i > 0; i-- { splits = append(splits, "") } return splits } ================================================ FILE: api/public_objects_test.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2024 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package api import ( "testing" "github.com/go-openapi/swag" "github.com/stretchr/testify/assert" ) func Test_decodeMinIOStringURL(t *testing.T) { tAssert := assert.New(t) type args struct { encodedURL string } tests := []struct { test string args args wantError *string expected *string }{ { test: "valid encoded minIO URL returns decoded URL string", // http://localhost:9000/... args: args{ encodedURL: "aHR0cDovL2xvY2FsaG9zdDo5MDAwL2J1Y2tldDEyMy9BdWRpbyUyMGljb24lMjgxJTI5LnN2Zz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPVVCTzFMMUM3VTg3UDFCUDI1MVRTJTJGMjAyNDA0MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDA1VDIxMDEzM1omWC1BbXotRXhwaXJlcz00MzIwMCZYLUFtei1TZWN1cml0eS1Ub2tlbj1leUpoYkdjaU9pSklVelV4TWlJc0luUjVjQ0k2SWtwWFZDSjkuZXlKaFkyTmxjM05MWlhraU9pSlZRazh4VERGRE4xVTROMUF4UWxBeU5URlVVeUlzSW1WNGNDSTZNVGN4TWpNNU5EQTRPU3dpY0dGeVpXNTBJam9pYldsdWFXOWhaRzFwYmlKOS5WLUtEZ3JMTVVCbG5KSEtYNlZ4SGw5LUFfLVBGRVdvazJkcFRxLTQ2YmxMbUxzdWVUeHNoVmFZNERad0dmb200VFQ1azhwaFVmZ2pjUWFuc25icmtlQSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmdmVyc2lvbklkPW51bGwmWC1BbXotU2lnbmF0dXJlPTA3Y2FkM2ViMmE2NzIyYjViYWVkMDljNmYxZmU0YTcwMWJmMTJmNDhlMTYyOGI5ZDQ1YzAxMWQ1OTU1Njc4NDU", }, wantError: nil, expected: swag.String("http://localhost:9000/bucket123/Audio%20icon%281%29.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=UBO1L1C7U87P1BP251TS%2F20240405%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240405T210133Z&X-Amz-Expires=43200&X-Amz-Security-Token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiJVQk8xTDFDN1U4N1AxQlAyNTFUUyIsImV4cCI6MTcxMjM5NDA4OSwicGFyZW50IjoibWluaW9hZG1pbiJ9.V-KDgrLMUBlnJHKX6VxHl9-A_-PFEWok2dpTq-46blLmLsueTxshVaY4DZwGfom4TT5k8phUfgjcQansnbrkeA&X-Amz-SignedHeaders=host&versionId=null&X-Amz-Signature=07cad3eb2a6722b5baed09c6f1fe4a701bf12f48e1628b9d45c011d595567845"), }, { test: "valid encoded url but not coming from MinIO server returns forbidden error", // http://non-minio-host:9000/... args: args{ encodedURL: "aHR0cDovL25vbi1taW5pby1ob3N0OjkwMDAvYnVja2V0MTIzL0F1ZGlvJTIwaWNvbiUyODElMjkuc3ZnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9VUJPMUwxQzdVODdQMUJQMjUxVFMlMkYyMDI0MDQwNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA0MDVUMjEwMTMzWiZYLUFtei1FeHBpcmVzPTQzMjAwJlgtQW16LVNlY3VyaXR5LVRva2VuPWV5SmhiR2NpT2lKSVV6VXhNaUlzSW5SNWNDSTZJa3BYVkNKOS5leUpoWTJObGMzTkxaWGtpT2lKVlFrOHhUREZETjFVNE4xQXhRbEF5TlRGVVV5SXNJbVY0Y0NJNk1UY3hNak01TkRBNE9Td2ljR0Z5Wlc1MElqb2liV2x1YVc5aFpHMXBiaUo5LlYtS0RnckxNVUJsbkpIS1g2VnhIbDktQV8tUEZFV29rMmRwVHEtNDZibExtTHN1ZVR4c2hWYVk0RFp3R2ZvbTRUVDVrOHBoVWZnamNRYW5zbmJya2VBJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZ2ZXJzaW9uSWQ9bnVsbCZYLUFtei1TaWduYXR1cmU9MDdjYWQzZWIyYTY3MjJiNWJhZWQwOWM2ZjFmZTRhNzAxYmYxMmY0OGUxNjI4YjlkNDVjMDExZDU5NTU2Nzg0NQ", }, wantError: swag.String("403 Forbidden"), expected: nil, }, { test: "valid encoded url but not coming from MinIO server port returns forbidden error", // other port http://localhost:8902/... args: args{ encodedURL: "aHR0cDovL2xvY2FsaG9zdDo4OTAyL2J1Y2tldDEyMy9BdWRpbyUyMGljb24lMjgxJTI5LnN2Zz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPVVCTzFMMUM3VTg3UDFCUDI1MVRTJTJGMjAyNDA0MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDA1VDIxMDEzM1omWC1BbXotRXhwaXJlcz00MzIwMCZYLUFtei1TZWN1cml0eS1Ub2tlbj1leUpoYkdjaU9pSklVelV4TWlJc0luUjVjQ0k2SWtwWFZDSjkuZXlKaFkyTmxjM05MWlhraU9pSlZRazh4VERGRE4xVTROMUF4UWxBeU5URlVVeUlzSW1WNGNDSTZNVGN4TWpNNU5EQTRPU3dpY0dGeVpXNTBJam9pYldsdWFXOWhaRzFwYmlKOS5WLUtEZ3JMTVVCbG5KSEtYNlZ4SGw5LUFfLVBGRVdvazJkcFRxLTQ2YmxMbUxzdWVUeHNoVmFZNERad0dmb200VFQ1azhwaFVmZ2pjUWFuc25icmtlQSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmdmVyc2lvbklkPW51bGwmWC1BbXotU2lnbmF0dXJlPTA3Y2FkM2ViMmE2NzIyYjViYWVkMDljNmYxZmU0YTcwMWJmMTJmNDhlMTYyOGI5ZDQ1YzAxMWQ1OTU1Njc4NDU", }, wantError: swag.String("403 Forbidden"), expected: nil, }, { test: "valid url but with invalid schema returns error", args: args{ encodedURL: "cG9zdGdyZXM6Ly9wb3N0Z3JlczoxMjM0NTZAMTI3LjAuMC4xOjU0MzIvZHVtbXk", // postgres://postgres:123456@127.0.0.1:5432/dummy }, wantError: swag.String("unexpected scheme found postgres"), expected: nil, }, { test: "invalid url returns error", args: args{ encodedURL: "YXNkc2Fkc2Rh", // asdsadsda }, wantError: swag.String("unexpected scheme found "), expected: nil, }, { test: "plain url", args: args{ encodedURL: "aHR0cHM6Ly9sb2NhbGhvc3Q6OTAwMC9jZXN0ZXN0L0F1ZGlvJTIwaWNvbi5zdmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTY", }, wantError: nil, expected: swag.String("https://localhost:9000/cestest/Audio%20icon.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256"), }, } for _, tt := range tests { t.Run(tt.test, func(_ *testing.T) { url, err := decodeMinIOStringURL(tt.args.encodedURL) if tt.wantError != nil { if err != nil { if err.Error() != *tt.wantError { t.Errorf("decodeMinIOStringURL() error: `%v`, wantErr: `%s`", err, *tt.wantError) return } } else { t.Errorf("decodeMinIOStringURL() error: `%v`, wantErr: `%s`", err, *tt.wantError) return } } else { if err != nil { t.Errorf("decodeMinIOStringURL() error: `%s`, wantErr: `%v`", err, tt.wantError) return } tAssert.Equal(*tt.expected, *url) } }) } } ================================================ FILE: api/server.go ================================================ //go:build exclude // This file is generated by go-swagger but it will be // replaced by a proper server to have more customization // Currently, this file is replaced by custom-server.go // Code generated by go-swagger; DO NOT EDIT. // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // package api 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/api/operations" ) const ( schemeHTTP = "http" schemeHTTPS = "https" schemeUnix = "unix" ) var defaultSchemes []string func init() { defaultSchemes = []string{ schemeHTTP, } } // NewServer creates a new api console server but does not configure it func NewServer(api *operations.ConsoleAPI) *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 console 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/console.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.ConsoleAPI 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.ConsoleAPI) { 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 console 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 console 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 console 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 console 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 console 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 console 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) } ================================================ FILE: api/service_accounts_handlers.go ================================================ // 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 api import ( "context" "encoding/json" "time" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" saApi "github.com/minio/console/api/operations/service_account" userApi "github.com/minio/console/api/operations/user" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" iampolicy "github.com/minio/pkg/v3/policy" ) func registerServiceAccountsHandlers(api *operations.ConsoleAPI) { // Create Service Account api.ServiceAccountCreateServiceAccountHandler = saApi.CreateServiceAccountHandlerFunc(func(params saApi.CreateServiceAccountParams, session *models.Principal) middleware.Responder { creds, err := getCreateServiceAccountResponse(session, params) if err != nil { return saApi.NewCreateServiceAccountDefault(err.Code).WithPayload(err.APIError) } return saApi.NewCreateServiceAccountCreated().WithPayload(creds) }) // Create User Service Account api.UserCreateAUserServiceAccountHandler = userApi.CreateAUserServiceAccountHandlerFunc(func(params userApi.CreateAUserServiceAccountParams, session *models.Principal) middleware.Responder { creds, err := getCreateAUserServiceAccountResponse(session, params) if err != nil { return saApi.NewCreateServiceAccountDefault(err.Code).WithPayload(err.APIError) } return userApi.NewCreateAUserServiceAccountCreated().WithPayload(creds) }) // Create User Service Account api.UserCreateServiceAccountCredentialsHandler = userApi.CreateServiceAccountCredentialsHandlerFunc(func(params userApi.CreateServiceAccountCredentialsParams, session *models.Principal) middleware.Responder { creds, err := getCreateAUserServiceAccountCredsResponse(session, params) if err != nil { return saApi.NewCreateServiceAccountDefault(err.Code).WithPayload(err.APIError) } return userApi.NewCreateServiceAccountCredentialsCreated().WithPayload(creds) }) api.ServiceAccountCreateServiceAccountCredsHandler = saApi.CreateServiceAccountCredsHandlerFunc(func(params saApi.CreateServiceAccountCredsParams, session *models.Principal) middleware.Responder { creds, err := getCreateServiceAccountCredsResponse(session, params) if err != nil { return saApi.NewCreateServiceAccountDefault(err.Code).WithPayload(err.APIError) } return userApi.NewCreateServiceAccountCredentialsCreated().WithPayload(creds) }) // List Service Accounts for User api.ServiceAccountListUserServiceAccountsHandler = saApi.ListUserServiceAccountsHandlerFunc(func(params saApi.ListUserServiceAccountsParams, session *models.Principal) middleware.Responder { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() serviceAccounts, err := getUserServiceAccountsResponse(ctx, session, "") if err != nil { return saApi.NewListUserServiceAccountsDefault(err.Code).WithPayload(err.APIError) } return saApi.NewListUserServiceAccountsOK().WithPayload(serviceAccounts) }) // Delete a User's service account api.ServiceAccountDeleteServiceAccountHandler = saApi.DeleteServiceAccountHandlerFunc(func(params saApi.DeleteServiceAccountParams, session *models.Principal) middleware.Responder { if err := getDeleteServiceAccountResponse(session, params); err != nil { return saApi.NewDeleteServiceAccountDefault(err.Code).WithPayload(err.APIError) } return saApi.NewDeleteServiceAccountNoContent() }) // List Service Accounts for User api.UserListAUserServiceAccountsHandler = userApi.ListAUserServiceAccountsHandlerFunc(func(params userApi.ListAUserServiceAccountsParams, session *models.Principal) middleware.Responder { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() serviceAccounts, err := getUserServiceAccountsResponse(ctx, session, params.Name) if err != nil { return saApi.NewListUserServiceAccountsDefault(err.Code).WithPayload(err.APIError) } return saApi.NewListUserServiceAccountsOK().WithPayload(serviceAccounts) }) api.ServiceAccountGetServiceAccountHandler = saApi.GetServiceAccountHandlerFunc(func(params saApi.GetServiceAccountParams, session *models.Principal) middleware.Responder { serviceAccounts, err := getServiceAccountInfo(session, params) if err != nil { return saApi.NewGetServiceAccountDefault(err.Code).WithPayload(err.APIError) } return saApi.NewGetServiceAccountOK().WithPayload(serviceAccounts) }) api.ServiceAccountUpdateServiceAccountHandler = saApi.UpdateServiceAccountHandlerFunc(func(params saApi.UpdateServiceAccountParams, session *models.Principal) middleware.Responder { err := updateSetServiceAccountResponse(session, params) if err != nil { return saApi.NewUpdateServiceAccountDefault(err.Code).WithPayload(err.APIError) } return saApi.NewUpdateServiceAccountOK() }) // Delete multiple service accounts api.ServiceAccountDeleteMultipleServiceAccountsHandler = saApi.DeleteMultipleServiceAccountsHandlerFunc(func(params saApi.DeleteMultipleServiceAccountsParams, session *models.Principal) middleware.Responder { if err := getDeleteMultipleServiceAccountsResponse(session, params); err != nil { return saApi.NewDeleteMultipleServiceAccountsDefault(err.Code).WithPayload(err.APIError) } return saApi.NewDeleteMultipleServiceAccountsNoContent() }) } // createServiceAccount adds a service account to the userClient and assigns a policy to him if defined. func createServiceAccount(ctx context.Context, userClient MinioAdmin, policy string, name string, description string, expiry *time.Time, comment string) (*models.ServiceAccountCreds, error) { creds, err := userClient.addServiceAccount(ctx, policy, "", "", "", name, description, expiry, comment) if err != nil { return nil, err } return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil } // createServiceAccount adds a service account with the given credentials to the // userClient and assigns a policy to him if defined. func createServiceAccountCreds(ctx context.Context, userClient MinioAdmin, policy string, accessKey string, secretKey string, name string, description string, expiry *time.Time, comment string) (*models.ServiceAccountCreds, error) { creds, err := userClient.addServiceAccount(ctx, policy, "", accessKey, secretKey, name, description, expiry, comment) if err != nil { return nil, err } return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil } // getCreateServiceAccountResponse creates a service account with the defined policy for the user that // is requesting, it first gets the credentials of the user and creates a client which is going to // make the call to create the Service Account func getCreateServiceAccountResponse(session *models.Principal, params saApi.CreateServiceAccountParams) (*models.ServiceAccountCreds, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO user Admin Client interface implementation // defining the client to be used userAdminClient := AdminClient{Client: userAdmin} var expiry *time.Time if params.Body.Expiry != "" { parsedExpiry, err := time.Parse(time.RFC3339, params.Body.Expiry) if err != nil { return nil, ErrorWithContext(ctx, err) } expiry = &parsedExpiry } saCreds, err := createServiceAccount(ctx, userAdminClient, params.Body.Policy, params.Body.Name, params.Body.Description, expiry, params.Body.Comment) if err != nil { return nil, ErrorWithContext(ctx, err) } return saCreds, nil } // createServiceAccount adds a service account to a given user and assigns a policy to him if defined. func createAUserServiceAccount(ctx context.Context, userClient MinioAdmin, policy string, user string, name string, description string, expiry *time.Time, comment string) (*models.ServiceAccountCreds, error) { creds, err := userClient.addServiceAccount(ctx, policy, user, "", "", name, description, expiry, comment) if err != nil { return nil, err } return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil } func createAUserServiceAccountCreds(ctx context.Context, userClient MinioAdmin, policy string, user string, accessKey string, secretKey string, name string, description string, expiry *time.Time, comment string) (*models.ServiceAccountCreds, error) { creds, err := userClient.addServiceAccount(ctx, policy, user, accessKey, secretKey, name, description, expiry, comment) if err != nil { return nil, err } return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil } // getCreateServiceAccountResponse creates a service account with the defined policy for the user that // is requesting it ,it first gets the credentials of the user and creates a client which is going to // make the call to create the Service Account func getCreateAUserServiceAccountResponse(session *models.Principal, params userApi.CreateAUserServiceAccountParams) (*models.ServiceAccountCreds, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO user Admin Client interface implementation // defining the client to be used userAdminClient := AdminClient{Client: userAdmin} var expiry *time.Time if params.Body.Expiry != "" { parsedExpiry, err := time.Parse(time.RFC3339, params.Body.Expiry) if err != nil { return nil, ErrorWithContext(ctx, err) } expiry = &parsedExpiry } saCreds, err := createAUserServiceAccount(ctx, userAdminClient, params.Body.Policy, params.Name, params.Body.Name, params.Body.Description, expiry, params.Body.Comment) if err != nil { return nil, ErrorWithContext(ctx, err) } return saCreds, nil } // getCreateServiceAccountCredsResponse creates a service account with the defined policy for the user that // is requesting it, and with the credentials provided func getCreateAUserServiceAccountCredsResponse(session *models.Principal, params userApi.CreateServiceAccountCredentialsParams) (*models.ServiceAccountCreds, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO user Admin Client interface implementation // defining the client to be used userAdminClient := AdminClient{Client: userAdmin} serviceAccount := params.Body if params.Name == serviceAccount.AccessKey { return nil, ErrorWithContext(ctx, ErrNonUniqueAccessKey) } accounts, err := userAdminClient.listServiceAccounts(ctx, params.Name) if err != nil { return nil, ErrorWithContext(ctx, err) } for i := 0; i < len(accounts.Accounts); i++ { if accounts.Accounts[i].AccessKey == serviceAccount.AccessKey { return nil, ErrorWithContext(ctx, ErrNonUniqueAccessKey) } } var expiry *time.Time if serviceAccount.Expiry != "" { parsedExpiry, err := time.Parse(time.RFC3339, serviceAccount.Expiry) if err != nil { return nil, ErrorWithContext(ctx, err) } expiry = &parsedExpiry } saCreds, err := createAUserServiceAccountCreds(ctx, userAdminClient, serviceAccount.Policy, params.Name, serviceAccount.AccessKey, serviceAccount.SecretKey, serviceAccount.Name, serviceAccount.Description, expiry, serviceAccount.Comment) if err != nil { return nil, ErrorWithContext(ctx, err) } return saCreds, nil } func getCreateServiceAccountCredsResponse(session *models.Principal, params saApi.CreateServiceAccountCredsParams) (*models.ServiceAccountCreds, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() serviceAccount := params.Body userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO user Admin Client interface implementation // defining the client to be used userAdminClient := AdminClient{Client: userAdmin} if session.AccountAccessKey == serviceAccount.AccessKey { return nil, ErrorWithContext(ctx, ErrNonUniqueAccessKey) } accounts, err := userAdminClient.listServiceAccounts(ctx, "") if err != nil { return nil, ErrorWithContext(ctx, err) } for i := 0; i < len(accounts.Accounts); i++ { if accounts.Accounts[i].AccessKey == serviceAccount.AccessKey { return nil, ErrorWithContext(ctx, ErrNonUniqueAccessKey) } } var expiry *time.Time if params.Body.Expiry != "" { parsedExpiry, err := time.Parse(time.RFC3339, params.Body.Expiry) if err != nil { return nil, ErrorWithContext(ctx, err) } expiry = &parsedExpiry } saCreds, err := createServiceAccountCreds(ctx, userAdminClient, serviceAccount.Policy, serviceAccount.AccessKey, serviceAccount.SecretKey, params.Body.Name, params.Body.Description, expiry, params.Body.Comment) if err != nil { return nil, ErrorWithContext(ctx, err) } return saCreds, nil } // getUserServiceAccount gets list of the user's service accounts func getUserServiceAccounts(ctx context.Context, userClient MinioAdmin, user string) (models.ServiceAccounts, error) { listServAccs, err := userClient.listServiceAccounts(ctx, user) if err != nil { return nil, err } saList := models.ServiceAccounts{} for _, acc := range listServAccs.Accounts { if acc.AccountStatus != "" { // Newer releases of MinIO would support enhanced listServiceAccounts() // we can avoid infoServiceAccount() at that point, this scales well // for 100's of service accounts. expiry := "" if acc.Expiration != nil { expiry = acc.Expiration.Format(time.RFC3339) } saList = append(saList, &models.ServiceAccountsItems0{ AccountStatus: acc.AccountStatus, Description: acc.Description, Expiration: expiry, Name: acc.Name, AccessKey: acc.AccessKey, }) continue } aInfo, err := userClient.infoServiceAccount(ctx, acc.AccessKey) if err != nil { continue } expiry := "" if aInfo.Expiration != nil { expiry = aInfo.Expiration.Format(time.RFC3339) } saList = append(saList, &models.ServiceAccountsItems0{ AccountStatus: aInfo.AccountStatus, Description: aInfo.Description, Expiration: expiry, Name: aInfo.Name, AccessKey: acc.AccessKey, }) } return saList, nil } // getUserServiceAccountsResponse authenticates the user and calls // getUserServiceAccounts to list the user's service accounts func getUserServiceAccountsResponse(ctx context.Context, session *models.Principal, user string) (models.ServiceAccounts, *CodedAPIError) { userAdmin, err := NewMinioAdminClient(ctx, session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO user Admin Client interface implementation // defining the client to be used userAdminClient := AdminClient{Client: userAdmin} serviceAccounts, err := getUserServiceAccounts(ctx, userAdminClient, user) if err != nil { return nil, ErrorWithContext(ctx, err) } return serviceAccounts, nil } // deleteServiceAccount calls delete service account api func deleteServiceAccount(ctx context.Context, userClient MinioAdmin, accessKey string) error { return userClient.deleteServiceAccount(ctx, accessKey) } // getDeleteServiceAccountResponse authenticates the user and calls deleteServiceAccount func getDeleteServiceAccountResponse(session *models.Principal, params saApi.DeleteServiceAccountParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a MinIO user Admin Client interface implementation // defining the client to be used userAdminClient := AdminClient{Client: userAdmin} if err := deleteServiceAccount(ctx, userAdminClient, params.AccessKey); err != nil { return ErrorWithContext(ctx, err) } return nil } // getServiceAccountDetails gets policy for a service account func getServiceAccountDetails(ctx context.Context, userClient MinioAdmin, accessKey string) (*models.ServiceAccount, error) { saInfo, err := userClient.infoServiceAccount(ctx, accessKey) if err != nil { return nil, err } var policyJSON string var policy iampolicy.Policy json.Unmarshal([]byte(saInfo.Policy), &policy) if policy.Statements == nil { policyJSON = "" } else { policyJSON = saInfo.Policy } expiry := "" if saInfo.Expiration != nil { expiry = saInfo.Expiration.Format(time.RFC3339) } sa := models.ServiceAccount{ AccountStatus: saInfo.AccountStatus, Description: saInfo.Description, Expiration: expiry, ImpliedPolicy: saInfo.ImpliedPolicy, Name: saInfo.Name, ParentUser: saInfo.ParentUser, Policy: policyJSON, } return &sa, nil } // getServiceAccountInfo authenticates the user and calls // getServiceAccountInfo to get the policy for a service account func getServiceAccountInfo(session *models.Principal, params saApi.GetServiceAccountParams) (*models.ServiceAccount, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a MinIO user Admin Client interface implementation // defining the client to be used userAdminClient := AdminClient{Client: userAdmin} serviceAccount, err := getServiceAccountDetails(ctx, userAdminClient, params.AccessKey) if err != nil { return nil, ErrorWithContext(ctx, err) } return serviceAccount, nil } // setServiceAccountPolicy sets policy for a service account func updateServiceAccountDetails(ctx context.Context, userClient MinioAdmin, accessKey string, policy string, expiry *time.Time, name string, description string, status string, secretKey string) error { req := madmin.UpdateServiceAccountReq{ NewPolicy: json.RawMessage(policy), NewSecretKey: secretKey, NewStatus: status, NewName: name, NewDescription: description, NewExpiration: expiry, } err := userClient.updateServiceAccount(ctx, accessKey, req) return err } // updateSetServiceAccountResponse authenticates the user and calls // getSetServiceAccountPolicy to set the policy for a service account func updateSetServiceAccountResponse(session *models.Principal, params saApi.UpdateServiceAccountParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() policy := *params.Body.Policy userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a MinIO user Admin Client interface implementation // defining the client to be used userAdminClient := AdminClient{Client: userAdmin} var expiry *time.Time if params.Body.Expiry != "" { parsedExpiry, err := time.Parse(time.RFC3339, params.Body.Expiry) if err != nil { return ErrorWithContext(ctx, err) } expiry = &parsedExpiry } err = updateServiceAccountDetails(ctx, userAdminClient, params.AccessKey, policy, expiry, params.Body.Name, params.Body.Description, params.Body.Status, params.Body.SecretKey) if err != nil { return ErrorWithContext(ctx, err) } return nil } // getDeleteMultipleServiceAccountsResponse authenticates the user and calls deleteServiceAccount for each account listed in selectedSAs func getDeleteMultipleServiceAccountsResponse(session *models.Principal, params saApi.DeleteMultipleServiceAccountsParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() selectedSAs := params.SelectedSA userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a MinIO user Admin Client interface implementation // defining the client to be used userAdminClient := AdminClient{Client: userAdmin} for _, sa := range selectedSAs { if err := deleteServiceAccount(ctx, userAdminClient, sa); err != nil { return ErrorWithContext(ctx, err) } } return nil } ================================================ FILE: api/service_accounts_handlers_test.go ================================================ // 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 api import ( "context" "errors" "fmt" "testing" "time" "github.com/minio/madmin-go/v3" "github.com/stretchr/testify/assert" ) func TestAddServiceAccount(t *testing.T) { assert := assert.New(t) // mock minIO client client := AdminClientMock{} function := "createServiceAccount()" // Test-1: createServiceAccount create a service account by assigning it a policy ctx, cancel := context.WithCancel(context.Background()) defer cancel() policyDefinition := "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:GetBucketLocation\",\"s3:GetObject\",\"s3:ListAllMyBuckets\"],\"Resource\":[\"arn:aws:s3:::bucket1/*\"]}]}" mockResponse := madmin.Credentials{ AccessKey: "minio", SecretKey: "minio123", } minioAddServiceAccountMock = func(_ context.Context, _ string, _ string, _ string, _ string, _ string, _ string, _ *time.Time, _ string) (madmin.Credentials, error) { return mockResponse, nil } saCreds, err := createServiceAccount(ctx, client, policyDefinition, "", "", nil, "") if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } assert.Equal(mockResponse.AccessKey, saCreds.AccessKey, fmt.Sprintf("Failed on %s:, error occurred: AccessKey differ", function)) assert.Equal(mockResponse.SecretKey, saCreds.SecretKey, fmt.Sprintf("Failed on %s:, error occurred: SecretKey differ", function)) // Test-2: if an error occurs on server while creating service account (valid policy), handle it policyDefinition = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:GetBucketLocation\",\"s3:GetObject\",\"s3:ListAllMyBuckets\"],\"Resource\":[\"arn:aws:s3:::bucket1/*\"]}]}" mockResponse = madmin.Credentials{ AccessKey: "minio", SecretKey: "minio123", } minioAddServiceAccountMock = func(_ context.Context, _ string, _ string, _ string, _ string, _ string, _ string, _ *time.Time, _ string) (madmin.Credentials, error) { return madmin.Credentials{}, errors.New("error") } _, err = createServiceAccount(ctx, client, policyDefinition, "", "", nil, "") if assert.Error(err) { assert.Equal("error", err.Error()) } } func TestListServiceAccounts(t *testing.T) { assert := assert.New(t) // mock minIO client client := AdminClientMock{} function := "getUserServiceAccounts()" // Test-1: getUserServiceAccounts list serviceaccounts for a user ctx, cancel := context.WithCancel(context.Background()) defer cancel() mockResponse := madmin.ListServiceAccountsResp{ Accounts: []madmin.ServiceAccountInfo{ { AccessKey: "accesskey1", }, { AccessKey: "accesskey2", }, }, } minioListServiceAccountsMock = func(_ context.Context, _ string) (madmin.ListServiceAccountsResp, error) { return mockResponse, nil } mockInfoResp := madmin.InfoServiceAccountResp{ ParentUser: "", AccountStatus: "", ImpliedPolicy: false, Policy: "", Name: "", Description: "", Expiration: nil, } minioInfoServiceAccountMock = func(_ context.Context, _ string) (madmin.InfoServiceAccountResp, error) { return mockInfoResp, nil } _, err := getUserServiceAccounts(ctx, client, "") if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2: getUserServiceAccounts returns an error, handle it properly minioListServiceAccountsMock = func(_ context.Context, _ string) (madmin.ListServiceAccountsResp, error) { return madmin.ListServiceAccountsResp{}, errors.New("error") } _, err = getUserServiceAccounts(ctx, client, "") if assert.Error(err) { assert.Equal("error", err.Error()) } } func TestDeleteServiceAccount(t *testing.T) { assert := assert.New(t) // mock minIO client client := AdminClientMock{} function := "deleteServiceAccount()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1: deleteServiceAccount receive a service account to delete testServiceAccount := "accesskeytest" minioDeleteServiceAccountMock = func(_ context.Context, _ string) error { return nil } if err := deleteServiceAccount(ctx, client, testServiceAccount); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2: if an invalid policy is assigned to the service account, this will raise an error minioDeleteServiceAccountMock = func(_ context.Context, _ string) error { return errors.New("error") } if err := deleteServiceAccount(ctx, client, testServiceAccount); assert.Error(err) { assert.Equal("error", err.Error()) } } func TestGetServiceAccountDetails(t *testing.T) { assert := assert.New(t) // mock minIO client client := AdminClientMock{} function := "getServiceAccountDetails()" // Test-1: getServiceAccountPolicy list serviceaccounts for a user ctx, cancel := context.WithCancel(context.Background()) defer cancel() mockResponse := madmin.InfoServiceAccountResp{ Policy: ` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`, } minioInfoServiceAccountMock = func(_ context.Context, _ string) (madmin.InfoServiceAccountResp, error) { return mockResponse, nil } serviceAccount, err := getServiceAccountDetails(ctx, client, "") if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } assert.Equal(mockResponse.Policy, serviceAccount.Policy) // Test-2: getServiceAccountPolicy returns an error, handle it properly minioInfoServiceAccountMock = func(_ context.Context, _ string) (madmin.InfoServiceAccountResp, error) { return madmin.InfoServiceAccountResp{}, errors.New("error") } _, err = getServiceAccountDetails(ctx, client, "") if assert.Error(err) { assert.Equal("error", err.Error()) } } ================================================ FILE: api/tls.go ================================================ // 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 api import ( "net/http" ) type ConsoleTransport struct { Transport http.RoundTripper ClientIP string } func (t *ConsoleTransport) RoundTrip(req *http.Request) (*http.Response, error) { if t.ClientIP != "" { // Do not set an empty x-forwarded-for req.Header.Add(xForwardedFor, t.ClientIP) } return t.Transport.RoundTrip(req) } // PrepareSTSClientTransport : func PrepareSTSClientTransport(clientIP string) *ConsoleTransport { return &ConsoleTransport{ Transport: GlobalTransport, ClientIP: clientIP, } } // PrepareConsoleHTTPClient returns an http.Client with custom configurations need it by *credentials.STSAssumeRole // custom configurations include the use of CA certificates func PrepareConsoleHTTPClient(clientIP string) *http.Client { // Return http client with default configuration return &http.Client{ Transport: PrepareSTSClientTransport(clientIP), } } ================================================ FILE: api/user_account.go ================================================ // 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 api import ( "context" "net/http" authApi "github.com/minio/console/api/operations/auth" "github.com/minio/console/pkg/auth" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" accountApi "github.com/minio/console/api/operations/account" "github.com/minio/console/models" ) func registerAccountHandlers(api *operations.ConsoleAPI) { // change user password api.AccountAccountChangePasswordHandler = accountApi.AccountChangePasswordHandlerFunc(func(params accountApi.AccountChangePasswordParams, session *models.Principal) middleware.Responder { changePasswordResponse, err := getChangePasswordResponse(session, params) if err != nil { return accountApi.NewAccountChangePasswordDefault(err.Code).WithPayload(err.APIError) } // Custom response writer to update the session cookies return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) { cookie := NewSessionCookieForConsole(changePasswordResponse.SessionID) http.SetCookie(w, &cookie) authApi.NewLoginNoContent().WriteResponse(w, p) }) }) } // changePassword validate current current user password and if it's correct set the new password func changePassword(ctx context.Context, client MinioAdmin, session *models.Principal, newSecretKey string) error { return client.changePassword(ctx, session.AccountAccessKey, newSecretKey) } // getChangePasswordResponse will validate user knows what is the current password (avoid account hijacking), update user account password // and authenticate the user generating a new session token/cookie func getChangePasswordResponse(session *models.Principal, params accountApi.AccountChangePasswordParams) (*models.LoginResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() clientIP := getClientIP(params.HTTPRequest) client := GetConsoleHTTPClient(clientIP) // changePassword operations requires an AdminClient initialized with parent account credentials not // STS credentials parentAccountClient, err := NewMinioAdminClient(params.HTTPRequest.Context(), &models.Principal{ STSAccessKeyID: session.AccountAccessKey, STSSecretAccessKey: *params.Body.CurrentSecretKey, }) if err != nil { return nil, ErrorWithContext(ctx, err) } // parentAccountClient will contain access and secret key credentials for the user userClient := AdminClient{Client: parentAccountClient} accessKey := session.AccountAccessKey newSecretKey := *params.Body.NewSecretKey // currentSecretKey will compare currentSecretKey against the stored secret key inside the encrypted session if err := changePassword(ctx, userClient, session, newSecretKey); err != nil { return nil, ErrorWithContext(ctx, ErrChangePassword, nil, err) } // user credentials are updated at this point, we need to generate a new admin client and authenticate using // the new credentials credentials, err := getConsoleCredentials(accessKey, newSecretKey, client) if err != nil { return nil, ErrorWithContext(ctx, ErrInvalidLogin, nil, err) } // authenticate user and generate new session token sessionID, err := login(credentials, &auth.SessionFeatures{HideMenu: session.Hm}) if err != nil { return nil, ErrorWithContext(ctx, ErrInvalidLogin, nil, err) } // serialize output loginResponse := &models.LoginResponse{ SessionID: *sessionID, } return loginResponse, nil } ================================================ FILE: api/user_account_test.go ================================================ // 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 api import ( "context" "errors" "net/http" "testing" accountApi "github.com/minio/console/api/operations/account" "github.com/minio/console/models" "github.com/stretchr/testify/assert" ) func Test_getChangePasswordResponse(t *testing.T) { assert := assert.New(t) session := &models.Principal{ AccountAccessKey: "TESTTEST", } CurrentSecretKey := "string" NewSecretKey := "string" changePasswordParameters := accountApi.AccountChangePasswordParams{ HTTPRequest: &http.Request{}, Body: &models.AccountChangePasswordRequest{ CurrentSecretKey: &CurrentSecretKey, NewSecretKey: &NewSecretKey, }, } loginResponse, actualError := getChangePasswordResponse(session, changePasswordParameters) expected := (*models.LoginResponse)(nil) assert.Equal(expected, loginResponse) expectedError := "error please check your current password" // errChangePassword assert.Equal(expectedError, actualError.APIError.DetailedMessage) } func Test_changePassword(t *testing.T) { client := AdminClientMock{} type args struct { ctx context.Context client AdminClientMock session *models.Principal currentSecretKey string newSecretKey string } tests := []struct { name string args args wantErr bool mock func() }{ { name: "password changed successfully", args: args{ client: client, ctx: context.Background(), session: &models.Principal{ AccountAccessKey: "TESTTEST", }, currentSecretKey: "TESTTEST", newSecretKey: "TESTTEST2", }, mock: func() { minioChangePasswordMock = func(_ context.Context, _, _ string) error { return nil } }, }, { name: "error when changing password", args: args{ client: client, ctx: context.Background(), session: &models.Principal{ AccountAccessKey: "TESTTEST", }, currentSecretKey: "TESTTEST", newSecretKey: "TESTTEST2", }, mock: func() { minioChangePasswordMock = func(_ context.Context, _, _ string) error { return errors.New("there was an error, please try again") } }, wantErr: true, }, { name: "error because current password doesn't match", args: args{ client: client, ctx: context.Background(), session: &models.Principal{ AccountAccessKey: "TESTTEST", }, currentSecretKey: "TESTTEST", newSecretKey: "TESTTEST2", }, mock: func() { minioChangePasswordMock = func(_ context.Context, _, _ string) error { return errors.New("there was an error, please try again") } }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if tt.mock != nil { tt.mock() } if err := changePassword(tt.args.ctx, tt.args.client, tt.args.session, tt.args.newSecretKey); (err != nil) != tt.wantErr { t.Errorf("changePassword() error = %v, wantErr %v", err, tt.wantErr) } }) } } ================================================ FILE: api/user_bucket_quota.go ================================================ // 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 api import ( "context" "errors" "fmt" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" bucketApi "github.com/minio/console/api/operations/bucket" "github.com/minio/madmin-go/v3" "github.com/minio/console/models" ) func registerBucketQuotaHandlers(api *operations.ConsoleAPI) { // set bucket quota api.BucketSetBucketQuotaHandler = bucketApi.SetBucketQuotaHandlerFunc(func(params bucketApi.SetBucketQuotaParams, session *models.Principal) middleware.Responder { err := setBucketQuotaResponse(session, params) if err != nil { return bucketApi.NewSetBucketQuotaDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewSetBucketQuotaOK() }) // get bucket quota api.BucketGetBucketQuotaHandler = bucketApi.GetBucketQuotaHandlerFunc(func(params bucketApi.GetBucketQuotaParams, session *models.Principal) middleware.Responder { resp, err := getBucketQuotaResponse(session, params) if err != nil { return bucketApi.NewGetBucketQuotaDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewGetBucketQuotaOK().WithPayload(resp) }) } func setBucketQuotaResponse(session *models.Principal, params bucketApi.SetBucketQuotaParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} if err := setBucketQuota(ctx, &adminClient, ¶ms.Name, params.Body); err != nil { return ErrorWithContext(ctx, err) } return nil } func setBucketQuota(ctx context.Context, ac *AdminClient, bucket *string, bucketQuota *models.SetBucketQuota) error { if bucketQuota == nil { return errors.New("nil bucket quota was provided") } if *bucketQuota.Enabled { var quotaType madmin.QuotaType switch bucketQuota.QuotaType { case models.SetBucketQuotaQuotaTypeHard: quotaType = madmin.HardQuota default: return fmt.Errorf("unsupported quota type %s", bucketQuota.QuotaType) } if err := ac.setBucketQuota(ctx, *bucket, &madmin.BucketQuota{ Size: uint64(bucketQuota.Amount), Type: quotaType, }); err != nil { return err } } else { if err := ac.Client.SetBucketQuota(ctx, *bucket, &madmin.BucketQuota{}); err != nil { return err } } return nil } func getBucketQuotaResponse(session *models.Principal, params bucketApi.GetBucketQuotaParams) (*models.BucketQuota, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} quota, err := getBucketQuota(ctx, &adminClient, ¶ms.Name) if err != nil { return nil, ErrorWithContext(ctx, err) } return quota, nil } func getBucketQuota(ctx context.Context, ac *AdminClient, bucket *string) (*models.BucketQuota, error) { quota, err := ac.getBucketQuota(ctx, *bucket) if err != nil { return nil, err } var quotaSize uint64 if quota.Size > 0 { quotaSize = quota.Size } else { quotaSize = quota.Quota } return &models.BucketQuota{ Quota: int64(quotaSize), Type: string(quota.Type), }, nil } ================================================ FILE: api/user_buckets.go ================================================ // 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 api import ( "context" "encoding/json" "errors" "fmt" "net/http" "strings" "time" "github.com/minio/minio-go/v7" "github.com/minio/madmin-go/v3" "github.com/minio/mc/cmd" "github.com/minio/mc/pkg/probe" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/sse" "github.com/minio/minio-go/v7/pkg/tags" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/swag" "github.com/minio/console/api/operations" bucketApi "github.com/minio/console/api/operations/bucket" "github.com/minio/console/models" "github.com/minio/console/pkg/auth/token" "github.com/minio/minio-go/v7/pkg/policy" "github.com/minio/minio-go/v7/pkg/replication" minioIAMPolicy "github.com/minio/pkg/v3/policy" ) func registerBucketsHandlers(api *operations.ConsoleAPI) { // list buckets api.BucketListBucketsHandler = bucketApi.ListBucketsHandlerFunc(func(params bucketApi.ListBucketsParams, session *models.Principal) middleware.Responder { listBucketsResponse, err := getListBucketsResponse(session, params) if err != nil { return bucketApi.NewListBucketsDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewListBucketsOK().WithPayload(listBucketsResponse) }) // make bucket api.BucketMakeBucketHandler = bucketApi.MakeBucketHandlerFunc(func(params bucketApi.MakeBucketParams, session *models.Principal) middleware.Responder { makeBucketResponse, err := getMakeBucketResponse(session, params) if err != nil { return bucketApi.NewMakeBucketDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewMakeBucketOK().WithPayload(makeBucketResponse) }) // delete bucket api.BucketDeleteBucketHandler = bucketApi.DeleteBucketHandlerFunc(func(params bucketApi.DeleteBucketParams, session *models.Principal) middleware.Responder { if err := getDeleteBucketResponse(session, params); err != nil { return bucketApi.NewMakeBucketDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewDeleteBucketNoContent() }) // get bucket info api.BucketBucketInfoHandler = bucketApi.BucketInfoHandlerFunc(func(params bucketApi.BucketInfoParams, session *models.Principal) middleware.Responder { bucketInfoResp, err := getBucketInfoResponse(session, params) if err != nil { return bucketApi.NewBucketInfoDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewBucketInfoOK().WithPayload(bucketInfoResp) }) // set bucket policy api.BucketBucketSetPolicyHandler = bucketApi.BucketSetPolicyHandlerFunc(func(params bucketApi.BucketSetPolicyParams, session *models.Principal) middleware.Responder { bucketSetPolicyResp, err := getBucketSetPolicyResponse(session, params) if err != nil { return bucketApi.NewBucketSetPolicyDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewBucketSetPolicyOK().WithPayload(bucketSetPolicyResp) }) // set bucket tags api.BucketPutBucketTagsHandler = bucketApi.PutBucketTagsHandlerFunc(func(params bucketApi.PutBucketTagsParams, session *models.Principal) middleware.Responder { err := getPutBucketTagsResponse(session, params) if err != nil { return bucketApi.NewPutBucketTagsDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewPutBucketTagsOK() }) // get bucket versioning api.BucketGetBucketVersioningHandler = bucketApi.GetBucketVersioningHandlerFunc(func(params bucketApi.GetBucketVersioningParams, session *models.Principal) middleware.Responder { getBucketVersioning, err := getBucketVersionedResponse(session, params) if err != nil { return bucketApi.NewGetBucketVersioningDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewGetBucketVersioningOK().WithPayload(getBucketVersioning) }) // update bucket versioning api.BucketSetBucketVersioningHandler = bucketApi.SetBucketVersioningHandlerFunc(func(params bucketApi.SetBucketVersioningParams, session *models.Principal) middleware.Responder { err := setBucketVersioningResponse(session, params) if err != nil { return bucketApi.NewSetBucketVersioningDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewSetBucketVersioningCreated() }) // get bucket replication api.BucketGetBucketReplicationHandler = bucketApi.GetBucketReplicationHandlerFunc(func(params bucketApi.GetBucketReplicationParams, session *models.Principal) middleware.Responder { getBucketReplication, err := getBucketReplicationResponse(session, params) if err != nil { return bucketApi.NewGetBucketReplicationDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewGetBucketReplicationOK().WithPayload(getBucketReplication) }) // get single bucket replication rule api.BucketGetBucketReplicationRuleHandler = bucketApi.GetBucketReplicationRuleHandlerFunc(func(params bucketApi.GetBucketReplicationRuleParams, session *models.Principal) middleware.Responder { getBucketReplicationRule, err := getBucketReplicationRuleResponse(session, params) if err != nil { return bucketApi.NewGetBucketReplicationRuleDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewGetBucketReplicationRuleOK().WithPayload(getBucketReplicationRule) }) // enable bucket encryption api.BucketEnableBucketEncryptionHandler = bucketApi.EnableBucketEncryptionHandlerFunc(func(params bucketApi.EnableBucketEncryptionParams, session *models.Principal) middleware.Responder { if err := enableBucketEncryptionResponse(session, params); err != nil { return bucketApi.NewEnableBucketEncryptionDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewEnableBucketEncryptionOK() }) // disable bucket encryption api.BucketDisableBucketEncryptionHandler = bucketApi.DisableBucketEncryptionHandlerFunc(func(params bucketApi.DisableBucketEncryptionParams, session *models.Principal) middleware.Responder { if err := disableBucketEncryptionResponse(session, params); err != nil { return bucketApi.NewDisableBucketEncryptionDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewDisableBucketEncryptionOK() }) // get bucket encryption info api.BucketGetBucketEncryptionInfoHandler = bucketApi.GetBucketEncryptionInfoHandlerFunc(func(params bucketApi.GetBucketEncryptionInfoParams, session *models.Principal) middleware.Responder { response, err := getBucketEncryptionInfoResponse(session, params) if err != nil { return bucketApi.NewGetBucketEncryptionInfoDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewGetBucketEncryptionInfoOK().WithPayload(response) }) // set bucket retention config api.BucketSetBucketRetentionConfigHandler = bucketApi.SetBucketRetentionConfigHandlerFunc(func(params bucketApi.SetBucketRetentionConfigParams, session *models.Principal) middleware.Responder { if err := getSetBucketRetentionConfigResponse(session, params); err != nil { return bucketApi.NewSetBucketRetentionConfigDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewSetBucketRetentionConfigOK() }) // get bucket retention config api.BucketGetBucketRetentionConfigHandler = bucketApi.GetBucketRetentionConfigHandlerFunc(func(params bucketApi.GetBucketRetentionConfigParams, session *models.Principal) middleware.Responder { response, err := getBucketRetentionConfigResponse(session, params) if err != nil { return bucketApi.NewGetBucketRetentionConfigDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewGetBucketRetentionConfigOK().WithPayload(response) }) // get bucket object locking status api.BucketGetBucketObjectLockingStatusHandler = bucketApi.GetBucketObjectLockingStatusHandlerFunc(func(params bucketApi.GetBucketObjectLockingStatusParams, session *models.Principal) middleware.Responder { getBucketObjectLockingStatus, err := getBucketObjectLockingResponse(session, params) if err != nil { return bucketApi.NewGetBucketObjectLockingStatusDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewGetBucketObjectLockingStatusOK().WithPayload(getBucketObjectLockingStatus) }) // get objects rewind for a bucket api.BucketGetBucketRewindHandler = bucketApi.GetBucketRewindHandlerFunc(func(params bucketApi.GetBucketRewindParams, session *models.Principal) middleware.Responder { getBucketRewind, err := getBucketRewindResponse(session, params) if err != nil { return bucketApi.NewGetBucketRewindDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewGetBucketRewindOK().WithPayload(getBucketRewind) }) // get max allowed share link expiration time api.BucketGetMaxShareLinkExpHandler = bucketApi.GetMaxShareLinkExpHandlerFunc(func(params bucketApi.GetMaxShareLinkExpParams, session *models.Principal) middleware.Responder { val, err := getMaxShareLinkExpirationResponse(session, params) if err != nil { return bucketApi.NewGetMaxShareLinkExpDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewGetMaxShareLinkExpOK().WithPayload(val) }) } type VersionState string const ( VersionEnable VersionState = "enable" VersionSuspend VersionState = "suspend" ) // removeBucket deletes a bucket func doSetVersioning(ctx context.Context, client MCClient, state VersionState, excludePrefix []string, excludeFolders bool) error { err := client.setVersioning(ctx, string(state), excludePrefix, excludeFolders) if err != nil { return err.Cause } return nil } func setBucketVersioningResponse(session *models.Principal, params bucketApi.SetBucketVersioningParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() bucketName := params.BucketName s3Client, err := newS3BucketClient(session, bucketName, "", getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a mc S3Client interface implementation // defining the client to be used amcClient := mcClient{client: s3Client} versioningState := VersionSuspend if params.Body.Enabled { versioningState = VersionEnable } var excludePrefixes []string if params.Body.ExcludePrefixes != nil { excludePrefixes = params.Body.ExcludePrefixes } excludeFolders := params.Body.ExcludeFolders if err := doSetVersioning(ctx, amcClient, versioningState, excludePrefixes, excludeFolders); err != nil { return ErrorWithContext(ctx, fmt.Errorf("error setting versioning for bucket: %s", err)) } return nil } func getBucketReplicationResponse(session *models.Principal, params bucketApi.GetBucketReplicationParams) (*models.BucketReplicationResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} // we will tolerate this call failing res, err := minioClient.getBucketReplication(ctx, params.BucketName) if err != nil { ErrorWithContext(ctx, err) } var rules []*models.BucketReplicationRule for _, rule := range res.Rules { repDelMarkerStatus := rule.DeleteMarkerReplication.Status == replication.Enabled repDelStatus := rule.DeleteReplication.Status == replication.Enabled rules = append(rules, &models.BucketReplicationRule{ DeleteMarkerReplication: repDelMarkerStatus, DeletesReplication: repDelStatus, Destination: &models.BucketReplicationDestination{Bucket: rule.Destination.Bucket}, Tags: rule.Tags(), Prefix: rule.Prefix(), ID: rule.ID, Priority: int32(rule.Priority), Status: string(rule.Status), StorageClass: rule.Destination.StorageClass, }) } // serialize output bucketRResponse := &models.BucketReplicationResponse{ Rules: rules, } return bucketRResponse, nil } func getBucketReplicationRuleResponse(session *models.Principal, params bucketApi.GetBucketReplicationRuleParams) (*models.BucketReplicationRule, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} replicationRules, err := minioClient.getBucketReplication(ctx, params.BucketName) if err != nil { return nil, ErrorWithContext(ctx, err) } var foundRule replication.Rule found := false for i := range replicationRules.Rules { if replicationRules.Rules[i].ID == params.RuleID { foundRule = replicationRules.Rules[i] found = true break } } if !found { return nil, ErrorWithContext(ctx, errors.New("no rule is set with this ID")) } repDelMarkerStatus := foundRule.DeleteMarkerReplication.Status == replication.Enabled repDelStatus := foundRule.DeleteReplication.Status == replication.Enabled existingObjects := foundRule.ExistingObjectReplication.Status == replication.Enabled metadataModifications := foundRule.SourceSelectionCriteria.ReplicaModifications.Status == replication.Enabled returnRule := &models.BucketReplicationRule{ DeleteMarkerReplication: repDelMarkerStatus, DeletesReplication: repDelStatus, Destination: &models.BucketReplicationDestination{Bucket: foundRule.Destination.Bucket}, Tags: foundRule.Tags(), Prefix: foundRule.Prefix(), ID: foundRule.ID, Priority: int32(foundRule.Priority), Status: string(foundRule.Status), StorageClass: foundRule.Destination.StorageClass, ExistingObjects: existingObjects, MetadataReplication: metadataModifications, } return returnRule, nil } func getBucketVersionedResponse(session *models.Principal, params bucketApi.GetBucketVersioningParams) (*models.BucketVersioningResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} // we will tolerate this call failing res, err := minioClient.getBucketVersioning(ctx, params.BucketName) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error versioning bucket: %v", err)) } excludedPrefixes := make([]*models.BucketVersioningResponseExcludedPrefixesItems0, len(res.ExcludedPrefixes)) for i, v := range res.ExcludedPrefixes { excludedPrefixes[i] = &models.BucketVersioningResponseExcludedPrefixesItems0{ Prefix: v.Prefix, } } // serialize output bucketVResponse := &models.BucketVersioningResponse{ ExcludeFolders: res.ExcludeFolders, ExcludedPrefixes: excludedPrefixes, MFADelete: res.MFADelete, Status: res.Status, } return bucketVResponse, nil } // getAccountBuckets fetches a list of all buckets allowed to that particular client from MinIO Servers func getAccountBuckets(ctx context.Context, client MinioAdmin) ([]*models.Bucket, error) { info, err := client.AccountInfo(ctx) if err != nil { return []*models.Bucket{}, err } bucketInfos := []*models.Bucket{} for _, bucket := range info.Buckets { bucketElem := &models.Bucket{ CreationDate: bucket.Created.Format(time.RFC3339), Details: &models.BucketDetails{ Quota: nil, }, RwAccess: &models.BucketRwAccess{ Read: bucket.Access.Read, Write: bucket.Access.Write, }, Name: swag.String(bucket.Name), Objects: int64(bucket.Objects), Size: int64(bucket.Size), } if bucket.Details != nil { if bucket.Details.Tagging != nil { bucketElem.Details.Tags = bucket.Details.Tagging.ToMap() } bucketElem.Details.Locking = bucket.Details.Locking bucketElem.Details.Replication = bucket.Details.Replication bucketElem.Details.Versioning = bucket.Details.Versioning bucketElem.Details.VersioningSuspended = bucket.Details.VersioningSuspended if bucket.Details.Quota != nil { bucketElem.Details.Quota = &models.BucketDetailsQuota{ Quota: int64(bucket.Details.Quota.Quota), Type: string(bucket.Details.Quota.Type), } } } bucketInfos = append(bucketInfos, bucketElem) } return bucketInfos, nil } // getListBucketsResponse performs listBuckets() and serializes it to the handler's output func getListBucketsResponse(session *models.Principal, params bucketApi.ListBucketsParams) (*models.ListBucketsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} buckets, err := getAccountBuckets(ctx, adminClient) if err != nil { return nil, ErrorWithContext(ctx, err) } // serialize output listBucketsResponse := &models.ListBucketsResponse{ Buckets: buckets, Total: int64(len(buckets)), } return listBucketsResponse, nil } // makeBucket creates a bucket for an specific minio client func makeBucket(ctx context.Context, client MinioClient, bucketName string, objectLocking bool) error { // creates a new bucket with bucketName with a context to control cancellations and timeouts. return client.makeBucketWithContext(ctx, bucketName, "", objectLocking) } // getMakeBucketResponse performs makeBucket() to create a bucket with its access policy func getMakeBucketResponse(session *models.Principal, params bucketApi.MakeBucketParams) (*models.MakeBucketsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() // bucket request needed to proceed br := params.Body if br == nil { return nil, ErrorWithContext(ctx, ErrBucketBodyNotInRequest) } mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} // if we need retention, then object locking needs to be enabled if br.Retention != nil { br.Locking = true } if err := makeBucket(ctx, minioClient, *br.Name, br.Locking); err != nil { return nil, ErrorWithContext(ctx, err) } // make sure to delete bucket if an errors occurs after bucket was created defer func() { if err != nil { ErrorWithContext(ctx, fmt.Errorf("error creating bucket: %v", err)) if err := removeBucket(minioClient, *br.Name); err != nil { ErrorWithContext(ctx, fmt.Errorf("error removing bucket: %v", err)) } } }() versioningEnabled := br.Versioning != nil && br.Versioning.Enabled // enable versioning if indicated or retention enabled if versioningEnabled || br.Retention != nil { s3Client, err := newS3BucketClient(session, *br.Name, "", getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a mc S3Client interface implementation // defining the client to be used amcClient := mcClient{client: s3Client} excludePrefixes := []string{} excludeFolders := false if br.Versioning.ExcludeFolders && !br.Locking { excludeFolders = true } if br.Versioning.ExcludePrefixes != nil && !br.Locking { excludePrefixes = br.Versioning.ExcludePrefixes } if err = doSetVersioning(ctx, amcClient, VersionEnable, excludePrefixes, excludeFolders); err != nil { return nil, ErrorWithContext(ctx, fmt.Errorf("error setting versioning for bucket: %s", err)) } } // if it has support for if br.Quota != nil && br.Quota.Enabled != nil && *br.Quota.Enabled { mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // we will tolerate this call failing if err := setBucketQuota(ctx, &adminClient, br.Name, br.Quota); err != nil { ErrorWithContext(ctx, fmt.Errorf("error versioning bucket: %v", err)) } } // Set Bucket Retention Configuration if defined if br.Retention != nil { err = setBucketRetentionConfig(ctx, minioClient, *br.Name, *br.Retention.Mode, *br.Retention.Unit, br.Retention.Validity) if err != nil { return nil, ErrorWithContext(ctx, err) } } return &models.MakeBucketsResponse{BucketName: *br.Name}, nil } // setBucketAccessPolicy set the access permissions on an existing bucket. func setBucketAccessPolicy(ctx context.Context, client MinioClient, bucketName string, access models.BucketAccess, policyDefinition string) error { if strings.TrimSpace(bucketName) == "" { return fmt.Errorf("error: bucket name not present") } if strings.TrimSpace(string(access)) == "" { return fmt.Errorf("error: bucket access not present") } // Prepare policyJSON corresponding to the access type if access != models.BucketAccessPRIVATE && access != models.BucketAccessPUBLIC && access != models.BucketAccessCUSTOM { return fmt.Errorf("access: `%s` not supported", access) } bucketAccessPolicy := policy.BucketAccessPolicy{Version: minioIAMPolicy.DefaultVersion} if access == models.BucketAccessCUSTOM { err := client.setBucketPolicyWithContext(ctx, bucketName, policyDefinition) if err != nil { return err } return nil } bucketPolicy := consoleAccess2policyAccess(access) bucketAccessPolicy.Statements = policy.SetPolicy(bucketAccessPolicy.Statements, bucketPolicy, bucketName, "") policyJSON, err := json.Marshal(bucketAccessPolicy) if err != nil { return err } return client.setBucketPolicyWithContext(ctx, bucketName, string(policyJSON)) } // getBucketSetPolicyResponse calls setBucketAccessPolicy() to set a access policy to a bucket // and returns the serialized output. func getBucketSetPolicyResponse(session *models.Principal, params bucketApi.BucketSetPolicyParams) (*models.Bucket, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() // get updated bucket details and return it mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} bucketName := params.Name req := params.Body if err := setBucketAccessPolicy(ctx, minioClient, bucketName, *req.Access, req.Definition); err != nil { return nil, ErrorWithContext(ctx, err) } // set bucket access policy bucket, err := getBucketInfo(ctx, minioClient, adminClient, bucketName) if err != nil { return nil, ErrorWithContext(ctx, err) } return bucket, nil } // putBucketTags sets tags for a bucket func getPutBucketTagsResponse(session *models.Principal, params bucketApi.PutBucketTagsParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} req := params.Body bucketName := params.BucketName newTagSet, err := tags.NewTags(req.Tags, true) if err != nil { return ErrorWithContext(ctx, err) } err = minioClient.SetBucketTagging(ctx, bucketName, newTagSet) if err != nil { return ErrorWithContext(ctx, err) } return nil } // removeBucket deletes a bucket func removeBucket(client MinioClient, bucketName string) error { return client.removeBucket(context.Background(), bucketName) } // getDeleteBucketResponse performs removeBucket() to delete a bucket func getDeleteBucketResponse(session *models.Principal, params bucketApi.DeleteBucketParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() if params.Name == "" { return ErrorWithContext(ctx, ErrBucketNameNotInRequest) } bucketName := params.Name mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} if err := removeBucket(minioClient, bucketName); err != nil { resp := ErrorWithContext(ctx, err) errResp := minio.ToErrorResponse(err) if errResp.Code == "NoSuchBucket" { resp.Code = 404 } return resp } return nil } // getBucketInfo return bucket information including name, policy access, size and creation date func getBucketInfo(ctx context.Context, client MinioClient, adminClient MinioAdmin, bucketName string) (*models.Bucket, error) { var bucketAccess models.BucketAccess policyStr, err := client.getBucketPolicy(context.Background(), bucketName) if err != nil { // we can tolerate this errors ErrorWithContext(ctx, fmt.Errorf("error getting bucket policy: %v", err)) } if policyStr == "" { bucketAccess = models.BucketAccessPRIVATE } else { var p policy.BucketAccessPolicy if err = json.Unmarshal([]byte(policyStr), &p); err != nil { return nil, err } policyAccess := policy.GetPolicy(p.Statements, bucketName, "") if len(p.Statements) > 0 && policyAccess == policy.BucketPolicyNone { bucketAccess = models.BucketAccessCUSTOM } else { bucketAccess = policyAccess2consoleAccess(policyAccess) } } bucketTags, err := client.GetBucketTagging(ctx, bucketName) if err != nil { // we can tolerate this errors ErrorWithContext(ctx, fmt.Errorf("error getting bucket tags: %v", err)) } bucketDetails := &models.BucketDetails{} if bucketTags != nil { bucketDetails.Tags = bucketTags.ToMap() } info, err := adminClient.AccountInfo(ctx) if err != nil { return nil, err } var bucketInfo madmin.BucketAccessInfo for _, bucket := range info.Buckets { if bucket.Name == bucketName { bucketInfo = bucket break } } return &models.Bucket{ Name: &bucketName, Access: &bucketAccess, Definition: policyStr, CreationDate: bucketInfo.Created.Format(time.RFC3339), Size: int64(bucketInfo.Size), Details: bucketDetails, Objects: int64(bucketInfo.Objects), }, nil } // getBucketInfoResponse calls getBucketInfo() to get the bucket's info func getBucketInfoResponse(session *models.Principal, params bucketApi.BucketInfoParams) (*models.Bucket, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} bucket, err := getBucketInfo(ctx, minioClient, adminClient, params.Name) if err != nil { return nil, ErrorWithContext(ctx, err) } return bucket, nil } // policyAccess2consoleAccess gets the equivalent of policy.BucketPolicy to models.BucketAccess func policyAccess2consoleAccess(bucketPolicy policy.BucketPolicy) (bucketAccess models.BucketAccess) { switch bucketPolicy { case policy.BucketPolicyReadWrite: bucketAccess = models.BucketAccessPUBLIC case policy.BucketPolicyNone: bucketAccess = models.BucketAccessPRIVATE default: bucketAccess = models.BucketAccessCUSTOM } return bucketAccess } // consoleAccess2policyAccess gets the equivalent of models.BucketAccess to policy.BucketPolicy func consoleAccess2policyAccess(bucketAccess models.BucketAccess) (bucketPolicy policy.BucketPolicy) { switch bucketAccess { case models.BucketAccessPUBLIC: bucketPolicy = policy.BucketPolicyReadWrite case models.BucketAccessPRIVATE: bucketPolicy = policy.BucketPolicyNone } return bucketPolicy } // enableBucketEncryption will enable bucket encryption based on two encryption algorithms, sse-s3 (server side encryption with external KMS) or sse-kms (aws s3 kms key) func enableBucketEncryption(ctx context.Context, client MinioClient, bucketName string, encryptionType models.BucketEncryptionType, kmsKeyID string) error { var config *sse.Configuration switch encryptionType { case models.BucketEncryptionTypeSseDashKms: config = sse.NewConfigurationSSEKMS(kmsKeyID) case models.BucketEncryptionTypeSseDashS3: config = sse.NewConfigurationSSES3() default: return ErrInvalidEncryptionAlgorithm } return client.setBucketEncryption(ctx, bucketName, config) } // enableBucketEncryptionResponse calls enableBucketEncryption() to create new encryption configuration for provided bucket name func enableBucketEncryptionResponse(session *models.Principal, params bucketApi.EnableBucketEncryptionParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} if err := enableBucketEncryption(ctx, minioClient, params.BucketName, *params.Body.EncType, params.Body.KmsKeyID); err != nil { return ErrorWithContext(ctx, err) } return nil } // disableBucketEncryption will disable bucket for the provided bucket name func disableBucketEncryption(ctx context.Context, client MinioClient, bucketName string) error { return client.removeBucketEncryption(ctx, bucketName) } // disableBucketEncryptionResponse calls disableBucketEncryption() func disableBucketEncryptionResponse(session *models.Principal, params bucketApi.DisableBucketEncryptionParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} if err := disableBucketEncryption(ctx, minioClient, params.BucketName); err != nil { return ErrorWithContext(ctx, err) } return nil } func getBucketEncryptionInfo(ctx context.Context, client MinioClient, bucketName string) (*models.BucketEncryptionInfo, error) { bucketInfo, err := client.getBucketEncryption(ctx, bucketName) if err != nil { return nil, err } if len(bucketInfo.Rules) == 0 { return nil, ErrDefault } return &models.BucketEncryptionInfo{Algorithm: bucketInfo.Rules[0].Apply.SSEAlgorithm, KmsMasterKeyID: bucketInfo.Rules[0].Apply.KmsMasterKeyID}, nil } func getBucketEncryptionInfoResponse(session *models.Principal, params bucketApi.GetBucketEncryptionInfoParams) (*models.BucketEncryptionInfo, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} bucketInfo, err := getBucketEncryptionInfo(ctx, minioClient, params.BucketName) if err != nil { return nil, ErrorWithContext(ctx, ErrSSENotConfigured, err) } return bucketInfo, nil } // setBucketRetentionConfig sets object lock configuration on a bucket func setBucketRetentionConfig(ctx context.Context, client MinioClient, bucketName string, mode models.ObjectRetentionMode, unit models.ObjectRetentionUnit, validity *int32) error { if validity == nil { return errors.New("retention validity can't be nil") } var retentionMode minio.RetentionMode switch mode { case models.ObjectRetentionModeGovernance: retentionMode = minio.Governance case models.ObjectRetentionModeCompliance: retentionMode = minio.Compliance default: return errors.New("invalid retention mode") } var retentionUnit minio.ValidityUnit switch unit { case models.ObjectRetentionUnitDays: retentionUnit = minio.Days case models.ObjectRetentionUnitYears: retentionUnit = minio.Years default: return errors.New("invalid retention unit") } retentionValidity := uint(*validity) return client.setObjectLockConfig(ctx, bucketName, &retentionMode, &retentionValidity, &retentionUnit) } func getSetBucketRetentionConfigResponse(session *models.Principal, params bucketApi.SetBucketRetentionConfigParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} err = setBucketRetentionConfig(ctx, minioClient, params.BucketName, *params.Body.Mode, *params.Body.Unit, params.Body.Validity) if err != nil { return ErrorWithContext(ctx, err) } return nil } func getBucketRetentionConfig(ctx context.Context, client MinioClient, bucketName string) (*models.GetBucketRetentionConfig, error) { m, v, u, err := client.getBucketObjectLockConfig(ctx, bucketName) if err != nil { errResp := minio.ToErrorResponse(probe.NewError(err).ToGoError()) if errResp.Code == "ObjectLockConfigurationNotFoundError" { return &models.GetBucketRetentionConfig{}, nil } return nil, err } // These values can be empty when all are empty, it means // object was created with object locking enabled but // does not have any default object locking configuration. if m == nil && v == nil && u == nil { return &models.GetBucketRetentionConfig{}, nil } var mode models.ObjectRetentionMode var unit models.ObjectRetentionUnit if m != nil { switch *m { case minio.Governance: mode = models.ObjectRetentionModeGovernance case minio.Compliance: mode = models.ObjectRetentionModeCompliance default: return nil, errors.New("invalid retention mode") } } if u != nil { switch *u { case minio.Days: unit = models.ObjectRetentionUnitDays case minio.Years: unit = models.ObjectRetentionUnitYears default: return nil, errors.New("invalid retention unit") } } var validity int32 if v != nil { validity = int32(*v) } config := &models.GetBucketRetentionConfig{ Mode: mode, Unit: unit, Validity: validity, } return config, nil } func getBucketRetentionConfigResponse(session *models.Principal, params bucketApi.GetBucketRetentionConfigParams) (*models.GetBucketRetentionConfig, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() bucketName := params.BucketName mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} config, err := getBucketRetentionConfig(ctx, minioClient, bucketName) if err != nil { return nil, ErrorWithContext(ctx, err) } return config, nil } func getBucketObjectLockingResponse(session *models.Principal, params bucketApi.GetBucketObjectLockingStatusParams) (*models.BucketObLockingResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() bucketName := params.BucketName mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, fmt.Errorf("error creating MinIO Client: %v", err)) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} // we will tolerate this call failing _, _, _, _, err = minioClient.getObjectLockConfig(ctx, bucketName) if err != nil { if minio.ToErrorResponse(err).Code == "ObjectLockConfigurationNotFoundError" { return &models.BucketObLockingResponse{ ObjectLockingEnabled: false, }, nil } return nil, ErrorWithContext(ctx, err) } // serialize output return &models.BucketObLockingResponse{ ObjectLockingEnabled: true, }, nil } func getBucketRewindResponse(session *models.Principal, params bucketApi.GetBucketRewindParams) (*models.RewindResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() prefix := "" if params.Prefix != nil { prefix = *params.Prefix } s3Client, err := newS3BucketClient(session, params.BucketName, prefix, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, fmt.Errorf("error creating S3Client: %v", err)) } // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} parsedDate, errDate := time.Parse(time.RFC3339, params.Date) if errDate != nil { return nil, ErrorWithContext(ctx, errDate) } var rewindItems []*models.RewindItem for content := range mcClient.client.List(ctx, cmd.ListOptions{TimeRef: parsedDate, WithDeleteMarkers: true}) { // build object name name := strings.ReplaceAll(content.URL.Path, fmt.Sprintf("/%s/", params.BucketName), "") listElement := &models.RewindItem{ LastModified: content.Time.Format(time.RFC3339), Size: content.Size, VersionID: content.VersionID, DeleteFlag: content.IsDeleteMarker, Action: "", Name: name, } rewindItems = append(rewindItems, listElement) } return &models.RewindResponse{ Objects: rewindItems, }, nil } func getMaxShareLinkExpirationResponse(session *models.Principal, params bucketApi.GetMaxShareLinkExpParams) (*models.MaxShareLinkExpResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() maxShareLinkExpSeconds, err := getMaxShareLinkExpirationSeconds(session) if err != nil { return nil, ErrorWithContext(ctx, err) } return &models.MaxShareLinkExpResponse{Exp: swag.Int64(maxShareLinkExpSeconds)}, nil } // getMaxShareLinkExpirationSeconds returns the max share link expiration time in seconds which is the sts token expiration time func getMaxShareLinkExpirationSeconds(session *models.Principal) (int64, error) { creds := getConsoleCredentialsFromSession(session) val, err := creds.GetWithContext(&credentials.CredContext{Client: http.DefaultClient}) if err != nil { return 0, err } if val.SignerType.IsAnonymous() { return 0, ErrAccessDenied } maxShareLinkExp := token.GetConsoleSTSDuration() return int64(maxShareLinkExp.Seconds()), nil } ================================================ FILE: api/user_buckets_events.go ================================================ // 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 api import ( "context" "strings" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/swag" "github.com/minio/console/api/operations" bucketApi "github.com/minio/console/api/operations/bucket" "github.com/minio/console/models" "github.com/minio/minio-go/v7/pkg/notification" ) func registerBucketEventsHandlers(api *operations.ConsoleAPI) { // list bucket events api.BucketListBucketEventsHandler = bucketApi.ListBucketEventsHandlerFunc(func(params bucketApi.ListBucketEventsParams, session *models.Principal) middleware.Responder { listBucketEventsResponse, err := getListBucketEventsResponse(session, params) if err != nil { return bucketApi.NewListBucketEventsDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewListBucketEventsOK().WithPayload(listBucketEventsResponse) }) // create bucket event api.BucketCreateBucketEventHandler = bucketApi.CreateBucketEventHandlerFunc(func(params bucketApi.CreateBucketEventParams, session *models.Principal) middleware.Responder { if err := getCreateBucketEventsResponse(session, params); err != nil { return bucketApi.NewCreateBucketEventDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewCreateBucketEventCreated() }) // delete bucket event api.BucketDeleteBucketEventHandler = bucketApi.DeleteBucketEventHandlerFunc(func(params bucketApi.DeleteBucketEventParams, session *models.Principal) middleware.Responder { if err := getDeleteBucketEventsResponse(session, params); err != nil { return bucketApi.NewDeleteBucketEventDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewDeleteBucketEventNoContent() }) } // listBucketEvents fetches a list of all events set for a bucket and serializes them for a proper output func listBucketEvents(client MinioClient, bucketName string) ([]*models.NotificationConfig, error) { var configs []*models.NotificationConfig bn, err := client.getBucketNotification(context.Background(), bucketName) if err != nil { return nil, err } // Generate pretty event names from event types prettyEventNames := func(eventsTypes []notification.EventType) []models.NotificationEventType { var result []models.NotificationEventType for _, eventType := range eventsTypes { var eventTypePretty models.NotificationEventType switch eventType { case notification.ObjectAccessedAll: eventTypePretty = models.NotificationEventTypeGet case notification.ObjectCreatedAll: eventTypePretty = models.NotificationEventTypePut case notification.ObjectRemovedAll: eventTypePretty = models.NotificationEventTypeDelete case notification.ObjectReplicationAll: eventTypePretty = models.NotificationEventTypeReplica case notification.ObjectTransitionAll: eventTypePretty = models.NotificationEventTypeIlm case notification.ObjectScannerManyVersions, notification.ObjectScannerBigPrefix: eventTypePretty = models.NotificationEventTypeScanner default: continue } result = append(result, eventTypePretty) } return result } // part of implementation taken from minio/mc // s3Client.ListNotificationConfigs()... to serialize configurations getFilters := func(config notification.Config) (prefix, suffix string) { if config.Filter == nil { return prefix, suffix } for _, filter := range config.Filter.S3Key.FilterRules { if strings.ToLower(filter.Name) == "prefix" { prefix = filter.Value } if strings.ToLower(filter.Name) == "suffix" { suffix = filter.Value } } return prefix, suffix } for _, embed := range bn.TopicConfigs { prefix, suffix := getFilters(embed.Config) configs = append(configs, &models.NotificationConfig{ ID: embed.ID, Arn: swag.String(embed.Topic), Events: prettyEventNames(embed.Events), Prefix: prefix, Suffix: suffix, }) } for _, embed := range bn.QueueConfigs { prefix, suffix := getFilters(embed.Config) configs = append(configs, &models.NotificationConfig{ ID: embed.ID, Arn: swag.String(embed.Queue), Events: prettyEventNames(embed.Events), Prefix: prefix, Suffix: suffix, }) } for _, embed := range bn.LambdaConfigs { prefix, suffix := getFilters(embed.Config) configs = append(configs, &models.NotificationConfig{ ID: embed.ID, Arn: swag.String(embed.Lambda), Events: prettyEventNames(embed.Events), Prefix: prefix, Suffix: suffix, }) } return configs, nil } // getListBucketsResponse performs listBucketEvents() and serializes it to the handler's output func getListBucketEventsResponse(session *models.Principal, params bucketApi.ListBucketEventsParams) (*models.ListBucketEventsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} bucketEvents, err := listBucketEvents(minioClient, params.BucketName) if err != nil { return nil, ErrorWithContext(ctx, err) } // serialize output listBucketsResponse := &models.ListBucketEventsResponse{ Events: bucketEvents, Total: int64(len(bucketEvents)), } return listBucketsResponse, nil } // createBucketEvent calls mc AddNotificationConfig() to create a bucket nofication // // If notificationEvents is empty, by default will set [get, put, delete], else the provided // ones will be set. // this function follows same behavior as minio/mc for adding a bucket event func createBucketEvent(ctx context.Context, client MCClient, arn string, notificationEvents []models.NotificationEventType, prefix, suffix string, ignoreExisting bool) error { var events []string if len(notificationEvents) == 0 { // default event values are [get, put, delete] events = []string{ string(models.NotificationEventTypeGet), string(models.NotificationEventTypePut), string(models.NotificationEventTypeDelete), } } else { // else use defined events in request // cast type models.NotificationEventType to string for _, e := range notificationEvents { events = append(events, string(e)) } } perr := client.addNotificationConfig(ctx, arn, events, prefix, suffix, ignoreExisting) if perr != nil { return perr.Cause } return nil } // getCreateBucketEventsResponse calls createBucketEvent to add a bucket event notification func getCreateBucketEventsResponse(session *models.Principal, params bucketApi.CreateBucketEventParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() bucketName := params.BucketName eventReq := params.Body s3Client, err := newS3BucketClient(session, bucketName, "", getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} err = createBucketEvent(ctx, mcClient, *eventReq.Configuration.Arn, eventReq.Configuration.Events, eventReq.Configuration.Prefix, eventReq.Configuration.Suffix, eventReq.IgnoreExisting) if err != nil { return ErrorWithContext(ctx, err) } return nil } // deleteBucketEventNotification calls S3Client.RemoveNotificationConfig to remove a bucket event notification func deleteBucketEventNotification(ctx context.Context, client MCClient, arn string, events []models.NotificationEventType, prefix, suffix *string) error { eventSingleString := joinNotificationEvents(events) perr := client.removeNotificationConfig(ctx, arn, eventSingleString, *prefix, *suffix) if perr != nil { return perr.Cause } return nil } func joinNotificationEvents(events []models.NotificationEventType) string { var eventsArn []string for _, e := range events { eventsArn = append(eventsArn, string(e)) } return strings.Join(eventsArn, ",") } // getDeleteBucketEventsResponse calls deleteBucketEventNotification() to delete a bucket event notification func getDeleteBucketEventsResponse(session *models.Principal, params bucketApi.DeleteBucketEventParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() bucketName := params.BucketName arn := params.Arn events := params.Body.Events prefix := params.Body.Prefix suffix := params.Body.Suffix s3Client, err := newS3BucketClient(session, bucketName, "", getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} err = deleteBucketEventNotification(ctx, mcClient, arn, events, prefix, suffix) if err != nil { return ErrorWithContext(ctx, err) } return nil } ================================================ FILE: api/user_buckets_events_test.go ================================================ // 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 api import ( "context" "errors" "fmt" "testing" "github.com/go-openapi/swag" "github.com/minio/console/models" "github.com/minio/mc/pkg/probe" "github.com/minio/minio-go/v7/pkg/notification" "github.com/stretchr/testify/assert" ) // assigning mock at runtime instead of compile time var minioGetBucketNotificationMock func(ctx context.Context, bucketName string) (bucketNotification notification.Configuration, err error) // mock function of getBucketNotification() func (mc minioClientMock) getBucketNotification(ctx context.Context, bucketName string) (bucketNotification notification.Configuration, err error) { return minioGetBucketNotificationMock(ctx, bucketName) } // // Mock mc S3Client functions //// var ( mcAddNotificationConfigMock func(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error mcRemoveNotificationConfigMock func(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error ) // Define a mock struct of mc S3Client interface implementation type s3ClientMock struct{} // implements mc.S3Client.AddNotificationConfigMock() func (c s3ClientMock) addNotificationConfig(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error { return mcAddNotificationConfigMock(ctx, arn, events, prefix, suffix, ignoreExisting) } // implements mc.S3Client.DeleteBucketEventNotification() func (c s3ClientMock) removeNotificationConfig(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error { return mcRemoveNotificationConfigMock(ctx, arn, event, prefix, suffix) } func TestAddBucketNotification(t *testing.T) { assert := assert.New(t) // mock minIO client ctx, cancel := context.WithCancel(context.Background()) defer cancel() client := s3ClientMock{} function := "createBucketEvent()" // Test-1: createBucketEvent() set an event with empty parameters and events, should set default values with no error testArn := "arn:minio:sqs::test:postgresql" testNotificationEvents := []models.NotificationEventType{} testPrefix := "" testSuffix := "" testIgnoreExisting := false mcAddNotificationConfigMock = func(_ context.Context, _ string, _ []string, _, _ string, _ bool) *probe.Error { return nil } if err := createBucketEvent(ctx, client, testArn, testNotificationEvents, testPrefix, testSuffix, testIgnoreExisting); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2: createBucketEvent() with different even types in list shouls create event with no errors testArn = "arn:minio:sqs::test:postgresql" testNotificationEvents = []models.NotificationEventType{ models.NotificationEventTypePut, models.NotificationEventTypeGet, } testPrefix = "photos/" testSuffix = ".jpg" testIgnoreExisting = true mcAddNotificationConfigMock = func(_ context.Context, _ string, _ []string, _, _ string, _ bool) *probe.Error { return nil } if err := createBucketEvent(ctx, client, testArn, testNotificationEvents, testPrefix, testSuffix, testIgnoreExisting); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-3 createBucketEvent() S3Client.AddNotificationConfig returns an error and is handled correctly mcAddNotificationConfigMock = func(_ context.Context, _ string, _ []string, _, _ string, _ bool) *probe.Error { return probe.NewError(errors.New("error")) } if err := createBucketEvent(ctx, client, testArn, testNotificationEvents, testPrefix, testSuffix, testIgnoreExisting); assert.Error(err) { assert.Equal("error", err.Error()) } } func TestDeleteBucketNotification(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() assert := assert.New(t) // mock minIO client client := s3ClientMock{} function := "deleteBucketEventNotification()" // Test-1: deleteBucketEventNotification() delete a bucket event notification testArn := "arn:minio:sqs::test:postgresql" // arn string, events []models.NotificationEventType, prefix, suffix *string events := []models.NotificationEventType{ models.NotificationEventTypeGet, models.NotificationEventTypeDelete, models.NotificationEventTypePut, } prefix := "/photos" suffix := ".jpg" mcRemoveNotificationConfigMock = func(_ context.Context, _ string, _ string, _ string, _ string) *probe.Error { return nil } if err := deleteBucketEventNotification(ctx, client, testArn, events, swag.String(prefix), swag.String(suffix)); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // Test-2 deleteBucketEventNotification() S3Client.DeleteBucketEventNotification returns an error and is handled correctly mcRemoveNotificationConfigMock = func(_ context.Context, _ string, _ string, _ string, _ string) *probe.Error { return probe.NewError(errors.New("error")) } if err := deleteBucketEventNotification(ctx, client, testArn, events, swag.String(prefix), swag.String(suffix)); assert.Error(err) { assert.Equal("error", err.Error()) } // Test-3 joinNotificationEvents() verify that it returns the events as a single string separated by commas function = "joinNotificationEvents()" eventString := joinNotificationEvents(events) assert.Equal("get,delete,put", eventString, fmt.Sprintf("Failed on %s:", function)) } func TestListBucketEvents(t *testing.T) { assert := assert.New(t) // mock minIO client minClient := minioClientMock{} function := "listBucketEvents()" ////// Test-1 : listBucketEvents() get list of events for a particular bucket only one config // mock bucketNotification response from MinIO mockBucketN := notification.Configuration{ LambdaConfigs: []notification.LambdaConfig{}, TopicConfigs: []notification.TopicConfig{}, QueueConfigs: []notification.QueueConfig{ { Queue: "arn:minio:sqs::test:postgresql", Config: notification.Config{ ID: "", Events: []notification.EventType{ notification.ObjectAccessedAll, notification.ObjectCreatedAll, notification.ObjectRemovedAll, }, Filter: ¬ification.Filter{ S3Key: notification.S3Key{ FilterRules: []notification.FilterRule{ { Name: "suffix", Value: ".jpg", }, { Name: "prefix", Value: "file/", }, }, }, }, }, }, }, } expectedOutput := []*models.NotificationConfig{ { Arn: swag.String("arn:minio:sqs::test:postgresql"), ID: "", Prefix: "file/", Suffix: ".jpg", Events: []models.NotificationEventType{ models.NotificationEventTypeGet, models.NotificationEventTypePut, models.NotificationEventTypeDelete, }, }, } minioGetBucketNotificationMock = func(_ context.Context, _ string) (bucketNotification notification.Configuration, err error) { return mockBucketN, nil } eventConfigs, err := listBucketEvents(minClient, "bucket") if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of buckets is correct assert.Equal(len(expectedOutput), len(eventConfigs), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) for i, conf := range eventConfigs { assert.Equal(expectedOutput[i].Arn, conf.Arn) assert.Equal(expectedOutput[i].ID, conf.ID) assert.Equal(expectedOutput[i].Suffix, conf.Suffix) assert.Equal(expectedOutput[i].Prefix, conf.Prefix) assert.Equal(len(expectedOutput[i].Events), len(conf.Events), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) for j, event := range conf.Events { assert.Equal(expectedOutput[i].Events[j], event) } } ////// Test-2 : listBucketEvents() get list of events no filters mockBucketN = notification.Configuration{ LambdaConfigs: []notification.LambdaConfig{}, TopicConfigs: []notification.TopicConfig{}, QueueConfigs: []notification.QueueConfig{ { Queue: "arn:minio:sqs::test:postgresql", Config: notification.Config{ ID: "", Events: []notification.EventType{ notification.ObjectRemovedAll, }, }, }, }, } expectedOutput = []*models.NotificationConfig{ { Arn: swag.String("arn:minio:sqs::test:postgresql"), ID: "", Prefix: "", Suffix: "", Events: []models.NotificationEventType{ models.NotificationEventTypeDelete, }, }, } minioGetBucketNotificationMock = func(_ context.Context, _ string) (bucketNotification notification.Configuration, err error) { return mockBucketN, nil } eventConfigs, err = listBucketEvents(minClient, "bucket") if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of buckets is correct assert.Equal(len(expectedOutput), len(eventConfigs), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) for i, conf := range eventConfigs { assert.Equal(expectedOutput[i].Arn, conf.Arn) assert.Equal(expectedOutput[i].ID, conf.ID) assert.Equal(expectedOutput[i].Suffix, conf.Suffix) assert.Equal(expectedOutput[i].Prefix, conf.Prefix) assert.Equal(len(expectedOutput[i].Events), len(conf.Events), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) for j, event := range conf.Events { assert.Equal(expectedOutput[i].Events[j], event) } } ////// Test-3 : listBucketEvents() get list of events mockBucketN = notification.Configuration{ LambdaConfigs: []notification.LambdaConfig{ { Lambda: "lambda", Config: notification.Config{ ID: "", Events: []notification.EventType{ notification.ObjectRemovedAll, }, Filter: ¬ification.Filter{ S3Key: notification.S3Key{ FilterRules: []notification.FilterRule{ { Name: "suffix", Value: ".png", }, { Name: "prefix", Value: "lambda/", }, }, }, }, }, }, }, TopicConfigs: []notification.TopicConfig{ { Topic: "topic", Config: notification.Config{ ID: "", Events: []notification.EventType{ notification.ObjectRemovedAll, }, Filter: ¬ification.Filter{ S3Key: notification.S3Key{ FilterRules: []notification.FilterRule{ { Name: "suffix", Value: ".gif", }, { Name: "prefix", Value: "topic/", }, }, }, }, }, }, }, QueueConfigs: []notification.QueueConfig{ { Queue: "arn:minio:sqs::test:postgresql", Config: notification.Config{ ID: "", Events: []notification.EventType{ notification.ObjectRemovedAll, }, Filter: ¬ification.Filter{ S3Key: notification.S3Key{ FilterRules: []notification.FilterRule{}, }, }, }, }, }, } // order matters in output: topic,queue then lambda are given respectively expectedOutput = []*models.NotificationConfig{ { Arn: swag.String("topic"), ID: "", Prefix: "topic/", Suffix: ".gif", Events: []models.NotificationEventType{ models.NotificationEventTypeDelete, }, }, { Arn: swag.String("arn:minio:sqs::test:postgresql"), ID: "", Prefix: "", Suffix: "", Events: []models.NotificationEventType{ models.NotificationEventTypeDelete, }, }, { Arn: swag.String("lambda"), ID: "", Prefix: "lambda/", Suffix: ".png", Events: []models.NotificationEventType{ models.NotificationEventTypeDelete, }, }, } minioGetBucketNotificationMock = func(_ context.Context, _ string) (bucketNotification notification.Configuration, err error) { return mockBucketN, nil } eventConfigs, err = listBucketEvents(minClient, "bucket") if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of buckets is correct assert.Equal(len(expectedOutput), len(eventConfigs), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) for i, conf := range eventConfigs { assert.Equal(expectedOutput[i].Arn, conf.Arn) assert.Equal(expectedOutput[i].ID, conf.ID) assert.Equal(expectedOutput[i].Suffix, conf.Suffix) assert.Equal(expectedOutput[i].Prefix, conf.Prefix) assert.Equal(len(expectedOutput[i].Events), len(conf.Events), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) for j, event := range conf.Events { assert.Equal(expectedOutput[i].Events[j], event) } } ////// Test-2 : listBucketEvents() Returns error and see that the error is handled correctly and returned minioGetBucketNotificationMock = func(_ context.Context, _ string) (bucketNotification notification.Configuration, err error) { return notification.Configuration{}, errors.New("error") } _, err = listBucketEvents(minClient, "bucket") if assert.Error(err) { assert.Equal("error", err.Error()) } } ================================================ FILE: api/user_buckets_lifecycle.go ================================================ // 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 api import ( "context" "errors" "fmt" "strconv" "strings" "time" "github.com/minio/minio-go/v7" "github.com/rs/xid" "github.com/minio/mc/cmd/ilm" "github.com/minio/minio-go/v7/pkg/lifecycle" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" bucketApi "github.com/minio/console/api/operations/bucket" "github.com/minio/console/models" ) type MultiLifecycleResult struct { BucketName string Error string } func registerBucketsLifecycleHandlers(api *operations.ConsoleAPI) { api.BucketGetBucketLifecycleHandler = bucketApi.GetBucketLifecycleHandlerFunc(func(params bucketApi.GetBucketLifecycleParams, session *models.Principal) middleware.Responder { listBucketLifecycleResponse, err := getBucketLifecycleResponse(session, params) if err != nil { return bucketApi.NewGetBucketLifecycleDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewGetBucketLifecycleOK().WithPayload(listBucketLifecycleResponse) }) api.BucketAddBucketLifecycleHandler = bucketApi.AddBucketLifecycleHandlerFunc(func(params bucketApi.AddBucketLifecycleParams, session *models.Principal) middleware.Responder { err := getAddBucketLifecycleResponse(session, params) if err != nil { return bucketApi.NewAddBucketLifecycleDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewAddBucketLifecycleCreated() }) api.BucketUpdateBucketLifecycleHandler = bucketApi.UpdateBucketLifecycleHandlerFunc(func(params bucketApi.UpdateBucketLifecycleParams, session *models.Principal) middleware.Responder { err := getEditBucketLifecycleRule(session, params) if err != nil { return bucketApi.NewUpdateBucketLifecycleDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewUpdateBucketLifecycleOK() }) api.BucketDeleteBucketLifecycleRuleHandler = bucketApi.DeleteBucketLifecycleRuleHandlerFunc(func(params bucketApi.DeleteBucketLifecycleRuleParams, session *models.Principal) middleware.Responder { err := getDeleteBucketLifecycleRule(session, params) if err != nil { return bucketApi.NewDeleteBucketLifecycleRuleDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewDeleteBucketLifecycleRuleNoContent() }) api.BucketAddMultiBucketLifecycleHandler = bucketApi.AddMultiBucketLifecycleHandlerFunc(func(params bucketApi.AddMultiBucketLifecycleParams, session *models.Principal) middleware.Responder { multiBucketResponse, err := getAddMultiBucketLifecycleResponse(session, params) if err != nil { bucketApi.NewAddMultiBucketLifecycleDefault(err.Code).WithPayload(err.APIError) } return bucketApi.NewAddMultiBucketLifecycleOK().WithPayload(multiBucketResponse) }) } // getBucketLifecycle() gets lifecycle lists for a bucket from MinIO API and returns their implementations func getBucketLifecycle(ctx context.Context, client MinioClient, bucketName string) (*models.BucketLifecycleResponse, error) { lifecycleList, err := client.getLifecycleRules(ctx, bucketName) if err != nil { return nil, err } var rules []*models.ObjectBucketLifecycle for _, rule := range lifecycleList.Rules { var tags []*models.LifecycleTag for _, tagData := range rule.RuleFilter.And.Tags { tags = append(tags, &models.LifecycleTag{ Key: tagData.Key, Value: tagData.Value, }) } if rule.RuleFilter.Tag.Key != "" { tags = append(tags, &models.LifecycleTag{ Key: rule.RuleFilter.Tag.Key, Value: rule.RuleFilter.Tag.Value, }) } rulePrefix := rule.RuleFilter.And.Prefix if rulePrefix == "" { rulePrefix = rule.RuleFilter.Prefix } rules = append(rules, &models.ObjectBucketLifecycle{ ID: rule.ID, Status: rule.Status, Prefix: rulePrefix, Expiration: &models.ExpirationResponse{ Date: rule.Expiration.Date.Format(time.RFC3339), Days: int64(rule.Expiration.Days), DeleteMarker: rule.Expiration.DeleteMarker.IsEnabled(), DeleteAll: bool(rule.Expiration.DeleteAll), NoncurrentExpirationDays: int64(rule.NoncurrentVersionExpiration.NoncurrentDays), NewerNoncurrentExpirationVersions: int64(rule.NoncurrentVersionExpiration.NewerNoncurrentVersions), }, Transition: &models.TransitionResponse{ Date: rule.Transition.Date.Format(time.RFC3339), Days: int64(rule.Transition.Days), StorageClass: rule.Transition.StorageClass, NoncurrentStorageClass: rule.NoncurrentVersionTransition.StorageClass, NoncurrentTransitionDays: int64(rule.NoncurrentVersionTransition.NoncurrentDays), }, Tags: tags, }) } // serialize output lifecycleBucketsResponse := &models.BucketLifecycleResponse{ Lifecycle: rules, } return lifecycleBucketsResponse, nil } // getBucketLifecycleResponse performs getBucketLifecycle() and serializes it to the handler's output func getBucketLifecycleResponse(session *models.Principal, params bucketApi.GetBucketLifecycleParams) (*models.BucketLifecycleResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} bucketEvents, err := getBucketLifecycle(ctx, minioClient, params.BucketName) if err != nil { return nil, ErrorWithContext(ctx, ErrBucketLifeCycleNotConfigured, err) } return bucketEvents, nil } // addBucketLifecycle gets lifecycle lists for a bucket from MinIO API and returns their implementations func addBucketLifecycle(ctx context.Context, client MinioClient, params bucketApi.AddBucketLifecycleParams) error { // Configuration that is already set. lfcCfg, err := client.getLifecycleRules(ctx, params.BucketName) if err != nil { if e := err; minio.ToErrorResponse(e).Code == "NoSuchLifecycleConfiguration" { lfcCfg = lifecycle.NewConfiguration() } else { return err } } id := xid.New().String() opts := ilm.LifecycleOptions{} // Verify if transition rule is requested switch params.Body.Type { case models.AddBucketLifecycleTypeTransition: if params.Body.TransitionDays == 0 && params.Body.NoncurrentversionTransitionDays == 0 { return errors.New("you must provide a value for transition days or date") } status := !params.Body.Disable opts = ilm.LifecycleOptions{ ID: id, Prefix: ¶ms.Body.Prefix, Status: &status, Tags: ¶ms.Body.Tags, ExpiredObjectDeleteMarker: ¶ms.Body.ExpiredObjectDeleteMarker, ExpiredObjectAllversions: ¶ms.Body.ExpiredObjectDeleteAll, } if params.Body.NoncurrentversionTransitionDays > 0 { noncurrentVersionTransitionDays := int(params.Body.NoncurrentversionTransitionDays) noncurrentVersionTransitionStorageClass := strings.ToUpper(params.Body.NoncurrentversionTransitionStorageClass) opts.NoncurrentVersionTransitionDays = &noncurrentVersionTransitionDays opts.NoncurrentVersionTransitionStorageClass = &noncurrentVersionTransitionStorageClass } else if params.Body.TransitionDays > 0 { tdays := strconv.Itoa(int(params.Body.TransitionDays)) sclass := strings.ToUpper(params.Body.StorageClass) opts.TransitionDays = &tdays opts.StorageClass = &sclass } case models.AddBucketLifecycleTypeExpiry: // Verify if expiry items are set if params.Body.NoncurrentversionTransitionDays != 0 { return errors.New("non current version Transition Days cannot be set when expiry is being configured") } if params.Body.NoncurrentversionTransitionStorageClass != "" { return errors.New("non current version Transition Storage Class cannot be set when expiry is being configured") } status := !params.Body.Disable opts = ilm.LifecycleOptions{ ID: id, Prefix: ¶ms.Body.Prefix, Status: &status, Tags: ¶ms.Body.Tags, ExpiredObjectDeleteMarker: ¶ms.Body.ExpiredObjectDeleteMarker, ExpiredObjectAllversions: ¶ms.Body.ExpiredObjectDeleteAll, } if params.Body.NewerNoncurrentversionExpirationVersions > 0 { versions := int(params.Body.NewerNoncurrentversionExpirationVersions) opts.NewerNoncurrentExpirationVersions = &versions } switch { case params.Body.NoncurrentversionExpirationDays > 0: days := int(params.Body.NoncurrentversionExpirationDays) opts.NoncurrentVersionExpirationDays = &days case params.Body.ExpiryDays > 0: days := strconv.Itoa(int(params.Body.ExpiryDays)) opts.ExpiryDays = &days } default: // Non set, we return errors return errors.New("no valid lifecycle configuration requested") } newRule, merr := opts.ToILMRule() if merr != nil { return merr.ToGoError() } lfcCfg.Rules = append(lfcCfg.Rules, newRule) return client.setBucketLifecycle(ctx, params.BucketName, lfcCfg) } // getAddBucketLifecycleResponse returns the response of adding a bucket lifecycle response func getAddBucketLifecycleResponse(session *models.Principal, params bucketApi.AddBucketLifecycleParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} err = addBucketLifecycle(ctx, minioClient, params) if err != nil { return ErrorWithContext(ctx, err) } return nil } // editBucketLifecycle gets lifecycle lists for a bucket from MinIO API and updates the selected lifecycle rule func editBucketLifecycle(ctx context.Context, client MinioClient, params bucketApi.UpdateBucketLifecycleParams) error { // Configuration that is already set. lfcCfg, err := client.getLifecycleRules(ctx, params.BucketName) if err != nil { if e := err; minio.ToErrorResponse(e).Code == "NoSuchLifecycleConfiguration" { lfcCfg = lifecycle.NewConfiguration() } else { return err } } id := params.LifecycleID opts := ilm.LifecycleOptions{} // Verify if transition items are set switch *params.Body.Type { case models.UpdateBucketLifecycleTypeTransition: if params.Body.TransitionDays == 0 && params.Body.NoncurrentversionTransitionDays == 0 { return errors.New("you must select transition days or non-current transition days configuration") } status := !params.Body.Disable opts = ilm.LifecycleOptions{ ID: id, Prefix: ¶ms.Body.Prefix, Status: &status, Tags: ¶ms.Body.Tags, ExpiredObjectDeleteMarker: ¶ms.Body.ExpiredObjectDeleteMarker, ExpiredObjectAllversions: ¶ms.Body.ExpiredObjectDeleteAll, } if params.Body.NoncurrentversionTransitionDays > 0 { noncurrentVersionTransitionDays := int(params.Body.NoncurrentversionTransitionDays) noncurrentVersionTransitionStorageClass := strings.ToUpper(params.Body.NoncurrentversionTransitionStorageClass) opts.NoncurrentVersionTransitionDays = &noncurrentVersionTransitionDays opts.NoncurrentVersionTransitionStorageClass = &noncurrentVersionTransitionStorageClass } else { tdays := strconv.Itoa(int(params.Body.TransitionDays)) sclass := strings.ToUpper(params.Body.StorageClass) opts.TransitionDays = &tdays opts.StorageClass = &sclass } case models.UpdateBucketLifecycleTypeExpiry: // Verify if expiry configuration is set if params.Body.NoncurrentversionTransitionDays != 0 { return errors.New("non current version Transition Days cannot be set when expiry is being configured") } if params.Body.NoncurrentversionTransitionStorageClass != "" { return errors.New("non current version Transition Storage Class cannot be set when expiry is being configured") } status := !params.Body.Disable opts = ilm.LifecycleOptions{ ID: id, Prefix: ¶ms.Body.Prefix, Status: &status, Tags: ¶ms.Body.Tags, ExpiredObjectDeleteMarker: ¶ms.Body.ExpiredObjectDeleteMarker, ExpiredObjectAllversions: ¶ms.Body.ExpiredObjectDeleteAll, } if params.Body.NoncurrentversionExpirationDays > 0 { days := int(params.Body.NoncurrentversionExpirationDays) opts.NoncurrentVersionExpirationDays = &days } else { days := strconv.Itoa(int(params.Body.ExpiryDays)) opts.ExpiryDays = &days } default: // Non set, we return errors return errors.New("no valid configuration requested") } var rule *lifecycle.Rule for i := range lfcCfg.Rules { if lfcCfg.Rules[i].ID == opts.ID { rule = &lfcCfg.Rules[i] break } } if rule == nil { return errors.New("unable to find the matching rule to update") } err2 := ilm.ApplyRuleFields(rule, opts) if err2.ToGoError() != nil { return fmt.Errorf("unable to generate new lifecycle rule: %v", err2.ToGoError()) } return client.setBucketLifecycle(ctx, params.BucketName, lfcCfg) } // getEditBucketLifecycleRule returns the response of bucket lifecycle tier edit func getEditBucketLifecycleRule(session *models.Principal, params bucketApi.UpdateBucketLifecycleParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} err = editBucketLifecycle(ctx, minioClient, params) if err != nil { return ErrorWithContext(ctx, err) } return nil } // deleteBucketLifecycle deletes lifecycle rule by passing an empty rule to a selected ID func deleteBucketLifecycle(ctx context.Context, client MinioClient, params bucketApi.DeleteBucketLifecycleRuleParams) error { // Configuration that is already set. lfcCfg, err := client.getLifecycleRules(ctx, params.BucketName) if err != nil { if e := err; minio.ToErrorResponse(e).Code == "NoSuchLifecycleConfiguration" { lfcCfg = lifecycle.NewConfiguration() } else { return err } } if len(lfcCfg.Rules) == 0 { return errors.New("no rules available to delete") } var newRules []lifecycle.Rule for _, rule := range lfcCfg.Rules { if rule.ID != params.LifecycleID { newRules = append(newRules, rule) } } if len(newRules) == len(lfcCfg.Rules) && len(lfcCfg.Rules) > 0 { // rule doesn't exist return fmt.Errorf("lifecycle rule for id '%s' doesn't exist", params.LifecycleID) } lfcCfg.Rules = newRules return client.setBucketLifecycle(ctx, params.BucketName, lfcCfg) } // getDeleteBucketLifecycleRule returns the response of bucket lifecycle tier delete func getDeleteBucketLifecycleRule(session *models.Principal, params bucketApi.DeleteBucketLifecycleRuleParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} err = deleteBucketLifecycle(ctx, minioClient, params) if err != nil { return ErrorWithContext(ctx, err) } return nil } // addMultiBucketLifecycle creates multibuckets lifecycle assignments func addMultiBucketLifecycle(ctx context.Context, client MinioClient, params bucketApi.AddMultiBucketLifecycleParams) []MultiLifecycleResult { bucketsRelation := params.Body.Buckets // Parallel Lifecycle rules set parallelLifecycleBucket := func(bucketName string) chan MultiLifecycleResult { remoteProc := make(chan MultiLifecycleResult) lifecycleParams := models.AddBucketLifecycle{ Type: *params.Body.Type, StorageClass: params.Body.StorageClass, TransitionDays: params.Body.TransitionDays, Prefix: params.Body.Prefix, NoncurrentversionTransitionDays: params.Body.NoncurrentversionTransitionDays, NoncurrentversionTransitionStorageClass: params.Body.NoncurrentversionTransitionStorageClass, NoncurrentversionExpirationDays: params.Body.NoncurrentversionExpirationDays, Tags: params.Body.Tags, ExpiryDays: params.Body.ExpiryDays, Disable: false, ExpiredObjectDeleteMarker: params.Body.ExpiredObjectDeleteMarker, ExpiredObjectDeleteAll: params.Body.ExpiredObjectDeleteMarker, } go func() { defer close(remoteProc) lifecycleParams := bucketApi.AddBucketLifecycleParams{ BucketName: bucketName, Body: &lifecycleParams, } // We add lifecycle rule & expect a response err := addBucketLifecycle(ctx, client, lifecycleParams) errorReturn := "" if err != nil { errorReturn = err.Error() } retParams := MultiLifecycleResult{ BucketName: bucketName, Error: errorReturn, } remoteProc <- retParams }() return remoteProc } var lifecycleManagement []chan MultiLifecycleResult for _, bucketName := range bucketsRelation { rBucket := parallelLifecycleBucket(bucketName) lifecycleManagement = append(lifecycleManagement, rBucket) } var resultsList []MultiLifecycleResult for _, result := range lifecycleManagement { res := <-result resultsList = append(resultsList, res) } return resultsList } // getAddMultiBucketLifecycleResponse returns the response of multibucket lifecycle assignment func getAddMultiBucketLifecycleResponse(session *models.Principal, params bucketApi.AddMultiBucketLifecycleParams) (*models.MultiLifecycleResult, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} multiCycleResult := addMultiBucketLifecycle(ctx, minioClient, params) var returnList []*models.MulticycleResultItem for _, resultItem := range multiCycleResult { multicycleRS := models.MulticycleResultItem{ BucketName: resultItem.BucketName, Error: resultItem.Error, } returnList = append(returnList, &multicycleRS) } finalResult := models.MultiLifecycleResult{Results: returnList} return &finalResult, nil } ================================================ FILE: api/user_buckets_lifecycle_test.go ================================================ // 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 api import ( "context" "errors" "fmt" "testing" "github.com/minio/console/models" "github.com/stretchr/testify/assert" bucketApi "github.com/minio/console/api/operations/bucket" "github.com/minio/minio-go/v7/pkg/lifecycle" ) // assigning mock at runtime instead of compile time var minioGetLifecycleRulesMock func(ctx context.Context, bucketName string) (lifecycle *lifecycle.Configuration, err error) // mock function of getLifecycleRules() func (ac minioClientMock) getLifecycleRules(ctx context.Context, bucketName string) (lifecycle *lifecycle.Configuration, err error) { return minioGetLifecycleRulesMock(ctx, bucketName) } // assign mock for set Bucket Lifecycle var minioSetBucketLifecycleMock func(ctx context.Context, bucketName string, config *lifecycle.Configuration) error // mock function of setBucketLifecycle() func (ac minioClientMock) setBucketLifecycle(ctx context.Context, bucketName string, config *lifecycle.Configuration) error { return minioSetBucketLifecycleMock(ctx, bucketName, config) } func TestGetLifecycleRules(t *testing.T) { assert := assert.New(t) // mock minIO client minClient := minioClientMock{} function := "getBucketLifecycle()" bucketName := "testBucket" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : getBucketLifecycle() get list of events for a particular bucket only one config // mock lifecycle response from MinIO mockLifecycle := lifecycle.Configuration{ Rules: []lifecycle.Rule{ { ID: "TESTRULE", Expiration: lifecycle.Expiration{Days: 15}, Status: "Enabled", RuleFilter: lifecycle.Filter{Tag: lifecycle.Tag{Key: "tag1", Value: "val1"}, And: lifecycle.And{Prefix: "prefix1"}}, }, }, } expectedOutput := models.BucketLifecycleResponse{ Lifecycle: []*models.ObjectBucketLifecycle{ { ID: "TESTRULE", Status: "Enabled", Prefix: "prefix1", Expiration: &models.ExpirationResponse{Days: int64(15)}, Transition: &models.TransitionResponse{}, Tags: []*models.LifecycleTag{{Key: "tag1", Value: "val1"}}, }, }, } minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { return &mockLifecycle, nil } lifeCycleConfigs, err := getBucketLifecycle(ctx, minClient, bucketName) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of buckets is correct assert.Equal(len(expectedOutput.Lifecycle), len(lifeCycleConfigs.Lifecycle), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) for i, conf := range lifeCycleConfigs.Lifecycle { assert.Equal(expectedOutput.Lifecycle[i].ID, conf.ID) assert.Equal(expectedOutput.Lifecycle[i].Status, conf.Status) assert.Equal(expectedOutput.Lifecycle[i].Prefix, conf.Prefix) assert.Equal(expectedOutput.Lifecycle[i].Expiration.Days, conf.Expiration.Days) for j, event := range conf.Tags { assert.Equal(expectedOutput.Lifecycle[i].Tags[j], event) } } // Test-2 : getBucketLifecycle() get list of events is empty mockLifecycleT2 := lifecycle.Configuration{ Rules: []lifecycle.Rule{}, } expectedOutputT2 := models.BucketLifecycleResponse{ Lifecycle: []*models.ObjectBucketLifecycle{}, } minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { return &mockLifecycleT2, nil } lifeCycleConfigsT2, err := getBucketLifecycle(ctx, minClient, bucketName) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // verify length of buckets is correct assert.Equal(len(expectedOutputT2.Lifecycle), len(lifeCycleConfigsT2.Lifecycle), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) // Test-3 : getBucketLifecycle() get list of events returns an error minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { return nil, errors.New("error returned") } _, errT3 := getBucketLifecycle(ctx, minClient, bucketName) errorCompare := errors.New("error returned") assert.Equal(errorCompare, errT3, fmt.Sprintf("Failed on %s: Invalid error message", function)) // verify length of buckets is correct assert.Equal(len(expectedOutputT2.Lifecycle), len(lifeCycleConfigsT2.Lifecycle), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) } func TestSetLifecycleRule(t *testing.T) { assert := assert.New(t) // mock minIO client minClient := minioClientMock{} function := "addBucketLifecycle()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : addBucketLifecycle() get list of events for a particular bucket only one config // mock create request mockLifecycle := lifecycle.Configuration{ Rules: []lifecycle.Rule{ { ID: "TESTRULE", Expiration: lifecycle.Expiration{Days: 15}, Status: "Enabled", RuleFilter: lifecycle.Filter{Tag: lifecycle.Tag{Key: "tag1", Value: "val1"}, And: lifecycle.And{Prefix: "prefix1"}}, }, }, } minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { return &mockLifecycle, nil } expiryRule := "expiry" insertMock := bucketApi.AddBucketLifecycleParams{ BucketName: "testBucket", Body: &models.AddBucketLifecycle{ Type: expiryRule, Disable: false, ExpiredObjectDeleteMarker: false, ExpiryDays: int32(16), NoncurrentversionExpirationDays: 0, NoncurrentversionTransitionDays: 0, NoncurrentversionTransitionStorageClass: "", Prefix: "pref1", StorageClass: "", Tags: "", TransitionDays: 0, }, } minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { return nil } err := addBucketLifecycle(ctx, minClient, insertMock) assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) // Test-2 : addBucketLifecycle() returns error minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { return errors.New("error setting lifecycle") } err2 := addBucketLifecycle(ctx, minClient, insertMock) assert.Equal(errors.New("error setting lifecycle"), err2, fmt.Sprintf("Failed on %s: Error returned", function)) } func TestUpdateLifecycleRule(t *testing.T) { assert := assert.New(t) // mock minIO client minClient := minioClientMock{} function := "editBucketLifecycle()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Test-1 : editBucketLifecycle() get list of events for a particular bucket only one config (get lifecycle mock) // mock create request mockLifecycle := lifecycle.Configuration{ Rules: []lifecycle.Rule{ { ID: "TESTRULE", Expiration: lifecycle.Expiration{Days: 15}, Status: "Enabled", RuleFilter: lifecycle.Filter{Tag: lifecycle.Tag{Key: "tag1", Value: "val1"}, And: lifecycle.And{Prefix: "prefix1"}}, }, }, } minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { return &mockLifecycle, nil } // Test-2 : editBucketLifecycle() Update lifecycle rule expiryRule := "expiry" editMock := bucketApi.UpdateBucketLifecycleParams{ BucketName: "testBucket", Body: &models.UpdateBucketLifecycle{ Type: &expiryRule, Disable: false, ExpiredObjectDeleteMarker: false, ExpiryDays: int32(16), NoncurrentversionExpirationDays: 0, NoncurrentversionTransitionDays: 0, NoncurrentversionTransitionStorageClass: "", Prefix: "pref1", StorageClass: "", Tags: "", TransitionDays: 0, }, LifecycleID: "TESTRULE", } minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { return nil } err := editBucketLifecycle(ctx, minClient, editMock) assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) // Test-2a : editBucketLifecycle() Update lifecycle rule transitionRule := "transition" editMock = bucketApi.UpdateBucketLifecycleParams{ BucketName: "testBucket", Body: &models.UpdateBucketLifecycle{ Type: &transitionRule, Disable: false, ExpiredObjectDeleteMarker: false, NoncurrentversionTransitionDays: 5, Prefix: "pref1", StorageClass: "TEST", NoncurrentversionTransitionStorageClass: "TESTNC", Tags: "", TransitionDays: int32(16), }, LifecycleID: "TESTRULE", } minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { return nil } err = editBucketLifecycle(ctx, minClient, editMock) assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) // Test-3 : editBucketLifecycle() returns error minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { return errors.New("error setting lifecycle") } err2 := editBucketLifecycle(ctx, minClient, editMock) assert.Equal(errors.New("error setting lifecycle"), err2, fmt.Sprintf("Failed on %s: Error returned", function)) } func TestDeleteLifecycleRule(t *testing.T) { assert := assert.New(t) // mock minIO client minClient := minioClientMock{} function := "deleteBucketLifecycle()" ctx, cancel := context.WithCancel(context.Background()) defer cancel() minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { return nil } // Test-1 : deleteBucketLifecycle() get list of events for a particular bucket only one config (get lifecycle mock) // mock create request mockLifecycle := lifecycle.Configuration{ Rules: []lifecycle.Rule{ { ID: "TESTRULE", Expiration: lifecycle.Expiration{Days: 15}, Status: "Enabled", RuleFilter: lifecycle.Filter{Tag: lifecycle.Tag{Key: "tag1", Value: "val1"}, And: lifecycle.And{Prefix: "prefix1"}}, }, { ID: "TESTRULE2", Transition: lifecycle.Transition{Days: 10, StorageClass: "TESTSTCLASS"}, Status: "Enabled", RuleFilter: lifecycle.Filter{Tag: lifecycle.Tag{Key: "tag1", Value: "val1"}, And: lifecycle.And{Prefix: "prefix1"}}, }, }, } minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { return &mockLifecycle, nil } // Test-2 : deleteBucketLifecycle() try to delete an available rule availableParams := bucketApi.DeleteBucketLifecycleRuleParams{ LifecycleID: "TESTRULE2", BucketName: "testBucket", } err := deleteBucketLifecycle(ctx, minClient, availableParams) assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) // Test-3 : deleteBucketLifecycle() returns error trying to delete a non available rule nonAvailableParams := bucketApi.DeleteBucketLifecycleRuleParams{ LifecycleID: "INVALIDTESTRULE", BucketName: "testBucket", } err2 := deleteBucketLifecycle(ctx, minClient, nonAvailableParams) assert.Equal(fmt.Errorf("lifecycle rule for id '%s' doesn't exist", nonAvailableParams.LifecycleID), err2, fmt.Sprintf("Failed on %s: Error returned", function)) // Test-4 : deleteBucketLifecycle() returns error trying to delete a rule when no rules are available mockLifecycle2 := lifecycle.Configuration{ Rules: []lifecycle.Rule{}, } minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { return &mockLifecycle2, nil } err3 := deleteBucketLifecycle(ctx, minClient, nonAvailableParams) assert.Equal(errors.New("no rules available to delete"), err3, fmt.Sprintf("Failed on %s: Error returned", function)) } ================================================ FILE: api/user_buckets_test.go ================================================ // 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 api import ( "context" "errors" "fmt" "os" "reflect" "testing" "time" "github.com/minio/console/pkg/auth/token" "github.com/minio/console/pkg/utils" "github.com/go-openapi/swag" "github.com/minio/console/models" "github.com/minio/madmin-go/v3" "github.com/minio/mc/pkg/probe" "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/sse" "github.com/minio/minio-go/v7/pkg/tags" "github.com/stretchr/testify/assert" ) // assigning mock at runtime instead of compile time var minioListBucketsWithContextMock func(ctx context.Context) ([]minio.BucketInfo, error) var ( minioMakeBucketWithContextMock func(ctx context.Context, bucketName, location string, objectLock bool) error minioSetBucketPolicyWithContextMock func(ctx context.Context, bucketName, policy string) error minioRemoveBucketMock func(bucketName string) error minioGetBucketPolicyMock func(bucketName string) (string, error) minioSetBucketEncryptionMock func(ctx context.Context, bucketName string, config *sse.Configuration) error minioRemoveBucketEncryptionMock func(ctx context.Context, bucketName string) error minioGetBucketEncryptionMock func(ctx context.Context, bucketName string) (*sse.Configuration, error) minioSetObjectLockConfigMock func(ctx context.Context, bucketName string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit) error minioGetBucketObjectLockConfigMock func(ctx context.Context, bucketName string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) minioGetObjectLockConfigMock func(ctx context.Context, bucketName string) (lock string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) minioSetVersioningMock func(ctx context.Context, state string, excludePrefix []string, excludeFolders bool) *probe.Error minioCopyObjectMock func(ctx context.Context, dst minio.CopyDestOptions, src minio.CopySrcOptions) (minio.UploadInfo, error) minioSetBucketTaggingMock func(ctx context.Context, bucketName string, tags *tags.Tags) error minioRemoveBucketTaggingMock func(ctx context.Context, bucketName string) error ) // Define a mock struct of minio Client interface implementation type minioClientMock struct{} // mock function of listBucketsWithContext() func (mc minioClientMock) listBucketsWithContext(ctx context.Context) ([]minio.BucketInfo, error) { return minioListBucketsWithContextMock(ctx) } // mock function of makeBucketsWithContext() func (mc minioClientMock) makeBucketWithContext(ctx context.Context, bucketName, location string, objectLock bool) error { return minioMakeBucketWithContextMock(ctx, bucketName, location, objectLock) } // mock function of setBucketPolicyWithContext() func (mc minioClientMock) setBucketPolicyWithContext(ctx context.Context, bucketName, policy string) error { return minioSetBucketPolicyWithContextMock(ctx, bucketName, policy) } // mock function of removeBucket() func (mc minioClientMock) removeBucket(_ context.Context, bucketName string) error { return minioRemoveBucketMock(bucketName) } // mock function of getBucketPolicy() func (mc minioClientMock) getBucketPolicy(_ context.Context, bucketName string) (string, error) { return minioGetBucketPolicyMock(bucketName) } func (mc minioClientMock) setBucketEncryption(ctx context.Context, bucketName string, config *sse.Configuration) error { return minioSetBucketEncryptionMock(ctx, bucketName, config) } func (mc minioClientMock) removeBucketEncryption(ctx context.Context, bucketName string) error { return minioRemoveBucketEncryptionMock(ctx, bucketName) } func (mc minioClientMock) getBucketEncryption(ctx context.Context, bucketName string) (*sse.Configuration, error) { return minioGetBucketEncryptionMock(ctx, bucketName) } func (mc minioClientMock) setObjectLockConfig(ctx context.Context, bucketName string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit) error { return minioSetObjectLockConfigMock(ctx, bucketName, mode, validity, unit) } func (mc minioClientMock) getBucketObjectLockConfig(ctx context.Context, bucketName string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) { return minioGetBucketObjectLockConfigMock(ctx, bucketName) } func (mc minioClientMock) getObjectLockConfig(ctx context.Context, bucketName string) (lock string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) { return minioGetObjectLockConfigMock(ctx, bucketName) } func (mc minioClientMock) copyObject(ctx context.Context, dst minio.CopyDestOptions, src minio.CopySrcOptions) (minio.UploadInfo, error) { return minioCopyObjectMock(ctx, dst, src) } func (c s3ClientMock) setVersioning(ctx context.Context, state string, excludePrefix []string, excludeFolders bool) *probe.Error { return minioSetVersioningMock(ctx, state, excludePrefix, excludeFolders) } func (mc minioClientMock) GetBucketTagging(ctx context.Context, bucketName string) (*tags.Tags, error) { return minioGetBucketTaggingMock(ctx, bucketName) } func (mc minioClientMock) SetBucketTagging(ctx context.Context, bucketName string, tags *tags.Tags) error { return minioSetBucketTaggingMock(ctx, bucketName, tags) } func (mc minioClientMock) RemoveBucketTagging(ctx context.Context, bucketName string) error { return minioRemoveBucketTaggingMock(ctx, bucketName) } func minioGetBucketTaggingMock(ctx context.Context, bucketName string) (*tags.Tags, error) { fmt.Println(ctx) fmt.Println(bucketName) retval, _ := tags.NewTags(map[string]string{}, true) return retval, nil } func TestMakeBucket(t *testing.T) { assert := assert.New(t) // mock minIO client minClient := minioClientMock{} function := "makeBucket()" ctx := context.Background() // Test-1: makeBucket() create a bucket // mock function response from makeBucketWithContext(ctx) minioMakeBucketWithContextMock = func(_ context.Context, _, _ string, _ bool) error { return nil } if err := makeBucket(ctx, minClient, "bucktest1", true); err != nil { t.Errorf("Failed on %s:, errors occurred: %s", function, err.Error()) } // Test-2 makeBucket() make sure errors are handled correctly when errors on MakeBucketWithContext minioMakeBucketWithContextMock = func(_ context.Context, _, _ string, _ bool) error { return errors.New("error") } if err := makeBucket(ctx, minClient, "bucktest1", true); assert.Error(err) { assert.Equal("error", err.Error()) } } func TestDeleteBucket(t *testing.T) { assert := assert.New(t) // mock minIO client minClient := minioClientMock{} function := "removeBucket()" // Test-1: removeBucket() delete a bucket // mock function response from removeBucket(bucketName) minioRemoveBucketMock = func(_ string) error { return nil } if err := removeBucket(minClient, "bucktest1"); err != nil { t.Errorf("Failed on %s:, errors occurred: %s", function, err.Error()) } // Test-2: removeBucket() make sure errors are handled correctly when errors on DeleteBucket() // mock function response from removeBucket(bucketName) minioRemoveBucketMock = func(_ string) error { return errors.New("error") } if err := removeBucket(minClient, "bucktest1"); assert.Error(err) { assert.Equal("error", err.Error()) } } func TestBucketInfo(t *testing.T) { assert := assert.New(t) // mock minIO client minClient := minioClientMock{} adminClient := AdminClientMock{} ctx := context.Background() function := "getBucketInfo()" // Test-1: getBucketInfo() get a bucket with PRIVATE access // if not policy set on bucket, access should be PRIVATE mockPolicy := "" minioGetBucketPolicyMock = func(_ string) (string, error) { return mockPolicy, nil } bucketToSet := "csbucket" outputExpected := &models.Bucket{ Name: swag.String(bucketToSet), Access: models.NewBucketAccess(models.BucketAccessPRIVATE), CreationDate: "0001-01-01T00:00:00Z", Size: 0, Objects: 0, } infoPolicy := ` { "Version": "2012-10-17", "Statement": [{ "Action": [ "admin:*" ], "Effect": "Allow", "Sid": "" }, { "Action": [ "s3:*" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::*" ], "Sid": "" } ] }` mockBucketList := madmin.AccountInfo{ AccountName: "test", Buckets: []madmin.BucketAccessInfo{ {Name: "bucket-1", Created: time.Now(), Size: 1024}, {Name: "bucket-2", Created: time.Now().Add(time.Hour * 1), Size: 0}, }, Policy: []byte(infoPolicy), } // mock function response from listBucketsWithContext(ctx) minioAccountInfoMock = func(_ context.Context) (madmin.AccountInfo, error) { return mockBucketList, nil } bucketInfo, err := getBucketInfo(ctx, minClient, adminClient, bucketToSet) if err != nil { t.Errorf("Failed on %s:, errors occurred: %s", function, err.Error()) } assert.Equal(outputExpected.Name, bucketInfo.Name) assert.Equal(outputExpected.Access, bucketInfo.Access) assert.Equal(outputExpected.CreationDate, bucketInfo.CreationDate) assert.Equal(outputExpected.Size, bucketInfo.Size) assert.Equal(outputExpected.Objects, bucketInfo.Objects) // Test-2: getBucketInfo() get a bucket with PUBLIC access // mock policy for bucket csbucket with readWrite access (should return PUBLIC) mockPolicy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetBucketLocation\",\"s3:ListBucket\",\"s3:ListBucketMultipartUploads\"],\"Resource\":[\"arn:aws:s3:::csbucket\"]},{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetObject\",\"s3:ListMultipartUploadParts\",\"s3:PutObject\",\"s3:AbortMultipartUpload\",\"s3:DeleteObject\"],\"Resource\":[\"arn:aws:s3:::csbucket/*\"]}]}" minioGetBucketPolicyMock = func(_ string) (string, error) { return mockPolicy, nil } bucketToSet = "csbucket" outputExpected = &models.Bucket{ Name: swag.String(bucketToSet), Access: models.NewBucketAccess(models.BucketAccessPUBLIC), CreationDate: "0001-01-01T00:00:00Z", Size: 0, Objects: 0, } bucketInfo, err = getBucketInfo(ctx, minClient, adminClient, bucketToSet) if err != nil { t.Errorf("Failed on %s:, errors occurred: %s", function, err.Error()) } assert.Equal(outputExpected.Name, bucketInfo.Name) assert.Equal(outputExpected.Access, bucketInfo.Access) assert.Equal(outputExpected.CreationDate, bucketInfo.CreationDate) assert.Equal(outputExpected.Size, bucketInfo.Size) assert.Equal(outputExpected.Objects, bucketInfo.Objects) // Test-3: getBucketInfo() get a bucket with PRIVATE access // if bucket has a null statement, the bucket is PRIVATE mockPolicy = "{\"Version\":\"2012-10-17\",\"Statement\":[]}" minioGetBucketPolicyMock = func(_ string) (string, error) { return mockPolicy, nil } bucketToSet = "csbucket" outputExpected = &models.Bucket{ Name: swag.String(bucketToSet), Access: models.NewBucketAccess(models.BucketAccessPRIVATE), CreationDate: "0001-01-01T00:00:00Z", Size: 0, Objects: 0, } bucketInfo, err = getBucketInfo(ctx, minClient, adminClient, bucketToSet) if err != nil { t.Errorf("Failed on %s:, errors occurred: %s", function, err.Error()) } assert.Equal(outputExpected.Name, bucketInfo.Name) assert.Equal(outputExpected.Access, bucketInfo.Access) assert.Equal(outputExpected.CreationDate, bucketInfo.CreationDate) assert.Equal(outputExpected.Size, bucketInfo.Size) assert.Equal(outputExpected.Objects, bucketInfo.Objects) // Test-4: getBucketInfo() returns an errors while parsing invalid policy mockPolicy = "policyinvalid" minioGetBucketPolicyMock = func(_ string) (string, error) { return mockPolicy, nil } bucketToSet = "csbucket" _, err = getBucketInfo(ctx, minClient, adminClient, bucketToSet) if assert.Error(err) { assert.Equal("invalid character 'p' looking for beginning of value", err.Error()) } // Test-4: getBucketInfo() handle GetBucketPolicy errors correctly // Test removed since we can tolerate this scenario now } func TestSetBucketAccess(t *testing.T) { assert := assert.New(t) ctx := context.Background() // mock minIO client minClient := minioClientMock{} function := "setBucketAccessPolicy()" // Test-1: setBucketAccessPolicy() set a bucket's access policy // mock function response from setBucketPolicyWithContext(ctx) minioSetBucketPolicyWithContextMock = func(_ context.Context, _, _ string) error { return nil } if err := setBucketAccessPolicy(ctx, minClient, "bucktest1", models.BucketAccessPUBLIC, ""); err != nil { t.Errorf("Failed on %s:, errors occurred: %s", function, err.Error()) } // Test-2: setBucketAccessPolicy() set private access if err := setBucketAccessPolicy(ctx, minClient, "bucktest1", models.BucketAccessPRIVATE, ""); err != nil { t.Errorf("Failed on %s:, errors occurred: %s", function, err.Error()) } // Test-3: setBucketAccessPolicy() set invalid access, expected errors if err := setBucketAccessPolicy(ctx, minClient, "bucktest1", "other", ""); assert.Error(err) { assert.Equal("access: `other` not supported", err.Error()) } // Test-4: setBucketAccessPolicy() set access on empty bucket name, expected errors if err := setBucketAccessPolicy(ctx, minClient, "", models.BucketAccessPRIVATE, ""); assert.Error(err) { assert.Equal("error: bucket name not present", err.Error()) } // Test-5: setBucketAccessPolicy() set empty access on bucket, expected errors if err := setBucketAccessPolicy(ctx, minClient, "bucktest1", "", ""); assert.Error(err) { assert.Equal("error: bucket access not present", err.Error()) } // Test-5: setBucketAccessPolicy() handle errors on SetPolicy call minioSetBucketPolicyWithContextMock = func(_ context.Context, _, _ string) error { return errors.New("error") } if err := setBucketAccessPolicy(ctx, minClient, "bucktest1", models.BucketAccessPUBLIC, ""); assert.Error(err) { assert.Equal("error", err.Error()) } } func Test_enableBucketEncryption(t *testing.T) { ctx := context.Background() minClient := minioClientMock{} type args struct { ctx context.Context client MinioClient bucketName string encryptionType models.BucketEncryptionType kmsKeyID string mockEnableBucketEncryptionFunc func(ctx context.Context, bucketName string, config *sse.Configuration) error } tests := []struct { name string args args wantErr bool }{ { name: "Bucket encryption enabled correctly", args: args{ ctx: ctx, client: minClient, bucketName: "test", encryptionType: "sse-s3", mockEnableBucketEncryptionFunc: func(_ context.Context, _ string, _ *sse.Configuration) error { return nil }, }, wantErr: false, }, { name: "Error when enabling bucket encryption", args: args{ ctx: ctx, client: minClient, bucketName: "test", encryptionType: "sse-s3", mockEnableBucketEncryptionFunc: func(_ context.Context, _ string, _ *sse.Configuration) error { return ErrInvalidSession }, }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { minioSetBucketEncryptionMock = tt.args.mockEnableBucketEncryptionFunc if err := enableBucketEncryption(tt.args.ctx, tt.args.client, tt.args.bucketName, tt.args.encryptionType, tt.args.kmsKeyID); (err != nil) != tt.wantErr { t.Errorf("enableBucketEncryption() errors = %v, wantErr %v", err, tt.wantErr) } }) } } func Test_disableBucketEncryption(t *testing.T) { ctx := context.Background() minClient := minioClientMock{} type args struct { ctx context.Context client MinioClient bucketName string mockBucketDisableFunc func(ctx context.Context, bucketName string) error } tests := []struct { name string args args wantErr bool }{ { name: "Bucket encryption disabled correctly", args: args{ ctx: ctx, client: minClient, bucketName: "test", mockBucketDisableFunc: func(_ context.Context, _ string) error { return nil }, }, wantErr: false, }, { name: "Error when disabling bucket encryption", args: args{ ctx: ctx, client: minClient, bucketName: "test", mockBucketDisableFunc: func(_ context.Context, _ string) error { return ErrDefault }, }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { minioRemoveBucketEncryptionMock = tt.args.mockBucketDisableFunc if err := disableBucketEncryption(tt.args.ctx, tt.args.client, tt.args.bucketName); (err != nil) != tt.wantErr { t.Errorf("disableBucketEncryption() errors = %v, wantErr %v", err, tt.wantErr) } }) } } func Test_getBucketEncryptionInfo(t *testing.T) { ctx := context.Background() minClient := minioClientMock{} type args struct { ctx context.Context client MinioClient bucketName string mockBucketEncryptionGet func(ctx context.Context, bucketName string) (*sse.Configuration, error) } tests := []struct { name string args args want *models.BucketEncryptionInfo wantErr bool }{ { name: "Bucket encryption info returned correctly", args: args{ ctx: ctx, client: minClient, bucketName: "test", mockBucketEncryptionGet: func(_ context.Context, _ string) (*sse.Configuration, error) { return &sse.Configuration{ Rules: []sse.Rule{ { Apply: sse.ApplySSEByDefault{SSEAlgorithm: "AES256", KmsMasterKeyID: ""}, }, }, }, nil }, }, wantErr: false, want: &models.BucketEncryptionInfo{ Algorithm: "AES256", KmsMasterKeyID: "", }, }, { name: "Bucket encryption info with no rules", args: args{ ctx: ctx, client: minClient, bucketName: "test", mockBucketEncryptionGet: func(_ context.Context, _ string) (*sse.Configuration, error) { return &sse.Configuration{ Rules: []sse.Rule{}, }, nil }, }, wantErr: true, }, { name: "Error when obtaining bucket encryption info", args: args{ ctx: ctx, client: minClient, bucketName: "test", mockBucketEncryptionGet: func(_ context.Context, _ string) (*sse.Configuration, error) { return nil, ErrSSENotConfigured }, }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { minioGetBucketEncryptionMock = tt.args.mockBucketEncryptionGet got, err := getBucketEncryptionInfo(tt.args.ctx, tt.args.client, tt.args.bucketName) if (err != nil) != tt.wantErr { t.Errorf("getBucketEncryptionInfo() errors = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("getBucketEncryptionInfo() got = %v, want %v", got, tt.want) } }) } } func Test_SetBucketRetentionConfig(t *testing.T) { assert := assert.New(t) ctx := context.Background() minClient := minioClientMock{} type args struct { ctx context.Context client MinioClient bucketName string mode models.ObjectRetentionMode unit models.ObjectRetentionUnit validity *int32 mockBucketRetentionFunc func(ctx context.Context, bucketName string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit) error } tests := []struct { name string args args expectedError error }{ { name: "Set Bucket Retention Config", args: args{ ctx: ctx, client: minClient, bucketName: "test", mode: models.ObjectRetentionModeCompliance, unit: models.ObjectRetentionUnitDays, validity: swag.Int32(2), mockBucketRetentionFunc: func(_ context.Context, _ string, _ *minio.RetentionMode, _ *uint, _ *minio.ValidityUnit) error { return nil }, }, expectedError: nil, }, { name: "Set Bucket Retention Config 2", args: args{ ctx: ctx, client: minClient, bucketName: "test", mode: models.ObjectRetentionModeGovernance, unit: models.ObjectRetentionUnitYears, validity: swag.Int32(2), mockBucketRetentionFunc: func(_ context.Context, _ string, _ *minio.RetentionMode, _ *uint, _ *minio.ValidityUnit) error { return nil }, }, expectedError: nil, }, { name: "Invalid validity", args: args{ ctx: ctx, client: minClient, bucketName: "test", mode: models.ObjectRetentionModeCompliance, unit: models.ObjectRetentionUnitDays, validity: nil, mockBucketRetentionFunc: func(_ context.Context, _ string, _ *minio.RetentionMode, _ *uint, _ *minio.ValidityUnit) error { return nil }, }, expectedError: errors.New("retention validity can't be nil"), }, { name: "Invalid retention mode", args: args{ ctx: ctx, client: minClient, bucketName: "test", mode: models.ObjectRetentionMode("othermode"), unit: models.ObjectRetentionUnitDays, validity: swag.Int32(2), mockBucketRetentionFunc: func(_ context.Context, _ string, _ *minio.RetentionMode, _ *uint, _ *minio.ValidityUnit) error { return nil }, }, expectedError: errors.New("invalid retention mode"), }, { name: "Invalid retention unit", args: args{ ctx: ctx, client: minClient, bucketName: "test", mode: models.ObjectRetentionModeCompliance, unit: models.ObjectRetentionUnit("otherunit"), validity: swag.Int32(2), mockBucketRetentionFunc: func(_ context.Context, _ string, _ *minio.RetentionMode, _ *uint, _ *minio.ValidityUnit) error { return nil }, }, expectedError: errors.New("invalid retention unit"), }, { name: "Handle errors on objec lock function", args: args{ ctx: ctx, client: minClient, bucketName: "test", mode: models.ObjectRetentionModeCompliance, unit: models.ObjectRetentionUnitDays, validity: swag.Int32(2), mockBucketRetentionFunc: func(_ context.Context, _ string, _ *minio.RetentionMode, _ *uint, _ *minio.ValidityUnit) error { return errors.New("error func") }, }, expectedError: errors.New("error func"), }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { minioSetObjectLockConfigMock = tt.args.mockBucketRetentionFunc err := setBucketRetentionConfig(tt.args.ctx, tt.args.client, tt.args.bucketName, tt.args.mode, tt.args.unit, tt.args.validity) if tt.expectedError != nil { fmt.Println(t.Name()) assert.Equal(tt.expectedError.Error(), err.Error(), fmt.Sprintf("setObjectRetention() errors: `%s`, wantErr: `%s`", err, tt.expectedError)) } else { assert.Nil(err, fmt.Sprintf("setBucketRetentionConfig() errors: %v, wantErr: %v", err, tt.expectedError)) } }) } } func Test_GetBucketRetentionConfig(t *testing.T) { assert := assert.New(t) ctx := context.Background() minClient := minioClientMock{} type args struct { ctx context.Context client MinioClient bucketName string getRetentionFunc func(ctx context.Context, bucketName string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) } tests := []struct { name string args args expectedResponse *models.GetBucketRetentionConfig expectedError error }{ { name: "Get Bucket Retention Config", args: args{ ctx: ctx, client: minClient, bucketName: "test", getRetentionFunc: func(_ context.Context, _ string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) { m := minio.Governance u := minio.Days return &m, swag.Uint(2), &u, nil }, }, expectedResponse: &models.GetBucketRetentionConfig{ Mode: models.ObjectRetentionModeGovernance, Unit: models.ObjectRetentionUnitDays, Validity: int32(2), }, expectedError: nil, }, { name: "Get Bucket Retention Config Compliance", args: args{ ctx: ctx, client: minClient, bucketName: "test", getRetentionFunc: func(_ context.Context, _ string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) { m := minio.Compliance u := minio.Days return &m, swag.Uint(2), &u, nil }, }, expectedResponse: &models.GetBucketRetentionConfig{ Mode: models.ObjectRetentionModeCompliance, Unit: models.ObjectRetentionUnitDays, Validity: int32(2), }, expectedError: nil, }, { name: "Handle Error on minio func", args: args{ ctx: ctx, client: minClient, bucketName: "test", getRetentionFunc: func(_ context.Context, _ string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) { return nil, nil, nil, errors.New("error func") }, }, expectedResponse: nil, expectedError: errors.New("error func"), }, { // Description: if minio return NoSuchObjectLockConfiguration, don't panic // and return empty response name: "Handle NoLock Config errors", args: args{ ctx: ctx, client: minClient, bucketName: "test", getRetentionFunc: func(_ context.Context, _ string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) { return nil, nil, nil, minio.ErrorResponse{ Code: "ObjectLockConfigurationNotFoundError", Message: "Object Lock configuration does not exist for this bucket", } }, }, expectedResponse: &models.GetBucketRetentionConfig{}, expectedError: nil, }, { name: "Return errors on invalid mode", args: args{ ctx: ctx, client: minClient, bucketName: "test", getRetentionFunc: func(_ context.Context, _ string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) { m := minio.RetentionMode("other") u := minio.Days return &m, swag.Uint(2), &u, nil }, }, expectedResponse: nil, expectedError: errors.New("invalid retention mode"), }, { name: "Return errors on invalid unit", args: args{ ctx: ctx, client: minClient, bucketName: "test", getRetentionFunc: func(_ context.Context, _ string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error) { m := minio.Governance u := minio.ValidityUnit("otherUnit") return &m, swag.Uint(2), &u, nil }, }, expectedResponse: nil, expectedError: errors.New("invalid retention unit"), }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { minioGetBucketObjectLockConfigMock = tt.args.getRetentionFunc resp, err := getBucketRetentionConfig(tt.args.ctx, tt.args.client, tt.args.bucketName) if tt.expectedError != nil { fmt.Println(t.Name()) assert.Equal(tt.expectedError.Error(), err.Error(), fmt.Sprintf("getBucketRetentionConfig() errors: `%s`, wantErr: `%s`", err, tt.expectedError)) } else { assert.Nil(err, fmt.Sprintf("getBucketRetentionConfig() errors: %v, wantErr: %v", err, tt.expectedError)) if !reflect.DeepEqual(resp, tt.expectedResponse) { t.Errorf("getBucketRetentionConfig() resp: %v, expectedResponse: %v", resp, tt.expectedResponse) return } } }) } } func Test_SetBucketVersioning(t *testing.T) { assert := assert.New(t) ctx := context.WithValue(context.Background(), utils.ContextClientIP, "127.0.0.1") errorMsg := "Error Message" minClient := s3ClientMock{} type args struct { ctx context.Context state VersionState excludePrefix []string excludeFolders bool bucketName string client s3ClientMock setVersioningFunc func(ctx context.Context, state string, excludePrefix []string, excludeFolders bool) *probe.Error } tests := []struct { name string args args expectedError error }{ { name: "Set Bucket Version Success", args: args{ ctx: ctx, state: VersionEnable, bucketName: "test", client: minClient, setVersioningFunc: func(_ context.Context, _ string, _ []string, _ bool) *probe.Error { return nil }, }, expectedError: nil, }, { name: "Set Bucket Version with Prefixes Success", args: args{ ctx: ctx, state: VersionEnable, excludePrefix: []string{"prefix1", "prefix2"}, bucketName: "test", client: minClient, setVersioningFunc: func(_ context.Context, _ string, _ []string, _ bool) *probe.Error { return nil }, }, expectedError: nil, }, { name: "Set Bucket Version with Excluded Folders Success", args: args{ ctx: ctx, state: VersionEnable, excludePrefix: []string{"prefix1", "prefix2"}, excludeFolders: true, bucketName: "test", client: minClient, setVersioningFunc: func(_ context.Context, _ string, _ []string, _ bool) *probe.Error { return nil }, }, expectedError: nil, }, { name: "Set Bucket Version Error", args: args{ ctx: ctx, state: VersionEnable, bucketName: "test", client: minClient, setVersioningFunc: func(_ context.Context, _ string, _ []string, _ bool) *probe.Error { return probe.NewError(errors.New(errorMsg)) }, }, expectedError: errors.New(errorMsg), }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { minioSetVersioningMock = tt.args.setVersioningFunc err := doSetVersioning(tt.args.ctx, tt.args.client, tt.args.state, tt.args.excludePrefix, tt.args.excludeFolders) fmt.Println(t.Name()) fmt.Println("Expected:", tt.expectedError, "Error:", err) if tt.expectedError != nil { fmt.Println(t.Name()) assert.Equal(tt.expectedError.Error(), err.Error(), fmt.Sprintf("getBucketRetentionConfig() errors: `%s`, wantErr: `%s`", err, tt.expectedError)) } }) } } func mustTags(tagsMap map[string]string) *tags.Tags { tags, _ := tags.NewTags(tagsMap, false) return tags } func Test_getAccountBuckets(t *testing.T) { type args struct { ctx context.Context mockBucketList madmin.AccountInfo mockError error } // Declaring layout constant const layout = "Jan 2, 2006 at 3:04pm (MST)" // Calling Parse() method with its parameters tm, _ := time.Parse(layout, "Feb 4, 2014 at 6:05pm (PST)") tests := []struct { name string args args want []*models.Bucket wantErr assert.ErrorAssertionFunc }{ { name: "Test list Buckets", args: args{ ctx: context.Background(), mockBucketList: madmin.AccountInfo{ AccountName: "test", Buckets: []madmin.BucketAccessInfo{ {Name: "bucket-1", Created: tm, Size: 1024}, {Name: "bucket-2", Created: tm, Size: 0}, }, Policy: []byte(` { "Version": "2012-10-17", "Statement": [{ "Action": [ "admin:*" ], "Effect": "Allow", "Sid": "" }, { "Action": [ "s3:*" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::*" ], "Sid": "" } ] }`), }, }, want: []*models.Bucket{ { Name: swag.String("bucket-1"), CreationDate: tm.Format(time.RFC3339), Details: &models.BucketDetails{}, RwAccess: &models.BucketRwAccess{}, Size: 1024, }, { Name: swag.String("bucket-2"), CreationDate: tm.Format(time.RFC3339), Details: &models.BucketDetails{}, RwAccess: &models.BucketRwAccess{}, }, }, wantErr: assert.NoError, }, { name: "Test list Buckets Details", args: args{ ctx: context.Background(), mockBucketList: madmin.AccountInfo{ AccountName: "test", Buckets: []madmin.BucketAccessInfo{ { Name: "bucket-1", Created: tm, Size: 1024, Details: &madmin.BucketDetails{ Versioning: true, VersioningSuspended: false, Locking: false, Replication: false, Tagging: nil, Quota: nil, }, }, {Name: "bucket-2", Created: tm, Size: 0}, }, Policy: []byte(` { "Version": "2012-10-17", "Statement": [{ "Action": [ "admin:*" ], "Effect": "Allow", "Sid": "" }, { "Action": [ "s3:*" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::*" ], "Sid": "" } ] }`), }, }, want: []*models.Bucket{ { Name: swag.String("bucket-1"), CreationDate: tm.Format(time.RFC3339), Details: &models.BucketDetails{ Locking: false, Quota: nil, Replication: false, Tags: nil, Versioning: true, VersioningSuspended: false, }, RwAccess: &models.BucketRwAccess{}, Size: 1024, }, { Name: swag.String("bucket-2"), CreationDate: tm.Format(time.RFC3339), Details: &models.BucketDetails{}, RwAccess: &models.BucketRwAccess{}, }, }, wantErr: assert.NoError, }, { name: "Test list Buckets Details Tags", args: args{ ctx: context.Background(), mockBucketList: madmin.AccountInfo{ AccountName: "test", Buckets: []madmin.BucketAccessInfo{ { Name: "bucket-1", Created: tm, Size: 1024, Details: &madmin.BucketDetails{ Versioning: true, VersioningSuspended: false, Locking: false, Replication: false, Tagging: mustTags(map[string]string{ "key": "val", }), Quota: nil, }, }, {Name: "bucket-2", Created: tm, Size: 0}, }, Policy: []byte(` { "Version": "2012-10-17", "Statement": [{ "Action": [ "admin:*" ], "Effect": "Allow", "Sid": "" }, { "Action": [ "s3:*" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::*" ], "Sid": "" } ] }`), }, }, want: []*models.Bucket{ { Name: swag.String("bucket-1"), CreationDate: tm.Format(time.RFC3339), Details: &models.BucketDetails{ Locking: false, Quota: nil, Replication: false, Tags: map[string]string{ "key": "val", }, Versioning: true, VersioningSuspended: false, }, RwAccess: &models.BucketRwAccess{}, Size: 1024, }, { Name: swag.String("bucket-2"), CreationDate: tm.Format(time.RFC3339), Details: &models.BucketDetails{}, RwAccess: &models.BucketRwAccess{}, }, }, wantErr: assert.NoError, }, { name: "Test list Buckets Details Quota", args: args{ ctx: context.Background(), mockBucketList: madmin.AccountInfo{ AccountName: "test", Buckets: []madmin.BucketAccessInfo{ { Name: "bucket-1", Created: tm, Size: 1024, Details: &madmin.BucketDetails{ Versioning: true, VersioningSuspended: false, Locking: false, Replication: false, Tagging: nil, Quota: &madmin.BucketQuota{ Quota: 10, Type: madmin.HardQuota, }, }, }, {Name: "bucket-2", Created: tm, Size: 0}, }, Policy: []byte(` { "Version": "2012-10-17", "Statement": [{ "Action": [ "admin:*" ], "Effect": "Allow", "Sid": "" }, { "Action": [ "s3:*" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::*" ], "Sid": "" } ] }`), }, }, want: []*models.Bucket{ { Name: swag.String("bucket-1"), CreationDate: tm.Format(time.RFC3339), Details: &models.BucketDetails{ Locking: false, Quota: &models.BucketDetailsQuota{ Quota: 10, Type: "hard", }, Replication: false, Tags: nil, Versioning: true, VersioningSuspended: false, }, RwAccess: &models.BucketRwAccess{}, Size: 1024, }, { Name: swag.String("bucket-2"), CreationDate: tm.Format(time.RFC3339), Details: &models.BucketDetails{}, RwAccess: &models.BucketRwAccess{}, }, }, wantErr: assert.NoError, }, { name: "Test list Buckets Error", args: args{ ctx: context.Background(), mockBucketList: madmin.AccountInfo{}, mockError: errors.New("some errors"), }, want: []*models.Bucket{}, wantErr: assert.Error, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // mock function response from listBucketsWithContext(ctx) minioAccountInfoMock = func(_ context.Context) (madmin.AccountInfo, error) { return tt.args.mockBucketList, tt.args.mockError } client := AdminClientMock{} got, err := getAccountBuckets(tt.args.ctx, client) if !tt.wantErr(t, err, fmt.Sprintf("getAccountBuckets(%v, %v)", tt.args.ctx, client)) { return } assert.EqualValues(t, tt.want, got, "getAccountBuckets(%v, %v)", tt.args.ctx, client) }) } } func Test_getMaxShareLinkExpirationSeconds(t *testing.T) { type args struct { session *models.Principal } tests := []struct { name string args args want int64 wantErr bool preFunc func() postFunc func() }{ { name: "empty session returns error", args: args{ session: nil, }, want: 0, wantErr: true, }, { name: "invalid/expired session returns error", args: args{ session: &models.Principal{ STSAccessKeyID: "", STSSecretAccessKey: "", STSSessionToken: "", }, }, want: 0, wantErr: true, }, { name: "valid session, returns value from env variable", args: args{ session: &models.Principal{ STSAccessKeyID: "VQH975JV49JYDLK7F81G", STSSecretAccessKey: "zZ2oMQrZwPWGEf1yyHneWFK2JBlGkVjYTJnfw75X", STSSessionToken: "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiJWUUg5NzVKVjQ5SllETEs3RjgxRyIsImV4cCI6MTY5Nzc0Mzg1MywicGFyZW50IjoibWluaW9hZG1pbiJ9.tRJVb3gbRFswKyNsxz_Dbw1SHoIQRRgA3xmXpXE4shScCsQXDydc7U_F9QOjL_BQDcgs65ZqWo3N2CIPmWoGDA", }, }, want: 3600, wantErr: false, preFunc: func() { os.Setenv(token.ConsoleSTSDuration, "1h") }, postFunc: func() { os.Unsetenv(token.ConsoleSTSDuration) }, }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(_ *testing.T) { if tt.preFunc != nil { tt.preFunc() } expTime, err := getMaxShareLinkExpirationSeconds(tt.args.session) if (err != nil) != tt.wantErr { t.Errorf("getMaxShareLinkExpirationSeconds() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(expTime, tt.want) { t.Errorf("getMaxShareLinkExpirationSeconds() got = %v, want %v", expTime, tt.want) } if tt.postFunc != nil { tt.postFunc() } }) } } ================================================ FILE: api/user_log_search.go ================================================ // 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 api import ( "context" "encoding/json" "fmt" "net/http" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" logApi "github.com/minio/console/api/operations/logging" "github.com/minio/console/models" iampolicy "github.com/minio/pkg/v3/policy" ) func registerLogSearchHandlers(api *operations.ConsoleAPI) { // log search api.LoggingLogSearchHandler = logApi.LogSearchHandlerFunc(func(params logApi.LogSearchParams, session *models.Principal) middleware.Responder { searchResp, err := getLogSearchResponse(session, params) if err != nil { return logApi.NewLogSearchDefault(err.Code).WithPayload(err.APIError) } return logApi.NewLogSearchOK().WithPayload(searchResp) }) } // getLogSearchResponse performs a query to Log Search if Enabled func getLogSearchResponse(session *models.Principal, params logApi.LogSearchParams) (*models.LogSearchResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() sessionResp, err := getSessionResponse(ctx, session) if err != nil { return nil, err } var allowedToQueryLogSearchAPI bool if permissions, ok := sessionResp.Permissions[ConsoleResourceName]; ok { for _, permission := range permissions { if permission == iampolicy.HealthInfoAdminAction { allowedToQueryLogSearchAPI = true break } } } if !allowedToQueryLogSearchAPI { return nil, &CodedAPIError{ Code: 403, APIError: &models.APIError{ Message: "Forbidden", DetailedMessage: "The Log Search API not available.", }, } } token := getLogSearchAPIToken() endpoint := fmt.Sprintf("%s/api/query?token=%s&q=reqinfo", getLogSearchURL(), token) for _, fp := range params.Fp { endpoint = fmt.Sprintf("%s&fp=%s", endpoint, fp) } endpoint = fmt.Sprintf("%s&%s=ok", endpoint, *params.Order) // timeStart if params.TimeStart != nil && *params.TimeStart != "" { endpoint = fmt.Sprintf("%s&timeStart=%s", endpoint, *params.TimeStart) } // timeEnd if params.TimeEnd != nil && *params.TimeEnd != "" { endpoint = fmt.Sprintf("%s&timeEnd=%s", endpoint, *params.TimeEnd) } // page size and page number endpoint = fmt.Sprintf("%s&pageSize=%d", endpoint, *params.PageSize) endpoint = fmt.Sprintf("%s&pageNo=%d", endpoint, *params.PageNo) response, errLogSearch := logSearch(endpoint, getClientIP(params.HTTPRequest)) if errLogSearch != nil { return nil, ErrorWithContext(ctx, errLogSearch) } return response, nil } func logSearch(endpoint string, clientIP string) (*models.LogSearchResponse, error) { httpClnt := GetConsoleHTTPClient(clientIP) resp, err := httpClnt.Get(endpoint) if err != nil { return nil, fmt.Errorf("the Log Search API cannot be reached. Please review the URL and try again %v", err) } defer resp.Body.Close() if resp.StatusCode != 200 { return nil, fmt.Errorf("error retrieving logs: %s", http.StatusText(resp.StatusCode)) } var results []map[string]interface{} if err = json.NewDecoder(resp.Body).Decode(&results); err != nil { return nil, err } return &models.LogSearchResponse{ Results: results, }, nil } ================================================ FILE: api/user_log_search_test.go ================================================ // 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 api import ( "encoding/json" "fmt" "net/http" "net/http/httptest" "reflect" "testing" "github.com/minio/console/models" ) func TestLogSearch(t *testing.T) { responseItem := []map[string]interface{}{ { "time": "2006-01-02T15:04:05Z", "api_time": "GetConfigKV", "bucket": "", "object": "", "time_to_response_ns": float64(452546530), "remote_host": "10.116.1.94", "request_id": "16595A4E30CCFE79", "user_agent": "MinIO (linux; amd64) madmin-go/0.0.1", "response_status": "OK", "response_status_code": float64(200), "request_content_length": nil, "response_content_length": nil, }, { "time": "2006-01-02T15:04:05Z", "api_time": "AssumeRole", "bucket": "", "object": "", "time_to_response_ns": float64(307423794), "remote_host": "127.0.0.1", "request_id": "16595A4DA906FBA9", "user_agent": "Go-http-client/1.1", "response_status": "OK", "response_status_code": float64(200), "request_content_length": nil, "response_content_length": nil, }, } type args struct { apiResponse string apiResponseCode int } response, _ := json.Marshal(responseItem) successfulResponse := &models.LogSearchResponse{ Results: responseItem, } tests := []struct { name string args args expectedResponse *models.LogSearchResponse wantErr bool }{ { name: "200 Success response", args: args{ apiResponse: string(response), apiResponseCode: 200, }, expectedResponse: successfulResponse, wantErr: false, }, { name: "500 unsuccessful response", args: args{ apiResponse: "Some random error", apiResponseCode: 500, }, expectedResponse: nil, wantErr: true, }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(_ *testing.T) { testRequest := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(tt.args.apiResponseCode) fmt.Fprintln(w, tt.args.apiResponse) })) defer testRequest.Close() resp, err := logSearch(testRequest.URL, "127.0.0.1") if (err != nil) != tt.wantErr { t.Errorf("logSearch() error = %v, wantErr %v", err, tt.wantErr) } if !reflect.DeepEqual(resp, tt.expectedResponse) { t.Errorf("\ngot: %d \nwant: %d", resp, tt.expectedResponse) } // if tt.wantErr { // assert.Equal(tt.expectedError.Code, err.Code, fmt.Sprintf("logSearch() error code: `%v`, wantErr: `%v`", err.Code, tt.expectedError)) // assert.Equal(tt.expectedError.Message, err.Message, fmt.Sprintf("logSearch() error message: `%v`, wantErr: `%v`", err.Message, tt.expectedError)) // } else { // assert.Nil(err, fmt.Sprintf("logSearch() error: %v, wantErr: %v", err, tt.expectedError)) // buf1, err1 := tt.expectedResponse.MarshalBinary() // buf2, err2 := resp.MarshalBinary() // if err1 != err2 { // t.Errorf("logSearch() resp: %v, expectedResponse: %v", resp, tt.expectedResponse) // return // } // h := sha256.New() // h.Write(buf1) // checkSum1 := fmt.Sprintf("%x\n", h.Sum(nil)) // h.Reset() // h.Write(buf2) // checkSum2 := fmt.Sprintf("%x\n", h.Sum(nil)) // if checkSum1 != checkSum2 { // t.Errorf("logSearch() resp: %v, expectedResponse: %v", resp, tt.expectedResponse) // } // } }) } } ================================================ FILE: api/user_login.go ================================================ // 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 api import ( "context" "encoding/base64" "encoding/json" "fmt" "net/http" "strings" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" authApi "github.com/minio/console/api/operations/auth" "github.com/minio/console/models" "github.com/minio/console/pkg/auth" "github.com/minio/console/pkg/auth/idp/oauth2" "github.com/minio/console/pkg/auth/ldap" "github.com/minio/madmin-go/v3" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/pkg/v3/env" xnet "github.com/minio/pkg/v3/net" ) func registerLoginHandlers(api *operations.ConsoleAPI) { // GET login strategy api.AuthLoginDetailHandler = authApi.LoginDetailHandlerFunc(func(params authApi.LoginDetailParams) middleware.Responder { loginDetails, err := getLoginDetailsResponse(params, GlobalMinIOConfig.OpenIDProviders) if err != nil { return authApi.NewLoginDetailDefault(err.Code).WithPayload(err.APIError) } return authApi.NewLoginDetailOK().WithPayload(loginDetails) }) // POST login using user credentials api.AuthLoginHandler = authApi.LoginHandlerFunc(func(params authApi.LoginParams) middleware.Responder { loginResponse, err := getLoginResponse(params) if err != nil { return authApi.NewLoginDefault(err.Code).WithPayload(err.APIError) } // Custom response writer to set the session cookies return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) { cookie := NewSessionCookieForConsole(loginResponse.SessionID) http.SetCookie(w, &cookie) authApi.NewLoginNoContent().WriteResponse(w, p) }) }) // POST login using external IDP api.AuthLoginOauth2AuthHandler = authApi.LoginOauth2AuthHandlerFunc(func(params authApi.LoginOauth2AuthParams) middleware.Responder { loginResponse, err := getLoginOauth2AuthResponse(params, GlobalMinIOConfig.OpenIDProviders) if err != nil { return authApi.NewLoginOauth2AuthDefault(err.Code).WithPayload(err.APIError) } // Custom response writer to set the session cookies return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) { cookie := NewSessionCookieForConsole(loginResponse.SessionID) http.SetCookie(w, &cookie) http.SetCookie(w, &http.Cookie{ Path: "/", Name: "idp-refresh-token", Value: loginResponse.IDPRefreshToken, HttpOnly: true, Secure: len(GlobalPublicCerts) > 0, SameSite: http.SameSiteLaxMode, }) 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 ConsoleCredentialsI, sessionFeatures *auth.SessionFeatures) (*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(), sessionFeatures) if err != nil { LogError("error authenticating user: %v", err) return nil, ErrInvalidLogin } return &token, nil } // getAccountInfo will return the current user information func getAccountInfo(ctx context.Context, client MinioAdmin) (*madmin.AccountInfo, error) { accountInfo, err := client.AccountInfo(ctx) if err != nil { return nil, err } return &accountInfo, nil } // getConsoleCredentials will return ConsoleCredentials interface func getConsoleCredentials(accessKey, secretKey string, client *http.Client) (*ConsoleCredentials, error) { creds, err := NewConsoleCredentials(accessKey, secretKey, GetMinIORegion(), client) if err != nil { return nil, err } return &ConsoleCredentials{ ConsoleCredentials: creds, AccountAccessKey: accessKey, CredContext: &credentials.CredContext{ Client: client, }, }, nil } // getLoginResponse performs login() and serializes it to the handler's output func getLoginResponse(params authApi.LoginParams) (*models.LoginResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() lr := params.Body // trim any leading and trailing whitespace from the login request lr.AccessKey = strings.TrimSpace(lr.AccessKey) lr.SecretKey = strings.TrimSpace(lr.SecretKey) lr.Sts = strings.TrimSpace(lr.Sts) clientIP := getClientIP(params.HTTPRequest) client := GetConsoleHTTPClient(clientIP) var err error var consoleCreds *ConsoleCredentials // if we receive an STS we use that instead of the credentials if lr.Sts != "" { consoleCreds = &ConsoleCredentials{ ConsoleCredentials: credentials.NewStaticV4(lr.AccessKey, lr.SecretKey, lr.Sts), AccountAccessKey: lr.AccessKey, CredContext: &credentials.CredContext{ Client: client, }, } } else { // prepare console credentials consoleCreds, err = getConsoleCredentials(lr.AccessKey, lr.SecretKey, client) if err != nil { return nil, ErrorWithContext(ctx, err, ErrInvalidLogin) } } sf := &auth.SessionFeatures{} if lr.Features != nil { sf.HideMenu = lr.Features.HideMenu } sessionID, err := login(consoleCreds, sf) if err != nil { if xnet.IsNetworkOrHostDown(err, true) { return nil, ErrorWithContext(ctx, ErrNetworkError) } return nil, ErrorWithContext(ctx, err, ErrInvalidLogin) } // serialize output loginResponse := &models.LoginResponse{ SessionID: *sessionID, } return loginResponse, 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, openIDProviders oauth2.OpenIDPCfg) (ld *models.LoginDetails, apiErr *CodedAPIError) { loginStrategy := models.LoginDetailsLoginStrategyForm var redirectRules []*models.RedirectRule r := params.HTTPRequest var loginDetails *models.LoginDetails if len(openIDProviders) > 0 { loginStrategy = models.LoginDetailsLoginStrategyRedirect } for name, provider := range openIDProviders { // initialize new oauth2 client oauth2Client, err := provider.GetOauth2Provider(name, nil, r, GetConsoleHTTPClient(getClientIP(params.HTTPRequest))) if err != nil { continue } // Validate user against IDP identityProvider := &auth.IdentityProvider{ KeyFunc: provider.GetStateKeyFunc(), Client: oauth2Client, } displayName := fmt.Sprintf("Login with SSO (%s)", name) serviceType := "" if provider.DisplayName != "" { displayName = provider.DisplayName } if provider.RoleArn != "" { splitRoleArn := strings.Split(provider.RoleArn, ":") if len(splitRoleArn) > 2 { serviceType = splitRoleArn[2] } } redirectRule := models.RedirectRule{ Redirect: identityProvider.GenerateLoginURL(), DisplayName: displayName, ServiceType: serviceType, } redirectRules = append(redirectRules, &redirectRule) } if len(openIDProviders) > 0 && len(redirectRules) == 0 { loginStrategy = models.LoginDetailsLoginStrategyForm // No IDP configured fallback to username/password } loginDetails = &models.LoginDetails{ LoginStrategy: loginStrategy, RedirectRules: redirectRules, IsK8S: isKubernetes(), LdapEnabled: ldap.GetLDAPEnabled(), } 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) (*credentials.Credentials, error) { userCredentials, err := provider.VerifyIdentity(ctx, code, state) if err != nil { LogError("error validating user identity against idp: %v", err) return nil, err } return userCredentials, nil } func getLoginOauth2AuthResponse(params authApi.LoginOauth2AuthParams, openIDProviders oauth2.OpenIDPCfg) (*models.LoginResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() r := params.HTTPRequest lr := params.Body client := GetConsoleHTTPClient(getClientIP(params.HTTPRequest)) if len(openIDProviders) > 0 { // we read state rState := *lr.State decodedRState, err := base64.StdEncoding.DecodeString(rState) if err != nil { return nil, ErrorWithContext(ctx, err) } var requestItems oauth2.LoginURLParams if err = json.Unmarshal(decodedRState, &requestItems); err != nil { return nil, ErrorWithContext(ctx, err) } IDPName := requestItems.IDPName state := requestItems.State providerCfg, ok := openIDProviders[IDPName] if !ok { return nil, ErrorWithContext(ctx, fmt.Errorf("selected IDP %s does not exist", IDPName)) } // Initialize new identity provider with new oauth2Client per IDPName oauth2Client, err := providerCfg.GetOauth2Provider(IDPName, nil, r, client) if err != nil { return nil, ErrorWithContext(ctx, err) } identityProvider := auth.IdentityProvider{ KeyFunc: providerCfg.GetStateKeyFunc(), Client: oauth2Client, RoleARN: providerCfg.RoleArn, } // Validate user against IDP userCredentials, err := verifyUserAgainstIDP(ctx, identityProvider, *lr.Code, state) if err != nil { return nil, ErrorWithContext(ctx, err) } // initialize admin client // login user against console and generate session token token, err := login(&ConsoleCredentials{ ConsoleCredentials: userCredentials, AccountAccessKey: "", CredContext: &credentials.CredContext{Client: client}, }, nil) if err != nil { return nil, ErrorWithContext(ctx, err) } // serialize output loginResponse := &models.LoginResponse{ SessionID: *token, IDPRefreshToken: identityProvider.Client.RefreshToken, } return loginResponse, nil } return nil, ErrorWithContext(ctx, ErrDefault) } ================================================ FILE: api/user_login_test.go ================================================ // 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 api import ( "context" "errors" "reflect" "testing" xoauth2 "golang.org/x/oauth2" "github.com/minio/madmin-go/v3" iampolicy "github.com/minio/pkg/v3/policy" "github.com/minio/console/pkg/auth" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/stretchr/testify/assert" ) // Define a mock struct of ConsoleCredentialsI interface implementation type consoleCredentialsMock struct{} func (ac consoleCredentialsMock) GetActions() []string { return []string{} } func (ac consoleCredentialsMock) GetAccountAccessKey() string { return "" } // Common mocks var consoleCredentialsGetMock func() (credentials.Value, error) // mock function of Get() func (ac consoleCredentialsMock) Get() (credentials.Value, error) { return consoleCredentialsGetMock() } func TestLogin(t *testing.T) { funcAssert := assert.New(t) consoleCredentials := consoleCredentialsMock{} // Test Case 1: Valid consoleCredentials consoleCredentialsGetMock = func() (credentials.Value, error) { return credentials.Value{ AccessKeyID: "fakeAccessKeyID", SecretAccessKey: "fakeSecretAccessKey", SessionToken: "fakeSessionToken", SignerType: 0, }, nil } token, err := login(consoleCredentials, nil) funcAssert.NotEmpty(token, "Token was returned empty") funcAssert.Nil(err, "error creating a session") // Test Case 2: Invalid credentials consoleCredentialsGetMock = func() (credentials.Value, error) { return credentials.Value{}, errors.New("") } _, err = login(consoleCredentials, nil) funcAssert.NotNil(err, "not error returned creating a session") } type IdentityProviderMock struct{} var ( idpVerifyIdentityMock func(ctx context.Context, code, state string) (*credentials.Credentials, error) idpVerifyIdentityForOperatorMock func(ctx context.Context, code, state string) (*xoauth2.Token, error) idpGenerateLoginURLMock func() string ) func (ac IdentityProviderMock) VerifyIdentity(ctx context.Context, code, state string) (*credentials.Credentials, error) { return idpVerifyIdentityMock(ctx, code, state) } func (ac IdentityProviderMock) VerifyIdentityForOperator(ctx context.Context, code, state string) (*xoauth2.Token, error) { return idpVerifyIdentityForOperatorMock(ctx, code, state) } func (ac IdentityProviderMock) GenerateLoginURL() string { return idpGenerateLoginURLMock() } func Test_validateUserAgainstIDP(t *testing.T) { provider := IdentityProviderMock{} mockCode := "EAEAEAE" mockState := "HUEHUEHUE" type args struct { ctx context.Context provider auth.IdentityProviderI code string state string } tests := []struct { name string args args want *credentials.Credentials wantErr bool mockFunc func() }{ { name: "failed to verify user identity with idp", args: args{ ctx: context.Background(), provider: provider, code: mockCode, state: mockState, }, want: nil, wantErr: true, mockFunc: func() { idpVerifyIdentityMock = func(_ context.Context, _, _ string) (*credentials.Credentials, error) { return nil, errors.New("something went wrong") } }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if tt.mockFunc != nil { tt.mockFunc() } got, err := verifyUserAgainstIDP(tt.args.ctx, tt.args.provider, tt.args.code, tt.args.state) if (err != nil) != tt.wantErr { t.Errorf("verifyUserAgainstIDP() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("verifyUserAgainstIDP() got = %v, want %v", got, tt.want) } }) } } func Test_getAccountInfo(t *testing.T) { client := AdminClientMock{} type args struct { ctx context.Context client MinioAdmin } tests := []struct { name string args args want *iampolicy.Policy wantErr bool mockFunc func() }{ { name: "error getting account info", args: args{ ctx: context.Background(), client: client, }, want: nil, wantErr: true, mockFunc: func() { minioAccountInfoMock = func(_ context.Context) (madmin.AccountInfo, error) { return madmin.AccountInfo{}, errors.New("something went wrong") } }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if tt.mockFunc != nil { tt.mockFunc() } got, err := getAccountInfo(tt.args.ctx, tt.args.client) if (err != nil) != tt.wantErr { t.Errorf("getAccountInfo() error = %v, wantErr %v", err, tt.wantErr) return } if tt.want != nil { if !reflect.DeepEqual(got, tt.want) { t.Errorf("getAccountInfo() got = %v, want %v", got, tt.want) } } }) } } ================================================ FILE: api/user_logout.go ================================================ // 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 api import ( "context" "encoding/base64" "encoding/json" "fmt" "net/http" "net/url" "time" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" authApi "github.com/minio/console/api/operations/auth" "github.com/minio/console/models" "github.com/minio/console/pkg/auth/idp/oauth2" ) func registerLogoutHandlers(api *operations.ConsoleAPI) { // logout from console api.AuthLogoutHandler = authApi.LogoutHandlerFunc(func(params authApi.LogoutParams, session *models.Principal) middleware.Responder { err := getLogoutResponse(session, params) if err != nil { api.Logger("IDP logout failed: %v", err.APIError.DetailedMessage) } // Custom response writer to expire the session cookies return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) { if err != nil { w.Header().Set("IDP-Logout", fmt.Sprintf("%v", err.APIError.DetailedMessage)) } expiredCookie := 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) http.SetCookie(w, &http.Cookie{ Path: "/", Name: "idp-refresh-token", Value: "", MaxAge: -1, Expires: time.Now().Add(-100 * time.Hour), HttpOnly: true, Secure: len(GlobalPublicCerts) > 0, SameSite: http.SameSiteLaxMode, }) authApi.NewLogoutOK().WriteResponse(w, p) }) }) } // logout() call Expire() on the provided ConsoleCredentials func logout(credentials ConsoleCredentialsI) { credentials.Expire() } // getLogoutResponse performs logout() and returns nil or errors func getLogoutResponse(session *models.Principal, params authApi.LogoutParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() state := params.Body.State if state != "" { if err := logoutFromIDPProvider(params.HTTPRequest, state); err != nil { return ErrorWithContext(ctx, err) } } creds := getConsoleCredentialsFromSession(session) credentials := ConsoleCredentials{ConsoleCredentials: creds} logout(credentials) return nil } func logoutFromIDPProvider(r *http.Request, state string) error { decodedRState, err := base64.StdEncoding.DecodeString(state) if err != nil { return err } var requestItems oauth2.LoginURLParams err = json.Unmarshal(decodedRState, &requestItems) if err != nil { return err } providerCfg := GlobalMinIOConfig.OpenIDProviders[requestItems.IDPName] refreshToken, err := r.Cookie("idp-refresh-token") if err != nil { return err } if providerCfg.EndSessionEndpoint != "" { params := url.Values{} params.Add("client_id", providerCfg.ClientID) params.Add("client_secret", providerCfg.ClientSecret) params.Add("refresh_token", refreshToken.Value) client := &http.Client{ Transport: GlobalTransport, } result, err := client.PostForm(providerCfg.EndSessionEndpoint, params) if err != nil { return errors.New(500, "failed to logout: %v", err.Error()) } if result.StatusCode != 204 { return errors.New(int32(result.StatusCode), "failed to logout") } } return nil } ================================================ FILE: api/user_logout_test.go ================================================ // 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 api import "testing" // mock function of Get() func (ac consoleCredentialsMock) Expire() { // Do nothing // Implementing this method for the consoleCredentials interface } func TestLogout(_ *testing.T) { // There's nothing to test right now } ================================================ FILE: api/user_objects.go ================================================ // 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 api import ( "context" "encoding/base64" "errors" "fmt" "io" "net/http" "net/url" "path/filepath" "regexp" "strconv" "strings" "time" "github.com/minio/minio-go/v7" "github.com/minio/console/pkg/utils" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/klauspost/compress/zip" "github.com/minio/console/api/operations" objectApi "github.com/minio/console/api/operations/object" "github.com/minio/console/models" mc "github.com/minio/mc/cmd" "github.com/minio/mc/pkg/probe" "github.com/minio/minio-go/v7/pkg/tags" "github.com/minio/pkg/v3/mimedb" ) // enum types const ( objectStorage = iota // MinIO and S3 compatible cloud storage fileSystem // POSIX compatible file systems ) func registerObjectsHandlers(api *operations.ConsoleAPI) { // list objects api.ObjectListObjectsHandler = objectApi.ListObjectsHandlerFunc(func(params objectApi.ListObjectsParams, session *models.Principal) middleware.Responder { resp, err := getListObjectsResponse(session, params) if err != nil { return objectApi.NewListObjectsDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewListObjectsOK().WithPayload(resp) }) // delete object api.ObjectDeleteObjectHandler = objectApi.DeleteObjectHandlerFunc(func(params objectApi.DeleteObjectParams, session *models.Principal) middleware.Responder { if err := getDeleteObjectResponse(session, params); err != nil { return objectApi.NewDeleteObjectDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewDeleteObjectOK() }) // delete multiple objects api.ObjectDeleteMultipleObjectsHandler = objectApi.DeleteMultipleObjectsHandlerFunc(func(params objectApi.DeleteMultipleObjectsParams, session *models.Principal) middleware.Responder { if err := getDeleteMultiplePathsResponse(session, params); err != nil { return objectApi.NewDeleteMultipleObjectsDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewDeleteMultipleObjectsOK() }) // download object api.ObjectDownloadObjectHandler = objectApi.DownloadObjectHandlerFunc(func(params objectApi.DownloadObjectParams, session *models.Principal) middleware.Responder { isFolder := false folders := strings.Split(params.Prefix, "/") if folders[len(folders)-1] == "" { isFolder = true } var resp middleware.Responder var err *CodedAPIError if isFolder { resp, err = getDownloadFolderResponse(session, params) } else { resp, err = getDownloadObjectResponse(session, params) } if err != nil { return objectApi.NewDownloadObjectDefault(err.Code).WithPayload(err.APIError) } return resp }) // download multiple objects api.ObjectDownloadMultipleObjectsHandler = objectApi.DownloadMultipleObjectsHandlerFunc(func(params objectApi.DownloadMultipleObjectsParams, session *models.Principal) middleware.Responder { ctx := params.HTTPRequest.Context() if len(params.ObjectList) < 1 { errCode := ErrorWithContext(ctx, errors.New("could not download, since object list is empty")) return objectApi.NewDownloadMultipleObjectsDefault(errCode.Code).WithPayload(errCode.APIError) } var resp middleware.Responder var err *CodedAPIError resp, err = getMultipleFilesDownloadResponse(session, params) if err != nil { return objectApi.NewDownloadMultipleObjectsDefault(err.Code).WithPayload(err.APIError) } return resp }) // upload object api.ObjectPostBucketsBucketNameObjectsUploadHandler = objectApi.PostBucketsBucketNameObjectsUploadHandlerFunc(func(params objectApi.PostBucketsBucketNameObjectsUploadParams, session *models.Principal) middleware.Responder { if err := getUploadObjectResponse(session, params); err != nil { if strings.Contains(err.APIError.DetailedMessage, "413") { return objectApi.NewPostBucketsBucketNameObjectsUploadDefault(413).WithPayload(err.APIError) } return objectApi.NewPostBucketsBucketNameObjectsUploadDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewPostBucketsBucketNameObjectsUploadOK() }) // get share object url api.ObjectShareObjectHandler = objectApi.ShareObjectHandlerFunc(func(params objectApi.ShareObjectParams, session *models.Principal) middleware.Responder { resp, err := getShareObjectResponse(session, params) if err != nil { return objectApi.NewShareObjectDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewShareObjectOK().WithPayload(*resp) }) // set object legalhold status api.ObjectPutObjectLegalHoldHandler = objectApi.PutObjectLegalHoldHandlerFunc(func(params objectApi.PutObjectLegalHoldParams, session *models.Principal) middleware.Responder { if err := getSetObjectLegalHoldResponse(session, params); err != nil { return objectApi.NewPutObjectLegalHoldDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewPutObjectLegalHoldOK() }) // set object retention api.ObjectPutObjectRetentionHandler = objectApi.PutObjectRetentionHandlerFunc(func(params objectApi.PutObjectRetentionParams, session *models.Principal) middleware.Responder { if err := getSetObjectRetentionResponse(session, params); err != nil { return objectApi.NewPutObjectRetentionDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewPutObjectRetentionOK() }) // delete object retention api.ObjectDeleteObjectRetentionHandler = objectApi.DeleteObjectRetentionHandlerFunc(func(params objectApi.DeleteObjectRetentionParams, session *models.Principal) middleware.Responder { if err := deleteObjectRetentionResponse(session, params); err != nil { return objectApi.NewDeleteObjectRetentionDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewDeleteObjectRetentionOK() }) // set tags in object api.ObjectPutObjectTagsHandler = objectApi.PutObjectTagsHandlerFunc(func(params objectApi.PutObjectTagsParams, session *models.Principal) middleware.Responder { if err := getPutObjectTagsResponse(session, params); err != nil { return objectApi.NewPutObjectTagsDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewPutObjectTagsOK() }) // Restore file version api.ObjectPutObjectRestoreHandler = objectApi.PutObjectRestoreHandlerFunc(func(params objectApi.PutObjectRestoreParams, session *models.Principal) middleware.Responder { if err := getPutObjectRestoreResponse(session, params); err != nil { return objectApi.NewPutObjectRestoreDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewPutObjectRestoreOK() }) // Metadata in object api.ObjectGetObjectMetadataHandler = objectApi.GetObjectMetadataHandlerFunc(func(params objectApi.GetObjectMetadataParams, session *models.Principal) middleware.Responder { resp, err := getObjectMetadataResponse(session, params) if err != nil { return objectApi.NewGetObjectMetadataDefault(err.Code).WithPayload(err.APIError) } return objectApi.NewGetObjectMetadataOK().WithPayload(resp) }) } // getListObjectsResponse returns a list of objects func getListObjectsResponse(session *models.Principal, params objectApi.ListObjectsParams) (*models.ListObjectsResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() var prefix string var recursive bool var withVersions bool var withMetadata bool if params.Prefix != nil { prefix = *params.Prefix } if params.Recursive != nil { recursive = *params.Recursive } if params.WithVersions != nil { withVersions = *params.WithVersions } if params.WithMetadata != nil { withMetadata = *params.WithMetadata } // bucket request needed to proceed if params.BucketName == "" { return nil, ErrorWithContext(ctx, ErrBucketNameNotInRequest) } mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} objs, err := listBucketObjects(ListObjectsOpts{ ctx: ctx, client: minioClient, bucketName: params.BucketName, prefix: prefix, recursive: recursive, withVersions: withVersions, withMetadata: withMetadata, limit: params.Limit, }) if err != nil { return nil, ErrorWithContext(ctx, err) } resp := &models.ListObjectsResponse{ Objects: objs, Total: int64(len(objs)), } return resp, nil } type ListObjectsOpts struct { ctx context.Context client MinioClient bucketName string prefix string recursive bool withVersions bool withMetadata bool limit *int32 } // listBucketObjects gets an array of objects in a bucket func listBucketObjects(listOpts ListObjectsOpts) ([]*models.BucketObject, error) { var objects []*models.BucketObject opts := minio.ListObjectsOptions{ Prefix: listOpts.prefix, Recursive: listOpts.recursive, WithVersions: listOpts.withVersions, WithMetadata: listOpts.withMetadata, MaxKeys: 100, } if listOpts.withMetadata { opts.MaxKeys = 1 } if listOpts.limit != nil { opts.MaxKeys = int(*listOpts.limit) } var totalObjs int32 for lsObj := range listOpts.client.listObjects(listOpts.ctx, listOpts.bucketName, opts) { if lsObj.Err != nil { return nil, lsObj.Err } obj := &models.BucketObject{ Name: lsObj.Key, Size: lsObj.Size, LastModified: lsObj.LastModified.Format(time.RFC3339), ContentType: lsObj.ContentType, VersionID: lsObj.VersionID, IsLatest: lsObj.IsLatest, IsDeleteMarker: lsObj.IsDeleteMarker, UserTags: lsObj.UserTags, UserMetadata: lsObj.UserMetadata, Etag: lsObj.ETag, } // only if single object with or without versions; get legalhold, retention and tags if !lsObj.IsDeleteMarker && listOpts.prefix != "" && !strings.HasSuffix(listOpts.prefix, "/") { // Add Legal Hold Status if available legalHoldStatus, err := listOpts.client.getObjectLegalHold(listOpts.ctx, listOpts.bucketName, lsObj.Key, minio.GetObjectLegalHoldOptions{VersionID: lsObj.VersionID}) if err != nil { errResp := minio.ToErrorResponse(probe.NewError(err).ToGoError()) if errResp.Code != "InvalidRequest" && errResp.Code != "NoSuchObjectLockConfiguration" { ErrorWithContext(listOpts.ctx, fmt.Errorf("error getting legal hold status for %s : %v", lsObj.VersionID, err)) } } else if legalHoldStatus != nil { obj.LegalHoldStatus = string(*legalHoldStatus) } // Add Retention Status if available retention, retUntilDate, err := listOpts.client.getObjectRetention(listOpts.ctx, listOpts.bucketName, lsObj.Key, lsObj.VersionID) if err != nil { errResp := minio.ToErrorResponse(probe.NewError(err).ToGoError()) if errResp.Code != "InvalidRequest" && errResp.Code != "NoSuchObjectLockConfiguration" { ErrorWithContext(listOpts.ctx, fmt.Errorf("error getting retention status for %s : %v", lsObj.VersionID, err)) } } else if retention != nil && retUntilDate != nil { date := *retUntilDate obj.RetentionMode = string(*retention) obj.RetentionUntilDate = date.Format(time.RFC3339) } objTags, err := listOpts.client.getObjectTagging(listOpts.ctx, listOpts.bucketName, lsObj.Key, minio.GetObjectTaggingOptions{VersionID: lsObj.VersionID}) if err != nil { ErrorWithContext(listOpts.ctx, fmt.Errorf("error getting object tags for %s : %v", lsObj.VersionID, err)) } else { obj.Tags = objTags.ToMap() } } objects = append(objects, obj) totalObjs++ if listOpts.limit != nil { if totalObjs >= *listOpts.limit { break } } } return objects, nil } type httpRange struct { Start int64 Length int64 } // Example: // // "Content-Range": "bytes 100-200/1000" // "Content-Range": "bytes 100-200/*" func getRange(start, end, total int64) string { // unknown total: -1 if total == -1 { return fmt.Sprintf("bytes %d-%d/*", start, end) } return fmt.Sprintf("bytes %d-%d/%d", start, end, total) } // Example: // // "Range": "bytes=100-200" // "Range": "bytes=-50" // "Range": "bytes=150-" // "Range": "bytes=0-0,-1" func parseRange(s string, size int64) ([]httpRange, error) { if s == "" { return nil, nil // header not present } const b = "bytes=" if !strings.HasPrefix(s, b) { return nil, errors.New("invalid range") } var ranges []httpRange for _, ra := range strings.Split(s[len(b):], ",") { ra = strings.TrimSpace(ra) if ra == "" { continue } i := strings.Index(ra, "-") if i < 0 { return nil, errors.New("invalid range") } start, end := strings.TrimSpace(ra[:i]), strings.TrimSpace(ra[i+1:]) var r httpRange if start == "" { // If no start is specified, end specifies the // range start relative to the end of the file. i, err := strconv.ParseInt(end, 10, 64) if err != nil { return nil, errors.New("invalid range") } if i > size { i = size } r.Start = size - i r.Length = size - r.Start } else { i, err := strconv.ParseInt(start, 10, 64) if err != nil || i >= size || i < 0 { return nil, errors.New("invalid range") } r.Start = i if end == "" { // If no end is specified, range extends to end of the file. r.Length = size - r.Start } else { i, err := strconv.ParseInt(end, 10, 64) if err != nil || r.Start > i { return nil, errors.New("invalid range") } if i >= size { i = size - 1 } r.Length = i - r.Start + 1 } } ranges = append(ranges, r) } return ranges, nil } func getDownloadObjectResponse(session *models.Principal, params objectApi.DownloadObjectParams) (middleware.Responder, *CodedAPIError) { ctx := params.HTTPRequest.Context() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } opts := minio.GetObjectOptions{} if params.VersionID != nil && *params.VersionID != "" { opts.VersionID = *params.VersionID } resp, err := mClient.GetObject(ctx, params.BucketName, params.Prefix, opts) if err != nil { return nil, ErrorWithContext(ctx, err) } return middleware.ResponderFunc(func(rw http.ResponseWriter, _ runtime.Producer) { defer resp.Close() isPreview := params.Preview != nil && *params.Preview overrideName := *params.OverrideFileName // indicate it's a download / inline content to the browser, and the size of the object var filename string prefixElements := strings.Split(params.Prefix, "/") if len(prefixElements) > 0 && overrideName == "" { if prefixElements[len(prefixElements)-1] == "" { filename = prefixElements[len(prefixElements)-2] } else { filename = prefixElements[len(prefixElements)-1] } } else if overrideName != "" { filename = overrideName } escapedName := url.PathEscape(filename) // indicate object size & content type stat, err := resp.Stat() if err != nil { minErr := minio.ToErrorResponse(err) fmtError := ErrorWithContext(ctx, fmt.Errorf("failed to get Stat() response from server for %s (version %s): %v", params.Prefix, opts.VersionID, minErr.Error())) http.Error(rw, fmtError.APIError.DetailedMessage, http.StatusInternalServerError) return } // if we are getting a Range Request (video) handle that specially ranges, err := parseRange(params.HTTPRequest.Header.Get("Range"), stat.Size) if err != nil { fmtError := ErrorWithContext(ctx, fmt.Errorf("unable to parse range header input %s: %v", params.HTTPRequest.Header.Get("Range"), err)) http.Error(rw, fmtError.APIError.DetailedMessage, http.StatusInternalServerError) return } contentType := stat.ContentType rw.Header().Set("X-XSS-Protection", "1; mode=block") if isPreview && isSafeToPreview(contentType) { rw.Header().Set("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"", escapedName)) rw.Header().Set("X-Frame-Options", "SAMEORIGIN") } else { rw.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", escapedName)) } rw.Header().Set("Last-Modified", stat.LastModified.UTC().Format(http.TimeFormat)) if isPreview { // In case content type was uploaded as octet-stream, we double verify content type if stat.ContentType == "application/octet-stream" { contentType = mimedb.TypeByExtension(filepath.Ext(escapedName)) } } rw.Header().Set("Content-Type", contentType) length := stat.Size if len(ranges) > 0 { start := ranges[0].Start length = ranges[0].Length _, err = resp.Seek(start, io.SeekStart) if err != nil { fmtError := ErrorWithContext(ctx, fmt.Errorf("unable to seek at offset %d: %v", start, err)) http.Error(rw, fmtError.APIError.DetailedMessage, http.StatusInternalServerError) return } rw.Header().Set("Accept-Ranges", "bytes") rw.Header().Set("Access-Control-Allow-Origin", "*") rw.Header().Set("Content-Range", getRange(start, start+length-1, stat.Size)) rw.WriteHeader(http.StatusPartialContent) } rw.Header().Set("Content-Length", fmt.Sprintf("%d", length)) _, err = io.Copy(rw, io.LimitReader(resp, length)) if err != nil { ErrorWithContext(ctx, fmt.Errorf("unable to write all data to client: %v", err)) // You can't change headers after you already started writing the body. // Handle incomplete write in client. return } }), nil } func getDownloadFolderResponse(session *models.Principal, params objectApi.DownloadObjectParams) (middleware.Responder, *CodedAPIError) { ctx := params.HTTPRequest.Context() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) folders := strings.Split(params.Prefix, "/") if err != nil { return nil, ErrorWithContext(ctx, err) } minioClient := minioClient{client: mClient} objects, err := listBucketObjects(ListObjectsOpts{ ctx: ctx, client: minioClient, bucketName: params.BucketName, prefix: params.Prefix, recursive: true, withVersions: false, withMetadata: false, }) if err != nil { return nil, ErrorWithContext(ctx, err) } resp, pw := io.Pipe() // Create file async go func() { defer pw.Close() zipw := zip.NewWriter(pw) var folder string if len(folders) > 1 { folder = folders[len(folders)-2] } defer zipw.Close() for i, obj := range objects { name := folder + objects[i].Name[len(params.Prefix)-1:] object, err := mClient.GetObject(ctx, params.BucketName, obj.Name, minio.GetObjectOptions{}) if err != nil { // Ignore errors, move to next continue } modified, _ := time.Parse(time.RFC3339, obj.LastModified) f, err := zipw.CreateHeader(&zip.FileHeader{ Name: name, NonUTF8: false, Method: zip.Deflate, Modified: modified, }) if err != nil { object.Close() // Ignore errors, move to next continue } _, err = io.Copy(f, object) object.Close() if err != nil { // We have a partial object, report error. pw.CloseWithError(err) return } } }() return middleware.ResponderFunc(func(rw http.ResponseWriter, _ runtime.Producer) { defer resp.Close() // indicate it's a download / inline content to the browser, and the size of the object var filename string prefixElements := strings.Split(params.Prefix, "/") if len(prefixElements) > 0 { if prefixElements[len(prefixElements)-1] == "" { filename = prefixElements[len(prefixElements)-2] } else { filename = prefixElements[len(prefixElements)-1] } } escapedName := url.PathEscape(filename) rw.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s.zip\"", escapedName)) rw.Header().Set("Content-Type", "application/zip") // Copy the stream _, err := io.Copy(rw, resp) if err != nil { ErrorWithContext(ctx, fmt.Errorf("unable to write all the requested data: %v", err)) // You can't change headers after you already started writing the body. // Handle incomplete write in client. return } }), nil } func getMultipleFilesDownloadResponse(session *models.Principal, params objectApi.DownloadMultipleObjectsParams) (middleware.Responder, *CodedAPIError) { ctx := params.HTTPRequest.Context() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } minioClient := minioClient{client: mClient} resp, pw := io.Pipe() // Create file async go func() { defer pw.Close() zipw := zip.NewWriter(pw) defer zipw.Close() addToZip := func(name string, modified time.Time) (io.Writer, error) { f, err := zipw.CreateHeader(&zip.FileHeader{ Name: name, NonUTF8: false, Method: zip.Deflate, Modified: modified, }) return f, err } for _, dObj := range params.ObjectList { // if a prefix is selected, list and add objects recursively // the prefixes are not base64 encoded. if strings.HasSuffix(dObj, "/") { prefix := dObj folders := strings.Split(prefix, "/") var folder string if len(folders) > 1 { folder = folders[len(folders)-2] } objects, err := listBucketObjects(ListObjectsOpts{ ctx: ctx, client: minioClient, bucketName: params.BucketName, prefix: prefix, recursive: true, withVersions: false, withMetadata: false, }) if err != nil { pw.CloseWithError(err) } for i, obj := range objects { name := folder + objects[i].Name[len(prefix)-1:] object, err := mClient.GetObject(ctx, params.BucketName, obj.Name, minio.GetObjectOptions{}) if err != nil { // Ignore errors, move to next continue } modified, _ := time.Parse(time.RFC3339, obj.LastModified) f, err := addToZip(name, modified) if err != nil { object.Close() // Ignore errors, move to next continue } _, err = io.Copy(f, object) object.Close() if err != nil { // We have a partial object, report error. pw.CloseWithError(err) return } } } else { object, err := mClient.GetObject(ctx, params.BucketName, dObj, minio.GetObjectOptions{}) if err != nil { // Ignore errors, move to next continue } // add selected individual object objectData, err := object.Stat() if err != nil { // Ignore errors, move to next continue } prefixes := strings.Split(dObj, "/") // truncate upper level prefixes to make the download as flat at the current level. objectName := prefixes[len(prefixes)-1] f, err := addToZip(objectName, objectData.LastModified) if err != nil { object.Close() // Ignore errors, move to next continue } _, err = io.Copy(f, object) object.Close() if err != nil { // We have a partial object, report error. pw.CloseWithError(err) return } } } }() return middleware.ResponderFunc(func(rw http.ResponseWriter, _ runtime.Producer) { defer resp.Close() // indicate it's a download / inline content to the browser, and the size of the object fileName := "selected_files_" + strings.ReplaceAll(strings.ReplaceAll(time.Now().UTC().Format(time.RFC3339), ":", ""), "-", "") rw.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s.zip\"", fileName)) rw.Header().Set("Content-Type", "application/zip") // Copy the stream _, err := io.Copy(rw, resp) if err != nil { ErrorWithContext(ctx, fmt.Errorf("unable to write all the requested data: %v", err)) // You can't change headers after you already started writing the body. // Handle incomplete write in client. return } }), nil } // getDeleteObjectResponse returns whether there was an error on deletion of object func getDeleteObjectResponse(session *models.Principal, params objectApi.DeleteObjectParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() s3Client, err := newS3BucketClient(session, params.BucketName, params.Prefix, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} var rec bool var version string var allVersions bool var nonCurrentVersions bool var bypass bool if params.Recursive != nil { rec = *params.Recursive } if params.VersionID != nil { version = *params.VersionID } if params.AllVersions != nil { allVersions = *params.AllVersions } if params.NonCurrentVersions != nil { nonCurrentVersions = *params.NonCurrentVersions } if params.Bypass != nil { bypass = *params.Bypass } if allVersions && nonCurrentVersions { err := errors.New("cannot set delete all versions and delete non-current versions flags at the same time") return ErrorWithContext(ctx, err) } err = deleteObjects(ctx, mcClient, params.BucketName, params.Prefix, version, rec, allVersions, nonCurrentVersions, bypass) if err != nil { return ErrorWithContext(ctx, err) } return nil } // getDeleteMultiplePathsResponse returns whether there was an error on deletion of any object func getDeleteMultiplePathsResponse(session *models.Principal, params objectApi.DeleteMultipleObjectsParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() var version string var allVersions bool var bypass bool if params.AllVersions != nil { allVersions = *params.AllVersions } if params.Bypass != nil { bypass = *params.Bypass } for i := 0; i < len(params.Files); i++ { if params.Files[i].VersionID != "" { version = params.Files[i].VersionID } prefix := params.Files[i].Path s3Client, err := newS3BucketClient(session, params.BucketName, prefix, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} err = deleteObjects(ctx, mcClient, params.BucketName, params.Files[i].Path, version, params.Files[i].Recursive, allVersions, false, bypass) if err != nil { return ErrorWithContext(ctx, err) } } return nil } // deleteObjects deletes either a single object or multiple objects based on recursive flag func deleteObjects(ctx context.Context, client MCClient, bucket string, path string, versionID string, recursive, allVersions, nonCurrentVersionsOnly, bypass bool) error { // Delete All non-Current versions only. if nonCurrentVersionsOnly { return deleteNonCurrentVersions(ctx, client, bypass) } if recursive || allVersions { return deleteMultipleObjects(ctx, client, path, recursive, allVersions, bypass) } return deleteSingleObject(ctx, client, bucket, path, versionID, bypass) } // Return standardized URL to be used to compare later. func getStandardizedURL(targetURL string) string { return filepath.FromSlash(targetURL) } // deleteMultipleObjects uses listing before removal, it can list recursively or not, // // Use cases: // * Remove objects recursively func deleteMultipleObjects(ctx context.Context, client MCClient, path string, recursive, allVersions, isBypass bool) error { // Constants defined to make this code more readable const ( isIncomplete = false isRemoveBucket = false forceDelete = false // Force delete not meant to be used by console UI. ) listOpts := mc.ListOptions{ Recursive: recursive, Incomplete: isIncomplete, ShowDir: mc.DirNone, WithOlderVersions: allVersions, WithDeleteMarkers: allVersions, } lctx, cancel := context.WithCancel(ctx) defer cancel() contentCh := make(chan *mc.ClientContent) go func() { defer close(contentCh) for content := range client.list(lctx, listOpts) { if content.Err != nil { continue } if !strings.HasSuffix(getStandardizedURL(content.URL.Path), path) && !strings.HasSuffix(path, "/") { continue } select { case contentCh <- content: case <-lctx.Done(): return } } }() for result := range client.remove(ctx, isIncomplete, isRemoveBucket, isBypass, forceDelete, contentCh) { if result.Err != nil { return result.Err.Cause } } return nil } func deleteSingleObject(ctx context.Context, client MCClient, bucket, object string, versionID string, isBypass bool) error { targetURL := fmt.Sprintf("%s/%s", bucket, object) contentCh := make(chan *mc.ClientContent, 1) contentCh <- &mc.ClientContent{URL: *newClientURL(targetURL), VersionID: versionID} close(contentCh) isIncomplete := false isRemoveBucket := false resultCh := client.remove(ctx, isIncomplete, isRemoveBucket, isBypass, false, contentCh) for result := range resultCh { if result.Err != nil { return result.Err.Cause } } return nil } func deleteNonCurrentVersions(ctx context.Context, client MCClient, isBypass bool) error { lctx, cancel := context.WithCancel(ctx) defer cancel() contentCh := make(chan *mc.ClientContent) go func() { defer close(contentCh) // Get current object versions for lsObj := range client.list(lctx, mc.ListOptions{ WithDeleteMarkers: true, WithOlderVersions: true, Recursive: true, }) { if lsObj.Err != nil { continue } if lsObj.IsLatest { continue } // All non-current objects proceed to purge. select { case contentCh <- lsObj: case <-lctx.Done(): return } } }() for result := range client.remove(ctx, false, false, isBypass, false, contentCh) { if result.Err != nil { return result.Err.Cause } } return nil } func getUploadObjectResponse(session *models.Principal, params objectApi.PostBucketsBucketNameObjectsUploadParams) *CodedAPIError { ctx := params.HTTPRequest.Context() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} if err := uploadFiles(ctx, minioClient, params); err != nil { return ErrorWithContext(ctx, err, ErrDefault) } return nil } // uploadFiles gets files from http.Request form and uploads them to MinIO func uploadFiles(ctx context.Context, client MinioClient, params objectApi.PostBucketsBucketNameObjectsUploadParams) error { var prefix string if params.Prefix != nil { prefix = *params.Prefix // trim any leading '/', since that is not expected // for any object. prefix = strings.TrimPrefix(prefix, "/") } // parse a request body as multipart/form-data. // 32 << 20 is default max memory mr, err := params.HTTPRequest.MultipartReader() if err != nil { return err } for { p, err := mr.NextPart() if err == io.EOF { break } size, err := strconv.ParseInt(p.FormName(), 10, 64) if err != nil { return err } contentType := p.Header.Get("content-type") if contentType == "" { contentType = mimedb.TypeByExtension(filepath.Ext(p.FileName())) } objectName := prefix // prefix will have complete object path e.g: /test-prefix/test-object.txt _, err = client.putObject(ctx, params.BucketName, objectName, p, size, minio.PutObjectOptions{ ContentType: contentType, DisableMultipart: true, // Do not upload as multipart stream for console uploader. }) if err != nil { return err } } return nil } // getShareObjectResponse returns a share object url func getShareObjectResponse(session *models.Principal, params objectApi.ShareObjectParams) (*string, *CodedAPIError) { ctx := params.HTTPRequest.Context() clientIP := utils.ClientIPFromContext(ctx) s3Client, err := newS3BucketClient(session, params.BucketName, params.Prefix, clientIP) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a mc S3Client interface implementation // defining the client to be used mcClient := mcClient{client: s3Client} var expireDuration string if params.Expires != nil { expireDuration = *params.Expires } toogleURL := false if params.ToggleURL != nil { toogleURL = *params.ToggleURL } url, err := getShareObjectURL(ctx, mcClient, params.HTTPRequest, params.VersionID, expireDuration, toogleURL) if err != nil { return nil, ErrorWithContext(ctx, err) } return url, nil } func getShareObjectURL(ctx context.Context, client MCClient, r *http.Request, versionID string, duration string, toogleURL bool) (*string, error) { // default duration 7d if not defined if strings.TrimSpace(duration) == "" { duration = "168h" } expiresDuration, err := time.ParseDuration(duration) if err != nil { return nil, err } minioURL, pErr := client.shareDownload(ctx, versionID, expiresDuration) if pErr != nil { return nil, pErr.Cause } shareMinIOURL := getConsoleShareMinIOURL() if toogleURL { shareMinIOURL = !shareMinIOURL } if shareMinIOURL { return &minioURL, nil } requestURL := getRequestURLWithScheme(r) encodedURL := base64.RawURLEncoding.EncodeToString([]byte(minioURL)) objURL := fmt.Sprintf("%s/api/v1/download-shared-object/%s", requestURL, url.PathEscape(encodedURL)) return &objURL, nil } func getRequestURLWithScheme(r *http.Request) string { scheme := "http" if r.TLS != nil { scheme = "https" } redirectURL := getConsoleBrowserRedirectURL() if redirectURL != "" { return strings.TrimSuffix(redirectURL, "/") } return fmt.Sprintf("%s://%s", scheme, r.Host) } func getSetObjectLegalHoldResponse(session *models.Principal, params objectApi.PutObjectLegalHoldParams) *CodedAPIError { ctx := params.HTTPRequest.Context() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} err = setObjectLegalHold(ctx, minioClient, params.BucketName, params.Prefix, params.VersionID, *params.Body.Status) if err != nil { return ErrorWithContext(ctx, err) } return nil } func setObjectLegalHold(ctx context.Context, client MinioClient, bucketName, prefix, versionID string, status models.ObjectLegalHoldStatus) error { var lstatus minio.LegalHoldStatus if status == models.ObjectLegalHoldStatusEnabled { lstatus = minio.LegalHoldEnabled } else { lstatus = minio.LegalHoldDisabled } return client.putObjectLegalHold(ctx, bucketName, prefix, minio.PutObjectLegalHoldOptions{VersionID: versionID, Status: &lstatus}) } func getSetObjectRetentionResponse(session *models.Principal, params objectApi.PutObjectRetentionParams) *CodedAPIError { ctx := params.HTTPRequest.Context() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} err = setObjectRetention(ctx, minioClient, params.BucketName, params.VersionID, params.Prefix, params.Body) if err != nil { return ErrorWithContext(ctx, err) } return nil } func setObjectRetention(ctx context.Context, client MinioClient, bucketName, versionID, prefix string, retentionOps *models.PutObjectRetentionRequest) error { if retentionOps == nil { return errors.New("object retention options can't be nil") } if retentionOps.Expires == nil { return errors.New("object retention expires can't be nil") } var mode minio.RetentionMode if *retentionOps.Mode == models.ObjectRetentionModeGovernance { mode = minio.Governance } else { mode = minio.Compliance } retentionUntilDate, err := time.Parse(time.RFC3339, *retentionOps.Expires) if err != nil { return err } opts := minio.PutObjectRetentionOptions{ GovernanceBypass: retentionOps.GovernanceBypass, RetainUntilDate: &retentionUntilDate, Mode: &mode, VersionID: versionID, } return client.putObjectRetention(ctx, bucketName, prefix, opts) } func deleteObjectRetentionResponse(session *models.Principal, params objectApi.DeleteObjectRetentionParams) *CodedAPIError { ctx := params.HTTPRequest.Context() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} err = deleteObjectRetention(ctx, minioClient, params.BucketName, params.Prefix, params.VersionID) if err != nil { return ErrorWithContext(ctx, err) } return nil } func deleteObjectRetention(ctx context.Context, client MinioClient, bucketName, prefix, versionID string) error { opts := minio.PutObjectRetentionOptions{ GovernanceBypass: true, VersionID: versionID, } return client.putObjectRetention(ctx, bucketName, prefix, opts) } func getPutObjectTagsResponse(session *models.Principal, params objectApi.PutObjectTagsParams) *CodedAPIError { ctx := params.HTTPRequest.Context() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} err = putObjectTags(ctx, minioClient, params.BucketName, params.Prefix, params.VersionID, params.Body.Tags) if err != nil { return ErrorWithContext(ctx, err) } return nil } func putObjectTags(ctx context.Context, client MinioClient, bucketName, prefix, versionID string, tagMap map[string]string) error { opt := minio.PutObjectTaggingOptions{ VersionID: versionID, } otags, err := tags.MapToObjectTags(tagMap) if err != nil { return err } return client.putObjectTagging(ctx, bucketName, prefix, otags, opt) } // Restore Object Version func getPutObjectRestoreResponse(session *models.Principal, params objectApi.PutObjectRestoreParams) *CodedAPIError { ctx := params.HTTPRequest.Context() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} err = restoreObject(ctx, minioClient, params.BucketName, params.Prefix, params.VersionID) if err != nil { return ErrorWithContext(ctx, err) } return nil } func restoreObject(ctx context.Context, client MinioClient, bucketName, prefix, versionID string) error { // Select required version srcOpts := minio.CopySrcOptions{ Bucket: bucketName, Object: prefix, VersionID: versionID, } // Destination object, same as current bucket replaceMetadata := make(map[string]string) replaceMetadata["copy-source"] = versionID dstOpts := minio.CopyDestOptions{ Bucket: bucketName, Object: prefix, UserMetadata: replaceMetadata, } // Copy object call _, err := client.copyObject(ctx, dstOpts, srcOpts) if err != nil { return err } return nil } // Metadata Response from minio-go API func getObjectMetadataResponse(session *models.Principal, params objectApi.GetObjectMetadataParams) (*models.Metadata, *CodedAPIError) { ctx := params.HTTPRequest.Context() mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) if err != nil { return nil, ErrorWithContext(ctx, err) } // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} var versionID string if params.VersionID != nil { versionID = *params.VersionID } objectInfo, err := getObjectInfo(ctx, minioClient, params.BucketName, params.Prefix, versionID) if err != nil { return nil, ErrorWithContext(ctx, err) } metadata := &models.Metadata{ObjectMetadata: objectInfo.Metadata} return metadata, nil } func getObjectInfo(ctx context.Context, client MinioClient, bucketName, prefix, versionID string) (minio.ObjectInfo, error) { objectData, err := client.statObject(ctx, bucketName, prefix, minio.GetObjectOptions{VersionID: versionID}) if err != nil { return minio.ObjectInfo{}, err } return objectData, nil } // newClientURL returns an abstracted URL for filesystems and object storage. func newClientURL(urlStr string) *mc.ClientURL { scheme, rest := getScheme(urlStr) if strings.HasPrefix(rest, "//") { // if rest has '//' prefix, skip them var authority string authority, rest = splitSpecial(rest[2:], "/", false) if rest == "" { rest = "/" } host := getHost(authority) if host != "" && (scheme == "http" || scheme == "https") { return &mc.ClientURL{ Scheme: scheme, Type: objectStorage, Host: host, Path: rest, SchemeSeparator: "://", Separator: '/', } } } return &mc.ClientURL{ Type: fileSystem, Path: rest, Separator: filepath.Separator, } } // Maybe rawurl is of the form scheme:path. (Scheme must be [a-zA-Z][a-zA-Z0-9+-.]*) // If so, return scheme, path; else return "", rawurl. func getScheme(rawurl string) (scheme, path string) { urlSplits := strings.Split(rawurl, "://") if len(urlSplits) == 2 { scheme, uri := urlSplits[0], "//"+urlSplits[1] // ignore numbers in scheme validScheme := regexp.MustCompile("^[a-zA-Z]+$") if uri != "" { if validScheme.MatchString(scheme) { return scheme, uri } } } return "", rawurl } // Assuming s is of the form [s delimiter s]. // If so, return s, [delimiter]s or return s, s if cutdelimiter == true // If no delimiter found return s, "". func splitSpecial(s string, delimiter string, cutdelimiter bool) (string, string) { i := strings.Index(s, delimiter) if i < 0 { // if delimiter not found return as is. return s, "" } // if delimiter should be removed, remove it. if cutdelimiter { return s[0:i], s[i+len(delimiter):] } // return split strings with delimiter return s[0:i], s[i:] } // getHost - extract host from authority string, we do not support ftp style username@ yet. func getHost(authority string) (host string) { i := strings.LastIndex(authority, "@") if i >= 0 { // TODO support, username@password style userinfo, useful for ftp support. return host } return authority } ================================================ FILE: api/user_objects_test.go ================================================ // 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 api import ( "context" "crypto/tls" "encoding/json" "errors" "fmt" "io" "net/http" "path/filepath" "reflect" "testing" "time" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations/object" "github.com/go-openapi/swag" "github.com/minio/console/models" mc "github.com/minio/mc/cmd" "github.com/minio/mc/pkg/probe" "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/tags" "github.com/stretchr/testify/assert" ) var ( minioListObjectsMock func(ctx context.Context, bucket string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo minioGetObjectLegalHoldMock func(ctx context.Context, bucketName, objectName string, opts minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) minioGetObjectRetentionMock func(ctx context.Context, bucketName, objectName, versionID string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) minioPutObjectMock func(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (info minio.UploadInfo, err error) minioPutObjectLegalHoldMock func(ctx context.Context, bucketName, objectName string, opts minio.PutObjectLegalHoldOptions) error minioPutObjectRetentionMock func(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error minioGetObjectTaggingMock func(ctx context.Context, bucketName, objectName string, opts minio.GetObjectTaggingOptions) (*tags.Tags, error) minioPutObjectTaggingMock func(ctx context.Context, bucketName, objectName string, otags *tags.Tags, opts minio.PutObjectTaggingOptions) error minioStatObjectMock func(ctx context.Context, bucketName, prefix string, opts minio.GetObjectOptions) (objectInfo minio.ObjectInfo, err error) ) var ( mcListMock func(ctx context.Context, opts mc.ListOptions) <-chan *mc.ClientContent mcRemoveMock func(ctx context.Context, isIncomplete, isRemoveBucket, isBypass, forceDelete bool, contentCh <-chan *mc.ClientContent) <-chan mc.RemoveResult mcGetMock func(ctx context.Context, opts mc.GetOptions) (io.ReadCloser, *probe.Error) mcShareDownloadMock func(ctx context.Context, versionID string, expires time.Duration) (string, *probe.Error) ) // mock functions for minioClientMock func (ac minioClientMock) listObjects(ctx context.Context, bucket string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo { return minioListObjectsMock(ctx, bucket, opts) } func (ac minioClientMock) getObjectLegalHold(ctx context.Context, bucketName, objectName string, opts minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { return minioGetObjectLegalHoldMock(ctx, bucketName, objectName, opts) } func (ac minioClientMock) getObjectRetention(ctx context.Context, bucketName, objectName, versionID string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { return minioGetObjectRetentionMock(ctx, bucketName, objectName, versionID) } func (ac minioClientMock) putObject(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (info minio.UploadInfo, err error) { return minioPutObjectMock(ctx, bucketName, objectName, reader, objectSize, opts) } func (ac minioClientMock) putObjectLegalHold(ctx context.Context, bucketName, objectName string, opts minio.PutObjectLegalHoldOptions) error { return minioPutObjectLegalHoldMock(ctx, bucketName, objectName, opts) } func (ac minioClientMock) putObjectRetention(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error { return minioPutObjectRetentionMock(ctx, bucketName, objectName, opts) } func (ac minioClientMock) getObjectTagging(ctx context.Context, bucketName, objectName string, opts minio.GetObjectTaggingOptions) (*tags.Tags, error) { return minioGetObjectTaggingMock(ctx, bucketName, objectName, opts) } func (ac minioClientMock) putObjectTagging(ctx context.Context, bucketName, objectName string, otags *tags.Tags, opts minio.PutObjectTaggingOptions) error { return minioPutObjectTaggingMock(ctx, bucketName, objectName, otags, opts) } func (ac minioClientMock) statObject(ctx context.Context, bucketName, prefix string, opts minio.GetObjectOptions) (objectInfo minio.ObjectInfo, err error) { return minioStatObjectMock(ctx, bucketName, prefix, opts) } // mock functions for s3ClientMock func (c s3ClientMock) list(ctx context.Context, opts mc.ListOptions) <-chan *mc.ClientContent { return mcListMock(ctx, opts) } func (c s3ClientMock) remove(ctx context.Context, isIncomplete, isRemoveBucket, isBypass, forceDelete bool, contentCh <-chan *mc.ClientContent) <-chan mc.RemoveResult { return mcRemoveMock(ctx, isIncomplete, isRemoveBucket, isBypass, forceDelete, contentCh) } func (c s3ClientMock) get(ctx context.Context, opts mc.GetOptions) (io.ReadCloser, *probe.Error) { return mcGetMock(ctx, opts) } func (c s3ClientMock) shareDownload(ctx context.Context, versionID string, expires time.Duration) (string, *probe.Error) { return mcShareDownloadMock(ctx, versionID, expires) } func Test_listObjects(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() t1 := time.Now() tretention := time.Now() minClient := minioClientMock{} type args struct { bucketName string prefix string recursive bool withVersions bool withMetadata bool limit *int32 listFunc func(ctx context.Context, bucket string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo objectLegalHoldFunc func(ctx context.Context, bucketName, objectName string, opts minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) objectRetentionFunc func(ctx context.Context, bucketName, objectName, versionID string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) objectGetTaggingFunc func(ctx context.Context, bucketName, objectName string, opts minio.GetObjectTaggingOptions) (*tags.Tags, error) } tests := []struct { test string args args expectedResp []*models.BucketObject wantError error }{ { test: "Return objects", args: args{ bucketName: "bucket1", prefix: "prefix", recursive: true, withVersions: false, withMetadata: false, listFunc: func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo { objectStatCh := make(chan minio.ObjectInfo, 1) go func(objectStatCh chan<- minio.ObjectInfo) { defer close(objectStatCh) for _, bucket := range []minio.ObjectInfo{ { Key: "obj1", LastModified: t1, Size: int64(1024), ContentType: "content", }, { Key: "obj2", LastModified: t1, Size: int64(512), ContentType: "content", }, } { objectStatCh <- bucket } }(objectStatCh) return objectStatCh }, objectLegalHoldFunc: func(_ context.Context, _, _ string, _ minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { s := minio.LegalHoldEnabled return &s, nil }, objectRetentionFunc: func(_ context.Context, _, _, _ string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { m := minio.Governance return &m, &tretention, nil }, objectGetTaggingFunc: func(_ context.Context, _, _ string, _ minio.GetObjectTaggingOptions) (*tags.Tags, error) { tagMap := map[string]string{ "tag1": "value1", } otags, err := tags.MapToObjectTags(tagMap) if err != nil { return nil, err } return otags, nil }, }, expectedResp: []*models.BucketObject{ { Name: "obj1", LastModified: t1.Format(time.RFC3339), Size: int64(1024), ContentType: "content", LegalHoldStatus: string(minio.LegalHoldEnabled), RetentionMode: string(minio.Governance), RetentionUntilDate: tretention.Format(time.RFC3339), Tags: map[string]string{ "tag1": "value1", }, }, { Name: "obj2", LastModified: t1.Format(time.RFC3339), Size: int64(512), ContentType: "content", LegalHoldStatus: string(minio.LegalHoldEnabled), RetentionMode: string(minio.Governance), RetentionUntilDate: tretention.Format(time.RFC3339), Tags: map[string]string{ "tag1": "value1", }, }, }, wantError: nil, }, { test: "Return zero objects", args: args{ bucketName: "bucket1", prefix: "prefix", recursive: true, withVersions: false, withMetadata: false, listFunc: func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo { objectStatCh := make(chan minio.ObjectInfo, 1) defer close(objectStatCh) return objectStatCh }, objectLegalHoldFunc: func(_ context.Context, _, _ string, _ minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { s := minio.LegalHoldEnabled return &s, nil }, objectRetentionFunc: func(_ context.Context, _, _, _ string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { m := minio.Governance return &m, &tretention, nil }, objectGetTaggingFunc: func(_ context.Context, _, _ string, _ minio.GetObjectTaggingOptions) (*tags.Tags, error) { tagMap := map[string]string{ "tag1": "value1", } otags, err := tags.MapToObjectTags(tagMap) if err != nil { return nil, err } return otags, nil }, }, expectedResp: nil, wantError: nil, }, { test: "Handle error if present on object", args: args{ bucketName: "bucket1", prefix: "prefix", recursive: true, withVersions: false, withMetadata: false, listFunc: func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo { objectStatCh := make(chan minio.ObjectInfo, 1) go func(objectStatCh chan<- minio.ObjectInfo) { defer close(objectStatCh) for _, bucket := range []minio.ObjectInfo{ { Key: "obj2", LastModified: t1, Size: int64(512), ContentType: "content", }, { Err: errors.New("error here"), }, } { objectStatCh <- bucket } }(objectStatCh) return objectStatCh }, objectLegalHoldFunc: func(_ context.Context, _, _ string, _ minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { s := minio.LegalHoldEnabled return &s, nil }, objectRetentionFunc: func(_ context.Context, _, _, _ string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { m := minio.Governance return &m, &tretention, nil }, objectGetTaggingFunc: func(_ context.Context, _, _ string, _ minio.GetObjectTaggingOptions) (*tags.Tags, error) { tagMap := map[string]string{ "tag1": "value1", } otags, err := tags.MapToObjectTags(tagMap) if err != nil { return nil, err } return otags, nil }, }, expectedResp: nil, wantError: errors.New("error here"), }, { // Description: deleted objects with IsDeleteMarker // should not call legsalhold, tag or retention funcs test: "Return deleted objects", args: args{ bucketName: "bucket1", prefix: "prefix", recursive: true, withVersions: false, withMetadata: false, listFunc: func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo { objectStatCh := make(chan minio.ObjectInfo, 1) go func(objectStatCh chan<- minio.ObjectInfo) { defer close(objectStatCh) for _, bucket := range []minio.ObjectInfo{ { Key: "obj1", LastModified: t1, Size: int64(1024), ContentType: "content", IsDeleteMarker: true, }, { Key: "obj2", LastModified: t1, Size: int64(512), ContentType: "content", }, } { objectStatCh <- bucket } }(objectStatCh) return objectStatCh }, objectLegalHoldFunc: func(_ context.Context, _, _ string, _ minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { s := minio.LegalHoldEnabled return &s, nil }, objectRetentionFunc: func(_ context.Context, _, _, _ string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { m := minio.Governance return &m, &tretention, nil }, objectGetTaggingFunc: func(_ context.Context, _, _ string, _ minio.GetObjectTaggingOptions) (*tags.Tags, error) { tagMap := map[string]string{ "tag1": "value1", } otags, err := tags.MapToObjectTags(tagMap) if err != nil { return nil, err } return otags, nil }, }, expectedResp: []*models.BucketObject{ { Name: "obj1", LastModified: t1.Format(time.RFC3339), Size: int64(1024), ContentType: "content", IsDeleteMarker: true, }, { Name: "obj2", LastModified: t1.Format(time.RFC3339), Size: int64(512), ContentType: "content", LegalHoldStatus: string(minio.LegalHoldEnabled), RetentionMode: string(minio.Governance), RetentionUntilDate: tretention.Format(time.RFC3339), Tags: map[string]string{ "tag1": "value1", }, }, }, wantError: nil, }, { // Description: deleted objects with // error on legalhold, tags or retention funcs // should only log errors test: "Return deleted objects, error on legalhold and retention", args: args{ bucketName: "bucket1", prefix: "prefix", recursive: true, withVersions: false, withMetadata: false, listFunc: func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo { objectStatCh := make(chan minio.ObjectInfo, 1) go func(objectStatCh chan<- minio.ObjectInfo) { defer close(objectStatCh) for _, bucket := range []minio.ObjectInfo{ { Key: "obj1", LastModified: t1, Size: int64(1024), ContentType: "content", }, } { objectStatCh <- bucket } }(objectStatCh) return objectStatCh }, objectLegalHoldFunc: func(_ context.Context, _, _ string, _ minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { return nil, errors.New("error legal") }, objectRetentionFunc: func(_ context.Context, _, _, _ string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { return nil, nil, errors.New("error retention") }, objectGetTaggingFunc: func(_ context.Context, _, _ string, _ minio.GetObjectTaggingOptions) (*tags.Tags, error) { return nil, errors.New("error get tags") }, }, expectedResp: []*models.BucketObject{ { Name: "obj1", LastModified: t1.Format(time.RFC3339), Size: int64(1024), ContentType: "content", }, }, wantError: nil, }, { // Description: if the prefix end with a `/` meaning it is a folder, // it should not fetch retention, legalhold nor tags for each object // it should only fetch it for single objects with or without versionID test: "Don't get object retention/legalhold/tags for folders", args: args{ bucketName: "bucket1", prefix: "prefix/folder/", recursive: true, withVersions: false, withMetadata: false, listFunc: func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo { objectStatCh := make(chan minio.ObjectInfo, 1) go func(objectStatCh chan<- minio.ObjectInfo) { defer close(objectStatCh) for _, bucket := range []minio.ObjectInfo{ { Key: "obj1", LastModified: t1, Size: int64(1024), ContentType: "content", }, { Key: "obj2", LastModified: t1, Size: int64(512), ContentType: "content", }, } { objectStatCh <- bucket } }(objectStatCh) return objectStatCh }, objectLegalHoldFunc: func(_ context.Context, _, _ string, _ minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { s := minio.LegalHoldEnabled return &s, nil }, objectRetentionFunc: func(_ context.Context, _, _, _ string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { m := minio.Governance return &m, &tretention, nil }, objectGetTaggingFunc: func(_ context.Context, _, _ string, _ minio.GetObjectTaggingOptions) (*tags.Tags, error) { tagMap := map[string]string{ "tag1": "value1", } otags, err := tags.MapToObjectTags(tagMap) if err != nil { return nil, err } return otags, nil }, }, expectedResp: []*models.BucketObject{ { Name: "obj1", LastModified: t1.Format(time.RFC3339), Size: int64(1024), ContentType: "content", }, { Name: "obj2", LastModified: t1.Format(time.RFC3339), Size: int64(512), ContentType: "content", }, }, wantError: nil, }, { // Description: if the prefix is "" meaning it is all contents within a bucket, // it should not fetch retention, legalhold nor tags for each object // it should only fetch it for single objects with or without versionID test: "Don't get object retention/legalhold/tags for empty prefix", args: args{ bucketName: "bucket1", prefix: "", recursive: true, withVersions: false, withMetadata: false, listFunc: func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo { objectStatCh := make(chan minio.ObjectInfo, 1) go func(objectStatCh chan<- minio.ObjectInfo) { defer close(objectStatCh) for _, bucket := range []minio.ObjectInfo{ { Key: "obj1", LastModified: t1, Size: int64(1024), ContentType: "content", }, { Key: "obj2", LastModified: t1, Size: int64(512), ContentType: "content", }, } { objectStatCh <- bucket } }(objectStatCh) return objectStatCh }, objectLegalHoldFunc: func(_ context.Context, _, _ string, _ minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { s := minio.LegalHoldEnabled return &s, nil }, objectRetentionFunc: func(_ context.Context, _, _, _ string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { m := minio.Governance return &m, &tretention, nil }, objectGetTaggingFunc: func(_ context.Context, _, _ string, _ minio.GetObjectTaggingOptions) (*tags.Tags, error) { tagMap := map[string]string{ "tag1": "value1", } otags, err := tags.MapToObjectTags(tagMap) if err != nil { return nil, err } return otags, nil }, }, expectedResp: []*models.BucketObject{ { Name: "obj1", LastModified: t1.Format(time.RFC3339), Size: int64(1024), ContentType: "content", }, { Name: "obj2", LastModified: t1.Format(time.RFC3339), Size: int64(512), ContentType: "content", }, }, wantError: nil, }, { test: "Return objects", args: args{ bucketName: "bucket1", prefix: "prefix", recursive: true, withVersions: false, withMetadata: false, listFunc: func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo { objectStatCh := make(chan minio.ObjectInfo, 1) go func(objectStatCh chan<- minio.ObjectInfo) { defer close(objectStatCh) for _, bucket := range []minio.ObjectInfo{ { Key: "obj1", LastModified: t1, Size: int64(1024), ContentType: "content", }, { Key: "obj2", LastModified: t1, Size: int64(512), ContentType: "content", }, } { objectStatCh <- bucket } }(objectStatCh) return objectStatCh }, objectLegalHoldFunc: func(_ context.Context, _, _ string, _ minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { s := minio.LegalHoldEnabled return &s, nil }, objectRetentionFunc: func(_ context.Context, _, _, _ string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { m := minio.Governance return &m, &tretention, nil }, objectGetTaggingFunc: func(_ context.Context, _, _ string, _ minio.GetObjectTaggingOptions) (*tags.Tags, error) { tagMap := map[string]string{ "tag1": "value1", } otags, err := tags.MapToObjectTags(tagMap) if err != nil { return nil, err } return otags, nil }, }, expectedResp: []*models.BucketObject{ { Name: "obj1", LastModified: t1.Format(time.RFC3339), Size: int64(1024), ContentType: "content", LegalHoldStatus: string(minio.LegalHoldEnabled), RetentionMode: string(minio.Governance), RetentionUntilDate: tretention.Format(time.RFC3339), Tags: map[string]string{ "tag1": "value1", }, }, { Name: "obj2", LastModified: t1.Format(time.RFC3339), Size: int64(512), ContentType: "content", LegalHoldStatus: string(minio.LegalHoldEnabled), RetentionMode: string(minio.Governance), RetentionUntilDate: tretention.Format(time.RFC3339), Tags: map[string]string{ "tag1": "value1", }, }, }, wantError: nil, }, { test: "Limit 1", args: args{ bucketName: "bucket1", prefix: "prefix", recursive: true, withVersions: false, withMetadata: false, limit: swag.Int32(1), listFunc: func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo { objectStatCh := make(chan minio.ObjectInfo, 1) go func(objectStatCh chan<- minio.ObjectInfo) { defer close(objectStatCh) for _, bucket := range []minio.ObjectInfo{ { Key: "obj1", LastModified: t1, Size: int64(1024), ContentType: "content", }, { Key: "obj2", LastModified: t1, Size: int64(512), ContentType: "content", }, } { objectStatCh <- bucket } }(objectStatCh) return objectStatCh }, objectLegalHoldFunc: func(_ context.Context, _, _ string, _ minio.GetObjectLegalHoldOptions) (status *minio.LegalHoldStatus, err error) { s := minio.LegalHoldEnabled return &s, nil }, objectRetentionFunc: func(_ context.Context, _, _, _ string) (mode *minio.RetentionMode, retainUntilDate *time.Time, err error) { m := minio.Governance return &m, &tretention, nil }, objectGetTaggingFunc: func(_ context.Context, _, _ string, _ minio.GetObjectTaggingOptions) (*tags.Tags, error) { tagMap := map[string]string{ "tag1": "value1", } otags, err := tags.MapToObjectTags(tagMap) if err != nil { return nil, err } return otags, nil }, }, expectedResp: []*models.BucketObject{ { Name: "obj1", LastModified: t1.Format(time.RFC3339), Size: int64(1024), ContentType: "content", LegalHoldStatus: string(minio.LegalHoldEnabled), RetentionMode: string(minio.Governance), RetentionUntilDate: tretention.Format(time.RFC3339), Tags: map[string]string{ "tag1": "value1", }, }, }, wantError: nil, }, } t.Parallel() for _, tt := range tests { tt := tt t.Run(tt.test, func(_ *testing.T) { minioListObjectsMock = tt.args.listFunc minioGetObjectLegalHoldMock = tt.args.objectLegalHoldFunc minioGetObjectRetentionMock = tt.args.objectRetentionFunc minioGetObjectTaggingMock = tt.args.objectGetTaggingFunc resp, err := listBucketObjects(ListObjectsOpts{ ctx: ctx, client: minClient, bucketName: tt.args.bucketName, prefix: tt.args.prefix, recursive: tt.args.recursive, withVersions: tt.args.withVersions, withMetadata: tt.args.withMetadata, limit: tt.args.limit, }) switch { case err == nil && tt.wantError != nil: t.Errorf("listBucketObjects() error: %v, wantErr: %v", err, tt.wantError) case err != nil && tt.wantError == nil: t.Errorf("listBucketObjects() error: %v, wantErr: %v", err, tt.wantError) case err != nil && tt.wantError != nil: if err.Error() != tt.wantError.Error() { t.Errorf("listBucketObjects() error: %v, wantErr: %v", err, tt.wantError) } } if err == nil { if !reflect.DeepEqual(resp, tt.expectedResp) { ji, _ := json.Marshal(resp) vi, _ := json.Marshal(tt.expectedResp) t.Errorf("\ngot: %s \nwant: %s", ji, vi) } } }) } } func Test_deleteObjects(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() s3Client1 := s3ClientMock{} type args struct { bucket string path string versionID string recursive bool nonCurrent bool listFunc func(ctx context.Context, opts mc.ListOptions) <-chan *mc.ClientContent removeFunc func(ctx context.Context, isIncomplete, isRemoveBucket, isBypass, forceDelete bool, contentCh <-chan *mc.ClientContent) <-chan mc.RemoveResult } tests := []struct { test string args args wantError error }{ { test: "Remove single object", args: args{ path: "obj.txt", versionID: "", recursive: false, nonCurrent: false, removeFunc: func(_ context.Context, _, _, _, _ bool, _ <-chan *mc.ClientContent) <-chan mc.RemoveResult { resultCh := make(chan mc.RemoveResult, 1) resultCh <- mc.RemoveResult{Err: nil} close(resultCh) return resultCh }, }, wantError: nil, }, { test: "Error on Remove single object", args: args{ path: "obj.txt", versionID: "", recursive: false, nonCurrent: false, removeFunc: func(_ context.Context, _, _, _, _ bool, _ <-chan *mc.ClientContent) <-chan mc.RemoveResult { resultCh := make(chan mc.RemoveResult, 1) resultCh <- mc.RemoveResult{Err: probe.NewError(errors.New("probe error"))} close(resultCh) return resultCh }, }, wantError: errors.New("probe error"), }, { test: "Remove multiple objects", args: args{ path: "path/", versionID: "", recursive: true, nonCurrent: false, removeFunc: func(_ context.Context, _, _, _, _ bool, _ <-chan *mc.ClientContent) <-chan mc.RemoveResult { resultCh := make(chan mc.RemoveResult, 1) resultCh <- mc.RemoveResult{Err: nil} close(resultCh) return resultCh }, listFunc: func(_ context.Context, _ mc.ListOptions) <-chan *mc.ClientContent { ch := make(chan *mc.ClientContent, 1) ch <- &mc.ClientContent{} close(ch) return ch }, }, wantError: nil, }, { // Description handle error when error happens on remove function // while deleting multiple objects test: "Error on Remove multiple objects", args: args{ path: "path/", versionID: "", recursive: true, nonCurrent: false, removeFunc: func(_ context.Context, _, _, _, _ bool, _ <-chan *mc.ClientContent) <-chan mc.RemoveResult { resultCh := make(chan mc.RemoveResult, 1) resultCh <- mc.RemoveResult{Err: probe.NewError(errors.New("probe error"))} close(resultCh) return resultCh }, listFunc: func(_ context.Context, _ mc.ListOptions) <-chan *mc.ClientContent { ch := make(chan *mc.ClientContent, 1) ch <- &mc.ClientContent{} close(ch) return ch }, }, wantError: errors.New("probe error"), }, { test: "Remove non current objects - no error", args: args{ path: "path/", versionID: "", recursive: true, nonCurrent: true, removeFunc: func(_ context.Context, _, _, _, _ bool, _ <-chan *mc.ClientContent) <-chan mc.RemoveResult { resultCh := make(chan mc.RemoveResult, 1) resultCh <- mc.RemoveResult{Err: nil} close(resultCh) return resultCh }, listFunc: func(_ context.Context, _ mc.ListOptions) <-chan *mc.ClientContent { ch := make(chan *mc.ClientContent, 1) ch <- &mc.ClientContent{} close(ch) return ch }, }, wantError: nil, }, { // Description handle error when error happens on remove function // while deleting multiple objects test: "Error deleting non current objects", args: args{ path: "path/", versionID: "", recursive: true, nonCurrent: true, removeFunc: func(_ context.Context, _, _, _, _ bool, _ <-chan *mc.ClientContent) <-chan mc.RemoveResult { resultCh := make(chan mc.RemoveResult, 1) resultCh <- mc.RemoveResult{Err: probe.NewError(errors.New("probe error"))} close(resultCh) return resultCh }, listFunc: func(_ context.Context, _ mc.ListOptions) <-chan *mc.ClientContent { ch := make(chan *mc.ClientContent, 1) ch <- &mc.ClientContent{} close(ch) return ch }, }, wantError: errors.New("probe error"), }, } t.Parallel() for _, tt := range tests { tt := tt t.Run(tt.test, func(_ *testing.T) { mcListMock = tt.args.listFunc mcRemoveMock = tt.args.removeFunc err := deleteObjects(ctx, s3Client1, tt.args.bucket, tt.args.path, tt.args.versionID, tt.args.recursive, false, tt.args.nonCurrent, false) switch { case err == nil && tt.wantError != nil: t.Errorf("deleteObjects() error: %v, wantErr: %v", err, tt.wantError) case err != nil && tt.wantError == nil: t.Errorf("deleteObjects() error: %v, wantErr: %v", err, tt.wantError) case err != nil && tt.wantError != nil: if err.Error() != tt.wantError.Error() { t.Errorf("deleteObjects() error: %v, wantErr: %v", err, tt.wantError) } } }) } } func Test_shareObject(t *testing.T) { tAssert := assert.New(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() client := s3ClientMock{} type args struct { r *http.Request versionID string expires string toogleURL bool shareFunc func(ctx context.Context, versionID string, expires time.Duration) (string, *probe.Error) } tests := []struct { test string args args setEnvVars func() wantError error expected string }{ { test: "return sharefunc url base64 encoded with host name", args: args{ r: &http.Request{ TLS: nil, Host: "localhost:9090", }, versionID: "2121434", expires: "30s", toogleURL: false, shareFunc: func(_ context.Context, _ string, _ time.Duration) (string, *probe.Error) { return "http://someurl", nil }, }, wantError: nil, expected: "http://localhost:9090/api/v1/download-shared-object/aHR0cDovL3NvbWV1cmw", }, { test: "return https scheme if url uses TLS", args: args{ r: &http.Request{ TLS: &tls.ConnectionState{}, Host: "localhost:9090", }, versionID: "2121434", expires: "30s", toogleURL: false, shareFunc: func(_ context.Context, _ string, _ time.Duration) (string, *probe.Error) { return "http://someurl", nil }, }, wantError: nil, expected: "https://localhost:9090/api/v1/download-shared-object/aHR0cDovL3NvbWV1cmw", }, { test: "returns invalid expire duration if expiration is invalid", args: args{ r: &http.Request{ TLS: nil, Host: "localhost:9090", }, versionID: "2121434", expires: "invalid", toogleURL: false, shareFunc: func(_ context.Context, _ string, _ time.Duration) (string, *probe.Error) { return "http://someurl", nil }, }, wantError: errors.New("time: invalid duration \"invalid\""), }, { test: "add default expiration if expiration is empty", args: args{ r: &http.Request{ TLS: nil, Host: "localhost:9090", }, versionID: "2121434", expires: "", toogleURL: false, shareFunc: func(_ context.Context, _ string, _ time.Duration) (string, *probe.Error) { return "http://someurl", nil }, }, wantError: nil, expected: "http://localhost:9090/api/v1/download-shared-object/aHR0cDovL3NvbWV1cmw", }, { test: "return error if sharefunc returns error", args: args{ r: &http.Request{ TLS: nil, Host: "localhost:9090", }, versionID: "2121434", expires: "3h", toogleURL: false, shareFunc: func(_ context.Context, _ string, _ time.Duration) (string, *probe.Error) { return "", probe.NewError(errors.New("probe error")) }, }, wantError: errors.New("probe error"), }, { test: "return shareFunc url base64 encoded url-safe", args: args{ r: &http.Request{ TLS: nil, Host: "localhost:9090", }, versionID: "2121434", expires: "3h", toogleURL: false, shareFunc: func(_ context.Context, _ string, _ time.Duration) (string, *probe.Error) { // https://127.0.0.1:9000/cestest/Audio%20icon.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256 using StdEncoding adds an extra `/` making it not url safe return "https://127.0.0.1:9000/cestest/Audio%20icon.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256", nil }, }, wantError: nil, expected: "http://localhost:9090/api/v1/download-shared-object/aHR0cHM6Ly8xMjcuMC4wLjE6OTAwMC9jZXN0ZXN0L0F1ZGlvJTIwaWNvbi5zdmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTY", }, { test: "returns redirect url with share link if redirect url env variable set", setEnvVars: func() { t.Setenv(ConsoleBrowserRedirectURL, "http://proxy-url.com:9012/console/subpath") }, args: args{ r: &http.Request{ TLS: nil, Host: "localhost:9090", }, versionID: "2121434", expires: "30s", toogleURL: false, shareFunc: func(_ context.Context, _ string, _ time.Duration) (string, *probe.Error) { return "http://someurl", nil }, }, wantError: nil, expected: "http://proxy-url.com:9012/console/subpath/api/v1/download-shared-object/aHR0cDovL3NvbWV1cmw", }, { test: "returns redirect url with share link if redirect url env variable set with trailing slash", setEnvVars: func() { t.Setenv(ConsoleBrowserRedirectURL, "http://proxy-url.com:9012/console/subpath/") }, args: args{ r: &http.Request{ TLS: nil, Host: "localhost:9090", }, versionID: "2121434", expires: "30s", toogleURL: false, shareFunc: func(_ context.Context, _ string, _ time.Duration) (string, *probe.Error) { return "http://someurl", nil }, }, wantError: nil, expected: "http://proxy-url.com:9012/console/subpath/api/v1/download-shared-object/aHR0cDovL3NvbWV1cmw", }, { test: "returns minio server url directly with share link if CONSOLE_SHARE_MINIO_URL env variable is on", setEnvVars: func() { t.Setenv(ConsoleShareMinIOURL, "on") }, args: args{ r: &http.Request{ TLS: nil, Host: "localhost:9090", }, versionID: "2121434", expires: "30s", toogleURL: false, shareFunc: func(_ context.Context, _ string, _ time.Duration) (string, *probe.Error) { return "http://someurl", nil }, }, wantError: nil, expected: "http://someurl", }, } for _, tt := range tests { t.Run(tt.test, func(_ *testing.T) { mcShareDownloadMock = tt.args.shareFunc if tt.setEnvVars != nil { tt.setEnvVars() } url, err := getShareObjectURL(ctx, client, tt.args.r, tt.args.versionID, tt.args.expires, tt.args.toogleURL) if tt.wantError != nil { if (err == nil) != (tt.wantError == nil) || (err != nil && tt.wantError != nil && err.Error() != tt.wantError.Error()) { t.Errorf("getShareObjectURL() error: `%s`, wantErr: `%s`", err, tt.wantError) return } } else { tAssert.Equal(tt.expected, *url) } }) } } func Test_putObjectLegalHold(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() client := minioClientMock{} type args struct { bucket string prefix string versionID string status models.ObjectLegalHoldStatus legalHoldFunc func(ctx context.Context, bucketName, objectName string, opts minio.PutObjectLegalHoldOptions) error } tests := []struct { test string args args wantError error }{ { test: "Put Object Legal hold enabled status", args: args{ bucket: "buck1", versionID: "someversion", prefix: "folder/file.txt", status: models.ObjectLegalHoldStatusEnabled, legalHoldFunc: func(_ context.Context, _, _ string, _ minio.PutObjectLegalHoldOptions) error { return nil }, }, wantError: nil, }, { test: "Put Object Legal hold disabled status", args: args{ bucket: "buck1", versionID: "someversion", prefix: "folder/file.txt", status: models.ObjectLegalHoldStatusDisabled, legalHoldFunc: func(_ context.Context, _, _ string, _ minio.PutObjectLegalHoldOptions) error { return nil }, }, wantError: nil, }, { test: "Handle error on legalhold func", args: args{ bucket: "buck1", versionID: "someversion", prefix: "folder/file.txt", status: models.ObjectLegalHoldStatusDisabled, legalHoldFunc: func(_ context.Context, _, _ string, _ minio.PutObjectLegalHoldOptions) error { return errors.New("new error") }, }, wantError: errors.New("new error"), }, } for _, tt := range tests { t.Run(tt.test, func(_ *testing.T) { minioPutObjectLegalHoldMock = tt.args.legalHoldFunc err := setObjectLegalHold(ctx, client, tt.args.bucket, tt.args.prefix, tt.args.versionID, tt.args.status) if (err == nil) != (tt.wantError == nil) || (err != nil && tt.wantError != nil && err.Error() != tt.wantError.Error()) { t.Errorf("setObjectLegalHold() error: %v, wantErr: %v", err, tt.wantError) return } }) } } func Test_putObjectRetention(t *testing.T) { tAssert := assert.New(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() client := minioClientMock{} type args struct { bucket string prefix string versionID string opts *models.PutObjectRetentionRequest retentionFunc func(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error } tests := []struct { test string args args wantError error }{ { test: "Put Object retention governance", args: args{ bucket: "buck1", versionID: "someversion", prefix: "folder/file.txt", opts: &models.PutObjectRetentionRequest{ Expires: swag.String("2006-01-02T15:04:05Z"), GovernanceBypass: false, Mode: models.NewObjectRetentionMode(models.ObjectRetentionModeGovernance), }, retentionFunc: func(_ context.Context, _, _ string, _ minio.PutObjectRetentionOptions) error { return nil }, }, wantError: nil, }, { test: "Put Object retention compliance", args: args{ bucket: "buck1", versionID: "someversion", prefix: "folder/file.txt", opts: &models.PutObjectRetentionRequest{ Expires: swag.String("2006-01-02T15:04:05Z"), GovernanceBypass: false, Mode: models.NewObjectRetentionMode(models.ObjectRetentionModeCompliance), }, retentionFunc: func(_ context.Context, _, _ string, _ minio.PutObjectRetentionOptions) error { return nil }, }, wantError: nil, }, { test: "Empty opts should return error", args: args{ bucket: "buck1", versionID: "someversion", prefix: "folder/file.txt", opts: nil, retentionFunc: func(_ context.Context, _, _ string, _ minio.PutObjectRetentionOptions) error { return nil }, }, wantError: errors.New("object retention options can't be nil"), }, { test: "Empty expire on opts should return error", args: args{ bucket: "buck1", versionID: "someversion", prefix: "folder/file.txt", opts: &models.PutObjectRetentionRequest{ Expires: nil, GovernanceBypass: false, Mode: models.NewObjectRetentionMode(models.ObjectRetentionModeCompliance), }, retentionFunc: func(_ context.Context, _, _ string, _ minio.PutObjectRetentionOptions) error { return nil }, }, wantError: errors.New("object retention expires can't be nil"), }, { test: "Handle invalid expire time", args: args{ bucket: "buck1", versionID: "someversion", prefix: "folder/file.txt", opts: &models.PutObjectRetentionRequest{ Expires: swag.String("invalidtime"), GovernanceBypass: false, Mode: models.NewObjectRetentionMode(models.ObjectRetentionModeCompliance), }, retentionFunc: func(_ context.Context, _, _ string, _ minio.PutObjectRetentionOptions) error { return nil }, }, wantError: errors.New("parsing time \"invalidtime\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"invalidtime\" as \"2006\""), }, { test: "Handle error on retention func", args: args{ bucket: "buck1", versionID: "someversion", prefix: "folder/file.txt", opts: &models.PutObjectRetentionRequest{ Expires: swag.String("2006-01-02T15:04:05Z"), GovernanceBypass: false, Mode: models.NewObjectRetentionMode(models.ObjectRetentionModeCompliance), }, retentionFunc: func(_ context.Context, _, _ string, _ minio.PutObjectRetentionOptions) error { return errors.New("new Error") }, }, wantError: errors.New("new Error"), }, } for _, tt := range tests { t.Run(tt.test, func(_ *testing.T) { minioPutObjectRetentionMock = tt.args.retentionFunc err := setObjectRetention(ctx, client, tt.args.bucket, tt.args.prefix, tt.args.versionID, tt.args.opts) if tt.wantError != nil { fmt.Println(t.Name()) tAssert.Equal(tt.wantError.Error(), err.Error(), fmt.Sprintf("setObjectRetention() error: `%s`, wantErr: `%s`", err, tt.wantError)) } else { tAssert.Nil(err, fmt.Sprintf("setObjectRetention() error: %v, wantErr: %v", err, tt.wantError)) } }) } } func Test_deleteObjectRetention(t *testing.T) { tAssert := assert.New(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() client := minioClientMock{} type args struct { bucket string prefix string versionID string retentionFunc func(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error } tests := []struct { test string args args wantError error }{ { test: "Delete Object retention governance", args: args{ bucket: "buck1", versionID: "someversion", prefix: "folder/file.txt", retentionFunc: func(_ context.Context, _, _ string, _ minio.PutObjectRetentionOptions) error { return nil }, }, wantError: nil, }, } for _, tt := range tests { t.Run(tt.test, func(_ *testing.T) { minioPutObjectRetentionMock = tt.args.retentionFunc err := deleteObjectRetention(ctx, client, tt.args.bucket, tt.args.prefix, tt.args.versionID) if tt.wantError != nil { fmt.Println(t.Name()) tAssert.Equal(tt.wantError.Error(), err.Error(), fmt.Sprintf("deleteObjectRetention() error: `%s`, wantErr: `%s`", err, tt.wantError)) } else { tAssert.Nil(err, fmt.Sprintf("deleteObjectRetention() error: %v, wantErr: %v", err, tt.wantError)) } }) } } func Test_getObjectInfo(t *testing.T) { tAssert := assert.New(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() client := minioClientMock{} type args struct { bucketName string prefix string versionID string statFunc func(ctx context.Context, bucketName string, prefix string, opts minio.GetObjectOptions) (objectInfo minio.ObjectInfo, err error) } tests := []struct { test string args args wantError error }{ { test: "Test function not returns an error", args: args{ bucketName: "bucket1", prefix: "someprefix", versionID: "version123", statFunc: func(_ context.Context, _ string, _ string, _ minio.GetObjectOptions) (minio.ObjectInfo, error) { return minio.ObjectInfo{}, nil }, }, wantError: nil, }, { test: "Test function returns an error", args: args{ bucketName: "bucket2", prefix: "someprefi2", versionID: "version456", statFunc: func(_ context.Context, _ string, _ string, _ minio.GetObjectOptions) (minio.ObjectInfo, error) { return minio.ObjectInfo{}, errors.New("new Error") }, }, wantError: errors.New("new Error"), }, } for _, tt := range tests { t.Run(tt.test, func(_ *testing.T) { minioStatObjectMock = tt.args.statFunc _, err := getObjectInfo(ctx, client, tt.args.bucketName, tt.args.prefix, tt.args.versionID) if tt.wantError != nil { fmt.Println(t.Name()) tAssert.Equal(tt.wantError.Error(), err.Error(), fmt.Sprintf("getObjectInfo() error: `%s`, wantErr: `%s`", err, tt.wantError)) } else { tAssert.Nil(err, fmt.Sprintf("getObjectInfo() error: %v, wantErr: %v", err, tt.wantError)) } }) } } func Test_getScheme(t *testing.T) { type args struct { rawurl string } tests := []struct { name string args args wantScheme string wantPath string }{ { name: "expected", args: args{ rawurl: "http://domain.com", }, wantScheme: "http", wantPath: "//domain.com", }, { name: "no scheme", args: args{ rawurl: "domain.com", }, wantScheme: "", wantPath: "domain.com", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { gotScheme, gotPath := getScheme(tt.args.rawurl) assert.Equalf(t, tt.wantScheme, gotScheme, "getScheme(%v)", tt.args.rawurl) assert.Equalf(t, tt.wantPath, gotPath, "getScheme(%v)", tt.args.rawurl) }) } } func Test_splitSpecial(t *testing.T) { type args struct { s string delimiter string cutdelimiter bool } tests := []struct { name string args args want string want1 string }{ { name: "Expected", args: args{ s: "[s , s]", delimiter: ",", cutdelimiter: false, }, want: "[s ", want1: ", s]", }, { name: "no delimited", args: args{ s: "[s s]", delimiter: "", cutdelimiter: false, }, want: "", want1: "[s s]", }, { name: "Expected not delim", args: args{ s: "[s , s]", delimiter: ",", cutdelimiter: true, }, want: "[s ", want1: " s]", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { got, got1 := splitSpecial(tt.args.s, tt.args.delimiter, tt.args.cutdelimiter) assert.Equalf(t, tt.want, got, "splitSpecial(%v, %v, %v)", tt.args.s, tt.args.delimiter, tt.args.cutdelimiter) assert.Equalf(t, tt.want1, got1, "splitSpecial(%v, %v, %v)", tt.args.s, tt.args.delimiter, tt.args.cutdelimiter) }) } } func Test_getHost(t *testing.T) { type args struct { authority string } tests := []struct { name string args args wantHost string }{ { name: "Expected", args: args{ authority: "username@domain.com", }, wantHost: "", }, { name: "Expected 2", args: args{ authority: "domain.com", }, wantHost: "domain.com", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { assert.Equalf(t, tt.wantHost, getHost(tt.args.authority), "getHost(%v)", tt.args.authority) }) } } func Test_newClientURL(t *testing.T) { type args struct { urlStr string } tests := []struct { name string args args want mc.ClientURL }{ { name: "Expected", args: args{ urlStr: "http://domain.com", }, want: mc.ClientURL{ Type: 0, Scheme: "http", Host: "domain.com", Path: "/", SchemeSeparator: "://", Separator: 47, }, }, { name: "Expected file", args: args{ urlStr: "file.jpeg", }, want: mc.ClientURL{ Type: fileSystem, Path: "file.jpeg", Separator: filepath.Separator, }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { assert.Equalf(t, tt.want, *newClientURL(tt.args.urlStr), "newClientURL(%v)", tt.args.urlStr) }) } } func Test_getMultipleFilesDownloadResponse(t *testing.T) { type args struct { session *models.Principal params object.DownloadMultipleObjectsParams } tests := []struct { name string args args want middleware.Responder want1 *CodedAPIError }{ { name: "test no objects sent for download", args: args{ session: nil, params: object.DownloadMultipleObjectsParams{ HTTPRequest: &http.Request{}, BucketName: "test-bucket", ObjectList: nil, }, }, want: nil, want1: nil, }, { name: "few objects sent for download", args: args{ session: nil, params: object.DownloadMultipleObjectsParams{ HTTPRequest: &http.Request{}, BucketName: "test-bucket", ObjectList: []string{"test.txt", ",y-obj.doc", "z-obj.png"}, }, }, want: nil, want1: nil, }, { name: "few prefixes and a file sent for download", args: args{ session: nil, params: object.DownloadMultipleObjectsParams{ HTTPRequest: &http.Request{}, BucketName: "test-bucket", ObjectList: []string{"my-folder/", "my-folder/test-nested", "z-obj.png"}, }, }, want: nil, want1: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { got, got1 := getMultipleFilesDownloadResponse(tt.args.session, tt.args.params) assert.Equal(t, tt.want1, got1) assert.NotNil(t, got) }) } } ================================================ FILE: api/user_session.go ================================================ // 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 api import ( "bytes" "context" "encoding/json" "strconv" "time" policies "github.com/minio/console/api/policy" "github.com/minio/madmin-go/v3" jwtgo "github.com/golang-jwt/jwt/v4" "github.com/minio/pkg/v3/policy/condition" minioIAMPolicy "github.com/minio/pkg/v3/policy" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" authApi "github.com/minio/console/api/operations/auth" "github.com/minio/console/models" "github.com/minio/console/pkg/auth/idp/oauth2" "github.com/minio/console/pkg/auth/ldap" ) type Conditions struct { S3Prefix []string `json:"s3:prefix"` } func registerSessionHandlers(api *operations.ConsoleAPI) { // session check api.AuthSessionCheckHandler = authApi.SessionCheckHandlerFunc(func(params authApi.SessionCheckParams, session *models.Principal) middleware.Responder { sessionResp, err := getSessionResponse(params.HTTPRequest.Context(), session) if err != nil { return authApi.NewSessionCheckDefault(err.Code).WithPayload(err.APIError) } return authApi.NewSessionCheckOK().WithPayload(sessionResp) }) } func getClaimsFromToken(sessionToken string) (map[string]interface{}, error) { jp := jwtgo.NewParser() var claims jwtgo.MapClaims _, _, err := jp.ParseUnverified(sessionToken, &claims) if err != nil { return nil, err } return claims, nil } // getSessionResponse parse the token of the current session and returns a list of allowed actions to render in the UI func getSessionResponse(ctx context.Context, session *models.Principal) (*models.SessionResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(ctx) defer cancel() // serialize output if session == nil { return nil, ErrorWithContext(ctx, ErrInvalidSession) } tokenClaims, _ := getClaimsFromToken(session.STSSessionToken) // initialize admin client mAdminClient, err := NewMinioAdminClient(ctx, &models.Principal{ STSAccessKeyID: session.STSAccessKeyID, STSSecretAccessKey: session.STSSecretAccessKey, STSSessionToken: session.STSSessionToken, }) if err != nil { return nil, ErrorWithContext(ctx, err, ErrInvalidSession) } userAdminClient := AdminClient{Client: mAdminClient} // Obtain the current policy assigned to this user // necessary for generating the list of allowed endpoints accountInfo, err := getAccountInfo(ctx, userAdminClient) if err != nil { return nil, ErrorWithContext(ctx, err, ErrInvalidSession) } erasure := accountInfo.Server.Type == madmin.Erasure rawPolicy := policies.ReplacePolicyVariables(tokenClaims, accountInfo) policy, err := minioIAMPolicy.ParseConfig(bytes.NewReader(rawPolicy)) if err != nil { return nil, ErrorWithContext(ctx, err, ErrInvalidSession) } currTime := time.Now().UTC() customStyles := session.CustomStyleOb // This actions will be global, meaning has to be attached to all resources conditionValues := map[string][]string{ condition.AWSUsername.Name(): {session.AccountAccessKey}, // All calls to MinIO from console use temporary credentials. condition.AWSPrincipalType.Name(): {"AssumeRole"}, condition.AWSSecureTransport.Name(): {strconv.FormatBool(getMinIOEndpointIsSecure())}, condition.AWSCurrentTime.Name(): {currTime.Format(time.RFC3339)}, condition.AWSEpochTime.Name(): {strconv.FormatInt(currTime.Unix(), 10)}, // All calls from console are signature v4. condition.S3SignatureVersion.Name(): {"AWS4-HMAC-SHA256"}, // All calls from console use header-based authentication condition.S3AuthType.Name(): {"REST-HEADER"}, // This is usually empty, may be set some times (rare). condition.S3LocationConstraint.Name(): {GetMinIORegion()}, } claims, err := getClaimsFromToken(session.STSSessionToken) if err != nil { return nil, ErrorWithContext(ctx, err, ErrInvalidSession) } // Support all LDAP, JWT variables for k, v := range claims { vstr, ok := v.(string) if !ok { // skip all non-strings continue } // store all claims from sessionToken conditionValues[k] = []string{vstr} } defaultActions := policy.IsAllowedActions("", "", conditionValues) // Allow Create Access Key when admin:CreateServiceAccount is provided with a condition for _, statement := range policy.Statements { if statement.Effect == "Deny" && len(statement.Conditions) > 0 && statement.Actions.Contains(minioIAMPolicy.CreateServiceAccountAdminAction) { defaultActions.Add(minioIAMPolicy.Action(minioIAMPolicy.CreateServiceAccountAdminAction)) } } permissions := map[string]minioIAMPolicy.ActionSet{ ConsoleResourceName: defaultActions, } deniedActions := map[string]minioIAMPolicy.ActionSet{} var allowResources []*models.PermissionResource for _, statement := range policy.Statements { for _, resource := range statement.Resources.ToSlice() { resourceName := resource.String() statementActions := statement.Actions.ToSlice() var prefixes []string if statement.Effect == "Allow" { // check if val are denied before adding them to the map var allowedActions []minioIAMPolicy.Action if dActions, ok := deniedActions[resourceName]; ok { for _, action := range statementActions { if len(dActions.Intersection(minioIAMPolicy.NewActionSet(action))) == 0 { // It's ok to allow this action allowedActions = append(allowedActions, action) } } } else { allowedActions = statementActions } // Add validated actions if resourceActions, ok := permissions[resourceName]; ok { mergedActions := append(resourceActions.ToSlice(), allowedActions...) permissions[resourceName] = minioIAMPolicy.NewActionSet(mergedActions...) } else { mergedActions := append(defaultActions.ToSlice(), allowedActions...) permissions[resourceName] = minioIAMPolicy.NewActionSet(mergedActions...) } // Allow Permissions request conditions, err := statement.Conditions.MarshalJSON() if err != nil { return nil, ErrorWithContext(ctx, err) } var wrapper map[string]Conditions if err := json.Unmarshal(conditions, &wrapper); err != nil { return nil, ErrorWithContext(ctx, err) } for condition, elements := range wrapper { prefixes = elements.S3Prefix resourceElement := models.PermissionResource{ Resource: resourceName, Prefixes: prefixes, ConditionOperator: condition, } allowResources = append(allowResources, &resourceElement) } } else { // Add new banned actions to the map if resourceActions, ok := deniedActions[resourceName]; ok { mergedActions := append(resourceActions.ToSlice(), statementActions...) deniedActions[resourceName] = minioIAMPolicy.NewActionSet(mergedActions...) } else { deniedActions[resourceName] = statement.Actions } // Remove existing val from key if necessary if currentResourceActions, ok := permissions[resourceName]; ok { var newAllowedActions []minioIAMPolicy.Action for _, action := range currentResourceActions.ToSlice() { if len(deniedActions[resourceName].Intersection(minioIAMPolicy.NewActionSet(action))) == 0 { // It's ok to allow this action newAllowedActions = append(newAllowedActions, action) } } permissions[resourceName] = minioIAMPolicy.NewActionSet(newAllowedActions...) } } } } resourcePermissions := map[string][]string{} for key, val := range permissions { var resourceActions []string for _, action := range val.ToSlice() { resourceActions = append(resourceActions, string(action)) } resourcePermissions[key] = resourceActions } // environment constants var envConstants models.EnvironmentConstants envConstants.MaxConcurrentUploads = getMaxConcurrentUploadsLimit() envConstants.MaxConcurrentDownloads = getMaxConcurrentDownloadsLimit() sessionResp := &models.SessionResponse{ Features: getListOfEnabledFeatures(ctx, userAdminClient, session), Status: models.SessionResponseStatusOk, Operator: false, DistributedMode: erasure, Permissions: resourcePermissions, AllowResources: allowResources, CustomStyles: customStyles, EnvConstants: &envConstants, ServerEndPoint: getMinIOServer(), } return sessionResp, nil } // getListOfEnabledFeatures returns a list of features func getListOfEnabledFeatures(ctx context.Context, minioClient MinioAdmin, session *models.Principal) []string { features := []string{} logSearchURL := getLogSearchURL() oidcEnabled := oauth2.IsIDPEnabled() ldapEnabled := ldap.GetLDAPEnabled() if logSearchURL != "" { features = append(features, "log-search") } if oidcEnabled { features = append(features, "oidc-idp", "external-idp") } if ldapEnabled { features = append(features, "ldap-idp", "external-idp") } if session.Hm { features = append(features, "hide-menu") } if session.Ob { features = append(features, "object-browser-only") } if minioClient != nil { _, err := minioClient.kmsStatus(ctx) if err == nil { features = append(features, "kms") } } return features } ================================================ FILE: api/user_session_test.go ================================================ // 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 api import ( "context" "os" "reflect" "testing" "github.com/minio/console/pkg/utils" "github.com/minio/console/models" "github.com/minio/console/pkg/auth/idp/oauth2" "github.com/minio/console/pkg/auth/ldap" "github.com/stretchr/testify/assert" ) func Test_getSessionResponse(t *testing.T) { type args struct { ctx context.Context session *models.Principal } ctx := context.WithValue(context.Background(), utils.ContextClientIP, "127.0.0.1") tests := []struct { name string args args want *models.SessionResponse wantErr bool preFunc func() postFunc func() }{ { name: "empty session", args: args{ ctx: ctx, session: nil, }, want: nil, wantErr: true, }, { name: "malformed session", args: args{ ctx: ctx, session: &models.Principal{ STSAccessKeyID: "W257A03HTI7L30F7YCRD", STSSecretAccessKey: "g+QVorWQR8aSy+k3OHOoYn0qKpENld72faCMfYps", STSSessionToken: "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiJXMjU3QTAzSFRJN0wzMEY3WUNSRCIsImV4cCI6MTY1MTAxNjU1OCwicGFyZW50IjoibWluaW8ifQ.uFFIIEQ6qM_QvMM297ODi_uK2IA1pwvsDbyBGErkQKqtbY_Ynte8GUkNsSHBEMCT9Fr7uUwaxK41kUqjtbqAwA", AccountAccessKey: "minio", Hm: false, }, }, want: nil, wantErr: true, }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(_ *testing.T) { if tt.preFunc != nil { tt.preFunc() } session, err := getSessionResponse(tt.args.ctx, tt.args.session) if (err != nil) != tt.wantErr { t.Errorf("getSessionResponse() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(session, tt.want) { t.Errorf("getSessionResponse() got = %v, want %v", session, tt.want) } if tt.postFunc != nil { tt.postFunc() } }) } } func Test_getListOfEnabledFeatures(t *testing.T) { type args struct { session *models.Principal } tests := []struct { name string args args want []string preFunc func() postFunc func() }{ { name: "all features are enabled", args: args{ session: &models.Principal{ STSAccessKeyID: "", STSSecretAccessKey: "", STSSessionToken: "", AccountAccessKey: "", Hm: true, }, }, want: []string{"log-search", "oidc-idp", "external-idp", "ldap-idp", "external-idp", "hide-menu"}, preFunc: func() { os.Setenv(ConsoleLogQueryURL, "http://logsearchapi:8080") os.Setenv(oauth2.ConsoleIDPURL, "http://external-idp.com") os.Setenv(oauth2.ConsoleIDPClientID, "eaeaeaeaeaea") os.Setenv(ldap.ConsoleLDAPEnabled, "on") }, postFunc: func() { os.Unsetenv(ConsoleLogQueryURL) os.Unsetenv(oauth2.ConsoleIDPURL) os.Unsetenv(oauth2.ConsoleIDPClientID) os.Unsetenv(ldap.ConsoleLDAPEnabled) }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if tt.preFunc != nil { tt.preFunc() } assert.Equalf(t, tt.want, getListOfEnabledFeatures(context.Background(), nil, tt.args.session), "getListOfEnabledFeatures(%v)", tt.args.session) if tt.postFunc != nil { tt.postFunc() } }) } } ================================================ FILE: api/user_watch.go ================================================ // 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 api import ( "context" "encoding/json" "fmt" "net/http" "regexp" "strings" mc "github.com/minio/mc/cmd" "github.com/minio/websocket" ) type watchOptions struct { BucketName string mc.WatchOptions } func startWatch(ctx context.Context, conn WSConn, wsc MCClient, options *watchOptions) error { wo, pErr := wsc.watch(ctx, options.WatchOptions) if pErr != nil { LogError("error initializing watch: %v", pErr.Cause) return pErr.Cause } for { select { case <-ctx.Done(): close(wo.DoneChan) return nil case events, ok := <-wo.Events(): // zero value returned because the channel is closed and empty if !ok { return nil } for _, event := range events { // Serialize message to be sent bytes, err := json.Marshal(event) if err != nil { LogError("error on json.Marshal: %v", err) return err } // Send Message through websocket connection err = conn.writeMessage(websocket.TextMessage, bytes) if err != nil { LogError("error writeMessage: %v", err) return err } } case pErr, ok := <-wo.Errors(): // zero value returned because the channel is closed and empty if !ok { return nil } if pErr != nil { LogError("error on watch: %v", pErr.Cause) return pErr.Cause } } } } // getWatchOptionsFromReq gets bucket name, events, prefix, suffix from a websocket // watch path if defined. // path come as : `/watch/bucket1` and query // params come on request form func getWatchOptionsFromReq(req *http.Request) (*watchOptions, error) { wOptions := watchOptions{} // Default Events if not defined wOptions.Events = []string{"put", "get", "delete"} re := regexp.MustCompile(`(/watch/)(.*?$)`) matches := re.FindAllSubmatch([]byte(req.URL.Path), -1) // matches comes as e.g. // [["...", "/watch/", "bucket1"]] // [["/watch/" "/watch/" ""]] if len(matches) == 0 || len(matches[0]) < 3 { return nil, fmt.Errorf("invalid url: %s", req.URL.Path) } wOptions.BucketName = strings.TrimSpace(string(matches[0][2])) events := req.FormValue("events") if strings.TrimSpace(events) != "" { wOptions.Events = strings.Split(events, ",") } wOptions.Prefix = req.FormValue("prefix") wOptions.Suffix = req.FormValue("suffix") return &wOptions, nil } ================================================ FILE: api/user_watch_test.go ================================================ // 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 api import ( "context" "encoding/json" "fmt" "net/http" "net/url" "testing" "time" mc "github.com/minio/mc/cmd" "github.com/minio/mc/pkg/probe" "github.com/stretchr/testify/assert" ) // assigning mock at runtime instead of compile time var mcWatchMock func(ctx context.Context, options mc.WatchOptions) (*mc.WatchObject, *probe.Error) // implements mc.S3Client.Watch() func (c s3ClientMock) watch(ctx context.Context, options mc.WatchOptions) (*mc.WatchObject, *probe.Error) { if options.Prefix == "file/" { return mcWatchMock(ctx, options) } wo := &mc.WatchObject{ EventInfoChan: make(chan []mc.EventInfo), ErrorChan: make(chan *probe.Error), DoneChan: make(chan struct{}), } return wo, nil } func TestWatchOnContextDone(t *testing.T) { assert := assert.New(t) client := s3ClientMock{} mockWSConn := mockConn{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() testOptions := &watchOptions{} testOptions.BucketName = "bucktest" testOptions.Prefix = "file2/" testOptions.Suffix = ".png" // Test-0: Test closing a done channel ctxWithTimeout, cancelFunction := context.WithTimeout(ctx, time.Duration(1)*time.Millisecond) defer cancelFunction() assert.Equal(startWatch(ctxWithTimeout, mockWSConn, client, testOptions), nil) } func TestWatch(t *testing.T) { assert := assert.New(t) client := s3ClientMock{} mockWSConn := mockConn{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() function := "startWatch()" testStreamSize := 5 testReceiver := make(chan []mc.EventInfo, testStreamSize) isClosed := false // testReceiver is closed? textToReceive := "test message" testOptions := &watchOptions{} testOptions.BucketName = "bucktest" testOptions.Prefix = "file/" testOptions.Suffix = ".png" // Test-1: Serve Watch with no errors until Watch finishes sending // define mock function behavior mcWatchMock = func(_ context.Context, _ mc.WatchOptions) (*mc.WatchObject, *probe.Error) { wo := &mc.WatchObject{ EventInfoChan: make(chan []mc.EventInfo), ErrorChan: make(chan *probe.Error), DoneChan: make(chan struct{}), } // Only success, start a routine to start reading line by line. go func(wo *mc.WatchObject) { defer func() { close(wo.EventInfoChan) close(wo.ErrorChan) }() lines := make([]int, testStreamSize) // mocking sending 5 lines of info for range lines { info := []mc.EventInfo{ { UserAgent: textToReceive, }, } wo.Events() <- info } }(wo) return wo, nil } writesCount := 1 // mock connection WriteMessage() no error connWriteMessageMock = func(_ int, data []byte) error { // emulate that receiver gets the message written var t []mc.EventInfo _ = json.Unmarshal(data, &t) if writesCount == testStreamSize { // for testing we need to close the receiver channel if !isClosed { close(testReceiver) isClosed = true } return nil } testReceiver <- t writesCount++ return nil } if err := startWatch(ctx, mockWSConn, client, testOptions); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // check that the TestReceiver got the same number of data from Console. for i := range testReceiver { for _, val := range i { assert.Equal(textToReceive, val.UserAgent) } } // Test-2: if error happens while writing, return error connWriteMessageMock = func(_ int, _ []byte) error { return fmt.Errorf("error on write") } if err := startWatch(ctx, mockWSConn, client, testOptions); assert.Error(err) { assert.Equal("error on write", err.Error()) } // Test-3: error happens on Watch, watch should stop // and error shall be returned. mcWatchMock = func(_ context.Context, _ mc.WatchOptions) (*mc.WatchObject, *probe.Error) { wo := &mc.WatchObject{ EventInfoChan: make(chan []mc.EventInfo), ErrorChan: make(chan *probe.Error), DoneChan: make(chan struct{}), } // Only success, start a routine to start reading line by line. go func(wo *mc.WatchObject) { defer func() { close(wo.EventInfoChan) close(wo.ErrorChan) }() lines := make([]int, testStreamSize) // mocking sending 5 lines of info for range lines { info := []mc.EventInfo{ { UserAgent: textToReceive, }, } wo.Events() <- info } wo.Errors() <- &probe.Error{Cause: fmt.Errorf("error on watch")} }(wo) return wo, nil } connWriteMessageMock = func(_ int, _ []byte) error { return nil } if err := startWatch(ctx, mockWSConn, client, testOptions); assert.Error(err) { assert.Equal("error on watch", err.Error()) } // Test-4: error happens on Watch, watch should stop // and error shall be returned. mcWatchMock = func(_ context.Context, _ mc.WatchOptions) (*mc.WatchObject, *probe.Error) { return nil, &probe.Error{Cause: fmt.Errorf("error on watch")} } if err := startWatch(ctx, mockWSConn, client, testOptions); assert.Error(err) { assert.Equal("error on watch", err.Error()) } // Test-5: return nil on error on watch mcWatchMock = func(_ context.Context, _ mc.WatchOptions) (*mc.WatchObject, *probe.Error) { wo := &mc.WatchObject{ EventInfoChan: make(chan []mc.EventInfo), ErrorChan: make(chan *probe.Error), DoneChan: make(chan struct{}), } // Only success, start a routine to start reading line by line. go func(wo *mc.WatchObject) { defer func() { close(wo.EventInfoChan) close(wo.ErrorChan) }() lines := make([]int, testStreamSize) // mocking sending 5 lines of info for range lines { info := []mc.EventInfo{ { UserAgent: textToReceive, }, } wo.Events() <- info } wo.Events() <- nil wo.Errors() <- nil }(wo) return wo, nil } if err := startWatch(ctx, mockWSConn, client, testOptions); err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } // check that the TestReceiver got the same number of data from Console. for i := range testReceiver { for _, val := range i { assert.Equal(textToReceive, val.UserAgent) } } // Test-6: getWatchOptionsFromReq return parameters from path u, err := url.Parse("http://localhost/api/v1/watch/bucket1?prefix=&suffix=.jpg&events=put,get") if err != nil { t.Errorf("Failed on %s:, error occurred: %s", "url.Parse()", err.Error()) } req := &http.Request{ URL: u, } opts, err := getWatchOptionsFromReq(req) if assert.NoError(err) { expectedOptions := watchOptions{ BucketName: "bucket1", } expectedOptions.Prefix = "" expectedOptions.Suffix = ".jpg" expectedOptions.Events = []string{"put", "get"} assert.Equal(expectedOptions.BucketName, opts.BucketName) assert.Equal(expectedOptions.Prefix, opts.Prefix) assert.Equal(expectedOptions.Suffix, opts.Suffix) assert.Equal(expectedOptions.Events, opts.Events) } // Test-7: getWatchOptionsFromReq return default events if not defined u, err = url.Parse("http://localhost/api/v1/watch/bucket1?prefix=&suffix=.jpg&events=") if err != nil { t.Errorf("Failed on %s:, error occurred: %s", "url.Parse()", err.Error()) } req = &http.Request{ URL: u, } opts, err = getWatchOptionsFromReq(req) if assert.NoError(err) { expectedOptions := watchOptions{ BucketName: "bucket1", } expectedOptions.Prefix = "" expectedOptions.Suffix = ".jpg" expectedOptions.Events = []string{"put", "get", "delete"} assert.Equal(expectedOptions.BucketName, opts.BucketName) assert.Equal(expectedOptions.Prefix, opts.Prefix) assert.Equal(expectedOptions.Suffix, opts.Suffix) assert.Equal(expectedOptions.Events, opts.Events) } // Test-8: getWatchOptionsFromReq return default events if not defined u, err = url.Parse("http://localhost/api/v1/watch/bucket2?prefix=&suffix=") if err != nil { t.Errorf("Failed on %s:, error occurred: %s", "url.Parse()", err.Error()) } req = &http.Request{ URL: u, } opts, err = getWatchOptionsFromReq(req) if assert.NoError(err) { expectedOptions := watchOptions{ BucketName: "bucket2", } expectedOptions.Events = []string{"put", "get", "delete"} assert.Equal(expectedOptions.BucketName, opts.BucketName) assert.Equal(expectedOptions.Prefix, opts.Prefix) assert.Equal(expectedOptions.Suffix, opts.Suffix) assert.Equal(expectedOptions.Events, opts.Events) } // Test-9: getWatchOptionsFromReq invalid url u, _ = url.Parse("http://localhost/api/v1/wach/bucket2?prefix=&suffix=") req = &http.Request{ URL: u, } _, err = getWatchOptionsFromReq(req) assert.Error(err) } ================================================ FILE: api/utils.go ================================================ // 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 api import ( "crypto/rand" "encoding/base64" "encoding/json" "errors" "io" "net/http" "strings" "time" xjwt "github.com/minio/console/pkg/auth/token" ) // Do not use: // https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-go // It relies on math/rand and therefore not on a cryptographically secure RNG => It must not be used // for access/secret keys. // The alphabet of random character string. Each character must be unique. // // The RandomCharString implementation requires that: 256 / len(letters) is a natural numbers. // For example: 256 / 64 = 4. However, 5 > 256/62 > 4 and therefore we must not use a alphabet // of 62 characters. // The reason is that if 256 / len(letters) is not a natural number then certain characters become // more likely then others. const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" type CustomButtonStyle struct { BackgroundColor *string `json:"backgroundColor"` TextColor *string `json:"textColor"` HoverColor *string `json:"hoverColor"` HoverText *string `json:"hoverText"` ActiveColor *string `json:"activeColor"` ActiveText *string `json:"activeText"` DisabledColor *string `json:"disabledColor"` DisabledText *string `json:"disdabledText"` } type CustomTableStyle struct { Border *string `json:"border"` DisabledBorder *string `json:"disabledBorder"` DisabledBG *string `json:"disabledBG"` Selected *string `json:"selected"` DeletedDisabled *string `json:"deletedDisabled"` HoverColor *string `json:"hoverColor"` } type CustomInputStyle struct { Border *string `json:"border"` HoverBorder *string `json:"hoverBorder"` TextColor *string `json:"textColor"` BackgroundColor *string `json:"backgroundColor"` } type CustomSwitchStyle struct { SwitchBackground *string `json:"switchBackground"` BulletBorderColor *string `json:"bulletBorderColor"` BulletBGColor *string `json:"bulletBGColor"` DisabledBackground *string `json:"disabledBackground"` DisabledBulletBorderColor *string `json:"disabledBulletBorderColor"` DisabledBulletBGColor *string `json:"disabledBulletBGColor"` } type CustomStyles struct { BackgroundColor *string `json:"backgroundColor"` FontColor *string `json:"fontColor"` SecondaryFontColor *string `json:"secondaryFontColor"` BorderColor *string `json:"borderColor"` LoaderColor *string `json:"loaderColor"` BoxBackground *string `json:"boxBackground"` OkColor *string `json:"okColor"` ErrorColor *string `json:"errorColor"` WarnColor *string `json:"warnColor"` LinkColor *string `json:"linkColor"` DisabledLinkColor *string `json:"disabledLinkColor"` HoverLinkColor *string `json:"hoverLinkColor"` ButtonStyles *CustomButtonStyle `json:"buttonStyles"` SecondaryButtonStyles *CustomButtonStyle `json:"secondaryButtonStyles"` RegularButtonStyles *CustomButtonStyle `json:"regularButtonStyles"` TableColors *CustomTableStyle `json:"tableColors"` InputBox *CustomInputStyle `json:"inputBox"` Switch *CustomSwitchStyle `json:"switch"` } func RandomCharStringWithAlphabet(n int, alphabet string) string { random := make([]byte, n) if _, err := io.ReadFull(rand.Reader, random); err != nil { panic(err) // Can only happen if we would run out of entropy. } var s strings.Builder for _, v := range random { j := v % byte(len(alphabet)) s.WriteByte(alphabet[j]) } return s.String() } func RandomCharString(n int) string { return RandomCharStringWithAlphabet(n, letters) } // DifferenceArrays returns the elements in `a` that aren't in `b`. func DifferenceArrays(a, b []string) []string { mb := make(map[string]struct{}, len(b)) for _, x := range b { mb[x] = struct{}{} } var diff []string for _, x := range a { if _, found := mb[x]; !found { diff = append(diff, x) } } return diff } // IsElementInArray returns true if the string belongs to the slice func IsElementInArray(a []string, b string) bool { for _, e := range a { if e == b { return true } } return false } // UniqueKeys returns an array without duplicated keys func UniqueKeys(a []string) []string { keys := make(map[string]bool) list := []string{} for _, entry := range a { if _, value := keys[entry]; !value { keys[entry] = true list = append(list, entry) } } return list } func NewSessionCookieForConsole(token string) http.Cookie { sessionDuration := xjwt.GetConsoleSTSDuration() return http.Cookie{ Path: "/", Name: "token", Value: token, MaxAge: int(sessionDuration.Seconds()), // default 1 hr Expires: time.Now().Add(sessionDuration), HttpOnly: true, // if len(GlobalPublicCerts) > 0 is true, that means Console is running with TLS enable and the browser // should not leak any cookie if we access the site using HTTP Secure: len(GlobalPublicCerts) > 0, // read more: https://web.dev/samesite-cookies-explained/ SameSite: http.SameSiteLaxMode, } } func ExpireSessionCookie() http.Cookie { return http.Cookie{ Path: "/", Name: "token", Value: "", MaxAge: -1, Expires: time.Now().Add(-100 * time.Hour), HttpOnly: true, // if len(GlobalPublicCerts) > 0 is true, that means Console is running with TLS enable and the browser // should not leak any cookie if we access the site using HTTP Secure: len(GlobalPublicCerts) > 0, // read more: https://web.dev/samesite-cookies-explained/ SameSite: http.SameSiteLaxMode, } } func ValidateEncodedStyles(encodedStyles string) error { // encodedStyle JSON validation str, err := base64.StdEncoding.DecodeString(encodedStyles) if err != nil { return err } var styleElements *CustomStyles err = json.Unmarshal(str, &styleElements) if err != nil { return err } if styleElements.BackgroundColor == nil || styleElements.FontColor == nil || styleElements.ButtonStyles == nil || styleElements.BorderColor == nil || styleElements.OkColor == nil { return errors.New("specified style is not in the correct format") } return nil } var safeMimeTypes = []string{ "image/jpeg", "image/apng", "image/avif", "image/webp", "image/bmp", "image/x-icon", "image/gif", "image/png", "image/heic", "image/heif", "application/pdf", "text/plain", "application/json", "audio/wav", "audio/mpeg", "audio/aiff", "audio/dsd", "video/mp4", "video/x-msvideo", "video/mpeg", "audio/webm", "video/webm", "video/quicktime", "video/x-flv", "audio/x-matroska", "video/x-matroska", "video/x-ms-wmv", "application/metastream", "video/avchd-stream", "audio/mp4", "video/mp4", } func isSafeToPreview(str string) bool { for _, v := range safeMimeTypes { if v == str { return true } } return false } ================================================ FILE: api/utils_test.go ================================================ // 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 api import ( "net/http" "testing" "time" "github.com/stretchr/testify/assert" ) func TestDifferenceArrays(t *testing.T) { assert := assert.New(t) exampleArrayAMock := []string{"a", "b", "c"} exampleArrayBMock := []string{"b", "d"} resultABArrayMock := []string{"a", "c"} resultBAArrayMock := []string{"d"} // Test-1: test DifferenceArrays() with array a vs array b diffArray := DifferenceArrays(exampleArrayAMock, exampleArrayBMock) assert.ElementsMatchf(diffArray, resultABArrayMock, "return array AB doesn't match %s") // Test-2: test DifferenceArrays() with array b vs array a diffArray2 := DifferenceArrays(exampleArrayBMock, exampleArrayAMock) assert.ElementsMatchf(diffArray2, resultBAArrayMock, "return array BA doesn't match %s") } func TestIsElementInArray(t *testing.T) { assert := assert.New(t) exampleElementsArray := []string{"c", "a", "d", "b"} // Test-1: test IsElementInArray() with element that is in the list responseArray := IsElementInArray(exampleElementsArray, "a") assert.Equal(true, responseArray) // Test-2: test IsElementInArray() with element that is not in the list responseArray2 := IsElementInArray(exampleElementsArray, "e") assert.Equal(false, responseArray2) } func TestUniqueKeys(t *testing.T) { assert := assert.New(t) exampleMixedArray := []string{"a", "b", "c", "e", "d", "b", "c", "h", "f", "g"} exampleUniqueArray := []string{"a", "b", "c", "e", "d", "h", "f", "g"} // Test-1 test UniqueKeys returns an array with unique elements responseArray := UniqueKeys(exampleMixedArray) assert.ElementsMatchf(responseArray, exampleUniqueArray, "returned array doesn't contain the correct elements %s") } func TestRandomCharStringWithAlphabet(t *testing.T) { type args struct { n int alphabet string } tests := []struct { name string args args want string }{ { name: "generated random string has the right length", args: args{ n: 10, alphabet: "A", }, want: "AAAAAAAAAA", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { assert.Equalf(t, tt.want, RandomCharStringWithAlphabet(tt.args.n, tt.args.alphabet), "RandomCharStringWithAlphabet(%v, %v)", tt.args.n, tt.args.alphabet) }) } } func TestNewSessionCookieForConsole(t *testing.T) { type args struct { token string } tests := []struct { name string args args want http.Cookie }{ { name: "session cookie has the right token an security configuration", args: args{ token: "jwt-xxxxxxxxx", }, want: http.Cookie{ Path: "/", Value: "jwt-xxxxxxxxx", HttpOnly: true, SameSite: http.SameSiteLaxMode, Name: "token", MaxAge: 43200, Expires: time.Now().Add(1 * time.Hour), }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { got := NewSessionCookieForConsole(tt.args.token) assert.Equalf(t, tt.want.Value, got.Value, "NewSessionCookieForConsole(%v)", tt.args.token) assert.Equalf(t, tt.want.Path, got.Path, "NewSessionCookieForConsole(%v)", tt.args.token) assert.Equalf(t, tt.want.HttpOnly, got.HttpOnly, "NewSessionCookieForConsole(%v)", tt.args.token) assert.Equalf(t, tt.want.Name, got.Name, "NewSessionCookieForConsole(%v)", tt.args.token) assert.Equalf(t, tt.want.MaxAge, got.MaxAge, "NewSessionCookieForConsole(%v)", tt.args.token) assert.Equalf(t, tt.want.SameSite, got.SameSite, "NewSessionCookieForConsole(%v)", tt.args.token) }) } } func TestExpireSessionCookie(t *testing.T) { tests := []struct { name string want http.Cookie }{ { name: "cookie is expired correctly", want: http.Cookie{ Name: "token", Value: "", MaxAge: -1, }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { got := ExpireSessionCookie() assert.Equalf(t, tt.want.Name, got.Name, "ExpireSessionCookie()") assert.Equalf(t, tt.want.Value, got.Value, "ExpireSessionCookie()") assert.Equalf(t, tt.want.MaxAge, got.MaxAge, "ExpireSessionCookie()") }) } } func Test_isSafeToPreview(t *testing.T) { type args struct { str string } tests := []struct { name string args args want bool }{ { name: "mime type is safe to preview", args: args{ str: "image/jpeg", }, want: true, }, { name: "mime type is not safe to preview", args: args{ str: "application/zip", }, want: false, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { assert.Equalf(t, tt.want, isSafeToPreview(tt.args.str), "isSafeToPreview(%v)", tt.args.str) }) } } func TestRandomCharString(t *testing.T) { type args struct { n int } tests := []struct { name string args args wantLength int }{ { name: "valid string", args: args{ n: 1, }, wantLength: 1, }, { name: "valid string", args: args{ n: 64, }, wantLength: 64, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { assert.Equalf(t, tt.wantLength, len(RandomCharString(tt.args.n)), "RandomCharString(%v)", tt.args.n) }) } } func TestValidateEncodedStyles(t *testing.T) { type args struct { encodedStyles string } tests := []struct { name string args args wantErr bool }{ { name: "valid", args: args{ encodedStyles: "ewogICJiYWNrZ3JvdW5kQ29sb3IiOiAiIzFjMWMxYyIsCiAgImZvbnRDb2xvciI6ICJ3aGl0ZSIsCiAgInNlY29uZGFyeUZvbnRDb2xvciI6ICJncmV5IiwKICAiYm9yZGVyQ29sb3IiOiAieWVsbG93IiwKICAibG9hZGVyQ29sb3IiOiAicmVkIiwKICAiYm94QmFja2dyb3VuZCI6ICIjMDU3OWFmIiwKICAib2tDb2xvciI6ICIjMDhhZjA1IiwKICAiZXJyb3JDb2xvciI6ICIjYmYxZTQ2IiwKICAid2FybkNvbG9yIjogIiNiZmFjMWUiLAogICJsaW5rQ29sb3IiOiAiIzFlYmZiZiIsCiAgImRpc2FibGVkTGlua0NvbG9yIjogIiM5ZGEwYTAiLAogICJob3ZlckxpbmtDb2xvciI6ICIjMGY0ZWJjIiwKICAidGFibGVDb2xvcnMiOiB7CiAgICAiYm9yZGVyIjogIiM0YmJjMGYiLAogICAgImRpc2FibGVkQm9yZGVyIjogIiM3MjhlNjMiLAogICAgImRpc2FibGVkQkciOiAiIzcyOGU2MyIsCiAgICAic2VsZWN0ZWQiOiAiIzU1ZGIwZCIsCiAgICAiZGVsZXRlZERpc2FibGVkIjogIiNlYWI2ZDAiLAogICAgImhvdmVyQ29sb3IiOiAiIzAwZmZmNiIKICB9LAogICJidXR0b25TdHlsZXMiOiB7CiAgICAiYmFja2dyb3VuZENvbG9yIjogIiMwMDczZmYiLAogICAgInRleHRDb2xvciI6ICIjZmZmZmZmIiwKICAgICJob3ZlckNvbG9yIjogIiMyYjhlZmYiLAogICAgImhvdmVyVGV4dCI6ICIjZmZmIiwKICAgICJhY3RpdmVDb2xvciI6ICIjMzg4M2Q4IiwKICAgICJhY3RpdmVUZXh0IjogIiNmZmYiLAogICAgImRpc2FibGVkQ29sb3IiOiAiIzc1OGU4ZCIsCiAgICAiZGlzYWJsZWRUZXh0IjogIiNkOWRkZGQiCiAgfSwKICAic2Vjb25kYXJ5QnV0dG9uU3R5bGVzIjogewogICAgImJhY2tncm91bmRDb2xvciI6ICIjZWEzMzc5IiwKICAgICJ0ZXh0Q29sb3IiOiAiI2VhMzM3OSIsCiAgICAiaG92ZXJDb2xvciI6ICIjZWEzMzAwIiwKICAgICJob3ZlclRleHQiOiAiI2VhMzMwMCIsCiAgICAiYWN0aXZlQ29sb3IiOiAiI2VhMzM3OSIsCiAgICAiYWN0aXZlVGV4dCI6ICIjM2NlYTMzIiwKICAgICJkaXNhYmxlZENvbG9yIjogIiM3ODdjNzciLAogICAgImRpc2FibGVkVGV4dCI6ICIjNzg3Yzc3IgogIH0sCiAgInJlZ3VsYXJCdXR0b25TdHlsZXMiOiB7CiAgICAiYmFja2dyb3VuZENvbG9yIjogIiMwMDczZmYiLAogICAgInRleHRDb2xvciI6ICIjMDA3M2ZmIiwKICAgICJob3ZlckNvbG9yIjogIiMyYjhlZmYiLAogICAgImhvdmVyVGV4dCI6ICIjMDA3M2ZmIiwKICAgICJhY3RpdmVDb2xvciI6ICIjMzg4M2Q4IiwKICAgICJhY3RpdmVUZXh0IjogIiMwMDczZmYiLAogICAgImRpc2FibGVkQ29sb3IiOiAiIzc1OGU4ZCIsCiAgICAiZGlzYWJsZWRUZXh0IjogIiNkOWRkZGQiCiAgfSwKICAiaW5wdXRCb3giOiB7CiAgICAiYm9yZGVyIjogImdyZWVuIiwKICAgICJob3ZlckJvcmRlciI6ICJibHVlIiwKICAgICJ0ZXh0Q29sb3IiOiAid2hpdGUiLAogICAgImJhY2tncm91bmRDb2xvciI6ICIjMjhkNGZmIgogIH0sCiAgInN3aXRjaCI6IHsKICAgICJzd2l0Y2hCYWNrZ3JvdW5kIjogIiMyOGQ0ZmYiLAogICAgImJ1bGxldEJvcmRlckNvbG9yIjogIiNhNmFjYWQiLAogICAgImJ1bGxldEJHQ29sb3IiOiAiI2RjZTFlMiIsCiAgICAiZGlzYWJsZWRCYWNrZ3JvdW5kIjogIiM0NzQ5NDkiLAogICAgImRpc2FibGVkQnVsbGV0Qm9yZGVyQ29sb3IiOiAiIzQ3NDk0OSIsCiAgICAiZGlzYWJsZWRCdWxsZXRCR0NvbG9yIjogIiM3Mzk3YTAiCiAgfQp9", }, wantErr: false, }, { name: "invalid config", args: args{ encodedStyles: "ewogICJvb3JnbGUiOiAic3MiCn0===", }, wantErr: true, }, { name: "invalid style config", args: args{ encodedStyles: "e30=", }, wantErr: true, }, { name: "invalid base64", args: args{ encodedStyles: "duck", }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if tt.wantErr { assert.NotNilf(t, ValidateEncodedStyles(tt.args.encodedStyles), "Wanted an error") } else { assert.Nilf(t, ValidateEncodedStyles(tt.args.encodedStyles), "Did not wanted an error") } }) } } ================================================ FILE: api/ws_handle.go ================================================ // 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 api import ( "context" "errors" "fmt" "log" "net" "net/http" "strconv" "strings" "time" "github.com/minio/madmin-go/v3" "github.com/minio/console/pkg/utils" errorsApi "github.com/go-openapi/errors" "github.com/minio/console/models" "github.com/minio/console/pkg/auth" "github.com/minio/websocket" ) var upgrader = websocket.Upgrader{ ReadBufferSize: 0, WriteBufferSize: 1024, } const ( // websocket base path wsBasePath = "/ws" ) // ConsoleWebsocketAdmin interface of a Websocket Client type ConsoleWebsocketAdmin interface { trace() console() } type wsAdminClient struct { // websocket connection. conn wsConn // MinIO admin Client client MinioAdmin } // ConsoleWebsocket interface of a Websocket Client type ConsoleWebsocket interface { watch(options watchOptions) } type wsS3Client struct { // websocket connection. conn wsConn // mcClient client MCClient } // ConsoleWebSocketMClient interface of a Websocket Client type ConsoleWebsocketMClient interface { objectManager(options objectsListOpts) } type wsMinioClient struct { // websocket connection. conn wsConn // MinIO admin Client client minioClient } // WSConn interface with all functions to be implemented // by mock when testing, it should include all websocket.Conn // respective api calls that are used within this project. type WSConn interface { writeMessage(messageType int, data []byte) error close() error readMessage() (messageType int, p []byte, err error) remoteAddress() string } // Interface implementation // // Define the structure of a websocket Connection type wsConn struct { conn *websocket.Conn } // Types for trace request. this adds support for calls, threshold, status and extra filters type TraceRequest struct { s3 bool internal bool storage bool os bool threshold int64 onlyErrors bool statusCode int64 method string funcName string path string } // Type for log requests. This allows for filtering by node and kind type LogRequest struct { node string logType string } func (c wsConn) writeMessage(messageType int, data []byte) error { return c.conn.WriteMessage(messageType, data) } func (c wsConn) close() error { return c.conn.Close() } func (c wsConn) readMessage() (messageType int, p []byte, err error) { return c.conn.ReadMessage() } func (c wsConn) remoteAddress() string { clientIP, _, err := net.SplitHostPort(c.conn.RemoteAddr().String()) if err != nil { // In case there's an error, return an empty string log.Printf("Invalid ws.clientIP = %s\n", err) return "" } return clientIP } // serveWS validates the incoming request and // upgrades the request to a Websocket protocol. // Websocket communication will be done depending // on the path. // Request should come like ws://:/ws/ func serveWS(w http.ResponseWriter, req *http.Request) { ctx := req.Context() wsPath := strings.TrimPrefix(req.URL.Path, wsBasePath) // Perform authentication before upgrading to a Websocket Connection // authenticate WS connection with Console session, err := auth.GetClaimsFromTokenInRequest(req) if err != nil && (errors.Is(err, auth.ErrReadingToken) && !strings.HasPrefix(wsPath, `/objectManager`)) { ErrorWithContext(ctx, err) errorsApi.ServeError(w, req, errorsApi.New(http.StatusUnauthorized, "%v", err)) return } // If we are using a subpath we are most likely behind a reverse proxy so we most likely // can't validate the proper Origin since we don't know the source domain, so we are going // to allow the connection to be upgraded in this case. if getSubPath() != "/" || getConsoleDevMode() { upgrader.CheckOrigin = func(_ *http.Request) bool { return true } } // upgrades the HTTP server connection to the WebSocket protocol. conn, err := upgrader.Upgrade(w, req, nil) if err != nil { ErrorWithContext(ctx, err) errorsApi.ServeError(w, req, err) return } clientIP := getSourceIPFromHeaders(req) if clientIP == "" { if ip, _, err := net.SplitHostPort(conn.RemoteAddr().String()); err == nil { clientIP = ip } else { // In case there's an error, return an empty string LogError("Invalid ws.RemoteAddr() = %v\n", err) } } switch { case strings.HasPrefix(wsPath, `/trace`): wsAdminClient, err := newWebSocketAdminClient(conn, session, clientIP) if err != nil { ErrorWithContext(ctx, err) closeWsConn(conn) return } calls := req.URL.Query().Get("calls") threshold, _ := strconv.ParseInt(req.URL.Query().Get("threshold"), 10, 64) onlyErrors := req.URL.Query().Get("onlyErrors") stCode, errorStCode := strconv.ParseInt(req.URL.Query().Get("statusCode"), 10, 32) method := req.URL.Query().Get("method") funcName := req.URL.Query().Get("funcname") path := req.URL.Query().Get("path") statusCode := int64(0) if errorStCode == nil { statusCode = stCode } traceRequestItem := TraceRequest{ s3: strings.Contains(calls, "s3") || strings.Contains(calls, "all"), internal: strings.Contains(calls, "internal") || strings.Contains(calls, "all"), storage: strings.Contains(calls, "storage") || strings.Contains(calls, "all"), os: strings.Contains(calls, "os") || strings.Contains(calls, "all"), onlyErrors: onlyErrors == "yes", threshold: threshold, statusCode: statusCode, method: method, funcName: funcName, path: path, } go wsAdminClient.trace(ctx, traceRequestItem) case strings.HasPrefix(wsPath, `/console`): wsAdminClient, err := newWebSocketAdminClient(conn, session, clientIP) if err != nil { ErrorWithContext(ctx, err) closeWsConn(conn) return } node := req.URL.Query().Get("node") logType := req.URL.Query().Get("logType") logRequestItem := LogRequest{ node: node, logType: logType, } go wsAdminClient.console(ctx, logRequestItem) case strings.HasPrefix(wsPath, `/health-info`): deadline, err := getHealthInfoOptionsFromReq(req) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error getting health info options: %v", err)) closeWsConn(conn) return } wsAdminClient, err := newWebSocketAdminClient(conn, session, clientIP) if err != nil { ErrorWithContext(ctx, err) closeWsConn(conn) return } go wsAdminClient.healthInfo(ctx, deadline) case strings.HasPrefix(wsPath, `/watch`): wOptions, err := getWatchOptionsFromReq(req) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error getting watch options: %v", err)) closeWsConn(conn) return } wsS3Client, err := newWebSocketS3Client(conn, session, wOptions.BucketName, "", clientIP) if err != nil { ErrorWithContext(ctx, err) closeWsConn(conn) return } go wsS3Client.watch(ctx, wOptions) case strings.HasPrefix(wsPath, `/speedtest`): speedtestOpts, err := getSpeedtestOptionsFromReq(req) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error getting speedtest options: %v", err)) closeWsConn(conn) return } wsAdminClient, err := newWebSocketAdminClient(conn, session, clientIP) if err != nil { ErrorWithContext(ctx, err) closeWsConn(conn) return } go wsAdminClient.speedtest(ctx, speedtestOpts) case strings.HasPrefix(wsPath, `/profile`): pOptions, err := getProfileOptionsFromReq(req) if err != nil { ErrorWithContext(ctx, fmt.Errorf("error getting profile options: %v", err)) closeWsConn(conn) return } wsAdminClient, err := newWebSocketAdminClient(conn, session, clientIP) if err != nil { ErrorWithContext(ctx, err) closeWsConn(conn) return } go wsAdminClient.profile(ctx, pOptions) case strings.HasPrefix(wsPath, `/objectManager`): wsMinioClient, err := newWebSocketMinioClient(conn, session, clientIP) if err != nil { ErrorWithContext(ctx, err) closeWsConn(conn) return } go wsMinioClient.objectManager(session) default: // path not found closeWsConn(conn) } } // newWebSocketAdminClient returns a wsAdminClient authenticated as an admin user func newWebSocketAdminClient(conn *websocket.Conn, autClaims *models.Principal, clientIP string) (*wsAdminClient, error) { // create a websocket connection interface implementation // defining the connection to be used wsConnection := wsConn{conn: conn} // Only start Websocket Interaction after user has been // authenticated with MinIO mAdmin, err := newAdminFromClaims(autClaims, clientIP) if err != nil { LogError("error creating madmin client: %v", err) return nil, err } // create a minioClient interface implementation // defining the client to be used adminClient := AdminClient{Client: mAdmin} // create websocket client and handle request wsAdminClient := &wsAdminClient{conn: wsConnection, client: adminClient} return wsAdminClient, nil } // newWebSocketS3Client returns a wsAdminClient authenticated as Console admin func newWebSocketS3Client(conn *websocket.Conn, claims *models.Principal, bucketName, prefix, clientIP string) (*wsS3Client, error) { // Only start Websocket Interaction after user has been // authenticated with MinIO s3Client, err := newS3BucketClient(claims, bucketName, prefix, clientIP) if err != nil { LogError("error creating S3Client:", err) return nil, err } // create a websocket connection interface implementation // defining the connection to be used wsConnection := wsConn{conn: conn} // create a s3Client interface implementation // defining the client to be used mcS3C := mcClient{client: s3Client} // create websocket client and handle request wsS3Client := &wsS3Client{conn: wsConnection, client: mcS3C} return wsS3Client, nil } func newWebSocketMinioClient(conn *websocket.Conn, claims *models.Principal, clientIP string) (*wsMinioClient, error) { mClient, err := newMinioClient(claims, clientIP) if err != nil { LogError("error creating MinioClient:", err) return nil, err } // create a websocket connection interface implementation // defining the connection to be used wsConnection := wsConn{conn: conn} // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} // create websocket client and handle request wsMinioClient := &wsMinioClient{conn: wsConnection, client: minioClient} return wsMinioClient, nil } // wsReadClientCtx reads the messages that come from the client // if the client sends a Close Message the context will be // canceled. If the connection is closed the goroutine inside // will return. func wsReadClientCtx(parentContext context.Context, conn WSConn) context.Context { // a cancel context is needed to end all goroutines used ctx, cancel := context.WithCancel(context.Background()) var requestID string var SessionID string var UserAgent string var Host string var RemoteHost string if val, o := parentContext.Value(utils.ContextRequestID).(string); o { requestID = val } if val, o := parentContext.Value(utils.ContextRequestUserID).(string); o { SessionID = val } if val, o := parentContext.Value(utils.ContextRequestUserAgent).(string); o { UserAgent = val } if val, o := parentContext.Value(utils.ContextRequestHost).(string); o { Host = val } if val, o := parentContext.Value(utils.ContextRequestRemoteAddr).(string); o { RemoteHost = val } ctx = context.WithValue(ctx, utils.ContextRequestID, requestID) ctx = context.WithValue(ctx, utils.ContextRequestUserID, SessionID) ctx = context.WithValue(ctx, utils.ContextRequestUserAgent, UserAgent) ctx = context.WithValue(ctx, utils.ContextRequestHost, Host) ctx = context.WithValue(ctx, utils.ContextRequestRemoteAddr, RemoteHost) go func() { defer cancel() for { _, _, err := conn.readMessage() if err != nil { // if errors of type websocket.CloseError and is Unexpected if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseNormalClosure) { ErrorWithContext(ctx, fmt.Errorf("error unexpected CloseError on ReadMessage: %v", err)) return } // Not all errors are of type websocket.CloseError. if _, ok := err.(*websocket.CloseError); !ok { ErrorWithContext(ctx, fmt.Errorf("error on ReadMessage: %v", err)) return } // else is an expected Close Error return } } }() return ctx } // closeWsConn sends Close Message and closes the websocket connection func closeWsConn(conn *websocket.Conn) { conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, "")) conn.Close() } // trace serves madmin.ServiceTraceInfo // on a Websocket connection. func (wsc *wsAdminClient) trace(ctx context.Context, traceRequestItem TraceRequest) { defer func() { LogInfo("trace stopped") // close connection after return wsc.conn.close() }() LogInfo("trace started") ctx = wsReadClientCtx(ctx, wsc.conn) err := startTraceInfo(ctx, wsc.conn, wsc.client, traceRequestItem) sendWsCloseMessage(wsc.conn, err) } // console serves madmin.GetLogs // on a Websocket connection. func (wsc *wsAdminClient) console(ctx context.Context, logRequestItem LogRequest) { defer func() { LogInfo("console logs stopped") // close connection after return wsc.conn.close() }() LogInfo("console logs started") ctx = wsReadClientCtx(ctx, wsc.conn) err := startConsoleLog(ctx, wsc.conn, wsc.client, logRequestItem) sendWsCloseMessage(wsc.conn, err) } func (wsc *wsS3Client) watch(ctx context.Context, params *watchOptions) { defer func() { LogInfo("watch stopped") // close connection after return wsc.conn.close() }() LogInfo("watch started") ctx = wsReadClientCtx(ctx, wsc.conn) err := startWatch(ctx, wsc.conn, wsc.client, params) sendWsCloseMessage(wsc.conn, err) } func (wsc *wsAdminClient) healthInfo(ctx context.Context, deadline *time.Duration) { defer func() { LogInfo("health info stopped") // close connection after return wsc.conn.close() }() LogInfo("health info started") ctx = wsReadClientCtx(ctx, wsc.conn) err := startHealthInfo(ctx, wsc.conn, wsc.client, deadline) sendWsCloseMessage(wsc.conn, err) } func (wsc *wsAdminClient) speedtest(ctx context.Context, opts *madmin.SpeedtestOpts) { defer func() { LogInfo("speedtest stopped") // close connection after return wsc.conn.close() }() LogInfo("speedtest started") ctx = wsReadClientCtx(ctx, wsc.conn) err := startSpeedtest(ctx, wsc.conn, wsc.client, opts) sendWsCloseMessage(wsc.conn, err) } func (wsc *wsAdminClient) profile(ctx context.Context, opts *profileOptions) { defer func() { LogInfo("profile stopped") // close connection after return wsc.conn.close() }() LogInfo("profile started") ctx = wsReadClientCtx(ctx, wsc.conn) err := startProfiling(ctx, wsc.conn, wsc.client, opts) sendWsCloseMessage(wsc.conn, err) } // sendWsCloseMessage sends Websocket Connection Close Message indicating the Status Code // see https://tools.ietf.org/html/rfc6455#page-45 func sendWsCloseMessage(conn WSConn, err error) { if err != nil { LogError("original ws error: %v", err) // If connection exceeded read deadline send Close // Message Policy Violation code since we don't want // to let the receiver figure out the read deadline. // This is a generic code designed if there is a // need to hide specific details about the policy. if nErr, ok := err.(net.Error); ok && nErr.Timeout() { conn.writeMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.ClosePolicyViolation, "")) return } // else, internal server error conn.writeMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseInternalServerErr, err.Error())) return } // normal closure conn.writeMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, "")) } ================================================ FILE: api/ws_handle_test.go ================================================ // 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 api import ( "context" "errors" "testing" "github.com/minio/websocket" ) // Common mocks for WSConn interface // assigning mock at runtime instead of compile time var ( connWriteMessageMock func(messageType int, data []byte) error connReadMessageMock func() (messageType int, p []byte, err error) ) // The Conn type represents a WebSocket connection. type mockConn struct{} func (c mockConn) writeMessage(messageType int, data []byte) error { return connWriteMessageMock(messageType, data) } func (c mockConn) readMessage() (messageType int, p []byte, err error) { return connReadMessageMock() } func (c mockConn) close() error { return nil } func (c mockConn) remoteAddress() string { return "127.0.0.1" } func TestWSHandle(_ *testing.T) { // assert := assert.New(t) mockWSConn := mockConn{} // mock function of conn.ReadMessage(), returns unexpected Close Error CloseAbnormalClosure connReadMessageMock = func() (messageType int, p []byte, err error) { return 0, []byte{}, &websocket.CloseError{Code: websocket.CloseAbnormalClosure, Text: ""} } parentCtx := context.Background() ctx := wsReadClientCtx(parentCtx, mockWSConn) <-ctx.Done() // closed ctx correctly // mock function of conn.ReadMessage(), returns unexpected Close Error CloseAbnormalClosure connReadMessageMock = func() (messageType int, p []byte, err error) { return 0, []byte{}, errors.New("error") } ctx2 := wsReadClientCtx(parentCtx, mockWSConn) <-ctx2.Done() // closed ctx correctly // mock function of conn.ReadMessage(), returns unexpected Close Error CloseAbnormalClosure connReadMessageMock = func() (messageType int, p []byte, err error) { return 0, []byte{}, &websocket.CloseError{Code: websocket.CloseGoingAway, Text: ""} } ctx3 := wsReadClientCtx(parentCtx, mockWSConn) <-ctx3.Done() // closed ctx correctly } ================================================ FILE: api/ws_objects.go ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package api import ( "context" "encoding/json" "fmt" "strings" "sync" "time" "github.com/minio/console/models" "github.com/minio/websocket" ) func (wsc *wsMinioClient) objectManager(session *models.Principal) { // Storage of Cancel Contexts for this connection var cancelContexts sync.Map // Initial goroutine defer func() { // We close socket at the end of requests wsc.conn.close() cancelContexts.Range(func(key, value interface{}) bool { cancelFunc := value.(context.CancelFunc) cancelFunc() cancelContexts.Delete(key) return true }) }() writeChannel := make(chan WSResponse) done := make(chan interface{}) sendWSResponse := func(r WSResponse) { select { case writeChannel <- r: case <-done: } } // Read goroutine go func() { defer close(writeChannel) for { select { case <-done: return default: } mType, message, err := wsc.conn.readMessage() if err != nil { LogInfo("Error while reading objectManager message: %s", err) return } if mType == websocket.TextMessage { // We get request data & review information var messageRequest ObjectsRequest if err := json.Unmarshal(message, &messageRequest); err != nil { LogInfo("Error on message request unmarshal: %s", err) continue } // new message, new context ctx, cancel := context.WithCancel(context.Background()) // We store the cancel func associated with this request cancelContexts.Store(messageRequest.RequestID, cancel) switch messageRequest.Mode { case "objects", "rewind": // cancel all previous open objects requests for listing cancelContexts.Range(func(key, value interface{}) bool { rid := key.(int64) if rid < messageRequest.RequestID { cancelFunc := value.(context.CancelFunc) cancelFunc() cancelContexts.Delete(key) } return true }) } const itemsPerBatch = 1000 switch messageRequest.Mode { case "close": return case "cancel": // if we have that request id, cancel it if cancelFunc, ok := cancelContexts.Load(messageRequest.RequestID); ok { cancelFunc.(context.CancelFunc)() cancelContexts.Delete(messageRequest.RequestID) } case "objects": // start listing and writing to web socket objectRqConfigs, err := getObjectsOptionsFromReq(messageRequest) if err != nil { LogInfo(fmt.Sprintf("Error during Objects OptionsParse %s", err.Error())) sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, Error: ErrorWithContext(ctx, err), Prefix: messageRequest.Prefix, BucketName: messageRequest.BucketName, }) return } var buffer []ObjectResponse for lsObj := range startObjectsListing(ctx, wsc.client, objectRqConfigs) { if lsObj.Err != nil { sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, Error: ErrorWithContext(ctx, lsObj.Err), Prefix: messageRequest.Prefix, BucketName: messageRequest.BucketName, }) continue } // if the key is same as requested prefix it would be nested directory object, so skip // and show only objects under the prefix // E.g: // bucket/prefix1/prefix2/ -- this should be skipped from list item. // bucket/prefix1/prefix2/an-object // bucket/prefix1/prefix2/another-object if messageRequest.Prefix != lsObj.Key { objItem := ObjectResponse{ Name: lsObj.Key, Size: lsObj.Size, LastModified: lsObj.LastModified.Format(time.RFC3339), VersionID: lsObj.VersionID, IsLatest: lsObj.IsLatest, DeleteMarker: lsObj.IsDeleteMarker, } buffer = append(buffer, objItem) } if len(buffer) >= itemsPerBatch { sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, Data: buffer, }) buffer = nil } } if len(buffer) > 0 { sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, Data: buffer, }) } sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, RequestEnd: true, }) // if we have that request id, cancel it if cancelFunc, ok := cancelContexts.Load(messageRequest.RequestID); ok { cancelFunc.(context.CancelFunc)() cancelContexts.Delete(messageRequest.RequestID) } case "rewind": // start listing and writing to web socket objectRqConfigs, err := getObjectsOptionsFromReq(messageRequest) if err != nil { LogInfo(fmt.Sprintf("Error during Objects OptionsParse %s", err.Error())) sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, Error: ErrorWithContext(ctx, err), Prefix: messageRequest.Prefix, BucketName: messageRequest.BucketName, }) return } clientIP := wsc.conn.remoteAddress() s3Client, err := newS3BucketClient(session, objectRqConfigs.BucketName, objectRqConfigs.Prefix, clientIP) if err != nil { sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, Error: ErrorWithContext(ctx, err), Prefix: messageRequest.Prefix, BucketName: messageRequest.BucketName, }) return } mcS3C := mcClient{client: s3Client} var buffer []ObjectResponse for lsObj := range startRewindListing(ctx, mcS3C, objectRqConfigs) { if lsObj.Err != nil { sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, Error: ErrorWithContext(ctx, lsObj.Err.ToGoError()), Prefix: messageRequest.Prefix, BucketName: messageRequest.BucketName, }) continue } name := strings.Replace(lsObj.URL.Path, fmt.Sprintf("/%s/", objectRqConfigs.BucketName), "", 1) objItem := ObjectResponse{ Name: name, Size: lsObj.Size, LastModified: lsObj.Time.Format(time.RFC3339), VersionID: lsObj.VersionID, IsLatest: lsObj.IsLatest, DeleteMarker: lsObj.IsDeleteMarker, } buffer = append(buffer, objItem) if len(buffer) >= itemsPerBatch { sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, Data: buffer, }) buffer = nil } } if len(buffer) > 0 { sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, Data: buffer, }) } sendWSResponse(WSResponse{ RequestID: messageRequest.RequestID, RequestEnd: true, }) // if we have that request id, cancel it if cancelFunc, ok := cancelContexts.Load(messageRequest.RequestID); ok { cancelFunc.(context.CancelFunc)() cancelContexts.Delete(messageRequest.RequestID) } } } } }() defer close(done) for writeM := range writeChannel { jsonData, err := json.Marshal(writeM) if err != nil { LogInfo("Error while marshaling the response: %s", err) return } err = wsc.conn.writeMessage(websocket.TextMessage, jsonData) if err != nil { LogInfo("Error while writing the message: %s", err) return } } } ================================================ FILE: code_of_conduct.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior, in compliance with the licensing terms applying to the Project developments. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. However, these actions shall respect the licensing terms of the Project Developments that will always supersede such Code of Conduct. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at dev@min.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] This version includes a clarification to ensure that the code of conduct is in compliance with the free software licensing terms of the project. [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ ================================================ FILE: cross-compile.sh ================================================ #!/bin/bash set -e # Enable tracing if set. [ -n "$BASH_XTRACEFD" ] && set -x ## All binaries are static make sure to disable CGO. export CGO_ENABLED=0 ## List of architectures and OS to test cross compilation. SUPPORTED_OSARCH_DEFAULTS="linux/ppc64le linux/mips64 linux/arm64 linux/s390x darwin/amd64 freebsd/amd64 windows/amd64 linux/arm linux/386 netbsd/amd64" SUPPORTED_OSARCH=${1:-$SUPPORTED_OSARCH_DEFAULTS} _build() { local osarch=$1 IFS=/ read -r -a arr <<<"$osarch" os="${arr[0]}" arch="${arr[1]}" package=$(go list -f '{{.ImportPath}}' ./cmd/console) printf -- "--> %15s:%s\n" "${osarch}" "${package}" # go build -trimpath to build the binary. GOOS=$os GOARCH=$arch GO111MODULE=on go build -trimpath --tags=kqueue --ldflags "-s -w" -o /dev/null ./cmd/console } main() { echo "Testing builds for OS/Arch: ${SUPPORTED_OSARCH}" for each_osarch in ${SUPPORTED_OSARCH}; do _build "${each_osarch}" done } main "$@" ================================================ FILE: docs/Debug.md ================================================ # Debug logging In some cases it may be convenient to log all HTTP requests. This can be enabled by setting the `CONSOLE_DEBUG_LOGLEVEL` environment variable to one of the following values: - `0` (default) uses no logging. - `1` log single line per request for server-side errors (status-code 5xx). - `2` log single line per request for client-side and server-side errors (status-code 4xx/5xx). - `3` log single line per request for all requests (status-code 4xx/5xx). - `4` log details per request for server-side errors (status-code 5xx). - `5` log details per request for client-side and server-side errors (status-code 4xx/5xx). - `6` log details per request for all requests (status-code 4xx/5xx). A single line logging has the following information: - Remote endpoint (IP + port) of the request. Note that reverse proxies may hide the actual remote endpoint of the client's browser. - HTTP method and URL - Status code of the response (websocket connections are hijacked, so no response is shown) - Duration of the request The detailed logging also includes all request and response headers (if any). ================================================ FILE: docs/Environment.md ================================================ # Environment Variable | Env | | | --- | -- | | `CONSOLE_MINIO_SERVER` | "http://localhost:9000" | | `CONSOLE_MINIO_REGION` | "us-east-1" | | `CONSOLE_HOSTNAME` | "" | | `CONSOLE_PORT` | 9090 | | `CONSOLE_TLS_PORT` | 9443 | | `CONSOLE_SUBPATH` | i.e. /console | | `CONSOLE_DEBUG_LOGLEVEL` | 0 - 6 | | `CONSOLE_SHARE_MINIO_URL` | "off" | `CONSOLE_SECURE_ALLOWED_HOSTS` | "" | | `CONSOLE_SECURE_ALLOWED_HOSTS_ARE_REGEX` | "off" | | `CONSOLE_SECURE_FRAME_DENY` | "on" | | `CONSOLE_SECURE_CONTENT_TYPE_NO_SNIFF` | "on" | | `CONSOLE_SECURE_BROWSER_XSS_FILTER` | "on" | | `CONSOLE_SECURE_CONTENT_SECURITY_POLICY` | "" | | `CONSOLE_SECURE_CONTENT_SECURITY_POLICY_REPORT_ONLY` | "" | | `CONSOLE_SECURE_HOSTS_PROXY_HEADERS` | "" | | `CONSOLE_SECURE_STS_SECONDS` | 0 | | `CONSOLE_SECURE_STS_INCLUDE_SUB_DOMAINS` | "off" | | `CONSOLE_SECURE_STS_PRELOAD` | "off" | | `CONSOLE_SECURE_TLS_REDIRECT` | "off" | | `CONSOLE_SECURE_TLS_HOST` | "" | | `CONSOLE_SECURE_TLS_TEMPORARY_REDIRECT` | "off" | | `CONSOLE_SECURE_FORCE_STS_HEADER` | "off" | | `CONSOLE_SECURE_PUBLIC_KEY` | | | `CONSOLE_SECURE_REFERRER_POLICY` | "" | | `CONSOLE_SECURE_FEATURE_POLICY` | "" | | `CONSOLE_SECURE_EXPECT_CT_HEADER` | | | `CONSOLE_PROMETHEUS_URL` | | | `CONSOLE_PROMETHEUS_AUTH_TOKEN` | | | `CONSOLE_PROMETHEUS_AUTH_USERNAME` | | | `CONSOLE_PROMETHEUS_AUTH_PASSWORD` | | | `CONSOLE_PROMETHEUS_JOB_ID` | "minio-job" | | `CONSOLE_PROMETHEUS_EXTRA_LABELS` | | | `CONSOLE_LOG_QUERY_URL` | | | `CONSOLE_LOG_QUERY_AUTH_TOKEN` | "" | | `CONSOLE_MAX_CONCURRENT_UPLOADS` | "10" | | `CONSOLE_MAX_CONCURRENT_DOWNLOADS` | "20" | | `CONSOLE_DEV_MODE` | "off" | | `CONSOLE_BROWSER_REDIRECT_URL` | | | `LOGSEARCH_QUERY_AUTH_TOKEN` | | | `CONSOLE_IDP_DISPLAY_NAME` | `MINIO_IDENTITY_OPENID_DISPLAY_NAME` | | `CONSOLE_IDP_URL` | `MINIO_IDENTITY_OPENID_CONFIG_URL` | | `CONSOLE_IDP_CLIENT_ID` | `MINIO_IDENTITY_OPENID_CLIENT_ID` | | `CONSOLE_IDP_SECRET` | `MINIO_IDENTITY_OPENID_CLIENT_SECRET` | | `CONSOLE_IDP_CALLBACK` | `MINIO_BROWSER_REDIRECT_URL` | | `CONSOLE_IDP_CALLBACK_DYNAMIC` | `MINIO_IDENTITY_OPENID_REDIRECT_URI_DYNAMIC` | | `CONSOLE_IDP_SCOPES` | `MINIO_IDENTITY_OPENID_SCOPES` | | `CONSOLE_IDP_USERINFO` | `MINIO_IDENTITY_OPENID_CLAIM_USERINFO` | | `CONSOLE_IDP_ROLE_ARN` | | | `CONSOLE_IDP_END_SESSION_ENDPOINT` | | | `CONSOLE_LDAP_ENABLED` | | | `CONSOLE_STS_DURATION` | time.Duration format, ie: 3600s, 2h45m, 1h, etc | `CONSOLE_PBKDF_PASSPHRASE` | | | `CONSOLE_PBKDF_SALT` | | | `CONSOLE_LOGGER_JSON_ENABLE` | | `CONSOLE_LOGGER_ANONYMOUS_ENABLE` | | `CONSOLE_LOGGER_QUIET_ENABLE` | | `CONSOLE_GLOBAL_DEPLOYMENT_ID` | | `CONSOLE_LOGGER_WEBHOOK_ENABLE` | | `CONSOLE_LOGGER_WEBHOOK_ENDPOINT` | | `CONSOLE_LOGGER_WEBHOOK_AUTH_TOKEN` | | `CONSOLE_LOGGER_WEBHOOK_CLIENT_CERT` | | `CONSOLE_LOGGER_WEBHOOK_CLIENT_KEY` | | `CONSOLE_LOGGER_WEBHOOK_QUEUE_SIZE` | | `CONSOLE_AUDIT_WEBHOOK_ENABLE` | | `CONSOLE_AUDIT_WEBHOOK_ENDPOINT` | | `CONSOLE_AUDIT_WEBHOOK_AUTH_TOKEN` | | `CONSOLE_AUDIT_WEBHOOK_CLIENT_CERT` | | `CONSOLE_AUDIT_WEBHOOK_CLIENT_KEY` | | `CONSOLE_AUDIT_WEBHOOK_QUEUE_SIZE` | ================================================ FILE: docs/OIDC.md ================================================ # OIDC When the console is running separately and is not embedded in the same binary as the server, the OIDC SSO login configuration is not set / taken over from the minio server. It needs to be configured using Environment Variables like this: ``` bash export CONSOLE_MINIO_SERVER="http://127.0.0.1:9000"; export CONSOLE_IDP_URL="http://PROVIDER:5556/.well-known/openid-configuration"; export CONSOLE_IDP_CLIENT_ID="minio-client-app"; export CONSOLE_IDP_SECRET="minio-client-app-secret"; export CONSOLE_IDP_CALLBACK="http://CONSOLE:9090"; export CONSOLE_IDP_DISPLAY_NAME="Login with OIDC"; ./console server ``` > [!IMPORTANT] > Currently, the following environment variables are mandatory: `CONSOLE_IDP_URL`, `CONSOLE_IDP_CLIENT_ID`, `CONSOLE_IDP_SECRET` and `CONSOLE_IDP_CALLBACK`. For convenience, the same environment variables are supported as for the server, with the `CONSOLE_` ones taking precedence over the `MINIO_` ones. This means you can use the same variables as you would set on the server and share them with the console. | Console Environment Variables | MinIO Server Environment Variables | Required | Example | | -- | -- | -- | -- | | CONSOLE_IDP_DISPLAY_NAME | MINIO_IDENTITY_OPENID_DISPLAY_NAME | | "Login with OIDC" | | CONSOLE_IDP_URL | MINIO_IDENTITY_OPENID_CONFIG_URL | ✓ | "https://provider/.well-known/openid-configuration" | | CONSOLE_IDP_CLIENT_ID | MINIO_IDENTITY_OPENID_CLIENT_ID | ✓ | minio-client-app | | CONSOLE_IDP_SECRET | MINIO_IDENTITY_OPENID_CLIENT_SECRET | ✓ | minio-client-app-secret | | CONSOLE_IDP_CALLBACK | MINIO_BROWSER_REDIRECT_URL | ✓ | "https://console" ***without*** /oauth_callback | | CONSOLE_IDP_CALLBACK_DYNAMIC | MINIO_IDENTITY_OPENID_REDIRECT_URI_DYNAMIC | | off / on| | CONSOLE_IDP_SCOPES | MINIO_IDENTITY_OPENID_SCOPES | | "openid,profile,email" | | CONSOLE_IDP_USERINFO | MINIO_IDENTITY_OPENID_CLAIM_USERINFO | | off / on | | *(only set on MinIO Server Side)*| MINIO_IDENTITY_OPENID_CLAIM_NAME | | "name" exclusiv with ROLE_POLICY ↓ | ↓ If set **NEEDS ARN** of Policy Role set on Console ↓ | MINIO_IDENTITY_OPENID_ROLE_POLICY | | "consoleAdmin" exclusiv with CLAIM_NAME ↑ | | CONSOLE_IDP_ROLE_ARN | ↑ If Role Policy set get Policy Role Arn from MinIO Startup Log ↑ looks like this example → | | "arn:minio:iam:::role/nOybJqMNzNmroqEKq5D0EUsRZw0" | | CONSOLE_IDP_END_SESSION_ENDPOINT | | | > [!TIP] > After setup use the [/sso](#sso-url) url, your console url + /sso, e.g. https://console/sso ## CONSOLE_IDP_CALLBACK / MINIO_BROWSER_REDIRECT_URL URL to Console e.g. `https://console.example.com` ***without*** `/oauth_callback` On IDP Site Callback URLs / redirect URI it is allways the full URL with `/oauth_callback` `https://console.example.com/oauth_callback` > [!NOTE] > Breaking Change with 1.9.0 > On 1.8.1 it needed /oauth_callback ## MINIO_IDENTITY_OPENID_CLAIM_NAME Only set on MinIO Server Side, exclusiv with `MINIO_IDENTITY_OPENID_ROLE_POLICY`. If value/ information is not included in the default scopes `openid,profile,email`, its needs to be included in _SCOPES for example `groups`. ## CONSOLE_IDP_ROLE_ARN Needs `MINIO_IDENTITY_OPENID_ROLE_POLICY` set on MinIO Server Side, exclusiv with `MINIO_IDENTITY_OPENID_CLAIM_NAME`. If set you get the RoleArn on Minio Star ### After MinIO Version: RELEASE.2025-07-23T15-54-02Z ``` INFO: IAM Roles: arn:minio:iam:::role/nOybJqMNzNmroqEKq5D0EUsRZw0 INFO: IAM load(startup) finished. (duration: 4.439165ms) ``` ### Before MinIO Version: RELEASE.2025-07-23T15-54-02Z If you use build-in / `canned` policies like `consoleAdmin`, you get an error on minio startup log ``` bash Error: The policies "[consoleAdmin]" mapped to role ARN arn:minio:iam:::role/nOybJqMNzNmroqEKq5D0EUsRZw0 are not defined - this role may not work as expected. (*errors.errorString) 7: internal/logger/logger.go:271:logger.LogIf() 6: cmd/logging.go:54:cmd.authZLogIf() 5: cmd/iam.go:524:cmd.(*IAMSys).validateAndAddRolePolicyMappings() 4: cmd/iam.go:370:cmd.(*IAMSys).Init() 3: cmd/server-main.go:1006:cmd.serverMain.func15.1() 2: cmd/server-main.go:566:cmd.bootstrapTrace() 1: cmd/server-main.go:1005:cmd.serverMain.func15() INFO: IAM Roles: arn:minio:iam:::role/nOybJqMNzNmroqEKq5D0EUsRZw0 --------------------------- ``` # SSO URL If you have set up OIDC, use your console URL with /sso added at the end to be automatically redirected to log in to your IDP provider. `https://console.example.com/sso` ================================================ FILE: docs/README.md ================================================ # Docs More documentation to read - [OIDC](OIDC.md) - [LDAP](ldap/LDAP.md) - [systemd](../systemd/README.md) - [TLS](TLS.md) - [Debug Logging](Debug.md) - [Environment Variables](Environment.md) - **Development** - [DEVELOPMENT](../DEVELOPMENT.md) - [Frontend Web App](../web-app/README.md) - [CONTRIBUTING](../CONTRIBUTING.md) ### Share Option With the enenvironment variable `CONSOLE_SHARE_MINIO_URL=on` can change the default from Console URL to MinIO Server URL in case Console endpoint is not exposed. There is a toggle in GUI to change between the two. ## FAQ ### How do I log in? Console uses the same users as minio, it just passes the login you enter to the minio server. Its the users you will see with the mc command below, the same user you would login to the now object browser only and you can always use your set minio admin. ``` bash mc admin user ls ``` These are NOT the access keys that every users can create themselves and you will get with ``` bash mc admin accesskey ls ``` ### Cant login, get error wrong region? ``` bash ErrorWithContext:The authorization header is malformed; the region is wrong; expecting 'us-east-1'. %!(EXTRA *errors.errorString=invalid login) ``` Set the console region variable `CONSOLE_MINIO_REGION` to the same as you have set on your minio server ``` bash docker run -p 9090:9090 -e CONSOLE_MINIO_SERVER=http://127.0.0.1:9000 -e CONSOLE_MINIO_REGION=your.region.here ghcr.io/georgmangold/console ``` ``` bash export CONSOLE_MINIO_REGION=eu-central-1 export CONSOLE_MINIO_SERVER=http://localhost:9000 ./console server ``` If you have changed your region on the minio config, you can also get it with ``` bash mc admin config get ALIAS region ``` ### Does OIDC works? Yes, see docs [OIDC](OIDC.md). ### Docker Volume Mount? There is no persistent data for the Console, everything is done with environment variables. The only one needed is the URL to the Minio server, i.e. `CONSOLE_MINIO_SERVER`. ### Can I use this Console as S3 Browser for other S3 Provider? No, this Console only works with minio . ``` minio-console-1 | ErrorWithContext:The s3 command you requested is not implemented. minio-console-1 | %!(EXTRA *errors.errorString=invalid login) ``` ================================================ FILE: docs/TLS.md ================================================ ## Start Console service with TLS: Copy your `public.crt` and `private.key` to `~/.console/certs`, then: ```sh ./console server 2021-01-19 02:36:08.893735 I | 2021/01/19 02:36:08 server.go:129: Serving console at http://[::]:9090 2021-01-19 02:36:08.893735 I | 2021/01/19 02:36:08 server.go:129: Serving console at https://[::]:9443 ``` For advanced users, `console` has support for multiple certificates to service clients through multiple domains. Following tree structure is expected for supporting multiple domains: ```sh certs/ │ ├─ public.crt ├─ private.key │ ├─ example.com/ │ │ │ ├─ public.crt │ └─ private.key └─ foobar.org/ │ ├─ public.crt └─ private.key ... ``` ## Connect Console to a Minio using TLS and a self-signed certificate Copy the MinIO `ca.crt` under `~/.console/certs/CAs`, then: ```sh export CONSOLE_MINIO_SERVER=https://localhost:9000 ./console server ``` You can verify that the apis work by doing the request on `localhost:9090/api/v1/...` ================================================ FILE: docs/ldap/LDAP.md ================================================ # LDAP authentication with Console ## Setup Console On Console you only need to set the Environment Variable `CONSOLE_LDAP_ENABLED=on` ``` export CONSOLE_LDAP_ENABLED=on ./console server ``` If this variable is set, a green icon will be displayed on the login screen. However, this does not indicate that the backend is accessible or correctly configured. ## Setup MinIO ``` export MINIO_ACCESS_KEY=minio export MINIO_SECRET_KEY=minio123 export MINIO_IDENTITY_LDAP_SERVER_ADDR='localhost:389' export MINIO_IDENTITY_LDAP_USERNAME_FORMAT='uid=%s,dc=example,dc=org' export MINIO_IDENTITY_LDAP_USERNAME_SEARCH_FILTER='(|(objectclass=posixAccount)(uid=%s))' export MINIO_IDENTITY_LDAP_TLS_SKIP_VERIFY=on export MINIO_IDENTITY_LDAP_SERVER_INSECURE=on ./minio server ~/Data ``` ## Example Setup with openLDAP Run openLDAP with docker. ``` $ docker run --rm -p 389:389 -p 636:636 --name my-openldap-container --detach osixia/openldap:1.3.0 ``` Run the `billy.ldif` file using `ldapadd` command to create a new user and assign it to a group. ``` $ docker cp console/docs/ldap/billy.ldif my-openldap-container:/container/service/slapd/assets/test/billy.ldif $ 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 containing ldap users and groups. ``` $ docker exec my-openldap-container ldapsearch -x -H ldap://localhost -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin ``` Query the ldap server again, this time filtering only for the user `billy`, you should see only 1 record. ``` $ docker exec my-openldap-container ldapsearch -x -H ldap://localhost -b uid=billy,dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin ``` ### Change the password for user billy Set the new password for `billy` to `minio123` and enter `admin` as the default `LDAP Password` ``` $ docker exec -it my-openldap-container /bin/bash # ldappasswd -H ldap://localhost -x -D "cn=admin,dc=example,dc=org" -W -S "uid=billy,dc=example,dc=org" New password: Re-enter new password: Enter LDAP Password: ``` ### Add the consoleAdmin policy to user billy on MinIO ``` $ cat > consoleAdmin.json << EOF { "Version": "2012-10-17", "Statement": [ { "Action": [ "admin:*" ], "Effect": "Allow", "Sid": "" }, { "Action": [ "s3:*" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::*" ], "Sid": "" } ] } EOF $ mc admin policy create myminio consoleAdmin consoleAdmin.json $ mc admin policy attach myminio consoleAdmin --user="uid=billy,dc=example,dc=org" ``` ================================================ FILE: docs/ldap/billy.ldif ================================================ # LDIF fragment to create group branch under root dn: uid=billy,dc=example,dc=org uid: billy cn: billy sn: 3 objectClass: top objectClass: posixAccount objectClass: inetOrgPerson loginShell: /bin/bash homeDirectory: /home/billy uidNumber: 14583102 gidNumber: 14564100 userPassword: {SSHA}j3lBh1Seqe4rqF1+NuWmjhvtAni1JC5A mail: billy@example.org gecos: Billy User # Create base group dn: ou=groups,dc=example,dc=org objectclass:organizationalunit ou: groups description: generic groups branch # create consoleAdmin group (this already exists on minio and have a policy of s3::*) dn: cn=consoleAdmin,ou=groups,dc=example,dc=org objectClass: top objectClass: posixGroup gidNumber: 678 # Assing group to new user dn: cn=consoleAdmin,ou=groups,dc=example,dc=org changetype: modify add: memberuid memberuid: billy ================================================ FILE: generator.config.js ================================================ module.exports = { hooks: { onInsertPathParam: (paramName) => `encodeURIComponent(${paramName})`, }, }; ================================================ FILE: go.mod ================================================ module github.com/minio/console go 1.26.2 tool github.com/go-swagger/go-swagger/cmd/swagger replace github.com/olekukonko/tablewriter => github.com/olekukonko/tablewriter v0.0.5 // needed for github.com/minio/mc require ( github.com/blang/semver/v4 v4.0.0 github.com/cheggaaa/pb/v3 v3.1.7 github.com/dustin/go-humanize v1.0.1 github.com/fatih/color v1.19.0 github.com/go-openapi/errors v0.22.7 github.com/go-openapi/loads v0.23.3 github.com/go-openapi/runtime v0.29.3 github.com/go-openapi/spec v0.22.4 github.com/go-openapi/strfmt v0.26.1 github.com/go-openapi/swag v0.25.5 github.com/go-openapi/validate v0.25.2 github.com/golang-jwt/jwt/v4 v4.5.2 github.com/google/uuid v1.6.0 github.com/jessevdk/go-flags v1.6.1 github.com/klauspost/compress v1.18.5 github.com/minio/cli v1.24.2 github.com/minio/highwayhash v1.0.4 github.com/minio/kes v0.24.0 github.com/minio/madmin-go/v3 v3.0.110 github.com/minio/mc v0.0.0-20251106162529-77f82e18b540 github.com/minio/minio-go/v7 v7.0.99 github.com/minio/selfupdate v0.6.0 github.com/minio/websocket v1.6.0 github.com/mitchellh/go-homedir v1.1.0 github.com/rs/xid v1.6.0 github.com/secure-io/sio-go v0.3.1 github.com/stretchr/testify v1.11.1 github.com/tidwall/gjson v1.18.0 // indirect github.com/unrolled/secure v1.17.0 golang.org/x/crypto v0.49.0 golang.org/x/net v0.52.0 golang.org/x/oauth2 v0.36.0 // Added to include security fix for // https://github.com/golang/go/issues/56152 golang.org/x/text v0.35.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) require github.com/minio/pkg/v3 v3.6.1 require ( aead.dev/mem v0.2.0 // indirect aead.dev/minisign v0.3.0 // indirect dario.cat/mergo v1.0.2 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/Masterminds/sprig/v3 v3.3.0 // indirect github.com/VividCortex/ewma v1.2.0 // indirect github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/charmbracelet/bubbles v1.0.0 // indirect github.com/charmbracelet/bubbletea v1.3.10 // indirect github.com/charmbracelet/colorprofile v0.4.3 // indirect github.com/charmbracelet/lipgloss v1.1.0 // indirect github.com/charmbracelet/x/ansi v0.11.6 // indirect github.com/charmbracelet/x/cellbuf v0.0.15 // indirect github.com/charmbracelet/x/term v0.2.2 // indirect github.com/cheggaaa/pb v1.0.29 // indirect github.com/clipperhouse/displaywidth v0.11.0 // indirect github.com/clipperhouse/uax29/v2 v2.7.0 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd/v22 v22.7.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/fatih/structs v1.1.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ini/ini v1.67.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-openapi/analysis v0.24.3 // indirect github.com/go-openapi/inflect v0.21.5 // indirect github.com/go-openapi/jsonpointer v0.22.5 // indirect github.com/go-openapi/jsonreference v0.21.5 // indirect github.com/go-openapi/swag/cmdutils v0.25.5 // indirect github.com/go-openapi/swag/conv v0.25.5 // indirect github.com/go-openapi/swag/fileutils v0.25.5 // indirect github.com/go-openapi/swag/jsonname v0.25.5 // indirect github.com/go-openapi/swag/jsonutils v0.25.5 // indirect github.com/go-openapi/swag/loading v0.25.5 // indirect github.com/go-openapi/swag/mangling v0.25.5 // indirect github.com/go-openapi/swag/netutils v0.25.5 // indirect github.com/go-openapi/swag/stringutils v0.25.5 // indirect github.com/go-openapi/swag/typeutils v0.25.5 // indirect github.com/go-openapi/swag/yamlutils v0.25.5 // indirect github.com/go-swagger/go-swagger v0.33.2 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/goccy/go-json v0.10.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/grafana/regexp v0.0.0-20250905093917-f7b3be9d1853 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jedib0t/go-pretty/v6 v6.7.8 // indirect github.com/juju/ratelimit v1.0.2 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/klauspost/crc32 v1.3.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lestrrat-go/blackmagic v1.0.4 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect github.com/lestrrat-go/httprc v1.0.6 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect github.com/lestrrat-go/jwx/v2 v2.1.6 // indirect github.com/lestrrat-go/option v1.0.1 // indirect github.com/lucasb-eyer/go-colorful v1.3.0 // indirect github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-ieproxy v0.0.12 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.21 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/minio/colorjson v1.0.8 // indirect github.com/minio/crc64nvme v1.1.1 // indirect github.com/minio/filepath v1.0.0 // indirect github.com/minio/kms-go/kes v0.3.1 // indirect github.com/minio/md5-simd v1.1.2 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.16.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oklog/ulid/v2 v2.1.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/pkg/xattr v0.4.12 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/posener/complete v1.2.3 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.5 // indirect github.com/prometheus/procfs v0.20.1 // indirect github.com/prometheus/prom2json v1.5.0 // indirect github.com/prometheus/prometheus v0.310.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/rjeczalik/notify v0.9.3 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/safchain/ethtool v0.7.0 // indirect github.com/sagikazarmark/locafero v0.10.0 // indirect github.com/segmentio/asm v1.2.1 // indirect github.com/shirou/gopsutil/v3 v3.24.5 // indirect github.com/shoenig/go-m1cpu v0.2.0 // indirect github.com/shopspring/decimal v1.4.0 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/spf13/afero v1.14.0 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/spf13/viper v1.20.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tidwall/match v1.2.0 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/tinylib/msgp v1.6.3 // indirect github.com/tklauser/go-sysconf v0.3.16 // indirect github.com/tklauser/numcpus v0.11.0 // indirect github.com/toqueteos/webbrowser v1.2.1 // indirect github.com/vbauerster/mpb/v8 v8.12.0 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect github.com/zeebo/xxh3 v1.1.0 // indirect go.etcd.io/etcd/api/v3 v3.6.8 // indirect go.etcd.io/etcd/client/pkg/v3 v3.6.8 // indirect go.etcd.io/etcd/client/v3 v3.6.8 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.1 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/mod v0.33.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/term v0.41.0 // indirect golang.org/x/tools v0.42.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c // indirect google.golang.org/grpc v1.79.3 // indirect google.golang.org/protobuf v1.36.11 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) ================================================ FILE: go.sum ================================================ aead.dev/mem v0.2.0 h1:ufgkESS9+lHV/GUjxgc2ObF43FLZGSemh+W+y27QFMI= aead.dev/mem v0.2.0/go.mod h1:4qj+sh8fjDhlvne9gm/ZaMRIX9EkmDrKOLwmyDtoMWM= aead.dev/minisign v0.2.0/go.mod h1:zdq6LdSd9TbuSxchxwhpA9zEb9YXcVGoE8JakuiGaIQ= aead.dev/minisign v0.3.0 h1:8Xafzy5PEVZqYDNP60yJHARlW1eOQtsKNp/Ph2c0vRA= aead.dev/minisign v0.3.0/go.mod h1:NLvG3Uoq3skkRMDuc3YHpWUTMTrSExqm+Ij73W13F6Y= dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow= github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3vj1nolY= github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc= github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E= github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw= github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4= github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q= github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q= github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY= github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30= github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8= github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ= github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI= github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q= github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ= github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk= github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI= github.com/cheggaaa/pb v1.0.29 h1:FckUN5ngEk2LpvuG0fw1GEFx6LtyY2pWI/Z2QgCnEYo= github.com/cheggaaa/pb v1.0.29/go.mod h1:W40334L7FMC5JKWldsTWbdGjLo0RxUKK73K+TuPxX30= github.com/cheggaaa/pb/v3 v3.1.7 h1:2FsIW307kt7A/rz/ZI2lvPO+v3wKazzE4K/0LtTWsOI= github.com/cheggaaa/pb/v3 v3.1.7/go.mod h1:/Ji89zfVPeC/u5j8ukD0MBPHt2bzTYp74lQ7KlgFWTQ= github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8= github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0= github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA= github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1 h1:5RVFMOWjMyRy8cARdy79nAmgYw3hK/4HUq48LQ6Wwqo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-openapi/analysis v0.24.3 h1:a1hrvMr8X0Xt69KP5uVTu5jH62DscmDifrLzNglAayk= github.com/go-openapi/analysis v0.24.3/go.mod h1:Nc+dWJ/FxZbhSow5Yh3ozg5CLJioB+XXT6MdLvJUsUw= github.com/go-openapi/errors v0.22.7 h1:JLFBGC0Apwdzw3484MmBqspjPbwa2SHvpDm0u5aGhUA= github.com/go-openapi/errors v0.22.7/go.mod h1://QW6SD9OsWtH6gHllUCddOXDL0tk0ZGNYHwsw4sW3w= github.com/go-openapi/inflect v0.21.5 h1:M2RCq6PPS3YbIaL7CXosGL3BbzAcmfBAT0nC3YfesZA= github.com/go-openapi/inflect v0.21.5/go.mod h1:GypUyi6bU880NYurWaEH2CmH84zFDNd+EhhmzroHmB4= github.com/go-openapi/jsonpointer v0.22.5 h1:8on/0Yp4uTb9f4XvTrM2+1CPrV05QPZXu+rvu2o9jcA= github.com/go-openapi/jsonpointer v0.22.5/go.mod h1:gyUR3sCvGSWchA2sUBJGluYMbe1zazrYWIkWPjjMUY0= github.com/go-openapi/jsonreference v0.21.5 h1:6uCGVXU/aNF13AQNggxfysJ+5ZcU4nEAe+pJyVWRdiE= github.com/go-openapi/jsonreference v0.21.5/go.mod h1:u25Bw85sX4E2jzFodh1FOKMTZLcfifd1Q+iKKOUxExw= github.com/go-openapi/loads v0.23.3 h1:g5Xap1JfwKkUnZdn+S0L3SzBDpcTIYzZ5Qaag0YDkKQ= github.com/go-openapi/loads v0.23.3/go.mod h1:NOH07zLajXo8y55hom0omlHWDVVvCwBM/S+csCK8LqA= github.com/go-openapi/runtime v0.29.3 h1:h5twGaEqxtQg40ePiYm9vFFH1q06Czd7Ot6ufdK0w/Y= github.com/go-openapi/runtime v0.29.3/go.mod h1:8A1W0/L5eyNJvKciqZtvIVQvYO66NlB7INMSZ9bw/oI= github.com/go-openapi/spec v0.22.4 h1:4pxGjipMKu0FzFiu/DPwN3CTBRlVM2yLf/YTWorYfDQ= github.com/go-openapi/spec v0.22.4/go.mod h1:WQ6Ai0VPWMZgMT4XySjlRIE6GP1bGQOtEThn3gcWLtQ= github.com/go-openapi/strfmt v0.26.1 h1:7zGCHji7zSYDC2tCXIusoxYQz/48jAf2q+sF6wXTG+c= github.com/go-openapi/strfmt v0.26.1/go.mod h1:Zslk5VZPOISLwmWTMBIS7oiVFem1o1EI6zULY8Uer7Y= github.com/go-openapi/swag v0.25.5 h1:pNkwbUEeGwMtcgxDr+2GBPAk4kT+kJ+AaB+TMKAg+TU= github.com/go-openapi/swag v0.25.5/go.mod h1:B3RT6l8q7X803JRxa2e59tHOiZlX1t8viplOcs9CwTA= github.com/go-openapi/swag/cmdutils v0.25.5 h1:yh5hHrpgsw4NwM9KAEtaDTXILYzdXh/I8Whhx9hKj7c= github.com/go-openapi/swag/cmdutils v0.25.5/go.mod h1:pdae/AFo6WxLl5L0rq87eRzVPm/XRHM3MoYgRMvG4A0= github.com/go-openapi/swag/conv v0.25.5 h1:wAXBYEXJjoKwE5+vc9YHhpQOFj2JYBMF2DUi+tGu97g= github.com/go-openapi/swag/conv v0.25.5/go.mod h1:CuJ1eWvh1c4ORKx7unQnFGyvBbNlRKbnRyAvDvzWA4k= github.com/go-openapi/swag/fileutils v0.25.5 h1:B6JTdOcs2c0dBIs9HnkyTW+5gC+8NIhVBUwERkFhMWk= github.com/go-openapi/swag/fileutils v0.25.5/go.mod h1:V3cT9UdMQIaH4WiTrUc9EPtVA4txS0TOmRURmhGF4kc= github.com/go-openapi/swag/jsonname v0.25.5 h1:8p150i44rv/Drip4vWI3kGi9+4W9TdI3US3uUYSFhSo= github.com/go-openapi/swag/jsonname v0.25.5/go.mod h1:jNqqikyiAK56uS7n8sLkdaNY/uq6+D2m2LANat09pKU= github.com/go-openapi/swag/jsonutils v0.25.5 h1:XUZF8awQr75MXeC+/iaw5usY/iM7nXPDwdG3Jbl9vYo= github.com/go-openapi/swag/jsonutils v0.25.5/go.mod h1:48FXUaz8YsDAA9s5AnaUvAmry1UcLcNVWUjY42XkrN4= github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.5 h1:SX6sE4FrGb4sEnnxbFL/25yZBb5Hcg1inLeErd86Y1U= github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.5/go.mod h1:/2KvOTrKWjVA5Xli3DZWdMCZDzz3uV/T7bXwrKWPquo= github.com/go-openapi/swag/loading v0.25.5 h1:odQ/umlIZ1ZVRteI6ckSrvP6e2w9UTF5qgNdemJHjuU= github.com/go-openapi/swag/loading v0.25.5/go.mod h1:I8A8RaaQ4DApxhPSWLNYWh9NvmX2YKMoB9nwvv6oW6g= github.com/go-openapi/swag/mangling v0.25.5 h1:hyrnvbQRS7vKePQPHHDso+k6CGn5ZBs5232UqWZmJZw= github.com/go-openapi/swag/mangling v0.25.5/go.mod h1:6hadXM/o312N/h98RwByLg088U61TPGiltQn71Iw0NY= github.com/go-openapi/swag/netutils v0.25.5 h1:LZq2Xc2QI8+7838elRAaPCeqJnHODfSyOa7ZGfxDKlU= github.com/go-openapi/swag/netutils v0.25.5/go.mod h1:lHbtmj4m57APG/8H7ZcMMSWzNqIQcu0RFiXrPUara14= github.com/go-openapi/swag/stringutils v0.25.5 h1:NVkoDOA8YBgtAR/zvCx5rhJKtZF3IzXcDdwOsYzrB6M= github.com/go-openapi/swag/stringutils v0.25.5/go.mod h1:PKK8EZdu4QJq8iezt17HM8RXnLAzY7gW0O1KKarrZII= github.com/go-openapi/swag/typeutils v0.25.5 h1:EFJ+PCga2HfHGdo8s8VJXEVbeXRCYwzzr9u4rJk7L7E= github.com/go-openapi/swag/typeutils v0.25.5/go.mod h1:itmFmScAYE1bSD8C4rS0W+0InZUBrB2xSPbWt6DLGuc= github.com/go-openapi/swag/yamlutils v0.25.5 h1:kASCIS+oIeoc55j28T4o8KwlV2S4ZLPT6G0iq2SSbVQ= github.com/go-openapi/swag/yamlutils v0.25.5/go.mod h1:Gek1/SjjfbYvM+Iq4QGwa/2lEXde9n2j4a3wI3pNuOQ= github.com/go-openapi/testify/enable/yaml/v2 v2.4.1 h1:NZOrZmIb6PTv5LTFxr5/mKV/FjbUzGE7E6gLz7vFoOQ= github.com/go-openapi/testify/enable/yaml/v2 v2.4.1/go.mod h1:r7dwsujEHawapMsxA69i+XMGZrQ5tRauhLAjV/sxg3Q= github.com/go-openapi/testify/v2 v2.4.1 h1:zB34HDKj4tHwyUQHrUkpV0Q0iXQ6dUCOQtIqn8hE6Iw= github.com/go-openapi/testify/v2 v2.4.1/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54= github.com/go-openapi/validate v0.25.2 h1:12NsfLAwGegqbGWr2CnvT65X/Q2USJipmJ9b7xDJZz0= github.com/go-openapi/validate v0.25.2/go.mod h1:Pgl1LpPPGFnZ+ys4/hTlDiRYQdI1ocKypgE+8Q8BLfY= github.com/go-swagger/go-swagger v0.33.2 h1:L1dxjjI29MKSWpRT0xXTOOaI3jzDWws2vR9oQmtYBZU= github.com/go-swagger/go-swagger v0.33.2/go.mod h1:1HGAWunq7SIuIPIWPHlZEDBURdzUk3BxSPr7x4dFHjc= github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU= github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/grafana/regexp v0.0.0-20250905093917-f7b3be9d1853 h1:cLN4IBkmkYZNnk7EAJ0BHIethd+J6LqxFNw5mSiI2bM= github.com/grafana/regexp v0.0.0-20250905093917-f7b3be9d1853/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs= github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jedib0t/go-pretty/v6 v6.7.8 h1:BVYrDy5DPBA3Qn9ICT+PokP9cvCv1KaHv2i+Hc8sr5o= github.com/jedib0t/go-pretty/v6 v6.7.8/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU= github.com/jessevdk/go-flags v1.6.1 h1:Cvu5U8UGrLay1rZfv/zP7iLpSHGUZ/Ou68T0iX1bBK4= github.com/jessevdk/go-flags v1.6.1/go.mod h1:Mk8T1hIAWpOiJiHa9rJASDK2UGWji0EuPGBnNLMooyc= github.com/juju/ratelimit v1.0.2 h1:sRxmtRiajbvrcLQT7S+JbqU0ntsb9W2yhSdNN8tWfaI= github.com/juju/ratelimit v1.0.2/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/klauspost/crc32 v1.3.0 h1:sSmTt3gUt81RP655XGZPElI0PelVTZ6YwCRnPSupoFM= github.com/klauspost/crc32 v1.3.0/go.mod h1:D7kQaZhnkX/Y0tstFGf8VUzv2UofNGqCjnC3zdHB0Hw= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lestrrat-go/blackmagic v1.0.4 h1:IwQibdnf8l2KoO+qC3uT4OaTWsW7tuRQXy9TRN9QanA= github.com/lestrrat-go/blackmagic v1.0.4/go.mod h1:6AWFyKNNj0zEXQYfTMPfZrAXUWUfTIZ5ECEUEJaijtw= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= github.com/lestrrat-go/httprc v1.0.6 h1:qgmgIRhpvBqexMJjA/PmwSvhNk679oqD1RbovdCGW8k= github.com/lestrrat-go/httprc v1.0.6/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= github.com/lestrrat-go/jwx/v2 v2.1.6 h1:hxM1gfDILk/l5ylers6BX/Eq1m/pnxe9NBwW6lVfecA= github.com/lestrrat-go/jwx/v2 v2.1.6/go.mod h1:Y722kU5r/8mV7fYDifjug0r8FK8mZdw0K0GpJw/l8pU= github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag= github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88 h1:PTw+yKnXcOFCR6+8hHTyWBeQ/P4Nb7dd4/0ohEcWQuM= github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-ieproxy v0.0.12 h1:OZkUFJC3ESNZPQ+6LzC3VJIFSnreeFLQyqvBWtvfL2M= github.com/mattn/go-ieproxy v0.0.12/go.mod h1:Vn+N61199DAnVeTgaF8eoB9PvLO8P3OBnG95ENh7B7c= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.21 h1:jJKAZiQH+2mIinzCJIaIG9Be1+0NR+5sz/lYEEjdM8w= github.com/mattn/go-runewidth v0.0.21/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/minio/cli v1.24.2 h1:J+fCUh9mhPLjN3Lj/YhklXvxj8mnyE/D6FpFduXJ2jg= github.com/minio/cli v1.24.2/go.mod h1:bYxnK0uS629N3Bq+AOZZ+6lwF77Sodk4+UL9vNuXhOY= github.com/minio/colorjson v1.0.8 h1:AS6gEQ1dTRYHmC4xuoodPDRILHP/9Wz5wYUGDQfPLpg= github.com/minio/colorjson v1.0.8/go.mod h1:wrs39G/4kqNlGjwqHvPlAnXuc2tlPszo6JKdSBCLN8w= github.com/minio/crc64nvme v1.1.1 h1:8dwx/Pz49suywbO+auHCBpCtlW1OfpcLN7wYgVR6wAI= github.com/minio/crc64nvme v1.1.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= github.com/minio/filepath v1.0.0 h1:fvkJu1+6X+ECRA6G3+JJETj4QeAYO9sV43I79H8ubDY= github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEXx9T/Bw= github.com/minio/highwayhash v1.0.4 h1:asJizugGgchQod2ja9NJlGOWq4s7KsAWr5XUc9Clgl4= github.com/minio/highwayhash v1.0.4/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/minio/kes v0.24.0 h1:iRAmVjgZ4vQV+V7wc88kADahGl1tA/USlfQzAAr+qh8= github.com/minio/kes v0.24.0/go.mod h1:rpgBd+s918q6zCclNLkYs//SDccXLCDv/xeM2/POzKk= github.com/minio/kms-go/kes v0.3.1 h1:K3sPFAvFbJx33XlCTUBnQo8JRmSZyDvT6T2/MQ2iC3A= github.com/minio/kms-go/kes v0.3.1/go.mod h1:Q9Ct0KUAuN9dH0hSVa0eva45Jg99cahbZpPxeqR9rOQ= github.com/minio/madmin-go/v3 v3.0.110 h1:FIYekj7YPc430ffpXFWiUtyut3qBt/unIAcDzJn9H5M= github.com/minio/madmin-go/v3 v3.0.110/go.mod h1:WOe2kYmYl1OIlY2DSRHVQ8j1v4OItARQ6jGyQqcCud8= github.com/minio/mc v0.0.0-20251106162529-77f82e18b540 h1:OAeamQLGQyf7sT/JEocLpAfMTU2Me5Jx3c1MjyS/mNo= github.com/minio/mc v0.0.0-20251106162529-77f82e18b540/go.mod h1:bqx15FhQpl5JfYU3yRM4iz2z2K6DiVSaPbj9P7trZZA= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v7 v7.0.99 h1:2vH/byrwUkIpFQFOilvTfaUpvAX3fEFhEzO+DR3DlCE= github.com/minio/minio-go/v7 v7.0.99/go.mod h1:EtGNKtlX20iL2yaYnxEigaIvj0G0GwSDnifnG8ClIdw= github.com/minio/mux v1.9.0 h1:dWafQFyEfGhJvK6AwLOt83bIG5bxKxKJnKMCi0XAaoA= github.com/minio/mux v1.9.0/go.mod h1:1pAare17ZRL5GpmNL+9YmqHoWnLmMZF9C/ioUCfy0BQ= github.com/minio/pkg/v3 v3.6.1 h1:gaNT80BS/iuIany5ylTkVmfN4s6UYY30OtImFv4GQA8= github.com/minio/pkg/v3 v3.6.1/go.mod h1:fYlexVD0GMD0XNeBHeefFI6YBE0Oo8oDbDPWm3Jd68I= github.com/minio/selfupdate v0.6.0 h1:i76PgT0K5xO9+hjzKcacQtO7+MjJ4JKA8Ak8XQ9DDwU= github.com/minio/selfupdate v0.6.0/go.mod h1:bO02GTIPCMQFTEvE5h4DjYB58bCoZ35XLeBf0buTDdM= github.com/minio/websocket v1.6.0 h1:CPvnQvNvlVaQmvw5gtJNyYQhg4+xRmrPNhBbv8BdpAE= github.com/minio/websocket v1.6.0/go.mod h1:COH1CePZfHT9Ec1O7vZjTlX5uEPpyYnrifPNbu665DM= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/oklog/ulid/v2 v2.1.1 h1:suPZ4ARWLOJLegGFiZZ1dFAkqzhMjL3J1TzI+5wHz8s= github.com/oklog/ulid/v2 v2.1.1/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/xattr v0.4.12 h1:rRTkSyFNTRElv6pkA3zpjHpQ90p/OdHQC1GmGh1aTjM= github.com/pkg/xattr v0.4.12/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= github.com/prometheus/prom2json v1.5.0 h1:WIcAOjLE1x476W3dUlmTL6E/e98CgVGuwwYusl6MPP8= github.com/prometheus/prom2json v1.5.0/go.mod h1:xPp6KDhCA30btxmqEfg/K3DAwgTIkp7TJKi4+7jaYd8= github.com/prometheus/prometheus v0.310.0 h1:iS0Uul/dHjy8ifBnqo3YEOhRxlTOWantRoDWwmIowwA= github.com/prometheus/prometheus v0.310.0/go.mod h1:rs6XoWKvgAStqxHxb2Twh1BR6rp7qw7fmUgW+gaXjbw= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rjeczalik/notify v0.9.3 h1:6rJAzHTGKXGj76sbRgDiDcYj/HniypXmSJo1SWakZeY= github.com/rjeczalik/notify v0.9.3/go.mod h1:gF3zSOrafR9DQEWSE8TjfI9NkooDxbyT4UgRGKZA0lc= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= github.com/safchain/ethtool v0.7.0 h1:rlJzfDetsVvT61uz8x1YIcFn12akMfuPulHtZjtb7Is= github.com/safchain/ethtool v0.7.0/go.mod h1:MenQKEjXdfkjD3mp2QdCk8B/hwvkrlOTm/FD4gTpFxQ= github.com/sagikazarmark/locafero v0.10.0 h1:FM8Cv6j2KqIhM2ZK7HZjm4mpj9NBktLgowT1aN9q5Cc= github.com/sagikazarmark/locafero v0.10.0/go.mod h1:Ieo3EUsjifvQu4NZwV5sPd4dwvu0OCgEQV7vjc9yDjw= github.com/secure-io/sio-go v0.3.1 h1:dNvY9awjabXTYGsTF1PiCySl9Ltofk9GA3VdWlo7rRc= github.com/secure-io/sio-go v0.3.1/go.mod h1:+xbkjDzPjwh4Axd07pRKSNriS9SCiYksWnZqdnfpQxs= github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0= github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI= github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk= github.com/shoenig/go-m1cpu v0.2.0 h1:t4GNqvPZ84Vjtpboo/kT3pIkbaK3vc+JIlD/Wz1zSFY= github.com/shoenig/go-m1cpu v0.2.0/go.mod h1:KkDOw6m3ZJQAPHbrzkZki4hnx+pDRR1Lo+ldA56wD5w= github.com/shoenig/test v1.7.0 h1:eWcHtTXa6QLnBvm0jgEabMRN/uJ4DMV3M8xUGgRkZmk= github.com/shoenig/test v1.7.0/go.mod h1:UxJ6u/x2v/TNs/LoLxBNJRV9DiwBBKYxXSyczsBHFoI= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA= github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4= github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM= github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI= github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw= github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ= github.com/toqueteos/webbrowser v1.2.1 h1:O7IsnnU7XQyJ1nHMRfAktUUJOAZD3aQyUVnxzhWphCg= github.com/toqueteos/webbrowser v1.2.1/go.mod h1:XWoZq4cyp9WeUeak7w7LXRUQf1F1ATJMir8RTqb4ayM= github.com/unrolled/secure v1.17.0 h1:Io7ifFgo99Bnh0J7+Q+qcMzWM6kaDPCA5FroFZEdbWU= github.com/unrolled/secure v1.17.0/go.mod h1:BmF5hyM6tXczk3MpQkFf1hpKSRqCyhqcbiQtiAF7+40= github.com/vbauerster/mpb/v8 v8.12.0 h1:+gneY3ifzc88tKDzOtfG8k8gfngCx615S2ZmFM4liWg= github.com/vbauerster/mpb/v8 v8.12.0/go.mod h1:V02YIuMVo301Y1VE9VtZlD8s84OMsk+EKN6mwvf/588= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs= github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s= go.etcd.io/etcd/api/v3 v3.6.8 h1:gqb1VN92TAI6G2FiBvWcqKtHiIjr4SU2GdXxTwyexbM= go.etcd.io/etcd/api/v3 v3.6.8/go.mod h1:qyQj1HZPUV3B5cbAL8scG62+fyz5dSxxu0w8pn28N6Q= go.etcd.io/etcd/client/pkg/v3 v3.6.8 h1:Qs/5C0LNFiqXxYf2GU8MVjYUEXJ6sZaYOz0zEqQgy50= go.etcd.io/etcd/client/pkg/v3 v3.6.8/go.mod h1:GsiTRUZE2318PggZkAo6sWb6l8JLVrnckTNfbG8PWtw= go.etcd.io/etcd/client/v3 v3.6.8 h1:B3G76t1UykqAOrbio7s/EPatixQDkQBevN8/mwiplrY= go.etcd.io/etcd/client/v3 v3.6.8/go.mod h1:MVG4BpSIuumPi+ELF7wYtySETmoTWBHVcDoHdVupwt8= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/otel v1.41.0 h1:YlEwVsGAlCvczDILpUXpIpPSL/VPugt7zHThEMLce1c= go.opentelemetry.io/otel v1.41.0/go.mod h1:Yt4UwgEKeT05QbLwbyHXEwhnjxNO6D8L5PQP51/46dE= go.opentelemetry.io/otel/metric v1.41.0 h1:rFnDcs4gRzBcsO9tS8LCpgR0dxg4aaxWlJxCno7JlTQ= go.opentelemetry.io/otel/metric v1.41.0/go.mod h1:xPvCwd9pU0VN8tPZYzDZV/BMj9CM9vs00GuBjeKhJps= go.opentelemetry.io/otel/sdk v1.41.0 h1:YPIEXKmiAwkGl3Gu1huk1aYWwtpRLeskpV+wPisxBp8= go.opentelemetry.io/otel/sdk v1.41.0/go.mod h1:ahFdU0G5y8IxglBf0QBJXgSe7agzjE4GiTJ6HT9ud90= go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8= go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew= go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa9TIN0= go.opentelemetry.io/otel/trace v1.41.0/go.mod h1:U1NU4ULCoxeDKc09yCWdWe+3QoyweJcISEVa1RBzOis= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= golang.org/x/exp v0.0.0-20260112195511-716be5621a96 h1:Z/6YuSHTLOHfNFdb8zVZomZr7cqNgTJvA8+Qz75D8gU= golang.org/x/exp v0.0.0-20260112195511-716be5621a96/go.mod h1:nzimsREAkjBCIEFtHiYkrJyT+2uy9YZJB7H1k68CXZU= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8= golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU= golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k= golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c h1:OyQPd6I3pN/9gDxz6L13kYGJgqkpdrAohJRBeXyxlgI= google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c/go.mod h1:X2gu9Qwng7Nn009s/r3RUxqkzQNqOrAy79bluY7ojIg= google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c h1:xgCzyF2LFIO/0X2UAoVRiXKU5Xg6VjToG4i2/ecSswk= google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= ================================================ FILE: hack/header.go.txt ================================================ // 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 . ================================================ FILE: hack/update-codegen.sh ================================================ #!/bin/bash set -o errexit set -o nounset set -o pipefail SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. GO111MODULE=off go get -d k8s.io/code-generator/... REPOSITORY=github.com/minio/console $GOPATH/src/k8s.io/code-generator/generate-groups.sh all \ $REPOSITORY/pkg/clientgen $REPOSITORY/pkg/apis networking.gke.io:v1beta2 \ --go-header-file $SCRIPT_ROOT/hack/header.go.txt ================================================ FILE: integration/access_rules_test.go ================================================ // 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 integration import ( "bytes" "encoding/json" "fmt" "log" "net/http" "testing" "time" "github.com/stretchr/testify/assert" ) func Test_AddAccessRuleAPI(t *testing.T) { assert := assert.New(t) AddBucket("testaccessruleadd", false, nil, nil, nil) type args struct { bucket string prefix string access string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Create Access Rule - Valid", args: args{ bucket: "testaccessruleadd", prefix: "/test/", access: "readonly", }, expectedStatus: 200, expectedError: nil, }, { name: "Add Access Rule - Invalid", args: args{ bucket: "testaccessruleadd", prefix: "/test/", access: "readonl", }, expectedStatus: 500, expectedError: nil, }, { name: "Add Access Rule - Invalid Bucket", args: args{ bucket: "fakebucket", prefix: "/test/", access: "readonl", }, expectedStatus: 404, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataPolicy["prefix"] = tt.args.prefix requestDataPolicy["access"] = tt.args.access requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", fmt.Sprintf("http://localhost:9090/api/v1/bucket/%s/access-rules", tt.args.bucket), requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") } }) } } func Test_GetAccessRulesAPI(t *testing.T) { assert := assert.New(t) AddBucket("testaccessruleget", false, nil, nil, nil) type args struct { bucket string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Get Access Rule - Valid", args: args{ bucket: "testaccessruleget", }, expectedStatus: 200, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", fmt.Sprintf("http://localhost:9090/api/v1/bucket/%s/access-rules", tt.args.bucket), nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") } }) } } func Test_DeleteAccessRuleAPI(t *testing.T) { assert := assert.New(t) AddBucket("testaccessruledelete", false, nil, nil, nil) type args struct { prefix string access string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Delete Access Rule - Valid", args: args{ prefix: "/test/", }, expectedStatus: 200, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataPolicy["prefix"] = tt.args.prefix requestDataPolicy["access"] = tt.args.access requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/bucket/testaccessruledelete/access-rules", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") } }) } } ================================================ FILE: integration/admin_api_integration_test.go ================================================ // 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 . // These tests are for AdminAPI Tag based on swagger-console.yml package integration import ( "bytes" "encoding/json" "fmt" "io" "log" "mime/multipart" "net/http" "os" "path" "testing" "time" "github.com/minio/console/models" "github.com/stretchr/testify/assert" ) func RestartService() (*http.Response, error) { /* Helper function to restart service HTTP Verb: POST URL: /api/v1/service/restart */ request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/service/restart", 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: 2000 * time.Second, // increased timeout since restart takes time, more than other APIs. } response, err := client.Do(request) return response, err } func GetNodes() (*http.Response, error) { /* Helper function to get nodes HTTP Verb: GET URL: /api/v1/nodes */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/nodes", 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: 2000 * time.Second, // increased timeout since restart takes time, more than other APIs. } response, err := client.Do(request) return response, err } func NotifyPostgres() (*http.Response, error) { /* Helper function to add Postgres Notification HTTP Verb: PUT URL: api/v1/configs/notify_postgres Body: { "key_values":[ { "key":"connection_string", "value":"user=postgres password=password host=localhost dbname=postgres port=5432 sslmode=disable" }, { "key":"table", "value":"accountsssss" }, { "key":"format", "value":"namespace" }, { "key":"queue_limit", "value":"10000" }, { "key":"comment", "value":"comment" } ] } */ Body := models.SetConfigRequest{ KeyValues: []*models.ConfigurationKV{ { Key: "connection_string", Value: "user=postgres password=password host=173.18.0.4 dbname=postgres port=5432 sslmode=disable", }, { Key: "table", Value: "accountsssss", }, { Key: "format", Value: "namespace", }, { Key: "queue_limit", Value: "10000", }, { Key: "comment", Value: "comment", }, }, } requestDataJSON, _ := json.Marshal(Body) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", "http://localhost:9090/api/v1/configs/notify_postgres", 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 TestNotifyPostgres(t *testing.T) { // Variables asserter := assert.New(t) // Test response, err := NotifyPostgres() finalResponse := inspectHTTPResponse(response) asserter.Nil(err) if err != nil { log.Println(err) asserter.Fail(finalResponse) return } if response != nil { asserter.Equal(200, response.StatusCode, finalResponse) } } func TestRestartService(t *testing.T) { asserter := assert.New(t) restartResponse, restartError := RestartService() asserter.Nil(restartError) if restartError != nil { log.Println(restartError) return } addObjRsp := inspectHTTPResponse(restartResponse) if restartResponse != nil { asserter.Equal( 204, restartResponse.StatusCode, addObjRsp, ) } } func ListPoliciesWithBucket(bucketName string) (*http.Response, error) { /* Helper function to List Policies With Given Bucket HTTP Verb: GET URL: /bucket-policy/{bucket} */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/bucket-policy/"+bucketName, 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 TestListPoliciesWithBucket(t *testing.T) { // Test Variables bucketName := "testlistpolicieswithbucket" asserter := assert.New(t) // Test response, err := ListPoliciesWithBucket(bucketName) asserter.Nil(err) if err != nil { log.Println(err) return } parsedResponse := inspectHTTPResponse(response) if response != nil { asserter.Equal( 200, response.StatusCode, parsedResponse, ) } } func ListUsersWithAccessToBucket(bucketName string) (*http.Response, error) { /* Helper function to List Users With Access to a Given Bucket HTTP Verb: GET URL: /bucket-users/{bucket} */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/bucket-users/"+bucketName, 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 TestListUsersWithAccessToBucket(t *testing.T) { // Test Variables bucketName := "testlistuserswithaccesstobucket1" asserter := assert.New(t) // Test response, err := ListUsersWithAccessToBucket(bucketName) asserter.Nil(err) if err != nil { log.Println(err) return } parsedResponse := inspectHTTPResponse(response) if response != nil { asserter.Equal( 200, response.StatusCode, parsedResponse, ) } } func TestGetNodes(t *testing.T) { asserter := assert.New(t) getNodesResponse, getNodesError := GetNodes() asserter.Nil(getNodesError) if getNodesError != nil { log.Println(getNodesError) return } addObjRsp := inspectHTTPResponse(getNodesResponse) if getNodesResponse != nil { asserter.Equal( 200, getNodesResponse.StatusCode, addObjRsp, ) } } func ArnList() (*http.Response, error) { /* Helper function to get arn list HTTP Verb: GET URL: /api/v1/admin/arns */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/admin/arns", 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 TestArnList(t *testing.T) { asserter := assert.New(t) resp, err := ArnList() asserter.Nil(err) if err != nil { log.Println(err) return } objRsp := inspectHTTPResponse(resp) if resp != nil { asserter.Equal( 200, resp.StatusCode, objRsp, ) } } func ExportConfig() (*http.Response, error) { request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/configs/export", nil) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) client := &http.Client{ Timeout: 2 * time.Second, } response, err := client.Do(request) return response, err } func ImportConfig() (*http.Response, error) { body := &bytes.Buffer{} writer := multipart.NewWriter(body) formFile, _ := writer.CreateFormFile("file", "sample-import-config.txt") fileDir, _ := os.Getwd() fileName := "sample-import-config.txt" filePath := path.Join(fileDir, fileName) file, _ := os.Open(filePath) io.Copy(formFile, file) writer.Close() request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/configs/import", bytes.NewReader(body.Bytes()), ) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Set("Content-Type", writer.FormDataContentType()) client := &http.Client{ Timeout: 2 * time.Second, } rsp, _ := client.Do(request) if rsp.StatusCode != http.StatusOK { log.Printf("Request failed with response code: %d", rsp.StatusCode) } return rsp, err } func TestExportConfig(t *testing.T) { asserter := assert.New(t) resp, err := ExportConfig() asserter.Nil(err) objRsp := inspectHTTPResponse(resp) if resp != nil { asserter.Equal( 200, resp.StatusCode, objRsp, ) } } func TestImportConfig(t *testing.T) { asserter := assert.New(t) resp, err := ImportConfig() asserter.Nil(err) objRsp := inspectHTTPResponse(resp) if resp != nil { asserter.Equal( 200, resp.StatusCode, objRsp, ) } } ================================================ FILE: integration/buckets_test.go ================================================ // 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 integration import ( "bytes" "encoding/json" "fmt" "io" "log" "net/http" "os" "strconv" "testing" "time" "github.com/go-openapi/loads" "github.com/minio/console/api" "github.com/minio/console/api/operations" ) var token 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 initConsoleServer() (*api.Server, error) { // os.Setenv("CONSOLE_MINIO_SERVER", "localhost:9000") swaggerSpec, err := loads.Embedded(api.SwaggerJSON, api.FlatSwaggerJSON) if err != nil { return nil, err } noLog := func(string, ...interface{}) { // nothing to log } // Initialize MinIO loggers api.LogInfo = noLog api.LogError = noLog consoleAPI := operations.NewConsoleAPI(swaggerSpec) consoleAPI.Logger = noLog server := api.NewServer(consoleAPI) // register all APIs server.ConfigureAPI() // api.GlobalRootCAs, api.GlobalPublicCerts, api.GlobalTLSCertsManager = globalRootCAs, globalPublicCerts, globalTLSCerts consolePort, _ := strconv.Atoi("9090") server.Host = "0.0.0.0" server.Port = consolePort api.Port = "9090" api.Hostname = "0.0.0.0" return server, nil } func TestMain(m *testing.M) { // start console server go func() { fmt.Println("start server") srv, err := initConsoleServer() if err != nil { log.Println(err) log.Println("init fail") return } srv.Serve() }() fmt.Println("sleeping") time.Sleep(2 * time.Second) client := &http.Client{ Timeout: 2 * time.Second, } // get login credentials requestData := map[string]string{ "accessKey": "minioadmin", "secretKey": "minioadmin", } requestDataJSON, _ := json.Marshal(requestData) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) 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() requestDataAdd := map[string]interface{}{ "name": "test1", } requestDataJSON, _ = json.Marshal(requestDataAdd) requestDataBody = bytes.NewReader(requestDataJSON) // delete bucket request, err = http.NewRequest("DELETE", "http://localhost:9090/api/v1/buckets/test1", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err = client.Do(request) if err != nil { log.Println(err) return } if response != nil { fmt.Println("DELETE StatusCode:", response.StatusCode) } os.Exit(code) } ================================================ FILE: integration/config_test.go ================================================ // 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 integration import ( "bytes" "encoding/json" "fmt" "log" "net/http" "testing" "time" "github.com/stretchr/testify/assert" ) func Test_ConfigAPI(t *testing.T) { assert := assert.New(t) tests := []struct { name string expectedStatus int expectedError error }{ { name: "Config - Valid", expectedStatus: 200, expectedError: nil, }, } client := &http.Client{ Timeout: 3 * time.Second, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/configs", nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } func Test_GetConfigAPI(t *testing.T) { assert := assert.New(t) type args struct { name string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Get Config - Valid", args: args{ name: "storage_class", }, expectedStatus: 200, expectedError: nil, }, { name: "Get Config - Invalid", args: args{ name: "asdf", }, expectedStatus: 404, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", fmt.Sprintf("http://localhost:9090/api/v1/configs/%s", tt.args.name), nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } func Test_SetConfigAPI(t *testing.T) { assert := assert.New(t) type args struct { name string keyValues []map[string]interface{} } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Set Config - Valid", args: args{ name: "region", keyValues: []map[string]interface{}{{"key": "name", "value": "testServer"}, {"key": "region", "value": "us-west-1"}}, }, expectedStatus: 200, expectedError: nil, }, { name: "Set Config - Invalid", args: args{ name: "regiontest", keyValues: []map[string]interface{}{{"key": "name", "value": "testServer"}, {"key": "region", "value": "us-west-1"}}, }, expectedStatus: 500, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataPolicy["key_values"] = tt.args.keyValues requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", fmt.Sprintf("http://localhost:9090/api/v1/configs/%s", tt.args.name), requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } func Test_ResetConfigAPI(t *testing.T) { assert := assert.New(t) type args struct { name string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Reset Config - Valid", args: args{ name: "region", }, expectedStatus: 200, expectedError: nil, }, { name: "Reset Config - Invalid", args: args{ name: "regiontest", }, expectedStatus: 500, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", fmt.Sprintf("http://localhost:9090/api/v1/configs/%s/reset", tt.args.name), requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } ================================================ FILE: integration/groups_test.go ================================================ // 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 integration import ( "bytes" "encoding/json" "fmt" "log" "net/http" "net/url" "testing" "time" "github.com/stretchr/testify/assert" ) func Test_AddGroupAPI(t *testing.T) { assert := assert.New(t) AddUser("member1", "testtest", []string{}, []string{"consoleAdmin"}) type args struct { group string members []string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Create Group - Valid", args: args{ group: "test", members: []string{"member1"}, }, expectedStatus: 201, expectedError: nil, }, { name: "Create Group - Invalid", args: args{ group: "test", members: []string{}, }, expectedStatus: 400, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataPolicy["group"] = tt.args.group requestDataPolicy["members"] = tt.args.members requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/groups", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") } }) } } func Test_GetGroupAPI(t *testing.T) { assert := assert.New(t) AddUser("member2", "testtest", []string{}, []string{"consoleAdmin"}) AddGroup("getgroup1", []string{"member2"}) type args struct { api string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Get Group - Valid", args: args{ api: "getgroup1", }, expectedStatus: 200, expectedError: nil, }, { name: "Get Group - Invalid", args: args{ api: "askfjalkd", }, expectedStatus: 500, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "GET", fmt.Sprintf("http://localhost:9090/api/v1/group/%s", url.PathEscape(tt.args.api)), requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") } }) } } func Test_ListGroupsAPI(t *testing.T) { assert := assert.New(t) tests := []struct { name string expectedStatus int expectedError error }{ { name: "Get Group - Valid", expectedStatus: 200, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/groups", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") } }) } } func Test_PutGroupsAPI(t *testing.T) { assert := assert.New(t) AddUser("member3", "testtest", []string{}, []string{"consoleAdmin"}) AddGroup("putgroup1", []string{}) type args struct { api string members []string status string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Put Group - Valid", args: args{ api: "putgroup1", members: []string{"member3"}, status: "enabled", }, expectedStatus: 200, expectedError: nil, }, { name: "Put Group - Invalid", args: args{ api: "gdgfdfgd", members: []string{"member3"}, status: "enabled", }, expectedStatus: 500, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataPolicy["members"] = tt.args.members requestDataPolicy["status"] = tt.args.status requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", fmt.Sprintf("http://localhost:9090/api/v1/group/%s", url.PathEscape(tt.args.api)), requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") } }) } } func Test_DeleteGroupAPI(t *testing.T) { assert := assert.New(t) AddGroup("grouptests1", []string{}) type args struct { api string } tests := []struct { name string args args expectedStatus int expectedError error verb string }{ { name: "Delete Group - Valid", args: args{ api: "grouptests1", }, verb: "DELETE", expectedStatus: 204, expectedError: nil, }, { name: "Delete Group - Invalid", args: args{ api: "grouptests12345", }, verb: "DELETE", expectedStatus: 404, expectedError: nil, }, { name: "Access Group After Delete - Invalid", args: args{ api: "grouptests1", }, verb: "GET", expectedStatus: 500, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( tt.verb, fmt.Sprintf("http://localhost:9090/api/v1/group/%s", url.PathEscape(tt.args.api)), requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") } }) } } ================================================ FILE: integration/inspect_test.go ================================================ package integration import ( "fmt" "log" "net/http" "testing" "time" "github.com/stretchr/testify/assert" ) func Inspect(volume string, file string, enc bool) (*http.Response, error) { requestURL := fmt.Sprintf("http://localhost:9090/api/v1/admin/inspect?volume=%s&file=%s&encrypt=%t", volume, file, enc) request, err := http.NewRequest( "GET", requestURL, 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 TestInspect(t *testing.T) { assert := assert.New(t) type args struct { volume string file string encrypt bool } // Inspect returns successful response always tests := []struct { name string args args expStatusCode int expectedError bool }{ { name: "Test Invalid Path", args: args{ volume: "/test-with-slash", file: "/test-with-slash", encrypt: false, }, expStatusCode: 200, expectedError: false, }, { name: "Test Invalid characters in Path", args: args{ volume: "//test", file: "//bucket", encrypt: false, }, expStatusCode: 200, expectedError: true, }, { name: "Test valid bucket", args: args{ volume: "test-bucket", file: "test.txt", encrypt: true, }, expStatusCode: 200, expectedError: false, }, { name: "Test Empty Path", // Un processable entity error args: args{ volume: "", file: "", encrypt: false, }, expStatusCode: 422, expectedError: false, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { resp, err := Inspect(tt.args.volume, tt.args.file, tt.args.encrypt) if tt.expectedError { assert.Nil(err) if err != nil { log.Println(err) return } } if resp != nil { assert.Equal( tt.expStatusCode, resp.StatusCode, ) } }) } } ================================================ FILE: integration/login_test.go ================================================ // 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 integration import ( "bytes" "encoding/json" "fmt" "io" "log" "net/http" "testing" "time" "github.com/minio/console/models" "github.com/stretchr/testify/assert" ) func TestLoginStrategy(t *testing.T) { assert := assert.New(t) // image for now: // minio: 9000 // console: 9090 client := &http.Client{ Timeout: 2 * time.Second, } // copy query params request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/login", nil) if err != nil { log.Println(err) return } response, err := client.Do(request) assert.Nil(err) if err != nil { log.Println(err) return } if response != nil { bodyBytes, _ := io.ReadAll(response.Body) loginDetails := models.LoginDetails{} err = json.Unmarshal(bodyBytes, &loginDetails) if err != nil { log.Println(err) } assert.Nil(err) assert.Equal(models.LoginDetailsLoginStrategyForm, loginDetails.LoginStrategy, "Login Details don't match") } } func TestLogout(t *testing.T) { assert := assert.New(t) // image for now: // minio: 9000 // console: 9090 client := &http.Client{ Timeout: 2 * time.Second, } requestData := map[string]string{ "accessKey": "minioadmin", "secretKey": "minioadmin", } requestDataJSON, _ := json.Marshal(requestData) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) assert.NotNil(response, "Login response is nil") assert.Nil(err, "Login errored out") var loginToken string for _, cookie := range response.Cookies() { if cookie.Name == "token" { loginToken = cookie.Value break } } if loginToken == "" { log.Println("authentication token not found in cookies response") return } logoutRequest := bytes.NewReader([]byte("{}")) request, err = http.NewRequest("POST", "http://localhost:9090/api/v1/logout", logoutRequest) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", loginToken)) request.Header.Add("Content-Type", "application/json") response, err = client.Do(request) assert.NotNil(response, "Logout response is nil") assert.Nil(err, "Logout errored out") assert.Equal(response.StatusCode, 200) } func TestLoginExtraSpaces(t *testing.T) { assert := assert.New(t) client := &http.Client{ Timeout: 2 * time.Second, } requestData := map[string]string{ "accessKey": " minioadmin ", "secretKey": "minioadmin", } requestDataJSON, _ := json.Marshal(requestData) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) assert.Equal(204, response.StatusCode, "Login request should succeed") assert.NotNil(response, "Login response is nil") assert.Nil(err, "Login errored out") } func TestBadLogin(t *testing.T) { assert := assert.New(t) client := &http.Client{ Timeout: 2 * time.Second, } requestData := map[string]string{ "accessKey": "minioadmin", "secretKey": "minioadminbad", } requestDataJSON, _ := json.Marshal(requestData) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) assert.Equal(401, response.StatusCode, "Login request not rejected") assert.NotNil(response, "Login response is nil") assert.Nil(err, "Login errored out") } ================================================ FILE: integration/objects_test.go ================================================ // 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 integration import ( "bytes" "context" "encoding/json" "fmt" "log" "math/rand" "net/http" "net/url" "strings" "testing" "time" "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/stretchr/testify/assert" ) func TestObjectGet(t *testing.T) { // for setup we'll create a bucket and upload a file endpoint := "localhost:9000" accessKeyID := "minioadmin" secretAccessKey := "minioadmin" // Initialize minio client object. minioClient, err := minio.New(endpoint, &minio.Options{ Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""), Secure: false, }) if err != nil { log.Fatalln(err) } bucketName := fmt.Sprintf("testbucket-%d", rand.Intn(1000-1)+1) err = minioClient.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1", ObjectLocking: true}) if err != nil { fmt.Println(err) } // upload a simple file fakeFile := "12345678" fileReader := strings.NewReader(fakeFile) _, err = minioClient.PutObject( context.Background(), bucketName, "myobject", fileReader, int64(len(fakeFile)), minio.PutObjectOptions{ContentType: "application/octet-stream"}) if err != nil { fmt.Println(err) return } _, err = minioClient.PutObject( context.Background(), bucketName, "myobject.jpg", fileReader, int64(len(fakeFile)), minio.PutObjectOptions{ContentType: "application/octet-stream"}) if err != nil { fmt.Println(err) return } assert := assert.New(t) type args struct { encodedPrefix string versionID string bytesRange string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Preview Object", args: args{ encodedPrefix: "myobject", }, expectedStatus: 200, expectedError: nil, }, { name: "Preview image", args: args{ encodedPrefix: "myobject.jpg", }, expectedStatus: 200, expectedError: nil, }, { name: "Get Range of bytes", args: args{ encodedPrefix: "myobject.jpg", bytesRange: "bytes=1-4", }, expectedStatus: 206, expectedError: nil, }, { name: "Get Range of bytes empty start", args: args{ encodedPrefix: "myobject.jpg", bytesRange: "bytes=-4", }, expectedStatus: 206, expectedError: nil, }, { name: "Get Invalid Range of bytes", args: args{ encodedPrefix: "myobject.jpg", bytesRange: "bytes=9-12", }, expectedStatus: 500, expectedError: nil, }, { name: "Get Larger Range of bytes empty start", args: args{ encodedPrefix: "myobject.jpg", bytesRange: "bytes=-12", }, expectedStatus: 206, expectedError: nil, }, { name: "Get invalid seek start Range of bytes", args: args{ encodedPrefix: "myobject.jpg", bytesRange: "bytes=12-16", }, expectedStatus: 500, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } destination := fmt.Sprintf("/api/v1/buckets/%s/objects/download?preview=true&prefix=%s&version_id=%s", url.PathEscape(bucketName), url.QueryEscape(tt.args.encodedPrefix), url.QueryEscape(tt.args.versionID)) finalURL := fmt.Sprintf("http://localhost:9090%s", destination) request, err := http.NewRequest("GET", finalURL, nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") if tt.args.bytesRange != "" { request.Header.Add("Range", tt.args.bytesRange) } response, err := client.Do(request) fmt.Printf("Console server Response: %v\nErr: %v\n", response, err) assert.NotNil(response, fmt.Sprintf("%s response object is nil", tt.name)) assert.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err)) if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, fmt.Sprintf("%s returned the wrong status code", tt.name)) } }) } } func downloadMultipleFiles(bucketName string, objects []string) (*http.Response, error) { requestURL := fmt.Sprintf("http://localhost:9090/api/v1/buckets/%s/objects/download-multiple", url.PathEscape(bucketName)) postReqParams, _ := json.Marshal(objects) reqBody := bytes.NewReader(postReqParams) request, err := http.NewRequest( "POST", requestURL, reqBody) if err != nil { log.Println(err) return nil, nil } 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 TestDownloadMultipleFiles(t *testing.T) { assert := assert.New(t) type args struct { bucketName string objectLis []string } tests := []struct { name string args args expectedStatus int expectedError bool }{ { name: "Test empty Bucket", args: args{ bucketName: "", }, expectedStatus: 400, expectedError: true, }, { name: "Test empty object list", args: args{ bucketName: "test-bucket", }, expectedStatus: 400, expectedError: true, }, { name: "Test with bucket and object list", args: args{ bucketName: "test-bucket", objectLis: []string{ "my-object.txt", "test-prefix/", "test-prefix/nested-prefix/", "test-prefix/nested-prefix/deep-nested/", }, }, expectedStatus: 200, expectedError: false, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { resp, err := downloadMultipleFiles(tt.args.bucketName, tt.args.objectLis) if tt.expectedError { assert.Nil(err) if err != nil { log.Println(err) return } } if resp != nil { assert.NotNil(resp) } }) } } ================================================ FILE: integration/policy_test.go ================================================ // 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 integration import ( "bytes" "encoding/json" "fmt" "io" "log" "net/http" "net/url" "testing" "time" "github.com/go-openapi/swag" "github.com/stretchr/testify/assert" ) func AddPolicy(name, definition string) (*http.Response, error) { /* This is an atomic function to add user and can be reused across different functions. */ client := &http.Client{ Timeout: 3 * time.Second, } requestDataAdd := map[string]interface{}{ "name": name, "policy": definition, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/policies", requestDataBody) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func SetPolicy(policies []string, entityName, entityType string) (*http.Response, error) { /* This is an atomic function to add user and can be reused across different functions. */ client := &http.Client{ Timeout: 3 * time.Second, } requestDataAdd := map[string]interface{}{ "name": policies, "entityType": entityType, "entityName": entityName, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", "http://localhost:9090/api/v1/set-policy", requestDataBody) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func Test_AddPolicyAPI(t *testing.T) { assert := assert.New(t) type args struct { api string name string policy *string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Create Policy - Valid", args: args{ api: "/policies", name: "test", policy: swag.String(` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`), }, expectedStatus: 201, expectedError: nil, }, { name: "Create Policy - Invalid", args: args{ api: "/policies", name: "test2", policy: swag.String(` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation" "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`), }, expectedStatus: 500, expectedError: nil, }, { name: "Create Policy - Space in Name", args: args{ api: "/policies", name: "space test", policy: swag.String(` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`), }, expectedStatus: 201, // Changed the expected status from 400 to 201, as spaces are now allowed in policy names. expectedError: nil, }, { name: "Create Policy - Reserved character in name", args: args{ api: "/policies", name: "space/test?", policy: swag.String(` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`), }, expectedStatus: 201, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataPolicy["name"] = tt.args.name if tt.args.policy != nil { requestDataPolicy["policy"] = *tt.args.policy } requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } func Test_SetPolicyAPI(t *testing.T) { assert := assert.New(t) AddUser("policyuser1", "testtest", []string{}, []string{"readwrite"}) AddGroup("testgroup123", []string{}) AddPolicy("setpolicytest", ` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`) type args struct { api string entityType string entityName string policyName []string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Set Policy - Valid", args: args{ api: "/set-policy", policyName: []string{"setpolicytest"}, entityType: "user", entityName: "policyuser1", }, expectedStatus: 204, expectedError: nil, }, { name: "Set Policy - Invalid", args: args{ api: "/set-policy", policyName: []string{"test3"}, entityType: "user", entityName: "policyuser1", }, expectedStatus: 500, expectedError: nil, }, { name: "Set Policy Group - Valid", args: args{ api: "/set-policy", policyName: []string{"setpolicytest"}, entityType: "group", entityName: "testgroup123", }, expectedStatus: 204, expectedError: nil, }, { name: "Set Policy Group - Invalid", args: args{ api: "/set-policy", policyName: []string{"test3"}, entityType: "group", entityName: "testgroup123", }, expectedStatus: 500, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataPolicy["entityName"] = tt.args.entityName requestDataPolicy["entityType"] = tt.args.entityType if tt.args.policyName != nil { requestDataPolicy["name"] = tt.args.policyName } requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } func Test_SetPolicyMultipleAPI(t *testing.T) { assert := assert.New(t) AddUser("policyuser2", "testtest", []string{}, []string{"readwrite"}) AddUser("policyuser3", "testtest", []string{}, []string{"readwrite"}) AddGroup("testgroup1234", []string{}) AddPolicy("setpolicytest2", ` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`) type args struct { api string users []string groups []string name []string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Set Policy - Valid", args: args{ api: "/set-policy-multi", name: []string{"setpolicytest2"}, users: []string{"policyuser2", "policyuser3"}, }, expectedStatus: 204, expectedError: nil, }, { name: "Set Policy - Invalid", args: args{ api: "/set-policy-multi", name: []string{"test3"}, users: []string{"policyuser2", "policyuser3"}, }, expectedStatus: 500, expectedError: nil, }, { name: "Set Policy Group - Valid", args: args{ api: "/set-policy-multi", name: []string{"setpolicytest2"}, groups: []string{"testgroup1234"}, }, expectedStatus: 204, expectedError: nil, }, { name: "Set Policy Group - Valid", args: args{ api: "/set-policy-multi", name: []string{"setpolicytest23"}, groups: []string{"testgroup1234"}, }, expectedStatus: 500, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } requestDataPolicy := map[string]interface{}{} requestDataPolicy["name"] = tt.args.name requestDataPolicy["users"] = tt.args.users requestDataPolicy["groups"] = tt.args.groups requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } func Test_ListPoliciesAPI(t *testing.T) { assert := assert.New(t) type args struct { api string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "List Policies", args: args{ api: "/policies", }, expectedStatus: 200, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } func Test_GetPolicyAPI(t *testing.T) { assert := assert.New(t) AddPolicy("test/policy?", ` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`) type args struct { api string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Get Policies - Invalid", args: args{ api: "test3", }, expectedStatus: 500, expectedError: nil, }, { name: "Get Policies - Valid", args: args{ api: "test/policy?", }, expectedStatus: 200, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", fmt.Sprintf("http://localhost:9090/api/v1/policy/%s", url.PathEscape(tt.args.api)), nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } func Test_PolicyListUsersAPI(t *testing.T) { assert := assert.New(t) AddUser("policyuser4", "testtest", []string{}, []string{"readwrite"}) AddPolicy("policylistusers", ` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`) SetPolicy([]string{"policylistusers"}, "policyuser4", "user") type args struct { api string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "List Users for Policy - Valid", args: args{ api: "/policies/" + url.PathEscape("policylistusers") + "/users", }, expectedStatus: 200, expectedError: nil, }, { name: "List Users for Policy - Invalid", args: args{ api: "/policies/" + url.PathEscape("test2") + "/users", }, expectedStatus: 404, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { bodyBytes, _ := io.ReadAll(response.Body) assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") if response.StatusCode == 200 { assert.Equal("[\"policyuser4\"]\n", string(bodyBytes)) } } }) } } func Test_PolicyListGroupsAPI(t *testing.T) { assert := assert.New(t) AddGroup("testgroup12345", []string{}) AddPolicy("policylistgroups", ` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`) SetPolicy([]string{"policylistgroups"}, "testgroup12345", "group") type args struct { api string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "List Users for Policy - Valid", args: args{ api: "/policies/" + url.PathEscape("policylistgroups") + "/groups", }, expectedStatus: 200, expectedError: nil, }, { name: "List Users for Policy - Invalid", args: args{ api: "/policies/" + url.PathEscape("test3") + "/groups", }, expectedStatus: 404, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { bodyBytes, _ := io.ReadAll(response.Body) assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") if response.StatusCode == 200 { assert.Equal("[\"testgroup12345\"]\n", string(bodyBytes)) } } }) } } func Test_DeletePolicyAPI(t *testing.T) { assert := assert.New(t) AddPolicy("testdelete", ` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`) type args struct { api string method string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Delete Policies - Valid", args: args{ api: "testdelete", method: "DELETE", }, expectedStatus: 204, expectedError: nil, }, { name: "Get Policy After Delete - Invalid", args: args{ api: "testdelete", method: "GET", }, expectedStatus: 500, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( tt.args.method, fmt.Sprintf("http://localhost:9090/api/v1/policy/%s", url.PathEscape(tt.args.api)), nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } func Test_GetAUserPolicyAPI(t *testing.T) { assert := assert.New(t) // Create a User with a Policy to use for testing groups := []string{} policies := []string{"readwrite"} _, err := AddUser("getuserpolicyuser", "secretKey", groups, policies) if err != nil { log.Println(err) return } type args struct { api string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Get User Policy - Invalid", args: args{ api: "/user/" + url.PathEscape("failname") + "/policies", }, expectedStatus: 401, expectedError: nil, }, { name: "Get User Policy - Valid", args: args{ api: "/user/" + url.PathEscape("getuserpolicyuser") + "/policies", }, expectedStatus: 200, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } ================================================ FILE: integration/profiling_test.go ================================================ // 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 integration import ( "archive/zip" "bytes" "fmt" "log" "net/http" "testing" "github.com/minio/websocket" "github.com/stretchr/testify/assert" ) func TestStartProfiling(t *testing.T) { testAssert := assert.New(t) tests := []struct { name string }{ { name: "start/stop profiling", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { files := map[string]bool{ "profile-127.0.0.1:9000-goroutines.txt": false, "profile-127.0.0.1:9000-goroutines-before.txt": false, "profile-127.0.0.1:9000-goroutines-before,debug=2.txt": false, "profile-127.0.0.1:9000-threads-before.pprof": false, "profile-127.0.0.1:9000-mem.pprof": false, "profile-127.0.0.1:9000-threads.pprof": false, "profile-127.0.0.1:9000-cpu.pprof": false, "profile-127.0.0.1:9000-mem-before.pprof": false, "profile-127.0.0.1:9000-block.pprof": false, "profile-127.0.0.1:9000-trace.trace": false, "profile-127.0.0.1:9000-mutex.pprof": false, "profile-127.0.0.1:9000-mutex-before.pprof": false, } wsDestination := "/ws/profile?types=cpu,mem,block,mutex,trace,threads,goroutines" wsFinalURL := fmt.Sprintf("ws://localhost:9090%s", wsDestination) ws, _, err := websocket.DefaultDialer.Dial(wsFinalURL, nil) if err != nil { log.Println(err) return } defer ws.Close() _, zipFileBytes, err := ws.ReadMessage() if err != nil { log.Println(err) return } filetype := http.DetectContentType(zipFileBytes) testAssert.Equal("application/zip", filetype) zipReader, err := zip.NewReader(bytes.NewReader(zipFileBytes), int64(len(zipFileBytes))) if err != nil { testAssert.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err)) } // Read all the files from zip archive for _, zipFile := range zipReader.File { files[zipFile.Name] = true } for k, v := range files { testAssert.Equal(true, v, fmt.Sprintf("%s : compressed file expected to have %v file inside", tt.name, k)) } }) } } ================================================ FILE: integration/sample-import-config.txt ================================================ subnet license= api_key= proxy= # callhome enable=off frequency=24h # site name= region= # api requests_max=0 requests_deadline=10s cluster_deadline=10s cors_allow_origin=* remote_transport_deadline=2h list_quorum=strict replication_priority=auto transition_workers=100 stale_uploads_cleanup_interval=6h stale_uploads_expiry=24h delete_cleanup_interval=5m disable_odirect=off gzip_objects=off # scanner speed=default # compression enable=off allow_encryption=off extensions=.txt,.log,.csv,.json,.tar,.xml,.bin mime_types=text/*,application/json,application/xml,binary/octet-stream # identity_openid enable= display_name= config_url= client_id= client_secret= claim_name=policy claim_userinfo= role_policy= claim_prefix= redirect_uri= redirect_uri_dynamic=off scopes= vendor= keycloak_realm= keycloak_admin_url= # identity_ldap server_addr= srv_record_name= user_dn_search_base_dn= user_dn_search_filter= group_search_filter= group_search_base_dn= tls_skip_verify=off server_insecure=off server_starttls=off lookup_bind_dn= lookup_bind_password= # identity_tls skip_verify=off # identity_plugin url= auth_token= role_policy= role_id= # policy_plugin url= auth_token= enable_http2=off # logger_webhook enable=off endpoint= auth_token= client_cert= client_key= queue_size=100000 # audit_webhook enable=off endpoint= auth_token= client_cert= client_key= queue_size=100000 # audit_kafka enable=off topic= brokers= sasl_username= sasl_password= sasl_mechanism=plain client_tls_cert= client_tls_key= tls_client_auth=0 sasl=off tls=off tls_skip_verify=off version= # notify_webhook enable=off endpoint= auth_token= queue_limit=0 queue_dir= client_cert= client_key= # notify_amqp enable=off url= exchange= exchange_type= routing_key= mandatory=off durable=off no_wait=off internal=off auto_deleted=off delivery_mode=0 publisher_confirms=off queue_limit=0 queue_dir= # notify_kafka enable=off topic= brokers= sasl_username= sasl_password= sasl_mechanism=plain client_tls_cert= client_tls_key= tls_client_auth=0 sasl=off tls=off tls_skip_verify=off queue_limit=0 queue_dir= version= # notify_mqtt enable=off broker= topic= password= username= qos=0 keep_alive_interval=0s reconnect_interval=0s queue_dir= queue_limit=0 # notify_nats enable=off address= subject= username= password= token= tls=off tls_skip_verify=off cert_authority= client_cert= client_key= ping_interval=0 jetstream=off streaming=off streaming_async=off streaming_max_pub_acks_in_flight=0 streaming_cluster_id= queue_dir= queue_limit=0 # notify_nsq enable=off nsqd_address= topic= tls=off tls_skip_verify=off queue_dir= queue_limit=0 # notify_mysql enable=off format=namespace dsn_string= table= queue_dir= queue_limit=0 max_open_connections=2 # notify_postgres enable=off format=namespace connection_string= table= queue_dir= queue_limit=0 max_open_connections=2 # notify_elasticsearch enable=off url= format=namespace index= queue_dir= queue_limit=0 username= password= # notify_redis enable=off format=namespace address= key= password= queue_dir= queue_limit=0 # etcd endpoints= path_prefix= coredns_path=/skydns client_cert= client_cert_key= # cache drives= exclude= expiry=90 quota=80 after=0 watermark_low=70 watermark_high=80 range=on commit= # storage_class standard= rrs=EC:1 # heal bitrotscan=off max_sleep=1s max_io=100 ================================================ FILE: integration/service_account_test.go ================================================ // 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 integration import ( "bytes" "encoding/json" "fmt" "log" "net/http" "net/url" "testing" "time" "github.com/go-openapi/swag" "github.com/stretchr/testify/assert" ) func TestAddServiceAccount(t *testing.T) { /* This is an atomic API Test to add a user service account, the intention is simple, add a user and make sure the response is 201 meaning that the user got added successfully. After test completion, it is expected that user is removed, so other tests like users.ts can run over clean data and we don't collide against it. */ assert := assert.New(t) client := &http.Client{ Timeout: 3 * time.Second, } // Add service account requestDataAddServiceAccount := map[string]interface{}{ "accessKey": "testuser1", "secretKey": "password", "policy": `{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`, } requestDataJSON, _ := json.Marshal(requestDataAddServiceAccount) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/service-account-credentials", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { fmt.Println("POST StatusCode:", response.StatusCode) assert.Equal(201, response.StatusCode, "Status Code is incorrect") } // {{baseUrl}}/user?name=proident velit // Investiga como se borra en el browser. request, err = http.NewRequest( "DELETE", "http://localhost:9090/api/v1/service-accounts/"+url.PathEscape("testuser1"), nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err = client.Do(request) if err != nil { log.Println(err) return } if response != nil { fmt.Println("DELETE StatusCode:", response.StatusCode) assert.Equal(204, response.StatusCode, "has to be 204 when delete user") } } func Test_ServiceAccountsAPI(t *testing.T) { assert := assert.New(t) type args struct { api string policy *string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Create Service Account - Default", args: args{ api: "/service-accounts", policy: nil, }, expectedStatus: 201, expectedError: nil, }, { name: "Create Service Account - Valid Policy", args: args{ api: "/service-accounts", policy: swag.String(` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`), }, expectedStatus: 201, expectedError: nil, }, { name: "Create Service Account - Invalid Policy", args: args{ api: "/service-accounts", policy: swag.String(` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation" "s3:GetObject" ], "Resource": [ "arn:aws:s3:::*" ] } ] }`), }, expectedStatus: 500, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } // Add service account requestDataPolicy := map[string]interface{}{} if tt.args.policy != nil { requestDataPolicy["policy"] = *tt.args.policy } requestDataJSON, _ := json.Marshal(requestDataPolicy) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") } }) } } func DeleteMultipleServiceAccounts(serviceAccounts []string) (*http.Response, error) { /* Helper function to delete multiple service accounts URL: http://localhost:9001/api/v1/service-accounts/delete-multi HTTP Verb: DELETE Data: ["U3RADB7J2ZZHELR0WSBB","ZE8H1HYOA6AVGKFCV6YU"] Response: Status Code: 204 No Content */ client := &http.Client{ Timeout: 3 * time.Second, } requestDataJSON, _ := json.Marshal(serviceAccounts) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/service-accounts/delete-multi", requestDataBody) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func TestCreateServiceAccountForUserWithCredentials(t *testing.T) { /* To test creation of service account for a user. */ // Test's variables userName := "testcreateserviceaccountforuserwithcredentials1" assert := assert.New(t) policy := "" // 1. Create the user groups := []string{} policies := []string{} secretKey := "testcreateserviceaccountforuserwithcrede" response, err := AddUser(userName, "secretKey", groups, policies) if err != nil { log.Println(err) return } if response != nil { fmt.Println("StatusCode:", response.StatusCode) assert.Equal(201, response.StatusCode, "Status Code is incorrect") } // Table driven testing part type args struct { accessKey string } tests := []struct { name string args args expectedStatus int }{ { name: "Service Account With Valid Credentials", expectedStatus: 201, args: args{ accessKey: "testcreateserviceacc", }, }, { name: "Service Account With Invalid Credentials", expectedStatus: 500, args: args{ accessKey: "tooooooooooooooooooooolongggggggggggggggggg", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // 2. Create the service account for the user createServiceAccountWithCredentialsResponse, createServiceAccountWithCredentialsError := CreateServiceAccountForUserWithCredentials( userName, policy, tt.args.accessKey, secretKey, ) if createServiceAccountWithCredentialsError != nil { log.Println(createServiceAccountWithCredentialsError) assert.Fail("Error in createServiceAccountWithCredentialsError") } if createServiceAccountWithCredentialsResponse != nil { fmt.Println("StatusCode:", createServiceAccountWithCredentialsResponse.StatusCode) assert.Equal( tt.expectedStatus, // different status expected per table's row createServiceAccountWithCredentialsResponse.StatusCode, inspectHTTPResponse(createServiceAccountWithCredentialsResponse), ) } // 3. Verify the service account for the user listOfAccountsResponse, listOfAccountsError := ReturnsAListOfServiceAccountsForAUser(userName) if listOfAccountsError != nil { log.Println(listOfAccountsError) assert.Fail("Error in listOfAccountsError") } finalResponse := inspectHTTPResponse(listOfAccountsResponse) if listOfAccountsResponse != nil { fmt.Println("StatusCode:", listOfAccountsResponse.StatusCode) assert.Equal( 200, listOfAccountsResponse.StatusCode, finalResponse, ) } }) } // Delete Multiple Service Accounts serviceAccount := make([]string, 1) serviceAccount[0] = "testcreateserviceacc" response, err = DeleteMultipleServiceAccounts(serviceAccount) if err != nil { log.Println(err) return } if response != nil { fmt.Println("StatusCode:", response.StatusCode) assert.Equal( 204, response.StatusCode, inspectHTTPResponse(response), ) } } ================================================ FILE: integration/tiers_test.go ================================================ // 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 integration import ( "fmt" "log" "net/http" "testing" "time" "github.com/stretchr/testify/assert" ) func TestTiersList(t *testing.T) { assert := assert.New(t) // image for now: // minio: 9000 // console: 9090 client := &http.Client{ Timeout: 2 * time.Second, } request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/admin/tiers", nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) assert.NotNil(response, "Tiers List response is nil") assert.Nil(err, "Tiers List errored out") assert.Equal(response.StatusCode, 200) } ================================================ FILE: integration/user_api_bucket_test.go ================================================ // 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 . // These tests are for UserAPI Tag based on swagger-console.yml package integration import ( "bytes" "context" "encoding/json" "errors" "fmt" "io" "log" "net/http" "net/url" "os" "strconv" "strings" "testing" "time" "github.com/minio/minio-go/v7" "github.com/minio/console/models" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/stretchr/testify/assert" ) type AddBucketOps struct { Name string Locking bool Versioning map[string]interface{} Quota map[string]interface{} Retention map[string]interface{} Endpoint *string UseToken *string } func AddBucket(name string, locking bool, versioning, quota, retention map[string]interface{}) (*http.Response, error) { return AddBucketWithOpts(&AddBucketOps{ Name: name, Locking: locking, Versioning: versioning, Quota: quota, Retention: retention, Endpoint: nil, }) } func AddBucketWithOpts(opts *AddBucketOps) (*http.Response, error) { /* This is an atomic function that we can re-use to create a bucket on any desired test. */ // Needed Parameters for API Call requestDataAdd := map[string]interface{}{ "name": opts.Name, "locking": opts.Locking, "versioning": opts.Versioning, "quota": opts.Quota, "retention": opts.Retention, } endpoint := "http://localhost:9090/api/v1/buckets" if opts.Endpoint != nil { endpoint = fmt.Sprintf("%s/api/v1/buckets", *opts.Endpoint) } // Creating the Call by adding the URL and Headers requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest("POST", endpoint, requestDataBody) if err != nil { log.Println(err) } if opts.UseToken != nil { request.Header.Add("Cookie", fmt.Sprintf("token=%s", *opts.UseToken)) } else { request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) } request.Header.Add("Content-Type", "application/json") // Performing the call client := &http.Client{ Timeout: 2 * time.Second, } response, err := client.Do(request) return response, err } func getTokenForEndpoint(endpoint string) string { var loginToken string client := &http.Client{ Timeout: 2 * time.Second, } // get login credentials requestData := map[string]string{ "accessKey": "minioadmin", "secretKey": "minioadmin", } requestDataJSON, _ := json.Marshal(requestData) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest("POST", fmt.Sprintf("%s/api/v1/login", endpoint), requestDataBody) if err != nil { log.Println(err) return "" } request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return "" } if response != nil { for _, cookie := range response.Cookies() { if cookie.Name == "token" { loginToken = cookie.Value break } } } return loginToken } func setupBucket(name string, locking bool, versioning, quota, retention map[string]interface{}, assert *assert.Assertions, expected int) bool { return setupBucketForEndpoint(name, locking, versioning, quota, retention, assert, expected, nil, nil) } func setupBucketForEndpoint(name string, locking bool, versioning, quota, retention map[string]interface{}, assert *assert.Assertions, expected int, endpoint, endpointToken *string) bool { /* The intention of this function is to return either true or false to reduce the code by performing the verification in one place only. */ // Verify if there is an error and return either true or false response, err := AddBucketWithOpts(&AddBucketOps{ Name: name, Locking: locking, Versioning: versioning, Quota: quota, Retention: retention, Endpoint: endpoint, UseToken: endpointToken, }) if err != nil { assert.Fail("Error adding the bucket") return false } if response != nil { if response.StatusCode >= 200 && response.StatusCode <= 299 { fmt.Println("setupBucketForEndpoint(): HTTP Status is in the 2xx range") return true } if response.StatusCode != expected { assert.Fail(inspectHTTPResponse(response)) return false } } return true } func ListBuckets() (*http.Response, error) { /* Helper function to list buckets HTTP Verb: GET {{baseUrl}}/buckets?sort_by=proident velit&offset=-5480083&limit=-5480083 */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets", 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 DeleteBucket(name string) (*http.Response, error) { /* Helper function to delete bucket. DELETE: {{baseUrl}}/buckets/:name */ request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/buckets/"+name, 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 BucketInfo(name string) (*http.Response, error) { /* Helper function to test Bucket Info End Point GET: {{baseUrl}}/buckets/:name */ bucketInformationRequest, bucketInformationError := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/"+name, nil) if bucketInformationError != nil { log.Println(bucketInformationError) } bucketInformationRequest.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) bucketInformationRequest.Header.Add("Content-Type", "application/json") client := &http.Client{ Timeout: 2 * time.Second, } response, err := client.Do(bucketInformationRequest) return response, err } func SetBucketRetention(bucketName, mode, unit string, validity int) (*http.Response, error) { /* Helper function to set bucket's retention PUT: {{baseUrl}}/buckets/:bucket_name/retention { "mode":"compliance", "unit":"years", "validity":2 } */ requestDataAdd := map[string]interface{}{ "mode": mode, "unit": unit, "validity": validity, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest("PUT", "http://localhost:9090/api/v1/buckets/"+bucketName+"/retention", 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 GetBucketRetention(bucketName string) (*http.Response, error) { /* Helper function to get the bucket's retention */ request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/retention", 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 PutObjectTags(bucketName, prefix string, tags map[string]string, versionID string) (*http.Response, error) { /* Helper function to put object's tags. PUT: /buckets/{bucket_name}/objects/tags?prefix=prefix { "tags": {} } */ requestDataAdd := map[string]interface{}{ "tags": tags, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", "http://localhost:9090/api/v1/buckets/"+ bucketName+"/objects/tags?prefix="+prefix+"&version_id="+versionID, 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 DeleteMultipleObjects(bucketName string, files []map[string]interface{}) (*http.Response, error) { /* Helper function to delete multiple objects in a container. POST: /buckets/{bucket_name}/delete-objects Example of the data being sent: [ { "path": "testdeletemultipleobjs1.txt", "versionID": "", "recursive": false }, { "path": "testdeletemultipleobjs2.txt", "versionID": "", "recursive": false }, ] */ requestDataJSON, _ := json.Marshal(files) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/buckets/"+bucketName+"/delete-objects", 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 DownloadObject(bucketName, path string) (*http.Response, error) { /* Helper function to download an object from a bucket. GET: {{baseUrl}}/buckets/bucketName/objects/download?prefix=file */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/objects/download?prefix="+ path, 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 UploadAnObject(bucketName, fileName string) (*http.Response, error) { /* Helper function to upload a file to a bucket for testing. POST {{baseUrl}}/buckets/:bucket_name/objects/upload */ boundary := "WebKitFormBoundaryWtayBM7t9EUQb8q3" boundaryStart := "------" + boundary + "\r\n" contentDispositionOne := "Content-Disposition: form-data; name=\"2\"; " contentDispositionTwo := "filename=\"" + fileName + "\"\r\n" contentType := "Content-Type: text/plain\r\n\r\na\n\r\n" boundaryEnd := "------" + boundary + "--\r\n" file := boundaryStart + contentDispositionOne + contentDispositionTwo + contentType + boundaryEnd arrayOfBytes := []byte(file) requestDataBody := bytes.NewReader(arrayOfBytes) apiURL := "http://localhost:9090/api/v1/buckets/" + url.PathEscape(bucketName) + "/objects/upload" + "?prefix=" + url.QueryEscape(fileName) request, err := http.NewRequest( "POST", apiURL, requestDataBody, ) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add( "Content-Type", "multipart/form-data; boundary=----"+boundary, ) client := &http.Client{ Timeout: 2 * time.Second, } response, err := client.Do(request) return response, err } func DeleteObject(bucketName, path string, recursive, allVersions bool) (*http.Response, error) { /* Helper function to delete an object from a given bucket. DELETE: {{baseUrl}}/buckets/bucketName/objects?path=Y2VzYXJpby50eHQ=&recursive=false&all_versions=false */ url := "http://localhost:9090/api/v1/buckets/" + url.PathEscape(bucketName) + "/objects?prefix=" + url.QueryEscape(path) + "&recursive=" + strconv.FormatBool(recursive) + "&all_versions=" + strconv.FormatBool(allVersions) request, err := http.NewRequest( "DELETE", url, 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 ListObjects(bucketName, prefix string, withVersions bool) (*http.Response, error) { /* Helper function to list objects in a bucket. GET: {{baseUrl}}/buckets/:bucket_name/objects */ request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/buckets/"+url.PathEscape(bucketName)+"/objects?prefix="+url.QueryEscape(prefix)+"&with_versions="+strconv.FormatBool(withVersions), 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 SharesAnObjectOnAUrl(bucketName, prefix, versionID, expires string) (*http.Response, error) { // Helper function to share an object on a url request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/objects/share?prefix="+prefix+"&version_id="+versionID+"&expires="+expires, 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 PutObjectsRetentionStatus(bucketName, prefix, versionID, mode, expires string, governanceBypass bool) (*http.Response, error) { requestDataAdd := map[string]interface{}{ "mode": mode, "expires": expires, "governance_bypass": governanceBypass, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) apiURL := "http://localhost:9090/api/v1/buckets/" + bucketName + "/objects/retention?prefix=" + prefix + "&version_id=" + versionID request, err := http.NewRequest( "PUT", apiURL, 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 GetsTheMetadataOfAnObject(bucketName, prefix string) (*http.Response, error) { /* Gets the metadata of an object GET {{baseUrl}}/buckets/:bucket_name/objects/metadata?prefix=proident velit */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/objects/metadata?prefix="+prefix, 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 PutBucketsTags(bucketName string, tags map[string]string) (*http.Response, error) { /* Helper function to put bucket's tags. PUT: {{baseUrl}}/buckets/:bucket_name/tags { "tags": {} } */ requestDataAdd := map[string]interface{}{ "tags": tags, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest("PUT", "http://localhost:9090/api/v1/buckets/"+bucketName+"/tags", 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 RestoreObjectToASelectedVersion(bucketName, prefix, versionID string) (*http.Response, error) { request, err := http.NewRequest( "PUT", "http://localhost:9090/api/v1/buckets/"+bucketName+"/objects/restore?prefix="+prefix+"&version_id="+versionID, 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 BucketSetPolicy(bucketName, access, definition string) (*http.Response, error) { /* Helper function to set policy on a bucket Name: Bucket Set Policy HTTP Verb: PUT URL: {{baseUrl}}/buckets/:name/set-policy Body: { "access": "PRIVATE", "definition": "dolo" } */ requestDataAdd := map[string]interface{}{ "access": access, "definition": definition, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", "http://localhost:9090/api/v1/buckets/"+bucketName+"/set-policy", 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 DeleteObjectsRetentionStatus(bucketName, prefix, versionID string) (*http.Response, error) { /* Helper function to Delete Object Retention Status DELETE: {{baseUrl}}/buckets/:bucket_name/objects/retention?prefix=proident velit&version_id=proident velit */ url := "http://localhost:9090/api/v1/buckets/" + bucketName + "/objects/retention?prefix=" + prefix + "&version_id=" + versionID request, err := http.NewRequest( "DELETE", url, 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 ListBucketEvents(bucketName string) (*http.Response, error) { /* Helper function to list bucket's events Name: List Bucket Events HTTP Verb: GET URL: {{baseUrl}}/buckets/:bucket_name/events */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/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 PutBucketQuota(bucketName string, enabled bool, quotaType string, amount int) (*http.Response, error) { /* Helper function to put bucket quota Name: Bucket Quota URL: {{baseUrl}}/buckets/:name/quota HTTP Verb: PUT Body: { "enabled": false, "quota_type": "fifo", "amount": 18462288 } */ requestDataAdd := map[string]interface{}{ "enabled": enabled, "quota_type": quotaType, "amount": amount, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", "http://localhost:9090/api/v1/buckets/"+bucketName+"/quota", 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 GetBucketQuota(bucketName string) (*http.Response, error) { /* Helper function to get bucket quota Name: Get Bucket Quota URL: {{baseUrl}}/buckets/:name/quota HTTP Verb: GET */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/quota", 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 PutObjectsLegalholdStatus(bucketName, prefix, status, versionID string) (*http.Response, error) { // Helper function to test "Put Object's legalhold status" end point requestDataAdd := map[string]interface{}{ "status": status, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) apiURL := "http://localhost:9090/api/v1/buckets/" + bucketName + "/objects/legalhold?prefix=" + prefix + "&version_id=" + versionID request, err := http.NewRequest( "PUT", apiURL, 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 TestPutObjectsLegalholdStatus(t *testing.T) { // Variables assert := assert.New(t) bucketName := "testputobjectslegalholdstatus" objName := "testputobjectslegalholdstatus.txt" objectNameEncoded := url.QueryEscape(objName) status := "enabled" // 1. Create bucket if !setupBucket(bucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 2. Add object uploadResponse, uploadError := UploadAnObject( bucketName, objName, ) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } addObjRsp := inspectHTTPResponse(uploadResponse) if uploadResponse != nil { assert.Equal( 200, uploadResponse.StatusCode, addObjRsp, ) } // Get versionID listResponse, _ := ListObjects(bucketName, "", true) bodyBytes, _ := io.ReadAll(listResponse.Body) listObjs := models.ListObjectsResponse{} err := json.Unmarshal(bodyBytes, &listObjs) if err != nil { log.Println(err) assert.Nil(err) } validVersionID := listObjs.Objects[0].VersionID type args struct { versionID string } tests := []struct { name string expectedStatus int args args }{ { name: "Valid VersionID when putting object's legal hold status", expectedStatus: 200, args: args{ versionID: validVersionID, }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // 3. Put Objects Legal Status putResponse, putError := PutObjectsLegalholdStatus( bucketName, objectNameEncoded, status, tt.args.versionID, ) if putError != nil { log.Println(putError) assert.Fail("Error putting object's legal hold status") } if putResponse != nil { assert.Equal( tt.expectedStatus, putResponse.StatusCode, inspectHTTPResponse(putResponse), ) } }) } } func TestGetBucketQuota(t *testing.T) { // Variables assert := assert.New(t) validBucket := "testgetbucketquota" // 1. Create bucket if !setupBucket(validBucket, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 2. Put Bucket Quota restResp, restErr := PutBucketQuota( validBucket, true, // enabled "hard", // quotaType 1099511627776, // amount ) assert.Nil(restErr) if restErr != nil { log.Println(restErr) return } finalResponse := inspectHTTPResponse(restResp) if restResp != nil { assert.Equal( 200, restResp.StatusCode, finalResponse, ) } // 3. Get Bucket Quota type args struct { bucketName string } tests := []struct { name string expectedStatus int args args }{ { name: "Valid bucket when getting quota", expectedStatus: 200, args: args{ bucketName: validBucket, }, }, { name: "Invalid bucket when getting quota", expectedStatus: 500, args: args{ bucketName: "askdaklsjdkasjdklasjdklasjdklajsdklasjdklasjdlkas", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { restResp, restErr := GetBucketQuota( tt.args.bucketName, ) assert.Nil(restErr) if restErr != nil { log.Println(restErr) return } finalResponse := inspectHTTPResponse(restResp) if restResp != nil { assert.Equal( tt.expectedStatus, restResp.StatusCode, finalResponse, ) } }) } } func TestPutBucketQuota(t *testing.T) { // Variables assert := assert.New(t) validBucket := "testputbucketquota" // 1. Create bucket if !setupBucket(validBucket, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 2. Put Bucket Quota type args struct { bucketName string } tests := []struct { name string expectedStatus int args args }{ { name: "Valid bucket when putting quota", expectedStatus: 200, args: args{ bucketName: validBucket, }, }, { name: "Invalid bucket when putting quota", expectedStatus: 500, args: args{ bucketName: "lksdjakldjklajdlkasjdklasjdkljaskdljaslkdjalksjdklasjdklajsdlkajs", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { restResp, restErr := PutBucketQuota( tt.args.bucketName, true, // enabled "hard", // quotaType 1099511627776, // amount ) assert.Nil(restErr) if restErr != nil { log.Println(restErr) return } finalResponse := inspectHTTPResponse(restResp) if restResp != nil { assert.Equal( tt.expectedStatus, restResp.StatusCode, finalResponse, ) } }) } } func TestListBucketEvents(t *testing.T) { // Variables assert := assert.New(t) validBucket := "testlistbucketevents" // 1. Create bucket if !setupBucket(validBucket, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 2. List bucket events type args struct { bucketName string } tests := []struct { name string expectedStatus int args args }{ { name: "Valid bucket when listing events", expectedStatus: 200, args: args{ bucketName: validBucket, }, }, { name: "Invalid bucket when listing events", expectedStatus: 500, args: args{ bucketName: "alksdjalksdjklasjdklasjdlkasjdkljaslkdjaskldjaklsjd", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { restResp, restErr := ListBucketEvents( tt.args.bucketName, ) assert.Nil(restErr) if restErr != nil { log.Println(restErr) return } finalResponse := inspectHTTPResponse(restResp) if restResp != nil { assert.Equal( tt.expectedStatus, restResp.StatusCode, finalResponse, ) } }) } } func TestDeleteObjectsRetentionStatus(t *testing.T) { // Variables assert := assert.New(t) bucketName := "testdeleteobjectslegalholdstatus" fileName := "testdeleteobjectslegalholdstatus.txt" validPrefix := url.QueryEscape(fileName) // 1. Create bucket if !setupBucket(bucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 2. Add object uploadResponse, uploadError := UploadAnObject( bucketName, fileName, ) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } addObjRsp := inspectHTTPResponse(uploadResponse) if uploadResponse != nil { assert.Equal( 200, uploadResponse.StatusCode, addObjRsp, ) } // Get versionID listResponse, _ := ListObjects(bucketName, validPrefix, true) bodyBytes, _ := io.ReadAll(listResponse.Body) listObjs := models.ListObjectsResponse{} err := json.Unmarshal(bodyBytes, &listObjs) if err != nil { log.Println(err) assert.Nil(err) } versionID := listObjs.Objects[0].VersionID // 3. Put Objects Retention Status putResponse, putError := PutObjectsRetentionStatus( bucketName, validPrefix, versionID, "governance", "2033-01-11T23:59:59Z", false, ) if putError != nil { log.Println(putError) assert.Fail("Error putting the object retention status") } if putResponse != nil { assert.Equal( 200, putResponse.StatusCode, inspectHTTPResponse(putResponse), ) } type args struct { prefix string } tests := []struct { name string expectedStatus int args args }{ { name: "Valid prefix when deleting object's retention status", expectedStatus: 200, args: args{ prefix: validPrefix, }, }, { name: "Invalid prefix when deleting object's retention status", expectedStatus: 500, args: args{ prefix: "fakefile", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // 4. Delete Objects Retention Status putResponse, putError := DeleteObjectsRetentionStatus( bucketName, tt.args.prefix, versionID, ) if putError != nil { log.Println(putError) assert.Fail("Error deleting the object retention status") } if putResponse != nil { assert.Equal( tt.expectedStatus, putResponse.StatusCode, inspectHTTPResponse(putResponse), ) } }) } } func TestBucketSetPolicy(t *testing.T) { // Variables assert := assert.New(t) validBucketName := "testbucketsetpolicy" // 1. Create bucket if !setupBucket(validBucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 2. Set a bucket's policy using table driven tests type args struct { bucketName string } tests := []struct { name string expectedStatus int args args }{ { name: "Valid bucket when setting a policy", expectedStatus: 200, args: args{ bucketName: validBucketName, }, }, { name: "Invalid bucket when setting a bucket", expectedStatus: 500, args: args{ bucketName: "wlkjsdkalsjdklajsdlkajsdlkajsdlkajsdklajsdkljaslkdjaslkdj", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // Set Policy restResp, restErr := BucketSetPolicy( tt.args.bucketName, "PUBLIC", "", ) assert.Nil(restErr) if restErr != nil { log.Println(restErr) return } finalResponse := inspectHTTPResponse(restResp) if restResp != nil { assert.Equal( tt.expectedStatus, restResp.StatusCode, finalResponse, ) } }) } } func TestRestoreObjectToASelectedVersion(t *testing.T) { // Variables assert := assert.New(t) bucketName := "testrestoreobjectstoselectedversion" fileName := "testrestoreobjectstoselectedversion.txt" validPrefix := url.QueryEscape(fileName) // 1. Create bucket if !setupBucket(bucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 2. Add object uploadResponse, uploadError := UploadAnObject( bucketName, fileName, ) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } addObjRsp := inspectHTTPResponse(uploadResponse) if uploadResponse != nil { assert.Equal( 200, uploadResponse.StatusCode, addObjRsp, ) } // 3. Get versionID listResponse, _ := ListObjects(bucketName, validPrefix, true) bodyBytes, _ := io.ReadAll(listResponse.Body) listObjs := models.ListObjectsResponse{} err := json.Unmarshal(bodyBytes, &listObjs) if err != nil { log.Println(err) assert.Nil(err) } versionID := listObjs.Objects[0].VersionID type args struct { prefix string } tests := []struct { name string expectedStatus int args args }{ { name: "Valid prefix when restoring object", expectedStatus: 200, args: args{ prefix: validPrefix, }, }, { name: "Invalid prefix when restoring object", expectedStatus: 500, args: args{ prefix: "fakefile", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // 4. Restore Object to a selected version restResp, restErr := RestoreObjectToASelectedVersion( bucketName, tt.args.prefix, versionID, ) assert.Nil(restErr) if restErr != nil { log.Println(restErr) return } finalResponse := inspectHTTPResponse(restResp) if restResp != nil { assert.Equal( tt.expectedStatus, restResp.StatusCode, finalResponse, ) } }) } } func TestPutBucketsTags(t *testing.T) { // Focused test for "Put Bucket's tags" endpoint // 1. Create the bucket assert := assert.New(t) validBucketName := "testputbuckettags1" if !setupBucket(validBucketName, false, nil, nil, nil, assert, 200) { return } type args struct { bucketName string } tests := []struct { name string expectedStatus int args args }{ { name: "Put a tag to a valid bucket", expectedStatus: 200, args: args{ bucketName: validBucketName, }, }, { name: "Put a tag to an invalid bucket", expectedStatus: 500, args: args{ bucketName: "invalidbucketname", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // 2. Add a tag to the bucket tags := make(map[string]string) tags["tag2"] = "tag2" putBucketTagResponse, putBucketTagError := PutBucketsTags( tt.args.bucketName, tags) if putBucketTagError != nil { log.Println(putBucketTagError) assert.Fail("Error putting the bucket's tags") return } if putBucketTagResponse != nil { assert.Equal( tt.expectedStatus, putBucketTagResponse.StatusCode, inspectHTTPResponse(putBucketTagResponse)) } }) } } func TestGetsTheMetadataOfAnObject(t *testing.T) { // Vars assert := assert.New(t) bucketName := "testgetsthemetadataofanobject" fileName := "testshareobjectonurl.txt" validPrefix := url.QueryEscape(fileName) tags := make(map[string]string) tags["tag"] = "testputobjecttagbucketonetagone" // 1. Create the bucket if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { return } // 2. Upload the object to the bucket uploadResponse, uploadError := UploadAnObject(bucketName, fileName) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } if uploadResponse != nil { assert.Equal( 200, uploadResponse.StatusCode, inspectHTTPResponse(uploadResponse), ) } type args struct { prefix string } tests := []struct { name string expectedStatus int args args }{ { name: "Get metadata with valid prefix", expectedStatus: 200, args: args{ prefix: validPrefix, }, }, { name: "Get metadata with invalid prefix", expectedStatus: 500, args: args{ prefix: "invalidprefix", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // 3. Get the metadata from an object getRsp, getErr := GetsTheMetadataOfAnObject( bucketName, tt.args.prefix) assert.Nil(getErr) if getErr != nil { log.Println(getErr) return } if getRsp != nil { assert.Equal( tt.expectedStatus, getRsp.StatusCode, inspectHTTPResponse(getRsp), ) } }) } } func TestPutObjectsRetentionStatus(t *testing.T) { // Variables assert := assert.New(t) bucketName := "testputobjectsretentionstatus" fileName := "testputobjectsretentionstatus.txt" prefix := url.QueryEscape(fileName) // 1. Create bucket if !setupBucket(bucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 2. Add object uploadResponse, uploadError := UploadAnObject( bucketName, fileName, ) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } addObjRsp := inspectHTTPResponse(uploadResponse) if uploadResponse != nil { assert.Equal( 200, uploadResponse.StatusCode, addObjRsp, ) } // Get versionID listResponse, _ := ListObjects(bucketName, prefix, true) bodyBytes, _ := io.ReadAll(listResponse.Body) listObjs := models.ListObjectsResponse{} err := json.Unmarshal(bodyBytes, &listObjs) if err != nil { log.Println(err) assert.Nil(err) } validVersionID := listObjs.Objects[0].VersionID type args struct { versionID string } tests := []struct { name string expectedStatus int args args }{ { name: "Valid VersionID when putting object's retention status", expectedStatus: 200, args: args{ versionID: url.QueryEscape(validVersionID), }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // 3. Put Objects Legal Status putResponse, putError := PutObjectsRetentionStatus( bucketName, prefix, tt.args.versionID, "compliance", "2033-01-13T23:59:59Z", false, ) if putError != nil { log.Println(putError) assert.Fail("Error putting the object's retention status") } if putResponse != nil { assert.Equal( tt.expectedStatus, putResponse.StatusCode, inspectHTTPResponse(putResponse), ) } }) } } func TestShareObjectOnURL(t *testing.T) { /* Test to share an object via URL */ // Vars assert := assert.New(t) bucketName := "testshareobjectonurl" fileName := "testshareobjectonurl.txt" validPrefix := url.QueryEscape(fileName) tags := make(map[string]string) tags["tag"] = "testputobjecttagbucketonetagone" versionID := "null" // 1. Create the bucket if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { return } // 2. Upload the object to the bucket uploadResponse, uploadError := UploadAnObject(bucketName, fileName) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } if uploadResponse != nil { assert.Equal( 200, uploadResponse.StatusCode, inspectHTTPResponse(uploadResponse), ) } type args struct { prefix string } tests := []struct { name string expectedStatus int args args }{ { name: "Share File with valid prefix", expectedStatus: 200, args: args{ prefix: validPrefix, }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // 3. Share the object on a URL shareResponse, shareError := SharesAnObjectOnAUrl(bucketName, tt.args.prefix, versionID, "604800s") assert.Nil(shareError) if shareError != nil { log.Println(shareError) return } finalResponse := inspectHTTPResponse(shareResponse) if shareResponse != nil { assert.Equal( tt.expectedStatus, shareResponse.StatusCode, finalResponse, ) } }) } } func TestListObjects(t *testing.T) { /* To test list objects end point. */ // Test's variables assert := assert.New(t) bucketName := "testlistobjecttobucket1" fileName := "testlistobjecttobucket1.txt" // 1. Create the bucket if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { return } // 2. Upload the object to the bucket uploadResponse, uploadError := UploadAnObject(bucketName, fileName) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } if uploadResponse != nil { assert.Equal(200, uploadResponse.StatusCode, inspectHTTPResponse(uploadResponse)) } // 3. List the object listResponse, listError := ListObjects(bucketName, "", false) assert.Nil(listError) if listError != nil { log.Println(listError) return } finalResponse := inspectHTTPResponse(listResponse) if listResponse != nil { assert.Equal(200, listResponse.StatusCode, finalResponse) } // 4. Verify the object was listed assert.True( strings.Contains(finalResponse, "testlistobjecttobucket1"), finalResponse) } func TestDeleteObject(t *testing.T) { /* Test to delete an object from a given bucket. */ // Variables assert := assert.New(t) bucketName := "testdeleteobjectbucket1" fileName := "testdeleteobjectfile" numberOfFiles := 2 // 1. Create bucket if !setupBucket(bucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 2. Add two objects to the bucket created. for i := 1; i <= numberOfFiles; i++ { uploadResponse, uploadError := UploadAnObject( bucketName, fileName+strconv.Itoa(i)+".txt") assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } if uploadResponse != nil { assert.Equal(200, uploadResponse.StatusCode, inspectHTTPResponse(uploadResponse)) } } objPathFull := fileName + "1.txt" // would be encoded in DeleteObject util method. // 3. Delete only one object from the bucket. deleteResponse, deleteError := DeleteObject(bucketName, objPathFull, false, false) assert.Nil(deleteError) if deleteError != nil { log.Println(deleteError) return } if deleteResponse != nil { assert.Equal(200, deleteResponse.StatusCode, inspectHTTPResponse(deleteResponse)) } // 4. List the objects in the bucket and make sure the object is gone listResponse, listError := ListObjects(bucketName, "", false) assert.Nil(listError) if listError != nil { log.Println(listError) return } finalResponse := inspectHTTPResponse(listResponse) if listResponse != nil { assert.Equal(200, listResponse.StatusCode, finalResponse) } // Expected only one file: "testdeleteobjectfile2.txt" // "testdeleteobjectfile1.txt" should be gone by now. assert.True( strings.Contains( finalResponse, "testdeleteobjectfile2.txt"), finalResponse) // Still there assert.False( strings.Contains( finalResponse, "testdeleteobjectfile1.txt"), finalResponse) // Gone } func TestUploadObjectToBucket(t *testing.T) { /* Function to test the upload of an object to a bucket. */ // Test's variables assert := assert.New(t) bucketName := "testuploadobjecttobucket1" fileName := "sample.txt" // 1. Create the bucket if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { return } // 2. Upload the object to the bucket uploadResponse, uploadError := UploadAnObject(bucketName, fileName) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } // 3. Verify the object was uploaded finalResponse := inspectHTTPResponse(uploadResponse) if uploadResponse != nil { assert.Equal(200, uploadResponse.StatusCode, finalResponse) } } func TestDownloadObject(t *testing.T) { /* Test to download an object from a given bucket. */ // Vars assert := assert.New(t) bucketName := "testdownloadobjbucketone" fileName := "testdownloadobjectfilenameone" path := url.QueryEscape(fileName) workingDirectory, getWdErr := os.Getwd() if getWdErr != nil { assert.Fail("Couldn't get the directory") } // 1. Create the bucket if !setupBucket(bucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 2. Upload an object to the bucket uploadResponse, uploadError := UploadAnObject(bucketName, fileName) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } if uploadResponse != nil { assert.Equal( 200, uploadResponse.StatusCode, inspectHTTPResponse(uploadResponse), ) } // 3. Download the object from the bucket downloadResponse, downloadError := DownloadObject(bucketName, path) assert.Nil(downloadError) if downloadError != nil { log.Println(downloadError) assert.Fail("Error downloading the object") return } finalResponse := inspectHTTPResponse(downloadResponse) if downloadResponse != nil { assert.Equal( 200, downloadResponse.StatusCode, finalResponse, ) } // 4. Verify the file was downloaded files, err := os.ReadDir(workingDirectory) if err != nil { log.Fatal(err) } for _, file := range files { fmt.Println(file.Name(), file.IsDir()) } if _, err := os.Stat(workingDirectory); errors.Is(err, os.ErrNotExist) { // path/to/whatever does not exist assert.Fail("File wasn't downloaded") } } func TestDeleteMultipleObjects(t *testing.T) { /* Function to test the deletion of multiple objects from a given bucket. */ // Variables assert := assert.New(t) bucketName := "testdeletemultipleobjsbucket1" numberOfFiles := 5 fileName := "testdeletemultipleobjs" // 1. Create a bucket for this particular test if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { return } // 2. Add couple of objects to this bucket for i := 1; i <= numberOfFiles; i++ { uploadResponse, uploadError := UploadAnObject( bucketName, fileName+strconv.Itoa(i)+".txt") assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } if uploadResponse != nil { assert.Equal(200, uploadResponse.StatusCode, inspectHTTPResponse(uploadResponse)) } } // Prepare the files for deletion files := make([]map[string]interface{}, numberOfFiles) for i := 1; i <= numberOfFiles; i++ { files[i-1] = map[string]interface{}{ "path": fileName + strconv.Itoa(i) + ".txt", "versionID": "", "recursive": false, } } // 3. Delete these objects all at once deleteResponse, deleteError := DeleteMultipleObjects( bucketName, files, ) assert.Nil(deleteError) if deleteError != nil { log.Println(deleteError) return } if deleteResponse != nil { assert.Equal(200, deleteResponse.StatusCode, inspectHTTPResponse(deleteResponse)) } // 4. List the objects, empty list is expected! listResponse, listError := ListObjects(bucketName, "", false) assert.Nil(listError) if listError != nil { log.Println(listError) return } finalResponse := inspectHTTPResponse(listResponse) if listResponse != nil { assert.Equal(200, listResponse.StatusCode, finalResponse) } // 5. Verify empty list is obtained as we deleted all the objects expected := "Http Response: {\"objects\":null}\n" assert.Equal(expected, finalResponse, finalResponse) } func TestPutObjectTag(t *testing.T) { /* Test to put a tag to an object */ // Vars assert := assert.New(t) bucketName := "testputobjecttagbucketone" fileName := "testputobjecttagbucketone.txt" path := url.QueryEscape(fileName) tags := make(map[string]string) tags["tag"] = "testputobjecttagbucketonetagone" versionID := "null" // 1. Create the bucket if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { return } // 2. Upload the object to the bucket uploadResponse, uploadError := UploadAnObject(bucketName, fileName) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } if uploadResponse != nil { assert.Equal( 200, uploadResponse.StatusCode, inspectHTTPResponse(uploadResponse), ) } // 3. Put a tag to the object putTagResponse, putTagError := PutObjectTags( bucketName, path, tags, versionID) assert.Nil(putTagError) if putTagError != nil { log.Println(putTagError) return } putObjectTagresult := inspectHTTPResponse(putTagResponse) if putTagResponse != nil { assert.Equal( 200, putTagResponse.StatusCode, putObjectTagresult) } // 4. Verify the object's tag is set listResponse, listError := ListObjects(bucketName, path, false) assert.Nil(listError) if listError != nil { log.Println(listError) return } finalResponse := inspectHTTPResponse(listResponse) if listResponse != nil { assert.Equal(200, listResponse.StatusCode, finalResponse) } assert.True( strings.Contains(finalResponse, tags["tag"]), finalResponse) } func TestBucketRetention(t *testing.T) { /* To test bucket retention feature */ // 1. Create the bucket with 2 years validity retention assert := assert.New(t) /* { "name":"setbucketretention1", "versioning":true, "locking":true, "retention": { "mode":"compliance", "unit":"years", "validity":2 } } */ retention := make(map[string]interface{}) retention["mode"] = "compliance" retention["unit"] = "years" retention["validity"] = 2 if !setupBucket("setbucketretention1", true, map[string]interface{}{"enabled": true}, nil, retention, assert, 200) { return } // 2. Set the bucket's retention from 2 years to 3 years setBucketRetentionResponse, setBucketRetentionError := SetBucketRetention( "setbucketretention1", "compliance", "years", 3, ) assert.Nil(setBucketRetentionError) if setBucketRetentionError != nil { log.Println(setBucketRetentionError) assert.Fail("Error setting the bucket retention") return } if setBucketRetentionResponse != nil { assert.Equal(200, setBucketRetentionResponse.StatusCode, inspectHTTPResponse(setBucketRetentionResponse)) } // 3. Verify the bucket's retention was properly set. getBucketRetentionResponse, getBucketRetentionError := GetBucketRetention( "setbucketretention1", ) assert.Nil(getBucketRetentionError) if getBucketRetentionError != nil { log.Println(getBucketRetentionError) assert.Fail("Error getting the bucket's retention") return } finalResponse := inspectHTTPResponse(getBucketRetentionResponse) if getBucketRetentionResponse != nil { assert.Equal( 200, getBucketRetentionResponse.StatusCode, finalResponse, ) } expected := "Http Response: {\"mode\":\"compliance\",\"unit\":\"years\",\"validity\":3}\n" assert.Equal(expected, finalResponse, finalResponse) } func TestBucketInformationGenericErrorResponse(t *testing.T) { /* Test Bucket Info End Point with a Generic Error Response. */ // 1. Create the bucket assert := assert.New(t) if !setupBucket("bucketinformation2", false, nil, nil, nil, assert, 200) { return } // 2. Add a tag to the bucket tags := make(map[string]string) tags["tag2"] = "tag2" putBucketTagResponse, putBucketTagError := PutBucketsTags( "bucketinformation2", tags) if putBucketTagError != nil { log.Println(putBucketTagError) assert.Fail("Error putting the bucket's tags") return } if putBucketTagResponse != nil { assert.Equal( 200, putBucketTagResponse.StatusCode, inspectHTTPResponse(putBucketTagResponse)) } // 3. Get the information bucketInfoResponse, bucketInfoError := BucketInfo("bucketinformation3") if bucketInfoError != nil { log.Println(bucketInfoError) assert.Fail("Error getting the bucket information") return } finalResponse := inspectHTTPResponse(bucketInfoResponse) if bucketInfoResponse != nil { assert.Equal(200, bucketInfoResponse.StatusCode) } // 4. Verify the information // Since bucketinformation3 hasn't been created, then it is expected that // tag2 is not part of the response, this is why assert.False is used. assert.False(strings.Contains(finalResponse, "tag2"), finalResponse) } func TestBucketInformationSuccessfulResponse(t *testing.T) { /* Test Bucket Info End Point with a Successful Response. */ // 1. Create the bucket assert := assert.New(t) if !setupBucket("bucketinformation1", false, nil, nil, nil, assert, 200) { return } // 2. Add a tag to the bucket tags := make(map[string]string) tags["tag1"] = "tag1" putBucketTagResponse, putBucketTagError := PutBucketsTags( "bucketinformation1", tags) if putBucketTagError != nil { log.Println(putBucketTagError) assert.Fail("Error putting the bucket's tags") return } if putBucketTagResponse != nil { assert.Equal( 200, putBucketTagResponse.StatusCode, inspectHTTPResponse(putBucketTagResponse)) } // 3. Get the information bucketInfoResponse, bucketInfoError := BucketInfo("bucketinformation1") if bucketInfoError != nil { log.Println(bucketInfoError) assert.Fail("Error getting the bucket information") return } debugResponse := inspectHTTPResponse(bucketInfoResponse) // call it once if bucketInfoResponse != nil { assert.Equal(200, bucketInfoResponse.StatusCode, debugResponse) } fmt.Println(debugResponse) // 4. Verify the information assert.True( strings.Contains(debugResponse, "bucketinformation1"), inspectHTTPResponse(bucketInfoResponse)) assert.True( strings.Contains(debugResponse, "tag1"), inspectHTTPResponse(bucketInfoResponse)) } func TestDeleteBucket(t *testing.T) { /* Test to delete a bucket */ assert := assert.New(t) type args struct { bucketName string createBucketName string } tests := []struct { name string args args expectedStatus int }{ { name: "Delete a bucket", expectedStatus: 204, args: args{ bucketName: "testdeletebucket1", createBucketName: "testdeletebucket1", }, }, { name: "Delete invalid bucket", expectedStatus: 404, args: args{ bucketName: "nonexistingbucket", createBucketName: "", }, }, } // Initialize minio client object. minioClient, err := minio.New("localhost:9000", &minio.Options{ Creds: credentials.NewStaticV4("minioadmin", "minioadmin", ""), Secure: false, }) if err != nil { log.Fatalln(err) } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { // Create bucket if needed for the test if tt.args.createBucketName != "" { if err := minioClient.MakeBucket(context.Background(), tt.args.createBucketName, minio.MakeBucketOptions{}); err != nil { assert.Failf("Failed to create bucket", "Could not create bucket %s: %v", tt.args.createBucketName, err) } } // Delete the bucket deleteBucketResponse, deleteBucketError := DeleteBucket(tt.args.bucketName) assert.Nil(deleteBucketError) if deleteBucketResponse != nil { assert.Equal( tt.expectedStatus, deleteBucketResponse.StatusCode, "Status Code is incorrect") } }) } } func TestListBuckets(t *testing.T) { /* Test the list of buckets without query parameters. */ assert := assert.New(t) // 1. Create buckets numberOfBuckets := 3 for i := 1; i <= numberOfBuckets; i++ { if !setupBucket("testlistbuckets"+strconv.Itoa(i), false, nil, nil, nil, assert, 200) { return } } // Waiting to retrieve the new list of buckets time.Sleep(3 * time.Second) // 2. List buckets listBucketsResponse, listBucketsError := ListBuckets() assert.Nil(listBucketsError) assert.NotNil(listBucketsResponse) assert.NotNil(listBucketsResponse.Body) // 3. Verify list of buckets b, _ := io.ReadAll(listBucketsResponse.Body) assert.Equal(200, listBucketsResponse.StatusCode, "Status Code is incorrect: "+string(b)) for i := 1; i <= numberOfBuckets; i++ { assert.True(strings.Contains(string(b), "testlistbuckets"+strconv.Itoa(i))) } } func TestBucketsGet(t *testing.T) { assert := assert.New(t) client := &http.Client{ Timeout: 2 * time.Second, } // get list of buckets request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/buckets", nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) response, err := client.Do(request) assert.Nil(err) if err != nil { log.Println(err) return } if response != nil { assert.Equal(200, response.StatusCode, "Status Code is incorrect") bodyBytes, _ := io.ReadAll(response.Body) listBuckets := models.ListBucketsResponse{} err = json.Unmarshal(bodyBytes, &listBuckets) if err != nil { log.Println(err) assert.Nil(err) } assert.Greater(len(listBuckets.Buckets), 0, "No bucket was returned") assert.Greater(listBuckets.Total, int64(0), "Total buckets is 0") } } func TestBucketVersioning(t *testing.T) { assert := assert.New(t) client := &http.Client{ Timeout: 2 * time.Second, } request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/session", nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) response, err := client.Do(request) assert.Nil(err) if err != nil { log.Println(err) return } var distributedSystem bool if response != nil { bodyBytes, _ := io.ReadAll(response.Body) sessionResponse := models.SessionResponse{} err = json.Unmarshal(bodyBytes, &sessionResponse) if err != nil { log.Println(err) } distributedSystem = sessionResponse.DistributedMode } requestDataVersioning := map[string]interface{}{ "name": "test2", "versioning": true, "locking": false, } requestDataJSON, _ := json.Marshal(requestDataVersioning) requestDataBody := bytes.NewReader(requestDataJSON) if !setupBucket("test2", true, nil, nil, nil, assert, 200) { return } // Read the HTTP Response and make sure we get: {"is_versioned":true} getVersioningResult, getVersioningError := GetBucketVersioning("test2") assert.Nil(getVersioningError) if getVersioningError != nil { log.Println(getVersioningError) return } if getVersioningResult != nil { assert.Equal( 200, getVersioningResult.StatusCode, "Status Code is incorrect") } bodyBytes, _ := io.ReadAll(getVersioningResult.Body) structBucketRepl := models.BucketVersioningResponse{ ExcludeFolders: false, ExcludedPrefixes: nil, MFADelete: "", Status: "", } err = json.Unmarshal(bodyBytes, &structBucketRepl) if err != nil { log.Println(err) assert.Nil(err) } assert.Equal( structBucketRepl.Status, "Enabled", structBucketRepl.Status, ) fmt.Println("Versioned bucket creation test status:", response.Status) if distributedSystem { assert.Equal(200, response.StatusCode, "Versioning test Status Code is incorrect - bucket failed to create") } else { assert.NotEqual(200, response.StatusCode, "Versioning test Status Code is incorrect - versioned bucket created on non-distributed system") } request, err = http.NewRequest("DELETE", "http://localhost:9090/api/v1/buckets/test2", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err = client.Do(request) if err != nil { log.Println(err) return } if response != nil { fmt.Println("DELETE StatusCode:", response.StatusCode) } } func TestSetBucketTags(t *testing.T) { assert := assert.New(t) client := &http.Client{ Timeout: 2 * time.Second, } // put bucket if !setupBucket("test4", false, nil, nil, nil, assert, 200) { return } requestDataTags := map[string]interface{}{ "tags": map[string]interface{}{ "test": "TAG", }, } requestTagsJSON, _ := json.Marshal(requestDataTags) requestTagsBody := bytes.NewBuffer(requestTagsJSON) request, err := http.NewRequest(http.MethodPut, "http://localhost:9090/api/v1/buckets/test4/tags", requestTagsBody) request.Close = true if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") _, err = client.Do(request) assert.Nil(err) if err != nil { log.Println(err) return } // get bucket request, err = http.NewRequest("GET", "http://localhost:9090/api/v1/buckets/test4", nil) request.Close = true if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) assert.Nil(err) if err != nil { log.Println(err) return } bodyBytes, _ := io.ReadAll(response.Body) bucket := models.Bucket{} err = json.Unmarshal(bodyBytes, &bucket) if err != nil { log.Println(err) } assert.Equal("TAG", bucket.Details.Tags["test"], "Failed to add tag") } func TestGetBucket(t *testing.T) { assert := assert.New(t) client := &http.Client{ Timeout: 2 * time.Second, } if !setupBucket("test3", false, nil, nil, nil, assert, 200) { return } // get bucket request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/buckets/test3", nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) assert.Nil(err) if err != nil { log.Println(err) return } if response != nil { assert.Equal(200, response.StatusCode, "Status Code is incorrect") } } func TestAddBucket(t *testing.T) { assert := assert.New(t) type args struct { bucketName string } tests := []struct { name string args args expectedStatus int }{ { name: "Add Bucket with valid name", expectedStatus: 200, args: args{ bucketName: "test1", }, }, { name: "Add Bucket with invalid name", expectedStatus: 500, args: args{ bucketName: "*&^###Test1ThisMightBeInvalid555", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if !setupBucket(tt.args.bucketName, false, nil, nil, nil, assert, tt.expectedStatus) { return } }) } } func CreateBucketEvent(bucketName string, ignoreExisting bool, arn, prefix, suffix string, events []string) (*http.Response, error) { /* Helper function to create bucket event POST: /buckets/{bucket_name}/events { "configuration": { "arn":"arn:minio:sqs::_:postgresql", "events":["put"], "prefix":"", "suffix":"" }, "ignoreExisting":true } */ configuration := map[string]interface{}{ "arn": arn, "events": events, "prefix": prefix, "suffix": suffix, } requestDataAdd := map[string]interface{}{ "configuration": configuration, "ignoreExisting": ignoreExisting, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/buckets/"+bucketName+"/events", 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 DeleteBucketEvent(bucketName, arn string, events []string, prefix, suffix string) (*http.Response, error) { /* Helper function to test Delete Bucket Event DELETE: /buckets/{bucket_name}/events/{arn} { "events":["put"], "prefix":"", "suffix":"" } */ requestDataAdd := map[string]interface{}{ "events": events, "prefix": prefix, "suffix": suffix, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/buckets/"+bucketName+"/events/"+arn, 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 TestDeleteBucketEvent(t *testing.T) { // Variables assert := assert.New(t) // 1. Add postgres notification response, err := NotifyPostgres() finalResponse := inspectHTTPResponse(response) assert.Nil(err) if err != nil { log.Println(err) assert.Fail(finalResponse) return } if response != nil { assert.Equal(200, response.StatusCode, finalResponse) } // 2. Restart the system restartResponse, restartError := RestartService() assert.Nil(restartError) if restartError != nil { log.Println(restartError) return } addObjRsp := inspectHTTPResponse(restartResponse) if restartResponse != nil { assert.Equal( 204, restartResponse.StatusCode, addObjRsp, ) } // 3. Subscribe bucket to event events := make([]string, 1) events[0] = "put" eventResponse, eventError := CreateBucketEvent( "testputobjectslegalholdstatus", // bucket name true, // ignore existing param "arn:minio:sqs::_:postgresql", // arn "", // prefix "", // suffix events, // events ) assert.Nil(eventError) if eventError != nil { log.Println(eventError) return } finalResponseEvent := inspectHTTPResponse(eventResponse) if eventResponse != nil { assert.Equal( 201, eventResponse.StatusCode, finalResponseEvent, ) } // 4. Delete Bucket Event events[0] = "put" deletEventResponse, deventError := DeleteBucketEvent( "testputobjectslegalholdstatus", // bucket name "arn:minio:sqs::_:postgresql", // arn events, // events "", // prefix "", // suffix ) assert.Nil(deventError) if deventError != nil { log.Println(deventError) return } efinalResponseEvent := inspectHTTPResponse(deletEventResponse) if deletEventResponse != nil { assert.Equal( 204, deletEventResponse.StatusCode, efinalResponseEvent, ) } } func SetMultiBucketReplication(accessKey, secretKey, targetURL, region, originBucket, destinationBucket, syncMode string, bandwidth, healthCheckPeriod int, prefix, tags string, replicateDeleteMarkers, replicateDeletes bool, priority int, storageClass string, replicateMetadata bool) (*http.Response, error) { /* Helper function URL: /buckets-replication HTTP Verb: POST Body: { "accessKey":"Q3AM3UQ867SPQQA43P2F", "secretKey":"zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", "targetURL":"https://play.min.io", "region":"", "bucketsRelation":[ { "originBucket":"test", "destinationBucket":"versioningenabled" } ], "syncMode":"async", "bandwidth":107374182400, "healthCheckPeriod":60, "prefix":"", "tags":"", "replicateDeleteMarkers":true, "replicateDeletes":true, "priority":1, "storageClass":"", "replicateMetadata":true } */ bucketsRelationArray := make([]map[string]interface{}, 1) bucketsRelationIndex0 := map[string]interface{}{ "originBucket": originBucket, "destinationBucket": destinationBucket, } bucketsRelationArray[0] = bucketsRelationIndex0 requestDataAdd := map[string]interface{}{ "accessKey": accessKey, "secretKey": secretKey, "targetURL": targetURL, "region": region, "bucketsRelation": bucketsRelationArray, "syncMode": syncMode, "bandwidth": bandwidth, "healthCheckPeriod": healthCheckPeriod, "prefix": prefix, "tags": tags, "replicateDeleteMarkers": replicateDeleteMarkers, "replicateDeletes": replicateDeletes, "priority": priority, "storageClass": storageClass, "replicateMetadata": replicateMetadata, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/buckets-replication", 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 GetBucketReplication(bucketName string) (*http.Response, error) { /* URL: /buckets/{bucket_name}/replication HTTP Verb: GET */ request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/replication", 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 DeletesAllReplicationRulesOnABucket(bucketName string) (*http.Response, error) { /* Helper function to delete all replication rules in a bucket URL: /buckets/{bucket_name}/delete-all-replication-rules HTTP Verb: DELETE */ request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/buckets/"+bucketName+"/delete-all-replication-rules", 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 DeleteMultipleReplicationRules(bucketName string, rules []string) (*http.Response, error) { /* Helper function to delete multiple replication rules in a bucket URL: /buckets/{bucket_name}/delete-multiple-replication-rules HTTP Verb: DELETE */ body := map[string]interface{}{ "rules": rules, } requestDataJSON, _ := json.Marshal(body) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/buckets/"+bucketName+"/delete-selected-replication-rules", 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 DeleteBucketReplicationRule(bucketName, ruleID string) (*http.Response, error) { /* Helper function to delete a bucket's replication rule URL: /buckets/{bucket_name}/replication/{rule_id} HTTP Verb: DELETE */ request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/buckets/"+bucketName+"/replication/"+ruleID, 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 TestReplication(t *testing.T) { // Vars assert := assert.New(t) originBucket := "testputobjectslegalholdstatus" destinationBuckets := []string{"testgetbucketquota", "testputbucketquota", "testlistbucketevents"} // an array of strings to iterate over // 1. Set replication rules with DIFFERENT PRIORITY <------- NOT SAME BUT DIFFERENT! 1, 2, etc. for index, destinationBucket := range destinationBuckets { response, err := SetMultiBucketReplication( "minioadmin", // accessKey string "minioadmin", // secretKey string "http://localhost:9000/", // targetURL string "", // region string originBucket, // originBucket string destinationBucket, // destinationBucket string "async", // syncMode string 107374182400, // bandwidth int 60, // healthCheckPeriod int "", // prefix string "", // tags string true, // replicateDeleteMarkers bool true, // replicateDeletes bool index+1, // priority int "", // storageClass string true, // replicateMetadata bool ) assert.Nil(err) if err != nil { log.Println(err) return } finalResponse := inspectHTTPResponse(response) if response != nil { assert.Equal(200, response.StatusCode, finalResponse) } } // 2. Get replication, at this point four rules are expected response, err := GetBucketReplication(originBucket) assert.Nil(err) if err != nil { log.Println(err) return } if response != nil { assert.Equal(200, response.StatusCode, "error invalid status") } // 3. Get rule ID and status from response's body bodyBytes, _ := io.ReadAll(response.Body) structBucketRepl := models.BucketReplicationResponse{} err = json.Unmarshal(bodyBytes, &structBucketRepl) if err != nil { log.Println(err) assert.Nil(err) } assert.Greater(len(structBucketRepl.Rules), 0, "Number of expected rules is 0") if len(structBucketRepl.Rules) == 0 || len(structBucketRepl.Rules) < 3 { return } // 4. Verify rules are enabled for index := 0; index < 3; index++ { Status := structBucketRepl.Rules[index].Status assert.Equal(Status, "Enabled") } // 5. Delete 3rd and 4th rules with endpoint for multiple rules: // /buckets/{bucket_name}/replication/{rule_id} ruleIDs := []string{structBucketRepl.Rules[2].ID} // To delete 3rd rule with the multi delete function response, err = DeleteMultipleReplicationRules( originBucket, ruleIDs, ) assert.Nil(err) if err != nil { log.Println(err) return } finalResponse := inspectHTTPResponse(response) if response != nil { assert.Equal(204, response.StatusCode, finalResponse) } // 6. Delete 2nd rule only with dedicated end point for single rules: // /buckets/{bucket_name}/replication/{rule_id} ruleID := structBucketRepl.Rules[1].ID // To delete 2nd rule in a single way response, err = DeleteBucketReplicationRule( originBucket, ruleID, ) assert.Nil(err) if err != nil { log.Println(err) return } finalResponse = inspectHTTPResponse(response) if response != nil { // https://github.com/minio/minio/pull/14972 // Disallow deletion of arn when active replication config // 204 is no longer expected but 500 assert.Equal(500, response.StatusCode, finalResponse) } // 7. Delete remaining Bucket Replication Rule with generic end point: // /buckets/{bucket_name}/delete-all-replication-rules response, err = DeletesAllReplicationRulesOnABucket( originBucket, ) assert.Nil(err) if err != nil { log.Println(err) return } finalResponse = inspectHTTPResponse(response) if response != nil { assert.Equal(204, response.StatusCode, finalResponse) } // 8. Get replication, at this point zero rules are expected response, err = GetBucketReplication(originBucket) assert.Nil(err) if err != nil { log.Println(err) return } if response != nil { assert.Equal(200, response.StatusCode, "error invalid status") } // 9. Get rule ID and status from response's body bodyBytes, _ = io.ReadAll(response.Body) structBucketRepl = models.BucketReplicationResponse{} err = json.Unmarshal(bodyBytes, &structBucketRepl) if err != nil { log.Println(err) assert.Nil(err) } expected := 0 actual := len(structBucketRepl.Rules) assert.Equal(expected, actual, "Delete failed") } func GetBucketVersioning(bucketName string) (*http.Response, error) { /* Helper function to get bucket's versioning */ endPoint := "versioning" return BaseGetFunction(bucketName, endPoint) } func ReturnsTheStatusOfObjectLockingSupportOnTheBucket(bucketName string) (*http.Response, error) { /* Helper function to test end point below: URL: /buckets/{bucket_name}/object-locking: HTTP Verb: GET */ endPoint := "object-locking" return BaseGetFunction(bucketName, endPoint) } func BaseGetFunction(bucketName, endPoint string) (*http.Response, error) { request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/"+endPoint, 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 TestReturnsTheStatusOfObjectLockingSupportOnTheBucket(t *testing.T) { // Test for end point: /buckets/{bucket_name}/object-locking // Vars assert := assert.New(t) bucketName := "testputobjectslegalholdstatus" // 1. Get the status response, err := ReturnsTheStatusOfObjectLockingSupportOnTheBucket( bucketName, ) assert.Nil(err) if err != nil { log.Println(err) return } if response != nil { assert.Equal(200, response.StatusCode, "error invalid status") } // 2. Verify the status to be enabled for this bucket bodyBytes, _ := io.ReadAll(response.Body) structBucketLocking := models.BucketObLockingResponse{} err = json.Unmarshal(bodyBytes, &structBucketLocking) if err != nil { log.Println(err) assert.Nil(err) } assert.Equal( structBucketLocking.ObjectLockingEnabled, true, structBucketLocking, ) } func SetBucketVersioning(bucketName string, versioning map[string]interface{}, endpoint, useToken *string) (*http.Response, error) { /* Helper function to set Bucket Versioning */ requestDataAdd := map[string]interface{}{ "versioning": versioning, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) endpointURL := fmt.Sprintf("http://localhost:9090/api/v1/buckets/%s/versioning", bucketName) if endpoint != nil { endpointURL = fmt.Sprintf("%s/api/v1/buckets/%s/versioning", *endpoint, bucketName) } request, err := http.NewRequest("PUT", endpointURL, requestDataBody) if err != nil { log.Println(err) } if useToken != nil { request.Header.Add("Cookie", fmt.Sprintf("token=%s", *useToken)) } else { 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 TestSetBucketVersioning(t *testing.T) { // Variables assert := assert.New(t) bucket := "test-set-bucket-versioning" locking := false versioning := map[string]interface{}{"enabled": true} // 1. Create bucket with versioning as true and locking as false if !setupBucket(bucket, locking, versioning, nil, nil, assert, 200) { return } // 2. Set versioning as False i.e Suspend versioning response, err := SetBucketVersioning(bucket, map[string]interface{}{"enabled": false}, nil, nil) assert.Nil(err) if err != nil { log.Println(err) assert.Fail("Error setting the bucket versioning") return } if response != nil { assert.Equal(201, response.StatusCode, inspectHTTPResponse(response)) } // 3. Read the HTTP Response and make sure is disabled. getVersioningResult, getVersioningError := GetBucketVersioning(bucket) assert.Nil(getVersioningError) if getVersioningError != nil { log.Println(getVersioningError) return } if getVersioningResult != nil { assert.Equal( 200, getVersioningResult.StatusCode, "Status Code is incorrect") } bodyBytes, _ := io.ReadAll(getVersioningResult.Body) result := models.BucketVersioningResponse{ ExcludeFolders: false, ExcludedPrefixes: nil, MFADelete: "", Status: "", } err = json.Unmarshal(bodyBytes, &result) if err != nil { log.Println(err) assert.Nil(err) } assert.Equal("Suspended", result.Status, result) } func EnableBucketEncryption(bucketName, encType, kmsKeyID string) (*http.Response, error) { // Helper function to enable bucket encryption // HTTP Verb: POST // URL: /buckets/{bucket_name}/encryption/enable // Body: // { // "encType":"sse-s3", // "kmsKeyID":"" // } requestDataAdd := map[string]interface{}{ "encType": encType, "kmsKeyID": kmsKeyID, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/buckets/"+bucketName+"/encryption/enable", requestDataBody) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") // Performing the call client := &http.Client{ Timeout: 2 * time.Second, } response, err := client.Do(request) return response, err } func TestEnableBucketEncryption(t *testing.T) { // Variables assert := assert.New(t) bucketName := "test-enable-bucket-encryption" locking := false encType := "sse-s3" kmsKeyID := "" // 1. Add bucket if !setupBucket(bucketName, locking, nil, nil, nil, assert, 200) { return } // 2. Enable Bucket's Encryption resp, err := EnableBucketEncryption(bucketName, encType, kmsKeyID) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, "Status Code is incorrect") } // 3. Get Bucket Encryption Information to verify it got encrypted. resp, err = GetBucketEncryptionInformation(bucketName) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, "Status Code is incorrect") } bodyBytes, _ := io.ReadAll(resp.Body) result := models.BucketEncryptionInfo{} err = json.Unmarshal(bodyBytes, &result) if err != nil { log.Println(err) assert.Nil(err) } assert.Equal("AES256", result.Algorithm, result) // 4. Disable Bucket's Encryption resp, err = DisableBucketEncryption(bucketName) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, "Status Code is incorrect") } // 5. Verify encryption got disabled. resp, err = GetBucketEncryptionInformation(bucketName) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 404, resp.StatusCode, "Status Code is incorrect") } bodyBytes, _ = io.ReadAll(resp.Body) result2 := models.APIError{} err = json.Unmarshal(bodyBytes, &result2) if err != nil { log.Println(err) assert.Nil(err) } dereferencedPointerDetailedMessage := result2.DetailedMessage assert.Equal("error server side encryption configuration not found", dereferencedPointerDetailedMessage, dereferencedPointerDetailedMessage) } func GetBucketEncryptionInformation(bucketName string) (*http.Response, error) { /* Helper function to get bucket encryption information HTTP Verb: GET URL: api/v1/buckets//encryption/info Response: {"algorithm":"AES256"} */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/encryption/info", 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 DisableBucketEncryption(bucketName string) (*http.Response, error) { /* Helper function to disable bucket's encryption HTTP Verb: POST URL: /buckets/{bucket_name}/encryption/disable */ request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/buckets/"+bucketName+"/encryption/disable", 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 UpdateLifecycleRule(bucketName, ltype string, disable bool, prefix, tags string, expiredObjectDeleteMarker bool, expiryDays, noncurrentversionExpirationDays int64, lifecycleID string) (*http.Response, error) { // Helper function to update lifecycle rule // HTTP Verb: PUT // URL: /buckets/{bucket_name}/lifecycle/{lifecycle_id} // Body Example: // { // "type":"expiry", // "disable":false, // "prefix":"", // "tags":"", // "expired_object_delete_marker":false, // "expiry_days":2, // "noncurrentversion_expiration_days":0 // } requestDataAdd := map[string]interface{}{ "type": ltype, "disable": disable, "prefix": prefix, "tags": tags, "expired_object_delete_marker": expiredObjectDeleteMarker, "expiry_days": expiryDays, "noncurrentversion_expiration_days": noncurrentversionExpirationDays, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest("PUT", "http://localhost:9090/api/v1/buckets/"+bucketName+"/lifecycle/"+lifecycleID, 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 GetBucketLifeCycle(bucketName string) (*http.Response, error) { // Get Bucket Lifecycle // HTTP Verb: GET // URL: /buckets/{bucket_name}/lifecycle // Response Example: // { // "lifecycle": [ // { // "expiration": { // "date": "0001-01-01T00:00:00Z", // "days": 1 // }, // "id": "c8nmpte49b3m6uu3pac0", // "status": "Enabled", // "tags": null, // "transition": { // "date": "0001-01-01T00:00:00Z" // } // } // ] // } request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/lifecycle", 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 AddBucketLifecycle(bucketName, ltype, prefix, tags string, expiredObjectDeleteMarker bool, expiryDays, noncurrentversionExpirationDays int64) (*http.Response, error) { // Helper function to add bucket lifecycle // URL: /buckets/{bucket_name}/lifecycle // HTTP Verb: POST // Body Example: // { // "type":"expiry", // "prefix":"", // "tags":"", // "expired_object_delete_marker":false, // "expiry_days":1, // "noncurrentversion_expiration_days":null // } // Needed Parameters for API Call requestDataAdd := map[string]interface{}{ "type": ltype, "prefix": prefix, "tags": tags, "expired_object_delete_marker": expiredObjectDeleteMarker, "expiry_days": expiryDays, "noncurrentversion_expiration_days": noncurrentversionExpirationDays, } // Creating the Call by adding the URL and Headers requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/buckets/"+bucketName+"/lifecycle", requestDataBody, ) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") // Performing the call client := &http.Client{ Timeout: 2 * time.Second, } response, err := client.Do(request) return response, err } func DeleteLifecycleRule(bucketName, lifecycleID string) (*http.Response, error) { // Helper function to delete lifecycle rule // HTTP Verb: DELETE // URL: /buckets/{bucket_name}/lifecycle/{lifecycle_id} request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/buckets/"+bucketName+"/lifecycle/"+lifecycleID, 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 TestBucketLifeCycle(t *testing.T) { // Variables assert := assert.New(t) bucketName := "test-bucket-life-cycle" locking := false ltype := "expiry" prefix := "" tags := "" var expiryDays int64 = 1 var expiryDays2 int64 = 2 disable := false expiredObjectDeleteMarker := false var noncurrentversionExpirationDays int64 // 1. Add bucket if !setupBucket(bucketName, locking, nil, nil, nil, assert, 200) { return } // 2. Add Bucket Lifecycle resp, err := AddBucketLifecycle( bucketName, ltype, prefix, tags, expiredObjectDeleteMarker, expiryDays, noncurrentversionExpirationDays, ) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 201, resp.StatusCode, "Status Code is incorrect") } // 3. Get Bucket LifeCycle resp, err = GetBucketLifeCycle(bucketName) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, "Status Code is incorrect") } bodyBytes, _ := io.ReadAll(resp.Body) result := models.BucketLifecycleResponse{} err = json.Unmarshal(bodyBytes, &result) if err != nil { log.Println(err) assert.Nil(err) } Status := &result.Lifecycle[0].Status Days := &result.Lifecycle[0].Expiration.Days lifecycleID := &result.Lifecycle[0].ID assert.Equal(expiryDays, *Days, *Days) // Checking it is one day expiration assert.Equal("Enabled", *Status, *Status) // Checking it's enabled // 4. Update from 1 day expiration to 2 days expiration resp, err = UpdateLifecycleRule( bucketName, ltype, disable, prefix, tags, expiredObjectDeleteMarker, expiryDays2, noncurrentversionExpirationDays, *lifecycleID, ) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, "Status Code is incorrect") } // 5. Verify 2 expiration days got updated resp, err = GetBucketLifeCycle(bucketName) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, "Status Code is incorrect") } bodyBytes, _ = io.ReadAll(resp.Body) result = models.BucketLifecycleResponse{} err = json.Unmarshal(bodyBytes, &result) if err != nil { log.Println(err) assert.Nil(err) } Days = &result.Lifecycle[0].Expiration.Days assert.Equal(expiryDays2, *Days, *Days) // Checking it is two days expiration // 6. Delete Bucket Lifecycle resp, err = DeleteLifecycleRule(bucketName, *lifecycleID) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 204, resp.StatusCode, "Status Code is incorrect") } // 6. Verify bucket lifecycle got deleted resp, err = GetBucketLifeCycle(bucketName) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 404, resp.StatusCode, "Status Code is incorrect") } } func SetAccessRuleWithBucket(bucketName, prefix, access string) (*http.Response, error) { /* Helper function to Set Access Rule within Bucket HTTP Verb: PUT URL: /bucket/{bucket}/access-rules Data Example: { "prefix":"prefix", "access":"readonly" } */ requestDataAdd := map[string]interface{}{ "prefix": prefix, "access": access, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", "http://localhost:9090/api/v1/bucket/"+bucketName+"/access-rules", 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 ListAccessRulesWithBucket(bucketName string) (*http.Response, error) { /* Helper function to List Access Rules Within Bucket HTTP Verb: GET URL: /bucket/{bucket}/access-rules */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/bucket/"+bucketName+"/access-rules", 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 DeleteAccessRuleWithBucket(bucketName, prefix string) (*http.Response, error) { /* Helper function to Delete Access Rule With Bucket HTTP Verb: DELETE URL: /bucket/{bucket}/access-rules Data Example: {"prefix":"prefix"} */ requestDataAdd := map[string]interface{}{ "prefix": prefix, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/bucket/"+bucketName+"/access-rules", 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 TestAccessRule(t *testing.T) { // Variables assert := assert.New(t) bucketName := "test-access-rule-bucket" locking := false prefix := "prefix" access := "readonly" // 1. Add bucket if !setupBucket(bucketName, locking, nil, nil, nil, assert, 200) { return } // 2. Set Access Rule With Bucket resp, err := SetAccessRuleWithBucket( bucketName, prefix, access, ) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, "Status Code is incorrect") } // 3. List Access Rule resp, err = ListAccessRulesWithBucket(bucketName) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, "Status Code is incorrect") } bodyBytes, _ := io.ReadAll(resp.Body) result := models.ListAccessRulesResponse{} err = json.Unmarshal(bodyBytes, &result) if err != nil { log.Println(err) assert.Nil(err) } Access := &result.AccessRules[0].Access Prefix := &result.AccessRules[0].Prefix assert.Equal("readonly", *Access, *Access) assert.Equal("prefix", *Prefix, *Prefix) // 4. Delete Access Rule resp, err = DeleteAccessRuleWithBucket( bucketName, prefix, ) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, "Status Code is incorrect") } // 5. Verify access rule was deleted resp, err = ListAccessRulesWithBucket(bucketName) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, "Status Code is incorrect") } bodyBytes, _ = io.ReadAll(resp.Body) result = models.ListAccessRulesResponse{} err = json.Unmarshal(bodyBytes, &result) if err != nil { log.Println(err) assert.Nil(err) } AccessRules := &result.AccessRules // The array has to be empty, no index accessible if len(*AccessRules) == 0 { fmt.Println("Cool, access rules are gone from this bucket") } else { assert.Fail("Access Rule not deleted") } } func GetBucketRewind(bucketName, date string) (*http.Response, error) { /* Helper function to get objects in a bucket for a rewind date HTTP Verb: GET URL: /buckets/{bucket_name}/rewind/{date} */ request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/buckets/"+bucketName+"/rewind/"+date, 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 TestGetBucketRewind(t *testing.T) { // Variables assert := assert.New(t) bucketName := "test-get-bucket-rewind" date := "2006-01-02T15:04:05Z" // Test resp, err := GetBucketRewind(bucketName, date) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 200, resp.StatusCode, inspectHTTPResponse(resp)) } } func GetRemoteBucket() (*http.Response, error) { request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/remote-buckets", 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 GetRemoteBucketARN(sourceBucket string) (*http.Response, error) { request, err := http.NewRequest( "GET", fmt.Sprintf("http://localhost:9090/api/v1/remote-buckets/%s", sourceBucket), 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 AddRemoteBucket(accessKey, secretKey, targetURL, sourceBucket, targetBucket string) (*http.Response, error) { // Needed Parameters for API Call bucketsRelationArray := make([]map[string]interface{}, 1) bucketsRelationIndex0 := map[string]interface{}{ "originBucket": sourceBucket, "destinationBucket": targetBucket, } bucketsRelationArray[0] = bucketsRelationIndex0 requestDataAdd := map[string]interface{}{ "accessKey": accessKey, "secretKey": secretKey, "targetURL": targetURL, "sourceBucket": sourceBucket, "targetBucket": targetBucket, "region": "", "bucketsRelation": bucketsRelationArray, "syncMode": "async", "bandwidth": 107374182400, "healthCheckPeriod": 60, "prefix": "", "tags": "", "replicateDeleteMarkers": true, "replicateDeletes": true, "priority": 1, "storageClass": "", "replicateMetadata": true, } // Creating the Call by adding the URL and Headers requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/remote-buckets", requestDataBody, ) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") // Performing the call client := &http.Client{ Timeout: 2 * time.Second, } response, err := client.Do(request) return response, err } func DeleteRemoteBucket(sourceBucket string, arn string) (*http.Response, error) { // Needed Parameters for API Call request, err := http.NewRequest( "DELETE", fmt.Sprintf("http://localhost:9090/api/v1/remote-buckets/%s/%s", sourceBucket, arn), nil, ) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") // Performing the call client := &http.Client{ Timeout: 2 * time.Second, } response, err := client.Do(request) return response, err } func TestAddRemoteBucket(t *testing.T) { // Variables assert := assert.New(t) accessKey := "minioadmin" secretKey := "minioadmin" targetURL := "http://173.18.0.3:9001" sourceBucket := "source" targetBucket := "targetbucket" fmt.Println("targetBucket: ", targetBucket) // 1. Create bucket if !setupBucket("source", true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 1.1. Create target bucket targetEndpoint := "http://localhost:9092" targetToken := getTokenForEndpoint(targetEndpoint) if !setupBucketForEndpoint(targetBucket, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200, &targetEndpoint, &targetToken) { log.Println("bucket already exists") } _, err := SetBucketVersioning(targetBucket, map[string]interface{}{"enabled": false}, &targetURL, &targetToken) if err != nil { log.Println("bucket already has versioning") } // 2. Add Remote Bucket resp, err := AddRemoteBucket( accessKey, secretKey, targetURL, sourceBucket, targetBucket, ) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 201, resp.StatusCode, inspectHTTPResponse(resp)) } // 3. Verify Remote Bucket was created resp, err = GetRemoteBucket() assert.Nil(err) if err != nil { log.Println(err) return } finalResponse := inspectHTTPResponse(resp) if resp != nil { assert.Equal( 200, resp.StatusCode, finalResponse) } fmt.Println("finalResponse: ", finalResponse) assert.Equal(strings.Contains(finalResponse, targetBucket), true) } func TestDeleteRemoteBucket(t *testing.T) { // Variables assert := assert.New(t) accessKey := "minioadmin" secretKey := "minioadmin" targetURL := "http://173.18.0.3:9001" sourceBucket := "deletesource" targetBucket := "targetbucket2" fmt.Println("targetBucket: ", targetBucket) // 1. Create bucket if !setupBucket("deletesource", true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { return } // 1.1. Create target bucket targetEndpoint := "http://localhost:9092" targetToken := getTokenForEndpoint(targetEndpoint) if !setupBucketForEndpoint(targetBucket, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200, &targetEndpoint, &targetToken) { log.Println("bucket already exists") } _, err := SetBucketVersioning(targetBucket, map[string]interface{}{"enabled": false}, &targetURL, &targetToken) if err != nil { log.Println("bucket already has versioning") } // 2. Add Remote Bucket resp, err := AddRemoteBucket( accessKey, secretKey, targetURL, sourceBucket, targetBucket, ) assert.Nil(err) if err != nil { log.Println(err) return } if resp != nil { assert.Equal( 201, resp.StatusCode, inspectHTTPResponse(resp)) } // 3. Get ARN resp, err = GetRemoteBucketARN(sourceBucket) assert.Nil(err) assert.NotNil(resp) assert.NotNil(resp.Body) bodyBytes, _ := io.ReadAll(resp.Body) remoteBucket := models.RemoteBucket{} err = json.Unmarshal(bodyBytes, &remoteBucket) assert.Nil(err) assert.Equal(200, resp.StatusCode, inspectHTTPResponse(resp)) // 4. Delete Remote Bucket if remoteBucket.RemoteARN != nil { resp, err = DeleteRemoteBucket(sourceBucket, *remoteBucket.RemoteARN) assert.Nil(err) if err != nil { log.Println(err) return } finalResponse := inspectHTTPResponse(resp) if resp != nil { assert.Equal( 204, resp.StatusCode, finalResponse) } } else { assert.Fail("No remote arn response") } } ================================================ FILE: integration/users_test.go ================================================ // 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 integration import ( "bytes" "encoding/json" "fmt" "io" "log" "net/http" "net/url" "strconv" "strings" "testing" "time" "github.com/stretchr/testify/assert" ) func AddUser(accessKey, secretKey string, groups, policies []string) (*http.Response, error) { /* This is an atomic function to add user and can be reused across different functions. */ client := &http.Client{ Timeout: 3 * time.Second, } requestDataAdd := map[string]interface{}{ "accessKey": accessKey, "secretKey": secretKey, "groups": groups, "policies": policies, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/users", requestDataBody) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func DeleteUser(userName string) (*http.Response, error) { /* This is an atomic function to delete user and can be reused across different functions. */ client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/user/"+url.PathEscape(userName), nil) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func ListUsers(offset, limit string) (*http.Response, error) { /* This is an atomic function to list users. {{baseUrl}}/users?offset=-5480083&limit=-5480083 */ client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/users?offset="+offset+"&limit="+limit, nil) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func GetUserInformation(userName string) (*http.Response, error) { /* Helper function to get user information via API: {{baseUrl}}/user?name=proident velit */ client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/user/"+url.PathEscape(userName), nil) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func UpdateUserInformation(name, status string, groups []string) (*http.Response, error) { /* Helper function to update user information: PUT: {{baseUrl}}/user?name=proident velit Body: { "status": "nisi voluptate amet ea", "groups": [ "ipsum eu cupidatat", "aliquip non nulla" ] } */ client := &http.Client{ Timeout: 3 * time.Second, } requestDataAdd := map[string]interface{}{ "status": status, "groups": groups, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", "http://localhost:9090/api/v1/user/"+url.PathEscape(name), requestDataBody) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func RemoveUser(name string) (*http.Response, error) { /* Helper function to remove user. DELETE: {{baseUrl}}/user?name=proident velit */ client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "DELETE", "http://localhost:9090/api/v1/user/"+url.PathEscape(name), nil) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func UpdateGroupsForAUser(userName string, groups []string) (*http.Response, error) { /* Helper function to update groups for a user PUT: {{baseUrl}}/user/groups?name=username { "groups":[ "groupone", "grouptwo" ] } */ client := &http.Client{ Timeout: 3 * time.Second, } requestDataAdd := map[string]interface{}{ "groups": groups, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", "http://localhost:9090/api/v1/user/"+url.PathEscape(userName)+"/groups", requestDataBody, ) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func CreateServiceAccountForUser(userName, policy string) (*http.Response, error) { /* Helper function to Create Service Account for user POST: api/v1/user/username/service-accounts { "policy": "ad magna" } */ client := &http.Client{ Timeout: 3 * time.Second, } requestDataAdd := map[string]interface{}{ "policy": policy, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/user/"+url.PathEscape(userName)+"/service-accounts", requestDataBody, ) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func CreateServiceAccountForUserWithCredentials(userName, policy, accessKey, secretKey string) (*http.Response, error) { // Helper function to test "Create Service Account for User With Credentials" end point. client := &http.Client{ Timeout: 3 * time.Second, } requestDataAdd := map[string]interface{}{ "policy": policy, "accessKey": accessKey, "secretKey": secretKey, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/user/"+url.PathEscape(userName)+"/service-account-credentials", requestDataBody, ) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func ReturnsAListOfServiceAccountsForAUser(userName string) (*http.Response, error) { /* Helper function to return a list of service accounts for a user. GET: {{baseUrl}}/user/:name/service-accounts */ client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", "http://localhost:9090/api/v1/user/"+url.PathEscape(userName)+"/service-accounts", nil, ) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func AddGroup(group string, members []string) (*http.Response, error) { /* Helper function to add a group. */ client := &http.Client{ Timeout: 3 * time.Second, } requestDataAdd := map[string]interface{}{ "group": group, "members": members, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "POST", "http://localhost:9090/api/v1/groups", requestDataBody, ) if err != nil { log.Println(err) } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) return response, err } func UsersGroupsBulk(users, groups []string) (*http.Response, error) { /* Helper function to test Bulk functionality to Add Users to Groups. PUT: {{baseUrl}}/users-groups-bulk { "users": [ "magna id", "enim sit tempor incididunt" ], "groups": [ "nisi est esse", "fugiat eu" ] } */ requestDataAdd := map[string]interface{}{ "users": users, "groups": groups, } requestDataJSON, _ := json.Marshal(requestDataAdd) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest( "PUT", "http://localhost:9090/api/v1/users-groups-bulk", 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 TestAddUser(t *testing.T) { /* This is an API Test to add a user via api/v1/users, the intention is simple, add a user and make sure the response is 201 meaning that the user got added successfully. After test completion, it is expected that user is removed, so other tests like users.ts can run over clean data and we don't collide against it. */ assert := assert.New(t) // With no groups & no policies groups := []string{} policies := []string{} response, err := AddUser("accessKey", "secretKey", groups, policies) if err != nil { log.Println(err) return } if response != nil { fmt.Println("POST StatusCode:", response.StatusCode) assert.Equal(201, response.StatusCode, "Status Code is incorrect") } response, err = DeleteUser("accessKey") if err != nil { log.Println(err) return } if response != nil { fmt.Println("DELETE StatusCode:", response.StatusCode) assert.Equal(204, response.StatusCode, "has to be 204 when delete user") } } func TestListUsers(t *testing.T) { /* This test is intended to list users via API. 1. First, it creates the users 2. Then, it lists the users <------ 200 is expected when listing them. 3. Finally, it deletes the users */ assert := assert.New(t) // With no groups & no policies groups := []string{} policies := []string{} // 1. Create the users numberOfUsers := 5 for i := 1; i < numberOfUsers; i++ { response, err := AddUser( strconv.Itoa(i)+"accessKey"+strconv.Itoa(i), "secretKey"+strconv.Itoa(i), groups, policies) if err != nil { log.Println(err) return } if response != nil { fmt.Println("POST StatusCode:", response.StatusCode) assert.Equal(201, response.StatusCode, "Status Code is incorrect on index: "+strconv.Itoa(i)) } b, err := io.ReadAll(response.Body) if err != nil { log.Fatalln(err) } fmt.Println(string(b)) } // 2. List the users listResponse, listError := ListUsers("-5480083", "-5480083") if listError != nil { log.Fatalln(listError) } if listResponse != nil { fmt.Println("POST StatusCode:", listResponse.StatusCode) assert.Equal(200, listResponse.StatusCode, "TestListUsers(): Status Code is incorrect when listing users") } b, err := io.ReadAll(listResponse.Body) if err != nil { log.Fatalln(err) } fmt.Println(string(b)) // 3. Delete the users for i := 1; i < numberOfUsers; i++ { response, err := DeleteUser( strconv.Itoa(i) + "accessKey" + strconv.Itoa(i)) if err != nil { log.Println(err) return } if response != nil { fmt.Println("DELETE StatusCode:", response.StatusCode) assert.Equal(204, response.StatusCode, "has to be 204 when delete user") } } } func TestGetUserInfo(t *testing.T) { /* Test to get the user information via API. */ // 1. Create the user fmt.Println("TestGetUserInfo(): 1. Create the user") assert := assert.New(t) groups := []string{} policies := []string{} response, err := AddUser("accessKey", "secretKey", groups, policies) if err != nil { log.Println(err) return } if response != nil { fmt.Println("POST StatusCode:", response.StatusCode) assert.Equal(201, response.StatusCode, "Status Code is incorrect") } // 2. Get user information fmt.Println("TestGetUserInfo(): 2. Get user information") response, err = GetUserInformation("accessKey") if err != nil { log.Println(err) assert.Fail("There was an error in the response") return } // 3. Verify user information fmt.Println("TestGetUserInfo(): 3. Verify user information") if response != nil { fmt.Println("POST StatusCode:", response.StatusCode) assert.Equal(200, response.StatusCode, "Status Code is incorrect") } b, err := io.ReadAll(response.Body) if err != nil { log.Fatalln(err) } fmt.Println(string(b)) expected := "{\"accessKey\":\"accessKey\",\"memberOf\":null,\"policy\":[],\"status\":\"enabled\"}\n" obtained := string(b) assert.Equal(expected, obtained, "User Information is wrong") } func TestUpdateUserInfoSuccessfulResponse(t *testing.T) { /* Update User Information Test with Successful Response */ assert := assert.New(t) // 1. Create an active user groups := []string{} policies := []string{} addUserResponse, addUserError := AddUser( "updateuser", "secretKey", groups, policies) if addUserError != nil { log.Println(addUserError) return } if addUserResponse != nil { fmt.Println("StatusCode:", addUserResponse.StatusCode) assert.Equal( 201, addUserResponse.StatusCode, "Status Code is incorrect") } // 2. Deactivate the user // '{"status":"disabled","groups":[]}' updateUserResponse, UpdateUserError := UpdateUserInformation( "updateuser", "disabled", groups) // 3. Verify user got deactivated if UpdateUserError != nil { log.Println(UpdateUserError) return } if updateUserResponse != nil { fmt.Println("StatusCode:", updateUserResponse.StatusCode) assert.Equal( 200, updateUserResponse.StatusCode, "Status Code is incorrect") } b, err := io.ReadAll(updateUserResponse.Body) if err != nil { log.Fatalln(err) } assert.True(strings.Contains(string(b), "disabled")) } func TestUpdateUserInfoGenericErrorResponse(t *testing.T) { /* Update User Information Test with Generic Error Response */ assert := assert.New(t) // 1. Create an active user groups := []string{} policies := []string{} addUserResponse, addUserError := AddUser( "updateusererror", "secretKey", groups, policies) if addUserError != nil { log.Println(addUserError) return } if addUserResponse != nil { fmt.Println("StatusCode:", addUserResponse.StatusCode) assert.Equal( 201, addUserResponse.StatusCode, "Status Code is incorrect") } // 2. Deactivate the user with wrong status updateUserResponse, UpdateUserError := UpdateUserInformation( "updateusererror", "inactive", groups) // 3. Verify user got deactivated if UpdateUserError != nil { log.Println(UpdateUserError) assert.Fail("There was an error while updating user info") return } if updateUserResponse != nil { fmt.Println("StatusCode:", updateUserResponse.StatusCode) assert.Equal( 500, updateUserResponse.StatusCode, "Status Code is incorrect") } b, err := io.ReadAll(updateUserResponse.Body) if err != nil { log.Fatalln(err) } assert.True(strings.Contains(string(b), "status not valid")) } func TestRemoveUserSuccessfulResponse(t *testing.T) { /* To test removing a user from API */ assert := assert.New(t) // 1. Create an active user groups := []string{} policies := []string{} addUserResponse, addUserError := AddUser( "testremoveuser1", "secretKey", groups, policies) if addUserError != nil { log.Println(addUserError) return } if addUserResponse != nil { fmt.Println("StatusCode:", addUserResponse.StatusCode) assert.Equal( 201, addUserResponse.StatusCode, "Status Code is incorrect") } // 2. Remove the user removeUserResponse, removeUserError := RemoveUser("testremoveuser1") if removeUserError != nil { log.Println(removeUserError) return } if removeUserResponse != nil { fmt.Println("StatusCode:", removeUserResponse.StatusCode) assert.Equal( 204, removeUserResponse.StatusCode, "Status Code is incorrect") } // 3. Verify the user got removed getUserInfoResponse, getUserInfoError := GetUserInformation( "testremoveuser1") if getUserInfoError != nil { log.Println(getUserInfoError) assert.Fail("There was an error in the response") return } if getUserInfoResponse != nil { fmt.Println("StatusCode:", getUserInfoResponse.StatusCode) assert.Equal( 404, getUserInfoResponse.StatusCode, "Status Code is incorrect") } finalResponse := inspectHTTPResponse(getUserInfoResponse) fmt.Println(finalResponse) assert.True(strings.Contains( finalResponse, "The specified user does not exist"), finalResponse) } func TestUpdateGroupsForAUser(t *testing.T) { /* To test Update Groups For a User End Point. */ // 1. Create the user numberOfGroups := 3 groupName := "updategroupforausergroup" userName := "updategroupsforauser1" assert := assert.New(t) groups := []string{} policies := []string{} response, err := AddUser(userName, "secretKey", groups, policies) if err != nil { log.Println(err) return } if response != nil { fmt.Println("StatusCode:", response.StatusCode) assert.Equal(201, response.StatusCode, "Status Code is incorrect") } // 2. Update the groups of the created user with newGroups newGroups := make([]string, 3) for i := 0; i < numberOfGroups; i++ { newGroups[i] = groupName + strconv.Itoa(i) } response, err = UpdateGroupsForAUser(userName, newGroups) if err != nil { log.Println(err) return } if response != nil { fmt.Println("StatusCode:", response.StatusCode) assert.Equal(200, response.StatusCode, "Status Code is incorrect") } // 3. Verify the newGroups were updated accordingly getUserInfoResponse, getUserInfoErr := GetUserInformation(userName) if getUserInfoErr != nil { log.Println(getUserInfoErr) assert.Fail("There was an error in the response") return } if getUserInfoResponse != nil { fmt.Println("StatusCode:", getUserInfoResponse.StatusCode) assert.Equal( 200, getUserInfoResponse.StatusCode, "Status Code is incorrect") } finalResponse := inspectHTTPResponse(getUserInfoResponse) for i := 0; i < numberOfGroups; i++ { assert.True(strings.Contains( finalResponse, groupName+strconv.Itoa(i)), finalResponse) } } func TestCreateServiceAccountForUser(t *testing.T) { /* To test creation of service account for a user. */ // Test's variables userName := "testcreateserviceaccountforuser1" assert := assert.New(t) policy := "" // 1. Create the user groups := []string{} policies := []string{} response, err := AddUser(userName, "secretKey", groups, policies) if err != nil { log.Println(err) return } if response != nil { fmt.Println("StatusCode:", response.StatusCode) assert.Equal(201, response.StatusCode, "Status Code is incorrect") } // 2. Create the service account for the user createServiceAccountResponse, createServiceAccountError := CreateServiceAccountForUser( userName, policy, ) if createServiceAccountError != nil { log.Println(createServiceAccountError) assert.Fail("Error in createServiceAccountError") } if createServiceAccountResponse != nil { fmt.Println("StatusCode:", createServiceAccountResponse.StatusCode) assert.Equal( 201, createServiceAccountResponse.StatusCode, inspectHTTPResponse(createServiceAccountResponse), ) } // 3. Verify the service account for the user listOfAccountsResponse, listOfAccountsError := ReturnsAListOfServiceAccountsForAUser(userName) fmt.Println(listOfAccountsResponse, listOfAccountsError) if listOfAccountsError != nil { log.Println(listOfAccountsError) assert.Fail("Error in listOfAccountsError") } finalResponse := inspectHTTPResponse(listOfAccountsResponse) if listOfAccountsResponse != nil { fmt.Println("StatusCode:", listOfAccountsResponse.StatusCode) assert.Equal( 200, listOfAccountsResponse.StatusCode, finalResponse, ) } } func TestUsersGroupsBulk(t *testing.T) { /* To test UsersGroupsBulk End Point */ // Vars assert := assert.New(t) numberOfUsers := 5 numberOfGroups := 1 // var groups = []string{} policies := []string{} username := "testusersgroupbulk" groupName := "testusersgroupsbulkgroupone" members := []string{} users := make([]string, numberOfUsers) groups := make([]string, numberOfGroups) // 1. Create some users for i := 0; i < numberOfUsers; i++ { users[i] = username + strconv.Itoa(i) response, err := AddUser( users[i], "secretKey"+strconv.Itoa(i), []string{}, policies) if err != nil { log.Println(err) return } if response != nil { fmt.Println("POST StatusCode:", response.StatusCode) assert.Equal(201, response.StatusCode, "Status Code is incorrect on index: "+strconv.Itoa(i)) } } // 2. Create a group with no members responseAddGroup, errorAddGroup := AddGroup(groupName, members) if errorAddGroup != nil { log.Println(errorAddGroup) return } finalResponse := inspectHTTPResponse(responseAddGroup) if responseAddGroup != nil { fmt.Println("POST StatusCode:", responseAddGroup.StatusCode) assert.Equal( 201, responseAddGroup.StatusCode, finalResponse, ) } // 3. Add users to the group groups[0] = groupName responseUsersGroupsBulk, errorUsersGroupsBulk := UsersGroupsBulk( users, groups, ) if errorUsersGroupsBulk != nil { log.Println(errorUsersGroupsBulk) return } finalResponse = inspectHTTPResponse(responseUsersGroupsBulk) if responseUsersGroupsBulk != nil { fmt.Println("POST StatusCode:", responseUsersGroupsBulk.StatusCode) assert.Equal( 200, responseUsersGroupsBulk.StatusCode, finalResponse, ) } // 4. Verify users got added to the group for i := 0; i < numberOfUsers; i++ { responseGetUserInfo, errGetUserInfo := GetUserInformation( username + strconv.Itoa(i), ) if errGetUserInfo != nil { log.Println(errGetUserInfo) assert.Fail("There was an error in the response") return } finalResponse = inspectHTTPResponse(responseGetUserInfo) if responseGetUserInfo != nil { assert.Equal(200, responseGetUserInfo.StatusCode, finalResponse) } // Make sure the user belongs to the created group assert.True(strings.Contains(finalResponse, groupName)) } } func Test_GetUserPolicyAPI(t *testing.T) { assert := assert.New(t) // 1. Create an active user with valid policy groups := []string{} policies := []string{"readwrite"} addUserResponse, addUserError := AddUser( "getpolicyuser", "secretKey", groups, policies) if addUserError != nil { log.Println(addUserError) return } if addUserResponse != nil { fmt.Println("StatusCode:", addUserResponse.StatusCode) assert.Equal( 201, addUserResponse.StatusCode, "Status Code is incorrect") } type args struct { api string } tests := []struct { name string args args expectedStatus int expectedError error }{ { name: "Get User Policies", args: args{ api: "/user/policy", }, expectedStatus: 200, expectedError: nil, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { client := &http.Client{ Timeout: 3 * time.Second, } request, err := http.NewRequest( "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil) if err != nil { log.Println(err) return } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) return } if response != nil { assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") } }) } } ================================================ FILE: models/a_user_policy_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // AUserPolicyResponse a user policy response // // swagger:model aUserPolicyResponse type AUserPolicyResponse struct { // policy Policy string `json:"policy,omitempty"` } // Validate validates this a user policy response func (m *AUserPolicyResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this a user policy response based on context it is used func (m *AUserPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *AUserPolicyResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AUserPolicyResponse) UnmarshalBinary(b []byte) error { var res AUserPolicyResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/access_rule.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // AccessRule access rule // // swagger:model accessRule type AccessRule struct { // access Access string `json:"access,omitempty"` // prefix Prefix string `json:"prefix,omitempty"` } // Validate validates this access rule func (m *AccessRule) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this access rule based on context it is used func (m *AccessRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *AccessRule) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AccessRule) UnmarshalBinary(b []byte) error { var res AccessRule if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/account_change_password_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // AccountChangePasswordRequest account change password request // // swagger:model accountChangePasswordRequest type AccountChangePasswordRequest struct { // current secret key // Required: true CurrentSecretKey *string `json:"current_secret_key"` // new secret key // Required: true NewSecretKey *string `json:"new_secret_key"` } // Validate validates this account change password request func (m *AccountChangePasswordRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateCurrentSecretKey(formats); err != nil { res = append(res, err) } if err := m.validateNewSecretKey(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *AccountChangePasswordRequest) validateCurrentSecretKey(formats strfmt.Registry) error { if err := validate.Required("current_secret_key", "body", m.CurrentSecretKey); err != nil { return err } return nil } func (m *AccountChangePasswordRequest) validateNewSecretKey(formats strfmt.Registry) error { if err := validate.Required("new_secret_key", "body", m.NewSecretKey); err != nil { return err } return nil } // ContextValidate validates this account change password request based on context it is used func (m *AccountChangePasswordRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *AccountChangePasswordRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AccountChangePasswordRequest) UnmarshalBinary(b []byte) error { var res AccountChangePasswordRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/add_bucket_lifecycle.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // AddBucketLifecycle add bucket lifecycle // // swagger:model addBucketLifecycle type AddBucketLifecycle struct { // Non required, toggle to disable or enable rule Disable bool `json:"disable,omitempty"` // Non required, toggle to disable or enable rule ExpiredObjectDeleteAll bool `json:"expired_object_delete_all,omitempty"` // Non required, toggle to disable or enable rule ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"` // Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM ExpiryDays int32 `json:"expiry_days,omitempty"` // Non required, can be set in case of expiration is enabled NewerNoncurrentversionExpirationVersions int32 `json:"newer_noncurrentversion_expiration_versions,omitempty"` // Non required, can be set in case of expiration is enabled NoncurrentversionExpirationDays int32 `json:"noncurrentversion_expiration_days,omitempty"` // Non required, can be set in case of transition is enabled NoncurrentversionTransitionDays int32 `json:"noncurrentversion_transition_days,omitempty"` // Non required, can be set in case of transition is enabled NoncurrentversionTransitionStorageClass string `json:"noncurrentversion_transition_storage_class,omitempty"` // Non required field, it matches a prefix to perform ILM operations on it Prefix string `json:"prefix,omitempty"` // Required only in case of transition is set. it refers to a tier StorageClass string `json:"storage_class,omitempty"` // Non required field, tags to match ILM files Tags string `json:"tags,omitempty"` // Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM TransitionDays int32 `json:"transition_days,omitempty"` // ILM Rule type (Expiry or transition) // Enum: ["expiry","transition"] Type string `json:"type,omitempty"` } // Validate validates this add bucket lifecycle func (m *AddBucketLifecycle) Validate(formats strfmt.Registry) error { var res []error if err := m.validateType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } var addBucketLifecycleTypeTypePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil { panic(err) } for _, v := range res { addBucketLifecycleTypeTypePropEnum = append(addBucketLifecycleTypeTypePropEnum, v) } } const ( // AddBucketLifecycleTypeExpiry captures enum value "expiry" AddBucketLifecycleTypeExpiry string = "expiry" // AddBucketLifecycleTypeTransition captures enum value "transition" AddBucketLifecycleTypeTransition string = "transition" ) // prop value enum func (m *AddBucketLifecycle) validateTypeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, addBucketLifecycleTypeTypePropEnum, true); err != nil { return err } return nil } func (m *AddBucketLifecycle) validateType(formats strfmt.Registry) error { if swag.IsZero(m.Type) { // not required return nil } // value enum if err := m.validateTypeEnum("type", "body", m.Type); err != nil { return err } return nil } // ContextValidate validates this add bucket lifecycle based on context it is used func (m *AddBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *AddBucketLifecycle) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AddBucketLifecycle) UnmarshalBinary(b []byte) error { var res AddBucketLifecycle if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/add_bucket_replication.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // AddBucketReplication add bucket replication // // swagger:model addBucketReplication type AddBucketReplication struct { // arn Arn string `json:"arn,omitempty"` // destination bucket DestinationBucket string `json:"destination_bucket,omitempty"` } // Validate validates this add bucket replication func (m *AddBucketReplication) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this add bucket replication based on context it is used func (m *AddBucketReplication) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *AddBucketReplication) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AddBucketReplication) UnmarshalBinary(b []byte) error { var res AddBucketReplication if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/add_group_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // AddGroupRequest add group request // // swagger:model addGroupRequest type AddGroupRequest struct { // group // Required: true Group *string `json:"group"` // members // Required: true Members []string `json:"members"` } // Validate validates this add group request func (m *AddGroupRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateGroup(formats); err != nil { res = append(res, err) } if err := m.validateMembers(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *AddGroupRequest) validateGroup(formats strfmt.Registry) error { if err := validate.Required("group", "body", m.Group); err != nil { return err } return nil } func (m *AddGroupRequest) validateMembers(formats strfmt.Registry) error { if err := validate.Required("members", "body", m.Members); err != nil { return err } return nil } // ContextValidate validates this add group request based on context it is used func (m *AddGroupRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *AddGroupRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AddGroupRequest) UnmarshalBinary(b []byte) error { var res AddGroupRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/add_multi_bucket_lifecycle.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // AddMultiBucketLifecycle add multi bucket lifecycle // // swagger:model addMultiBucketLifecycle type AddMultiBucketLifecycle struct { // buckets // Required: true Buckets []string `json:"buckets"` // Non required, toggle to disable or enable rule ExpiredObjectDeleteAll bool `json:"expired_object_delete_all,omitempty"` // Non required, toggle to disable or enable rule ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"` // Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM ExpiryDays int32 `json:"expiry_days,omitempty"` // Non required, can be set in case of expiration is enabled NoncurrentversionExpirationDays int32 `json:"noncurrentversion_expiration_days,omitempty"` // Non required, can be set in case of transition is enabled NoncurrentversionTransitionDays int32 `json:"noncurrentversion_transition_days,omitempty"` // Non required, can be set in case of transition is enabled NoncurrentversionTransitionStorageClass string `json:"noncurrentversion_transition_storage_class,omitempty"` // Non required field, it matches a prefix to perform ILM operations on it Prefix string `json:"prefix,omitempty"` // Required only in case of transition is set. it refers to a tier StorageClass string `json:"storage_class,omitempty"` // Non required field, tags to match ILM files Tags string `json:"tags,omitempty"` // Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM TransitionDays int32 `json:"transition_days,omitempty"` // ILM Rule type (Expiry or transition) // Required: true // Enum: ["expiry","transition"] Type *string `json:"type"` } // Validate validates this add multi bucket lifecycle func (m *AddMultiBucketLifecycle) Validate(formats strfmt.Registry) error { var res []error if err := m.validateBuckets(formats); err != nil { res = append(res, err) } if err := m.validateType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *AddMultiBucketLifecycle) validateBuckets(formats strfmt.Registry) error { if err := validate.Required("buckets", "body", m.Buckets); err != nil { return err } return nil } var addMultiBucketLifecycleTypeTypePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil { panic(err) } for _, v := range res { addMultiBucketLifecycleTypeTypePropEnum = append(addMultiBucketLifecycleTypeTypePropEnum, v) } } const ( // AddMultiBucketLifecycleTypeExpiry captures enum value "expiry" AddMultiBucketLifecycleTypeExpiry string = "expiry" // AddMultiBucketLifecycleTypeTransition captures enum value "transition" AddMultiBucketLifecycleTypeTransition string = "transition" ) // prop value enum func (m *AddMultiBucketLifecycle) validateTypeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, addMultiBucketLifecycleTypeTypePropEnum, true); err != nil { return err } return nil } func (m *AddMultiBucketLifecycle) validateType(formats strfmt.Registry) error { if err := validate.Required("type", "body", m.Type); err != nil { return err } // value enum if err := m.validateTypeEnum("type", "body", *m.Type); err != nil { return err } return nil } // ContextValidate validates this add multi bucket lifecycle based on context it is used func (m *AddMultiBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *AddMultiBucketLifecycle) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AddMultiBucketLifecycle) UnmarshalBinary(b []byte) error { var res AddMultiBucketLifecycle if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/add_policy_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // AddPolicyRequest add policy request // // swagger:model addPolicyRequest type AddPolicyRequest struct { // name // Required: true Name *string `json:"name"` // policy // Required: true Policy *string `json:"policy"` } // Validate validates this add policy request func (m *AddPolicyRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateName(formats); err != nil { res = append(res, err) } if err := m.validatePolicy(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *AddPolicyRequest) validateName(formats strfmt.Registry) error { if err := validate.Required("name", "body", m.Name); err != nil { return err } return nil } func (m *AddPolicyRequest) validatePolicy(formats strfmt.Registry) error { if err := validate.Required("policy", "body", m.Policy); err != nil { return err } return nil } // ContextValidate validates this add policy request based on context it is used func (m *AddPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *AddPolicyRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AddPolicyRequest) UnmarshalBinary(b []byte) error { var res AddPolicyRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/add_user_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // AddUserRequest add user request // // swagger:model addUserRequest type AddUserRequest struct { // access key // Required: true AccessKey *string `json:"accessKey"` // groups // Required: true Groups []string `json:"groups"` // policies // Required: true Policies []string `json:"policies"` // secret key // Required: true SecretKey *string `json:"secretKey"` } // Validate validates this add user request func (m *AddUserRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAccessKey(formats); err != nil { res = append(res, err) } if err := m.validateGroups(formats); err != nil { res = append(res, err) } if err := m.validatePolicies(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 *AddUserRequest) validateAccessKey(formats strfmt.Registry) error { if err := validate.Required("accessKey", "body", m.AccessKey); err != nil { return err } return nil } func (m *AddUserRequest) validateGroups(formats strfmt.Registry) error { if err := validate.Required("groups", "body", m.Groups); err != nil { return err } return nil } func (m *AddUserRequest) validatePolicies(formats strfmt.Registry) error { if err := validate.Required("policies", "body", m.Policies); err != nil { return err } return nil } func (m *AddUserRequest) validateSecretKey(formats strfmt.Registry) error { if err := validate.Required("secretKey", "body", m.SecretKey); err != nil { return err } return nil } // ContextValidate validates this add user request based on context it is used func (m *AddUserRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *AddUserRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AddUserRequest) UnmarshalBinary(b []byte) error { var res AddUserRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/admin_info_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // AdminInfoResponse admin info response // // swagger:model adminInfoResponse type AdminInfoResponse struct { // advanced metrics status // Enum: ["not configured","available","unavailable"] AdvancedMetricsStatus string `json:"advancedMetricsStatus,omitempty"` // backend Backend *BackendProperties `json:"backend,omitempty"` // buckets Buckets int64 `json:"buckets,omitempty"` // objects Objects int64 `json:"objects,omitempty"` // servers Servers []*ServerProperties `json:"servers"` // usage Usage int64 `json:"usage,omitempty"` // widgets Widgets []*Widget `json:"widgets"` } // Validate validates this admin info response func (m *AdminInfoResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAdvancedMetricsStatus(formats); err != nil { res = append(res, err) } if err := m.validateBackend(formats); err != nil { res = append(res, err) } if err := m.validateServers(formats); err != nil { res = append(res, err) } if err := m.validateWidgets(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } var adminInfoResponseTypeAdvancedMetricsStatusPropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["not configured","available","unavailable"]`), &res); err != nil { panic(err) } for _, v := range res { adminInfoResponseTypeAdvancedMetricsStatusPropEnum = append(adminInfoResponseTypeAdvancedMetricsStatusPropEnum, v) } } const ( // AdminInfoResponseAdvancedMetricsStatusNotConfigured captures enum value "not configured" AdminInfoResponseAdvancedMetricsStatusNotConfigured string = "not configured" // AdminInfoResponseAdvancedMetricsStatusAvailable captures enum value "available" AdminInfoResponseAdvancedMetricsStatusAvailable string = "available" // AdminInfoResponseAdvancedMetricsStatusUnavailable captures enum value "unavailable" AdminInfoResponseAdvancedMetricsStatusUnavailable string = "unavailable" ) // prop value enum func (m *AdminInfoResponse) validateAdvancedMetricsStatusEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, adminInfoResponseTypeAdvancedMetricsStatusPropEnum, true); err != nil { return err } return nil } func (m *AdminInfoResponse) validateAdvancedMetricsStatus(formats strfmt.Registry) error { if swag.IsZero(m.AdvancedMetricsStatus) { // not required return nil } // value enum if err := m.validateAdvancedMetricsStatusEnum("advancedMetricsStatus", "body", m.AdvancedMetricsStatus); err != nil { return err } return nil } func (m *AdminInfoResponse) validateBackend(formats strfmt.Registry) error { if swag.IsZero(m.Backend) { // not required return nil } if m.Backend != nil { if err := m.Backend.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("backend") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("backend") } return err } } return nil } func (m *AdminInfoResponse) validateServers(formats strfmt.Registry) error { if swag.IsZero(m.Servers) { // not required return nil } for i := 0; i < len(m.Servers); i++ { if swag.IsZero(m.Servers[i]) { // not required continue } if m.Servers[i] != nil { if err := m.Servers[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("servers" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("servers" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *AdminInfoResponse) validateWidgets(formats strfmt.Registry) error { if swag.IsZero(m.Widgets) { // not required return nil } for i := 0; i < len(m.Widgets); i++ { if swag.IsZero(m.Widgets[i]) { // not required continue } if m.Widgets[i] != nil { if err := m.Widgets[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("widgets" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("widgets" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this admin info response based on the context it is used func (m *AdminInfoResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateBackend(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateServers(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateWidgets(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *AdminInfoResponse) contextValidateBackend(ctx context.Context, formats strfmt.Registry) error { if m.Backend != nil { if swag.IsZero(m.Backend) { // not required return nil } if err := m.Backend.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("backend") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("backend") } return err } } return nil } func (m *AdminInfoResponse) contextValidateServers(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Servers); i++ { if m.Servers[i] != nil { if swag.IsZero(m.Servers[i]) { // not required return nil } if err := m.Servers[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("servers" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("servers" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *AdminInfoResponse) contextValidateWidgets(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Widgets); i++ { if m.Widgets[i] != nil { if swag.IsZero(m.Widgets[i]) { // not required return nil } if err := m.Widgets[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("widgets" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("widgets" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *AdminInfoResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AdminInfoResponse) UnmarshalBinary(b []byte) error { var res AdminInfoResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/api_error.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // APIError Api error // // swagger:model ApiError type APIError struct { // detailed message DetailedMessage string `json:"detailedMessage,omitempty"` // message Message string `json:"message,omitempty"` } // Validate validates this Api error func (m *APIError) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this Api error based on context it is used func (m *APIError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *APIError) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *APIError) UnmarshalBinary(b []byte) error { var res APIError if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/api_key.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // APIKey api key // // swagger:model apiKey type APIKey struct { // api key APIKey string `json:"apiKey,omitempty"` } // Validate validates this api key func (m *APIKey) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this api key based on context it is used func (m *APIKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *APIKey) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *APIKey) UnmarshalBinary(b []byte) error { var res APIKey if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/arns_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ArnsResponse arns response // // swagger:model arnsResponse type ArnsResponse struct { // arns Arns []string `json:"arns"` } // Validate validates this arns response func (m *ArnsResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this arns response based on context it is used func (m *ArnsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ArnsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ArnsResponse) UnmarshalBinary(b []byte) error { var res ArnsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/backend_properties.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // BackendProperties backend properties // // swagger:model BackendProperties type BackendProperties struct { // backend type BackendType string `json:"backendType,omitempty"` // offline drives OfflineDrives int64 `json:"offlineDrives,omitempty"` // online drives OnlineDrives int64 `json:"onlineDrives,omitempty"` // rr s c parity RrSCParity int64 `json:"rrSCParity,omitempty"` // standard s c parity StandardSCParity int64 `json:"standardSCParity,omitempty"` } // Validate validates this backend properties func (m *BackendProperties) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this backend properties based on context it is used func (m *BackendProperties) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BackendProperties) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BackendProperties) UnmarshalBinary(b []byte) error { var res BackendProperties if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Bucket bucket // // swagger:model bucket type Bucket struct { // access Access *BucketAccess `json:"access,omitempty"` // creation date CreationDate string `json:"creation_date,omitempty"` // definition Definition string `json:"definition,omitempty"` // details Details *BucketDetails `json:"details,omitempty"` // name // Required: true // Min Length: 3 Name *string `json:"name"` // objects Objects int64 `json:"objects,omitempty"` // rw access RwAccess *BucketRwAccess `json:"rw_access,omitempty"` // size Size int64 `json:"size,omitempty"` } // Validate validates this bucket func (m *Bucket) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAccess(formats); err != nil { res = append(res, err) } if err := m.validateDetails(formats); err != nil { res = append(res, err) } if err := m.validateName(formats); err != nil { res = append(res, err) } if err := m.validateRwAccess(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Bucket) validateAccess(formats strfmt.Registry) error { if swag.IsZero(m.Access) { // not required return nil } if m.Access != nil { if err := m.Access.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("access") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("access") } return err } } return nil } func (m *Bucket) validateDetails(formats strfmt.Registry) error { if swag.IsZero(m.Details) { // not required return nil } if m.Details != nil { if err := m.Details.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("details") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("details") } return err } } return nil } func (m *Bucket) validateName(formats strfmt.Registry) error { if err := validate.Required("name", "body", m.Name); err != nil { return err } if err := validate.MinLength("name", "body", *m.Name, 3); err != nil { return err } return nil } func (m *Bucket) validateRwAccess(formats strfmt.Registry) error { if swag.IsZero(m.RwAccess) { // not required return nil } if m.RwAccess != nil { if err := m.RwAccess.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("rw_access") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("rw_access") } return err } } return nil } // ContextValidate validate this bucket based on the context it is used func (m *Bucket) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateAccess(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateDetails(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateRwAccess(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Bucket) contextValidateAccess(ctx context.Context, formats strfmt.Registry) error { if m.Access != nil { if swag.IsZero(m.Access) { // not required return nil } if err := m.Access.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("access") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("access") } return err } } return nil } func (m *Bucket) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { if m.Details != nil { if swag.IsZero(m.Details) { // not required return nil } if err := m.Details.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("details") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("details") } return err } } return nil } func (m *Bucket) contextValidateRwAccess(ctx context.Context, formats strfmt.Registry) error { if m.RwAccess != nil { if swag.IsZero(m.RwAccess) { // not required return nil } if err := m.RwAccess.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("rw_access") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("rw_access") } return err } } return nil } // MarshalBinary interface implementation func (m *Bucket) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Bucket) UnmarshalBinary(b []byte) error { var res Bucket if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // BucketDetails bucket details // // swagger:model BucketDetails type BucketDetails struct { // locking Locking bool `json:"locking,omitempty"` // quota Quota *BucketDetailsQuota `json:"quota,omitempty"` // replication Replication bool `json:"replication,omitempty"` // tags Tags map[string]string `json:"tags,omitempty"` // versioning Versioning bool `json:"versioning,omitempty"` // versioning suspended VersioningSuspended bool `json:"versioningSuspended,omitempty"` } // Validate validates this bucket details func (m *BucketDetails) Validate(formats strfmt.Registry) error { var res []error if err := m.validateQuota(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketDetails) validateQuota(formats strfmt.Registry) error { if swag.IsZero(m.Quota) { // not required return nil } if m.Quota != nil { if err := m.Quota.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("details" + "." + "quota") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("details" + "." + "quota") } return err } } return nil } // ContextValidate validate this bucket details based on the context it is used func (m *BucketDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateQuota(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketDetails) contextValidateQuota(ctx context.Context, formats strfmt.Registry) error { if m.Quota != nil { if swag.IsZero(m.Quota) { // not required return nil } if err := m.Quota.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("details" + "." + "quota") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("details" + "." + "quota") } return err } } return nil } // MarshalBinary interface implementation func (m *BucketDetails) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketDetails) UnmarshalBinary(b []byte) error { var res BucketDetails if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // BucketDetailsQuota bucket details quota // // swagger:model BucketDetailsQuota type BucketDetailsQuota struct { // quota Quota int64 `json:"quota,omitempty"` // type // Enum: ["hard"] Type string `json:"type,omitempty"` } // Validate validates this bucket details quota func (m *BucketDetailsQuota) Validate(formats strfmt.Registry) error { var res []error if err := m.validateType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } var bucketDetailsQuotaTypeTypePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["hard"]`), &res); err != nil { panic(err) } for _, v := range res { bucketDetailsQuotaTypeTypePropEnum = append(bucketDetailsQuotaTypeTypePropEnum, v) } } const ( // BucketDetailsQuotaTypeHard captures enum value "hard" BucketDetailsQuotaTypeHard string = "hard" ) // prop value enum func (m *BucketDetailsQuota) validateTypeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, bucketDetailsQuotaTypeTypePropEnum, true); err != nil { return err } return nil } func (m *BucketDetailsQuota) validateType(formats strfmt.Registry) error { if swag.IsZero(m.Type) { // not required return nil } // value enum if err := m.validateTypeEnum("details"+"."+"quota"+"."+"type", "body", m.Type); err != nil { return err } return nil } // ContextValidate validates this bucket details quota based on context it is used func (m *BucketDetailsQuota) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BucketDetailsQuota) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketDetailsQuota) UnmarshalBinary(b []byte) error { var res BucketDetailsQuota if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // BucketRwAccess bucket rw access // // swagger:model BucketRwAccess type BucketRwAccess struct { // read Read bool `json:"read,omitempty"` // write Write bool `json:"write,omitempty"` } // Validate validates this bucket rw access func (m *BucketRwAccess) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this bucket rw access based on context it is used func (m *BucketRwAccess) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BucketRwAccess) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketRwAccess) UnmarshalBinary(b []byte) error { var res BucketRwAccess if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_access.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // BucketAccess bucket access // // swagger:model bucketAccess type BucketAccess string func NewBucketAccess(value BucketAccess) *BucketAccess { return &value } // Pointer returns a pointer to a freshly-allocated BucketAccess. func (m BucketAccess) Pointer() *BucketAccess { return &m } const ( // BucketAccessPRIVATE captures enum value "PRIVATE" BucketAccessPRIVATE BucketAccess = "PRIVATE" // BucketAccessPUBLIC captures enum value "PUBLIC" BucketAccessPUBLIC BucketAccess = "PUBLIC" // BucketAccessCUSTOM captures enum value "CUSTOM" BucketAccessCUSTOM BucketAccess = "CUSTOM" ) // for schema var bucketAccessEnum []any func init() { var res []BucketAccess if err := json.Unmarshal([]byte(`["PRIVATE","PUBLIC","CUSTOM"]`), &res); err != nil { panic(err) } for _, v := range res { bucketAccessEnum = append(bucketAccessEnum, v) } } func (m BucketAccess) validateBucketAccessEnum(path, location string, value BucketAccess) error { if err := validate.EnumCase(path, location, value, bucketAccessEnum, true); err != nil { return err } return nil } // Validate validates this bucket access func (m BucketAccess) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validateBucketAccessEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ContextValidate validates this bucket access based on context it is used func (m BucketAccess) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/bucket_encryption_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // BucketEncryptionInfo bucket encryption info // // swagger:model bucketEncryptionInfo type BucketEncryptionInfo struct { // algorithm Algorithm string `json:"algorithm,omitempty"` // kms master key ID KmsMasterKeyID string `json:"kmsMasterKeyID,omitempty"` } // Validate validates this bucket encryption info func (m *BucketEncryptionInfo) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this bucket encryption info based on context it is used func (m *BucketEncryptionInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BucketEncryptionInfo) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketEncryptionInfo) UnmarshalBinary(b []byte) error { var res BucketEncryptionInfo if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_encryption_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // BucketEncryptionRequest bucket encryption request // // swagger:model bucketEncryptionRequest type BucketEncryptionRequest struct { // enc type EncType *BucketEncryptionType `json:"encType,omitempty"` // kms key ID KmsKeyID string `json:"kmsKeyID,omitempty"` } // Validate validates this bucket encryption request func (m *BucketEncryptionRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateEncType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketEncryptionRequest) validateEncType(formats strfmt.Registry) error { if swag.IsZero(m.EncType) { // not required return nil } if m.EncType != nil { if err := m.EncType.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("encType") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("encType") } return err } } return nil } // ContextValidate validate this bucket encryption request based on the context it is used func (m *BucketEncryptionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateEncType(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketEncryptionRequest) contextValidateEncType(ctx context.Context, formats strfmt.Registry) error { if m.EncType != nil { if swag.IsZero(m.EncType) { // not required return nil } if err := m.EncType.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("encType") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("encType") } return err } } return nil } // MarshalBinary interface implementation func (m *BucketEncryptionRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketEncryptionRequest) UnmarshalBinary(b []byte) error { var res BucketEncryptionRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_encryption_type.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // BucketEncryptionType bucket encryption type // // swagger:model bucketEncryptionType type BucketEncryptionType string func NewBucketEncryptionType(value BucketEncryptionType) *BucketEncryptionType { return &value } // Pointer returns a pointer to a freshly-allocated BucketEncryptionType. func (m BucketEncryptionType) Pointer() *BucketEncryptionType { return &m } const ( // BucketEncryptionTypeSseDashS3 captures enum value "sse-s3" BucketEncryptionTypeSseDashS3 BucketEncryptionType = "sse-s3" // BucketEncryptionTypeSseDashKms captures enum value "sse-kms" BucketEncryptionTypeSseDashKms BucketEncryptionType = "sse-kms" ) // for schema var bucketEncryptionTypeEnum []any func init() { var res []BucketEncryptionType if err := json.Unmarshal([]byte(`["sse-s3","sse-kms"]`), &res); err != nil { panic(err) } for _, v := range res { bucketEncryptionTypeEnum = append(bucketEncryptionTypeEnum, v) } } func (m BucketEncryptionType) validateBucketEncryptionTypeEnum(path, location string, value BucketEncryptionType) error { if err := validate.EnumCase(path, location, value, bucketEncryptionTypeEnum, true); err != nil { return err } return nil } // Validate validates this bucket encryption type func (m BucketEncryptionType) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validateBucketEncryptionTypeEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ContextValidate validates this bucket encryption type based on context it is used func (m BucketEncryptionType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/bucket_event_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // BucketEventRequest bucket event request // // swagger:model bucketEventRequest type BucketEventRequest struct { // configuration // Required: true Configuration *NotificationConfig `json:"configuration"` // ignore existing IgnoreExisting bool `json:"ignoreExisting,omitempty"` } // Validate validates this bucket event request func (m *BucketEventRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateConfiguration(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketEventRequest) validateConfiguration(formats strfmt.Registry) error { if err := validate.Required("configuration", "body", m.Configuration); err != nil { return err } if m.Configuration != nil { if err := m.Configuration.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("configuration") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("configuration") } return err } } return nil } // ContextValidate validate this bucket event request based on the context it is used func (m *BucketEventRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateConfiguration(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketEventRequest) contextValidateConfiguration(ctx context.Context, formats strfmt.Registry) error { if m.Configuration != nil { if err := m.Configuration.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("configuration") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("configuration") } return err } } return nil } // MarshalBinary interface implementation func (m *BucketEventRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketEventRequest) UnmarshalBinary(b []byte) error { var res BucketEventRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_lifecycle_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // BucketLifecycleResponse bucket lifecycle response // // swagger:model bucketLifecycleResponse type BucketLifecycleResponse struct { // lifecycle Lifecycle []*ObjectBucketLifecycle `json:"lifecycle"` } // Validate validates this bucket lifecycle response func (m *BucketLifecycleResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateLifecycle(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketLifecycleResponse) validateLifecycle(formats strfmt.Registry) error { if swag.IsZero(m.Lifecycle) { // not required return nil } for i := 0; i < len(m.Lifecycle); i++ { if swag.IsZero(m.Lifecycle[i]) { // not required continue } if m.Lifecycle[i] != nil { if err := m.Lifecycle[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("lifecycle" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("lifecycle" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this bucket lifecycle response based on the context it is used func (m *BucketLifecycleResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateLifecycle(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketLifecycleResponse) contextValidateLifecycle(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Lifecycle); i++ { if m.Lifecycle[i] != nil { if swag.IsZero(m.Lifecycle[i]) { // not required return nil } if err := m.Lifecycle[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("lifecycle" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("lifecycle" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *BucketLifecycleResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketLifecycleResponse) UnmarshalBinary(b []byte) error { var res BucketLifecycleResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_ob_locking_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // BucketObLockingResponse bucket ob locking response // // swagger:model bucketObLockingResponse type BucketObLockingResponse struct { // object locking enabled ObjectLockingEnabled bool `json:"object_locking_enabled,omitempty"` } // Validate validates this bucket ob locking response func (m *BucketObLockingResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this bucket ob locking response based on context it is used func (m *BucketObLockingResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BucketObLockingResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketObLockingResponse) UnmarshalBinary(b []byte) error { var res BucketObLockingResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_object.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // BucketObject bucket object // // swagger:model bucketObject type BucketObject struct { // content type ContentType string `json:"content_type,omitempty"` // etag Etag string `json:"etag,omitempty"` // expiration Expiration string `json:"expiration,omitempty"` // expiration rule id ExpirationRuleID string `json:"expiration_rule_id,omitempty"` // is delete marker IsDeleteMarker bool `json:"is_delete_marker,omitempty"` // is latest IsLatest bool `json:"is_latest,omitempty"` // last modified LastModified string `json:"last_modified,omitempty"` // legal hold status LegalHoldStatus string `json:"legal_hold_status,omitempty"` // metadata Metadata map[string]string `json:"metadata,omitempty"` // name Name string `json:"name,omitempty"` // retention mode RetentionMode string `json:"retention_mode,omitempty"` // retention until date RetentionUntilDate string `json:"retention_until_date,omitempty"` // size Size int64 `json:"size,omitempty"` // tags Tags map[string]string `json:"tags,omitempty"` // user metadata UserMetadata map[string]string `json:"user_metadata,omitempty"` // user tags UserTags map[string]string `json:"user_tags,omitempty"` // version id VersionID string `json:"version_id,omitempty"` } // Validate validates this bucket object func (m *BucketObject) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this bucket object based on context it is used func (m *BucketObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BucketObject) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketObject) UnmarshalBinary(b []byte) error { var res BucketObject if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_quota.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // BucketQuota bucket quota // // swagger:model bucketQuota type BucketQuota struct { // quota Quota int64 `json:"quota,omitempty"` // type // Enum: ["hard"] Type string `json:"type,omitempty"` } // Validate validates this bucket quota func (m *BucketQuota) Validate(formats strfmt.Registry) error { var res []error if err := m.validateType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } var bucketQuotaTypeTypePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["hard"]`), &res); err != nil { panic(err) } for _, v := range res { bucketQuotaTypeTypePropEnum = append(bucketQuotaTypeTypePropEnum, v) } } const ( // BucketQuotaTypeHard captures enum value "hard" BucketQuotaTypeHard string = "hard" ) // prop value enum func (m *BucketQuota) validateTypeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, bucketQuotaTypeTypePropEnum, true); err != nil { return err } return nil } func (m *BucketQuota) validateType(formats strfmt.Registry) error { if swag.IsZero(m.Type) { // not required return nil } // value enum if err := m.validateTypeEnum("type", "body", m.Type); err != nil { return err } return nil } // ContextValidate validates this bucket quota based on context it is used func (m *BucketQuota) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BucketQuota) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketQuota) UnmarshalBinary(b []byte) error { var res BucketQuota if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_replication_destination.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // BucketReplicationDestination bucket replication destination // // swagger:model bucketReplicationDestination type BucketReplicationDestination struct { // bucket Bucket string `json:"bucket,omitempty"` } // Validate validates this bucket replication destination func (m *BucketReplicationDestination) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this bucket replication destination based on context it is used func (m *BucketReplicationDestination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BucketReplicationDestination) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketReplicationDestination) UnmarshalBinary(b []byte) error { var res BucketReplicationDestination if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_replication_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // BucketReplicationResponse bucket replication response // // swagger:model bucketReplicationResponse type BucketReplicationResponse struct { // rules Rules []*BucketReplicationRule `json:"rules"` } // Validate validates this bucket replication response func (m *BucketReplicationResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateRules(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketReplicationResponse) validateRules(formats strfmt.Registry) error { if swag.IsZero(m.Rules) { // not required return nil } for i := 0; i < len(m.Rules); i++ { if swag.IsZero(m.Rules[i]) { // not required continue } if m.Rules[i] != nil { if err := m.Rules[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("rules" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("rules" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this bucket replication response based on the context it is used func (m *BucketReplicationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateRules(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketReplicationResponse) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Rules); i++ { if m.Rules[i] != nil { if swag.IsZero(m.Rules[i]) { // not required return nil } if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("rules" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("rules" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *BucketReplicationResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketReplicationResponse) UnmarshalBinary(b []byte) error { var res BucketReplicationResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_replication_rule.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // BucketReplicationRule bucket replication rule // // swagger:model bucketReplicationRule type BucketReplicationRule struct { // bandwidth Bandwidth string `json:"bandwidth,omitempty"` // delete marker replication DeleteMarkerReplication bool `json:"delete_marker_replication,omitempty"` // deletes replication DeletesReplication bool `json:"deletes_replication,omitempty"` // destination Destination *BucketReplicationDestination `json:"destination,omitempty"` // existing objects ExistingObjects bool `json:"existingObjects,omitempty"` // health check period HealthCheckPeriod int64 `json:"healthCheckPeriod,omitempty"` // id ID string `json:"id,omitempty"` // metadata replication MetadataReplication bool `json:"metadata_replication,omitempty"` // prefix Prefix string `json:"prefix,omitempty"` // priority Priority int32 `json:"priority,omitempty"` // status // Enum: ["Enabled","Disabled"] Status string `json:"status,omitempty"` // storage class StorageClass string `json:"storageClass,omitempty"` // sync mode // Enum: ["async","sync"] SyncMode *string `json:"syncMode,omitempty"` // tags Tags string `json:"tags,omitempty"` } // Validate validates this bucket replication rule func (m *BucketReplicationRule) Validate(formats strfmt.Registry) error { var res []error if err := m.validateDestination(formats); err != nil { res = append(res, err) } if err := m.validateStatus(formats); err != nil { res = append(res, err) } if err := m.validateSyncMode(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketReplicationRule) validateDestination(formats strfmt.Registry) error { if swag.IsZero(m.Destination) { // not required return nil } if m.Destination != nil { if err := m.Destination.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("destination") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("destination") } return err } } return nil } var bucketReplicationRuleTypeStatusPropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["Enabled","Disabled"]`), &res); err != nil { panic(err) } for _, v := range res { bucketReplicationRuleTypeStatusPropEnum = append(bucketReplicationRuleTypeStatusPropEnum, v) } } const ( // BucketReplicationRuleStatusEnabled captures enum value "Enabled" BucketReplicationRuleStatusEnabled string = "Enabled" // BucketReplicationRuleStatusDisabled captures enum value "Disabled" BucketReplicationRuleStatusDisabled string = "Disabled" ) // prop value enum func (m *BucketReplicationRule) validateStatusEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, bucketReplicationRuleTypeStatusPropEnum, true); err != nil { return err } return nil } func (m *BucketReplicationRule) 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 } var bucketReplicationRuleTypeSyncModePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["async","sync"]`), &res); err != nil { panic(err) } for _, v := range res { bucketReplicationRuleTypeSyncModePropEnum = append(bucketReplicationRuleTypeSyncModePropEnum, v) } } const ( // BucketReplicationRuleSyncModeAsync captures enum value "async" BucketReplicationRuleSyncModeAsync string = "async" // BucketReplicationRuleSyncModeSync captures enum value "sync" BucketReplicationRuleSyncModeSync string = "sync" ) // prop value enum func (m *BucketReplicationRule) validateSyncModeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, bucketReplicationRuleTypeSyncModePropEnum, true); err != nil { return err } return nil } func (m *BucketReplicationRule) validateSyncMode(formats strfmt.Registry) error { if swag.IsZero(m.SyncMode) { // not required return nil } // value enum if err := m.validateSyncModeEnum("syncMode", "body", *m.SyncMode); err != nil { return err } return nil } // ContextValidate validate this bucket replication rule based on the context it is used func (m *BucketReplicationRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateDestination(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketReplicationRule) contextValidateDestination(ctx context.Context, formats strfmt.Registry) error { if m.Destination != nil { if swag.IsZero(m.Destination) { // not required return nil } if err := m.Destination.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("destination") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("destination") } return err } } return nil } // MarshalBinary interface implementation func (m *BucketReplicationRule) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketReplicationRule) UnmarshalBinary(b []byte) error { var res BucketReplicationRule if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_replication_rule_list.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // BucketReplicationRuleList bucket replication rule list // // swagger:model bucketReplicationRuleList type BucketReplicationRuleList struct { // rules Rules []string `json:"rules"` } // Validate validates this bucket replication rule list func (m *BucketReplicationRuleList) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this bucket replication rule list based on context it is used func (m *BucketReplicationRuleList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BucketReplicationRuleList) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketReplicationRuleList) UnmarshalBinary(b []byte) error { var res BucketReplicationRuleList if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bucket_versioning_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // BucketVersioningResponse bucket versioning response // // swagger:model bucketVersioningResponse type BucketVersioningResponse struct { // m f a delete MFADelete string `json:"MFADelete,omitempty"` // exclude folders ExcludeFolders bool `json:"excludeFolders,omitempty"` // excluded prefixes ExcludedPrefixes []*BucketVersioningResponseExcludedPrefixesItems0 `json:"excludedPrefixes"` // status Status string `json:"status,omitempty"` } // Validate validates this bucket versioning response func (m *BucketVersioningResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateExcludedPrefixes(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketVersioningResponse) validateExcludedPrefixes(formats strfmt.Registry) error { if swag.IsZero(m.ExcludedPrefixes) { // not required return nil } for i := 0; i < len(m.ExcludedPrefixes); i++ { if swag.IsZero(m.ExcludedPrefixes[i]) { // not required continue } if m.ExcludedPrefixes[i] != nil { if err := m.ExcludedPrefixes[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("excludedPrefixes" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("excludedPrefixes" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this bucket versioning response based on the context it is used func (m *BucketVersioningResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateExcludedPrefixes(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BucketVersioningResponse) contextValidateExcludedPrefixes(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.ExcludedPrefixes); i++ { if m.ExcludedPrefixes[i] != nil { if swag.IsZero(m.ExcludedPrefixes[i]) { // not required return nil } if err := m.ExcludedPrefixes[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("excludedPrefixes" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("excludedPrefixes" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *BucketVersioningResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketVersioningResponse) UnmarshalBinary(b []byte) error { var res BucketVersioningResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // BucketVersioningResponseExcludedPrefixesItems0 bucket versioning response excluded prefixes items0 // // swagger:model BucketVersioningResponseExcludedPrefixesItems0 type BucketVersioningResponseExcludedPrefixesItems0 struct { // prefix Prefix string `json:"prefix,omitempty"` } // Validate validates this bucket versioning response excluded prefixes items0 func (m *BucketVersioningResponseExcludedPrefixesItems0) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this bucket versioning response excluded prefixes items0 based on context it is used func (m *BucketVersioningResponseExcludedPrefixesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BucketVersioningResponseExcludedPrefixesItems0) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BucketVersioningResponseExcludedPrefixesItems0) UnmarshalBinary(b []byte) error { var res BucketVersioningResponseExcludedPrefixesItems0 if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/bulk_user_groups.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // BulkUserGroups bulk user groups // // swagger:model bulkUserGroups type BulkUserGroups struct { // groups // Required: true Groups []string `json:"groups"` // users // Required: true Users []string `json:"users"` } // Validate validates this bulk user groups func (m *BulkUserGroups) Validate(formats strfmt.Registry) error { var res []error if err := m.validateGroups(formats); err != nil { res = append(res, err) } if err := m.validateUsers(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *BulkUserGroups) validateGroups(formats strfmt.Registry) error { if err := validate.Required("groups", "body", m.Groups); err != nil { return err } return nil } func (m *BulkUserGroups) validateUsers(formats strfmt.Registry) error { if err := validate.Required("users", "body", m.Users); err != nil { return err } return nil } // ContextValidate validates this bulk user groups based on context it is used func (m *BulkUserGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *BulkUserGroups) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *BulkUserGroups) UnmarshalBinary(b []byte) error { var res BulkUserGroups if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/change_user_password_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ChangeUserPasswordRequest change user password request // // swagger:model changeUserPasswordRequest type ChangeUserPasswordRequest struct { // new secret key // Required: true NewSecretKey *string `json:"newSecretKey"` // selected user // Required: true SelectedUser *string `json:"selectedUser"` } // Validate validates this change user password request func (m *ChangeUserPasswordRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateNewSecretKey(formats); err != nil { res = append(res, err) } if err := m.validateSelectedUser(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ChangeUserPasswordRequest) validateNewSecretKey(formats strfmt.Registry) error { if err := validate.Required("newSecretKey", "body", m.NewSecretKey); err != nil { return err } return nil } func (m *ChangeUserPasswordRequest) validateSelectedUser(formats strfmt.Registry) error { if err := validate.Required("selectedUser", "body", m.SelectedUser); err != nil { return err } return nil } // ContextValidate validates this change user password request based on context it is used func (m *ChangeUserPasswordRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ChangeUserPasswordRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ChangeUserPasswordRequest) UnmarshalBinary(b []byte) error { var res ChangeUserPasswordRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/config_description.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ConfigDescription config description // // swagger:model configDescription type ConfigDescription struct { // description Description string `json:"description,omitempty"` // key Key string `json:"key,omitempty"` } // Validate validates this config description func (m *ConfigDescription) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this config description based on context it is used func (m *ConfigDescription) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ConfigDescription) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ConfigDescription) UnmarshalBinary(b []byte) error { var res ConfigDescription if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/config_export_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ConfigExportResponse config export response // // swagger:model configExportResponse type ConfigExportResponse struct { // status Status string `json:"status,omitempty"` // Returns base64 encoded value Value string `json:"value,omitempty"` } // Validate validates this config export response func (m *ConfigExportResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this config export response based on context it is used func (m *ConfigExportResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ConfigExportResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ConfigExportResponse) UnmarshalBinary(b []byte) error { var res ConfigExportResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/configuration.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Configuration configuration // // swagger:model configuration type Configuration struct { // key values KeyValues []*ConfigurationKV `json:"key_values"` // name Name string `json:"name,omitempty"` } // Validate validates this configuration func (m *Configuration) Validate(formats strfmt.Registry) error { var res []error if err := m.validateKeyValues(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Configuration) validateKeyValues(formats strfmt.Registry) error { if swag.IsZero(m.KeyValues) { // not required return nil } for i := 0; i < len(m.KeyValues); i++ { if swag.IsZero(m.KeyValues[i]) { // not required continue } if m.KeyValues[i] != nil { if err := m.KeyValues[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("key_values" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("key_values" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this configuration based on the context it is used func (m *Configuration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateKeyValues(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Configuration) contextValidateKeyValues(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.KeyValues); i++ { if m.KeyValues[i] != nil { if swag.IsZero(m.KeyValues[i]) { // not required return nil } if err := m.KeyValues[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("key_values" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("key_values" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *Configuration) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Configuration) UnmarshalBinary(b []byte) error { var res Configuration if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/configuration_k_v.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ConfigurationKV configuration k v // // swagger:model configurationKV type ConfigurationKV struct { // env override EnvOverride *EnvOverride `json:"env_override,omitempty"` // key Key string `json:"key,omitempty"` // value Value string `json:"value,omitempty"` } // Validate validates this configuration k v func (m *ConfigurationKV) Validate(formats strfmt.Registry) error { var res []error if err := m.validateEnvOverride(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ConfigurationKV) validateEnvOverride(formats strfmt.Registry) error { if swag.IsZero(m.EnvOverride) { // not required return nil } if m.EnvOverride != nil { if err := m.EnvOverride.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("env_override") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("env_override") } return err } } return nil } // ContextValidate validate this configuration k v based on the context it is used func (m *ConfigurationKV) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateEnvOverride(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ConfigurationKV) contextValidateEnvOverride(ctx context.Context, formats strfmt.Registry) error { if m.EnvOverride != nil { if swag.IsZero(m.EnvOverride) { // not required return nil } if err := m.EnvOverride.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("env_override") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("env_override") } return err } } return nil } // MarshalBinary interface implementation func (m *ConfigurationKV) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ConfigurationKV) UnmarshalBinary(b []byte) error { var res ConfigurationKV if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/create_remote_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CreateRemoteBucket create remote bucket // // swagger:model createRemoteBucket type CreateRemoteBucket struct { // access key // Required: true // Min Length: 3 AccessKey *string `json:"accessKey"` // bandwidth Bandwidth int64 `json:"bandwidth,omitempty"` // health check period HealthCheckPeriod int32 `json:"healthCheckPeriod,omitempty"` // region Region string `json:"region,omitempty"` // secret key // Required: true // Min Length: 8 SecretKey *string `json:"secretKey"` // source bucket // Required: true SourceBucket *string `json:"sourceBucket"` // sync mode // Enum: ["async","sync"] SyncMode *string `json:"syncMode,omitempty"` // target bucket // Required: true TargetBucket *string `json:"targetBucket"` // target URL // Required: true TargetURL *string `json:"targetURL"` } // Validate validates this create remote bucket func (m *CreateRemoteBucket) 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 err := m.validateSourceBucket(formats); err != nil { res = append(res, err) } if err := m.validateSyncMode(formats); err != nil { res = append(res, err) } if err := m.validateTargetBucket(formats); err != nil { res = append(res, err) } if err := m.validateTargetURL(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *CreateRemoteBucket) validateAccessKey(formats strfmt.Registry) error { if err := validate.Required("accessKey", "body", m.AccessKey); err != nil { return err } if err := validate.MinLength("accessKey", "body", *m.AccessKey, 3); err != nil { return err } return nil } func (m *CreateRemoteBucket) validateSecretKey(formats strfmt.Registry) error { if err := validate.Required("secretKey", "body", m.SecretKey); err != nil { return err } if err := validate.MinLength("secretKey", "body", *m.SecretKey, 8); err != nil { return err } return nil } func (m *CreateRemoteBucket) validateSourceBucket(formats strfmt.Registry) error { if err := validate.Required("sourceBucket", "body", m.SourceBucket); err != nil { return err } return nil } var createRemoteBucketTypeSyncModePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["async","sync"]`), &res); err != nil { panic(err) } for _, v := range res { createRemoteBucketTypeSyncModePropEnum = append(createRemoteBucketTypeSyncModePropEnum, v) } } const ( // CreateRemoteBucketSyncModeAsync captures enum value "async" CreateRemoteBucketSyncModeAsync string = "async" // CreateRemoteBucketSyncModeSync captures enum value "sync" CreateRemoteBucketSyncModeSync string = "sync" ) // prop value enum func (m *CreateRemoteBucket) validateSyncModeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, createRemoteBucketTypeSyncModePropEnum, true); err != nil { return err } return nil } func (m *CreateRemoteBucket) validateSyncMode(formats strfmt.Registry) error { if swag.IsZero(m.SyncMode) { // not required return nil } // value enum if err := m.validateSyncModeEnum("syncMode", "body", *m.SyncMode); err != nil { return err } return nil } func (m *CreateRemoteBucket) validateTargetBucket(formats strfmt.Registry) error { if err := validate.Required("targetBucket", "body", m.TargetBucket); err != nil { return err } return nil } func (m *CreateRemoteBucket) validateTargetURL(formats strfmt.Registry) error { if err := validate.Required("targetURL", "body", m.TargetURL); err != nil { return err } return nil } // ContextValidate validates this create remote bucket based on context it is used func (m *CreateRemoteBucket) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *CreateRemoteBucket) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *CreateRemoteBucket) UnmarshalBinary(b []byte) error { var res CreateRemoteBucket if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/delete_file.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // DeleteFile delete file // // swagger:model deleteFile type DeleteFile struct { // path Path string `json:"path,omitempty"` // recursive Recursive bool `json:"recursive,omitempty"` // version ID VersionID string `json:"versionID,omitempty"` } // Validate validates this delete file func (m *DeleteFile) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this delete file based on context it is used func (m *DeleteFile) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *DeleteFile) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *DeleteFile) UnmarshalBinary(b []byte) error { var res DeleteFile if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/env_override.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // EnvOverride env override // // swagger:model envOverride type EnvOverride struct { // name Name string `json:"name,omitempty"` // value Value string `json:"value,omitempty"` } // Validate validates this env override func (m *EnvOverride) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this env override based on context it is used func (m *EnvOverride) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *EnvOverride) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *EnvOverride) UnmarshalBinary(b []byte) error { var res EnvOverride if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/environment_constants.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // EnvironmentConstants environment constants // // swagger:model environmentConstants type EnvironmentConstants struct { // max concurrent downloads MaxConcurrentDownloads int64 `json:"maxConcurrentDownloads,omitempty"` // max concurrent uploads MaxConcurrentUploads int64 `json:"maxConcurrentUploads,omitempty"` } // Validate validates this environment constants func (m *EnvironmentConstants) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this environment constants based on context it is used func (m *EnvironmentConstants) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *EnvironmentConstants) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *EnvironmentConstants) UnmarshalBinary(b []byte) error { var res EnvironmentConstants if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/expiration_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ExpirationResponse expiration response // // swagger:model expirationResponse type ExpirationResponse struct { // date Date string `json:"date,omitempty"` // days Days int64 `json:"days,omitempty"` // delete all DeleteAll bool `json:"delete_all,omitempty"` // delete marker DeleteMarker bool `json:"delete_marker,omitempty"` // newer noncurrent expiration versions NewerNoncurrentExpirationVersions int64 `json:"newer_noncurrent_expiration_versions,omitempty"` // noncurrent expiration days NoncurrentExpirationDays int64 `json:"noncurrent_expiration_days,omitempty"` } // Validate validates this expiration response func (m *ExpirationResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this expiration response based on context it is used func (m *ExpirationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ExpirationResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ExpirationResponse) UnmarshalBinary(b []byte) error { var res ExpirationResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/get_bucket_retention_config.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // GetBucketRetentionConfig get bucket retention config // // swagger:model getBucketRetentionConfig type GetBucketRetentionConfig struct { // mode Mode ObjectRetentionMode `json:"mode,omitempty"` // unit Unit ObjectRetentionUnit `json:"unit,omitempty"` // validity Validity int32 `json:"validity,omitempty"` } // Validate validates this get bucket retention config func (m *GetBucketRetentionConfig) Validate(formats strfmt.Registry) error { var res []error if err := m.validateMode(formats); err != nil { res = append(res, err) } if err := m.validateUnit(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *GetBucketRetentionConfig) validateMode(formats strfmt.Registry) error { if swag.IsZero(m.Mode) { // not required return nil } if err := m.Mode.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("mode") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("mode") } return err } return nil } func (m *GetBucketRetentionConfig) validateUnit(formats strfmt.Registry) error { if swag.IsZero(m.Unit) { // not required return nil } if err := m.Unit.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("unit") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("unit") } return err } return nil } // ContextValidate validate this get bucket retention config based on the context it is used func (m *GetBucketRetentionConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateMode(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateUnit(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *GetBucketRetentionConfig) contextValidateMode(ctx context.Context, formats strfmt.Registry) error { if swag.IsZero(m.Mode) { // not required return nil } if err := m.Mode.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("mode") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("mode") } return err } return nil } func (m *GetBucketRetentionConfig) contextValidateUnit(ctx context.Context, formats strfmt.Registry) error { if swag.IsZero(m.Unit) { // not required return nil } if err := m.Unit.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("unit") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("unit") } return err } return nil } // MarshalBinary interface implementation func (m *GetBucketRetentionConfig) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *GetBucketRetentionConfig) UnmarshalBinary(b []byte) error { var res GetBucketRetentionConfig if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/group.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Group group // // swagger:model group type Group struct { // members Members []string `json:"members"` // name Name string `json:"name,omitempty"` // policy Policy string `json:"policy,omitempty"` // status Status string `json:"status,omitempty"` } // Validate validates this group func (m *Group) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this group based on context it is used func (m *Group) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *Group) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Group) UnmarshalBinary(b []byte) error { var res Group if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/iam_entity.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" ) // IamEntity iam entity // // swagger:model iamEntity type IamEntity string // Validate validates this iam entity func (m IamEntity) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this iam entity based on context it is used func (m IamEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/iam_policy.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // IamPolicy iam policy // // swagger:model iamPolicy type IamPolicy struct { // statement Statement []*IamPolicyStatement `json:"statement"` // version Version string `json:"version,omitempty"` } // Validate validates this iam policy func (m *IamPolicy) Validate(formats strfmt.Registry) error { var res []error if err := m.validateStatement(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *IamPolicy) validateStatement(formats strfmt.Registry) error { if swag.IsZero(m.Statement) { // not required return nil } for i := 0; i < len(m.Statement); i++ { if swag.IsZero(m.Statement[i]) { // not required continue } if m.Statement[i] != nil { if err := m.Statement[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("statement" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("statement" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this iam policy based on the context it is used func (m *IamPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateStatement(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *IamPolicy) contextValidateStatement(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Statement); i++ { if m.Statement[i] != nil { if swag.IsZero(m.Statement[i]) { // not required return nil } if err := m.Statement[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("statement" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("statement" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *IamPolicy) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *IamPolicy) UnmarshalBinary(b []byte) error { var res IamPolicy if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/iam_policy_statement.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // IamPolicyStatement iam policy statement // // swagger:model iamPolicyStatement type IamPolicyStatement struct { // action Action []string `json:"action"` // condition Condition map[string]any `json:"condition,omitempty"` // effect Effect string `json:"effect,omitempty"` // resource Resource []string `json:"resource"` } // Validate validates this iam policy statement func (m *IamPolicyStatement) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this iam policy statement based on context it is used func (m *IamPolicyStatement) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *IamPolicyStatement) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *IamPolicyStatement) UnmarshalBinary(b []byte) error { var res IamPolicyStatement if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/idp_list_configurations_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // IdpListConfigurationsResponse idp list configurations response // // swagger:model idpListConfigurationsResponse type IdpListConfigurationsResponse struct { // results Results []*IdpServerConfiguration `json:"results"` } // Validate validates this idp list configurations response func (m *IdpListConfigurationsResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateResults(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *IdpListConfigurationsResponse) validateResults(formats strfmt.Registry) error { if swag.IsZero(m.Results) { // not required return nil } for i := 0; i < len(m.Results); i++ { if swag.IsZero(m.Results[i]) { // not required continue } if m.Results[i] != nil { if err := m.Results[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("results" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("results" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this idp list configurations response based on the context it is used func (m *IdpListConfigurationsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateResults(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *IdpListConfigurationsResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Results); i++ { if m.Results[i] != nil { if swag.IsZero(m.Results[i]) { // not required return nil } if err := m.Results[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("results" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("results" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *IdpListConfigurationsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *IdpListConfigurationsResponse) UnmarshalBinary(b []byte) error { var res IdpListConfigurationsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/idp_server_configuration.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // IdpServerConfiguration idp server configuration // // swagger:model idpServerConfiguration type IdpServerConfiguration struct { // enabled Enabled bool `json:"enabled,omitempty"` // info Info []*IdpServerConfigurationInfo `json:"info"` // input Input string `json:"input,omitempty"` // name Name string `json:"name,omitempty"` // type Type string `json:"type,omitempty"` } // Validate validates this idp server configuration func (m *IdpServerConfiguration) Validate(formats strfmt.Registry) error { var res []error if err := m.validateInfo(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *IdpServerConfiguration) validateInfo(formats strfmt.Registry) error { if swag.IsZero(m.Info) { // not required return nil } for i := 0; i < len(m.Info); i++ { if swag.IsZero(m.Info[i]) { // not required continue } if m.Info[i] != nil { if err := m.Info[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("info" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("info" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this idp server configuration based on the context it is used func (m *IdpServerConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateInfo(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *IdpServerConfiguration) contextValidateInfo(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Info); i++ { if m.Info[i] != nil { if swag.IsZero(m.Info[i]) { // not required return nil } if err := m.Info[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("info" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("info" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *IdpServerConfiguration) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *IdpServerConfiguration) UnmarshalBinary(b []byte) error { var res IdpServerConfiguration if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/idp_server_configuration_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // IdpServerConfigurationInfo idp server configuration info // // swagger:model idpServerConfigurationInfo type IdpServerConfigurationInfo struct { // is cfg IsCfg bool `json:"isCfg,omitempty"` // is env IsEnv bool `json:"isEnv,omitempty"` // key Key string `json:"key,omitempty"` // value Value string `json:"value,omitempty"` } // Validate validates this idp server configuration info func (m *IdpServerConfigurationInfo) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this idp server configuration info based on context it is used func (m *IdpServerConfigurationInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *IdpServerConfigurationInfo) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *IdpServerConfigurationInfo) UnmarshalBinary(b []byte) error { var res IdpServerConfigurationInfo if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_api.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // KmsAPI kms API // // swagger:model kmsAPI type KmsAPI struct { // max body MaxBody int64 `json:"maxBody,omitempty"` // method Method string `json:"method,omitempty"` // path Path string `json:"path,omitempty"` // timeout Timeout int64 `json:"timeout,omitempty"` } // Validate validates this kms API func (m *KmsAPI) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this kms API based on context it is used func (m *KmsAPI) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *KmsAPI) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsAPI) UnmarshalBinary(b []byte) error { var res KmsAPI if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_apis_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // KmsAPIsResponse kms APIs response // // swagger:model kmsAPIsResponse type KmsAPIsResponse struct { // results Results []*KmsAPI `json:"results"` } // Validate validates this kms APIs response func (m *KmsAPIsResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateResults(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *KmsAPIsResponse) validateResults(formats strfmt.Registry) error { if swag.IsZero(m.Results) { // not required return nil } for i := 0; i < len(m.Results); i++ { if swag.IsZero(m.Results[i]) { // not required continue } if m.Results[i] != nil { if err := m.Results[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("results" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("results" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this kms APIs response based on the context it is used func (m *KmsAPIsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateResults(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *KmsAPIsResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Results); i++ { if m.Results[i] != nil { if swag.IsZero(m.Results[i]) { // not required return nil } if err := m.Results[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("results" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("results" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *KmsAPIsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsAPIsResponse) UnmarshalBinary(b []byte) error { var res KmsAPIsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_create_key_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // KmsCreateKeyRequest kms create key request // // swagger:model kmsCreateKeyRequest type KmsCreateKeyRequest struct { // key // Required: true Key *string `json:"key"` } // Validate validates this kms create key request func (m *KmsCreateKeyRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateKey(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *KmsCreateKeyRequest) validateKey(formats strfmt.Registry) error { if err := validate.Required("key", "body", m.Key); err != nil { return err } return nil } // ContextValidate validates this kms create key request based on context it is used func (m *KmsCreateKeyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *KmsCreateKeyRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsCreateKeyRequest) UnmarshalBinary(b []byte) error { var res KmsCreateKeyRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_endpoint.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // KmsEndpoint kms endpoint // // swagger:model kmsEndpoint type KmsEndpoint struct { // status Status string `json:"status,omitempty"` // url URL string `json:"url,omitempty"` } // Validate validates this kms endpoint func (m *KmsEndpoint) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this kms endpoint based on context it is used func (m *KmsEndpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *KmsEndpoint) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsEndpoint) UnmarshalBinary(b []byte) error { var res KmsEndpoint if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_key_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // KmsKeyInfo kms key info // // swagger:model kmsKeyInfo type KmsKeyInfo struct { // created at CreatedAt string `json:"createdAt,omitempty"` // created by CreatedBy string `json:"createdBy,omitempty"` // name Name string `json:"name,omitempty"` } // Validate validates this kms key info func (m *KmsKeyInfo) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this kms key info based on context it is used func (m *KmsKeyInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *KmsKeyInfo) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsKeyInfo) UnmarshalBinary(b []byte) error { var res KmsKeyInfo if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_key_status_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // KmsKeyStatusResponse kms key status response // // swagger:model kmsKeyStatusResponse type KmsKeyStatusResponse struct { // decryption err DecryptionErr string `json:"decryptionErr,omitempty"` // encryption err EncryptionErr string `json:"encryptionErr,omitempty"` // key ID KeyID string `json:"keyID,omitempty"` } // Validate validates this kms key status response func (m *KmsKeyStatusResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this kms key status response based on context it is used func (m *KmsKeyStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *KmsKeyStatusResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsKeyStatusResponse) UnmarshalBinary(b []byte) error { var res KmsKeyStatusResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_latency_histogram.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // KmsLatencyHistogram kms latency histogram // // swagger:model kmsLatencyHistogram type KmsLatencyHistogram struct { // duration Duration int64 `json:"duration,omitempty"` // total Total int64 `json:"total,omitempty"` } // Validate validates this kms latency histogram func (m *KmsLatencyHistogram) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this kms latency histogram based on context it is used func (m *KmsLatencyHistogram) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *KmsLatencyHistogram) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsLatencyHistogram) UnmarshalBinary(b []byte) error { var res KmsLatencyHistogram if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_list_keys_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // KmsListKeysResponse kms list keys response // // swagger:model kmsListKeysResponse type KmsListKeysResponse struct { // results Results []*KmsKeyInfo `json:"results"` } // Validate validates this kms list keys response func (m *KmsListKeysResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateResults(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *KmsListKeysResponse) validateResults(formats strfmt.Registry) error { if swag.IsZero(m.Results) { // not required return nil } for i := 0; i < len(m.Results); i++ { if swag.IsZero(m.Results[i]) { // not required continue } if m.Results[i] != nil { if err := m.Results[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("results" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("results" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this kms list keys response based on the context it is used func (m *KmsListKeysResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateResults(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *KmsListKeysResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Results); i++ { if m.Results[i] != nil { if swag.IsZero(m.Results[i]) { // not required return nil } if err := m.Results[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("results" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("results" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *KmsListKeysResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsListKeysResponse) UnmarshalBinary(b []byte) error { var res KmsListKeysResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_metrics_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // KmsMetricsResponse kms metrics response // // swagger:model kmsMetricsResponse type KmsMetricsResponse struct { // audit events // Required: true AuditEvents *int64 `json:"auditEvents"` // cpus // Required: true Cpus *int64 `json:"cpus"` // error events // Required: true ErrorEvents *int64 `json:"errorEvents"` // heap alloc // Required: true HeapAlloc *int64 `json:"heapAlloc"` // heap objects HeapObjects int64 `json:"heapObjects,omitempty"` // latency histogram // Required: true LatencyHistogram []*KmsLatencyHistogram `json:"latencyHistogram"` // request active // Required: true RequestActive *int64 `json:"requestActive"` // request err // Required: true RequestErr *int64 `json:"requestErr"` // request fail // Required: true RequestFail *int64 `json:"requestFail"` // request o k // Required: true RequestOK *int64 `json:"requestOK"` // stack alloc // Required: true StackAlloc *int64 `json:"stackAlloc"` // threads // Required: true Threads *int64 `json:"threads"` // uptime // Required: true Uptime *int64 `json:"uptime"` // usable CPUs // Required: true UsableCPUs *int64 `json:"usableCPUs"` } // Validate validates this kms metrics response func (m *KmsMetricsResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAuditEvents(formats); err != nil { res = append(res, err) } if err := m.validateCpus(formats); err != nil { res = append(res, err) } if err := m.validateErrorEvents(formats); err != nil { res = append(res, err) } if err := m.validateHeapAlloc(formats); err != nil { res = append(res, err) } if err := m.validateLatencyHistogram(formats); err != nil { res = append(res, err) } if err := m.validateRequestActive(formats); err != nil { res = append(res, err) } if err := m.validateRequestErr(formats); err != nil { res = append(res, err) } if err := m.validateRequestFail(formats); err != nil { res = append(res, err) } if err := m.validateRequestOK(formats); err != nil { res = append(res, err) } if err := m.validateStackAlloc(formats); err != nil { res = append(res, err) } if err := m.validateThreads(formats); err != nil { res = append(res, err) } if err := m.validateUptime(formats); err != nil { res = append(res, err) } if err := m.validateUsableCPUs(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *KmsMetricsResponse) validateAuditEvents(formats strfmt.Registry) error { if err := validate.Required("auditEvents", "body", m.AuditEvents); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateCpus(formats strfmt.Registry) error { if err := validate.Required("cpus", "body", m.Cpus); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateErrorEvents(formats strfmt.Registry) error { if err := validate.Required("errorEvents", "body", m.ErrorEvents); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateHeapAlloc(formats strfmt.Registry) error { if err := validate.Required("heapAlloc", "body", m.HeapAlloc); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateLatencyHistogram(formats strfmt.Registry) error { if err := validate.Required("latencyHistogram", "body", m.LatencyHistogram); err != nil { return err } for i := 0; i < len(m.LatencyHistogram); i++ { if swag.IsZero(m.LatencyHistogram[i]) { // not required continue } if m.LatencyHistogram[i] != nil { if err := m.LatencyHistogram[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("latencyHistogram" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("latencyHistogram" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *KmsMetricsResponse) validateRequestActive(formats strfmt.Registry) error { if err := validate.Required("requestActive", "body", m.RequestActive); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateRequestErr(formats strfmt.Registry) error { if err := validate.Required("requestErr", "body", m.RequestErr); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateRequestFail(formats strfmt.Registry) error { if err := validate.Required("requestFail", "body", m.RequestFail); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateRequestOK(formats strfmt.Registry) error { if err := validate.Required("requestOK", "body", m.RequestOK); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateStackAlloc(formats strfmt.Registry) error { if err := validate.Required("stackAlloc", "body", m.StackAlloc); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateThreads(formats strfmt.Registry) error { if err := validate.Required("threads", "body", m.Threads); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateUptime(formats strfmt.Registry) error { if err := validate.Required("uptime", "body", m.Uptime); err != nil { return err } return nil } func (m *KmsMetricsResponse) validateUsableCPUs(formats strfmt.Registry) error { if err := validate.Required("usableCPUs", "body", m.UsableCPUs); err != nil { return err } return nil } // ContextValidate validate this kms metrics response based on the context it is used func (m *KmsMetricsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateLatencyHistogram(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *KmsMetricsResponse) contextValidateLatencyHistogram(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.LatencyHistogram); i++ { if m.LatencyHistogram[i] != nil { if swag.IsZero(m.LatencyHistogram[i]) { // not required return nil } if err := m.LatencyHistogram[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("latencyHistogram" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("latencyHistogram" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *KmsMetricsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsMetricsResponse) UnmarshalBinary(b []byte) error { var res KmsMetricsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_status_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // KmsStatusResponse kms status response // // swagger:model kmsStatusResponse type KmsStatusResponse struct { // default key ID DefaultKeyID string `json:"defaultKeyID,omitempty"` // endpoints Endpoints []*KmsEndpoint `json:"endpoints"` // name Name string `json:"name,omitempty"` } // Validate validates this kms status response func (m *KmsStatusResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateEndpoints(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *KmsStatusResponse) validateEndpoints(formats strfmt.Registry) error { if swag.IsZero(m.Endpoints) { // not required return nil } for i := 0; i < len(m.Endpoints); i++ { if swag.IsZero(m.Endpoints[i]) { // not required continue } if m.Endpoints[i] != nil { if err := m.Endpoints[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("endpoints" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("endpoints" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this kms status response based on the context it is used func (m *KmsStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateEndpoints(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *KmsStatusResponse) contextValidateEndpoints(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Endpoints); i++ { if m.Endpoints[i] != nil { if swag.IsZero(m.Endpoints[i]) { // not required return nil } if err := m.Endpoints[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("endpoints" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("endpoints" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *KmsStatusResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsStatusResponse) UnmarshalBinary(b []byte) error { var res KmsStatusResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/kms_version_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // KmsVersionResponse kms version response // // swagger:model kmsVersionResponse type KmsVersionResponse struct { // version Version string `json:"version,omitempty"` } // Validate validates this kms version response func (m *KmsVersionResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this kms version response based on context it is used func (m *KmsVersionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *KmsVersionResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *KmsVersionResponse) UnmarshalBinary(b []byte) error { var res KmsVersionResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/ldap_entities.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LdapEntities ldap entities // // swagger:model ldapEntities type LdapEntities struct { // groups Groups []*LdapGroupPolicyEntity `json:"groups"` // policies Policies []*LdapPolicyEntity `json:"policies"` // timestamp Timestamp string `json:"timestamp,omitempty"` // users Users []*LdapUserPolicyEntity `json:"users"` } // Validate validates this ldap entities func (m *LdapEntities) Validate(formats strfmt.Registry) error { var res []error if err := m.validateGroups(formats); err != nil { res = append(res, err) } if err := m.validatePolicies(formats); err != nil { res = append(res, err) } if err := m.validateUsers(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *LdapEntities) validateGroups(formats strfmt.Registry) error { if swag.IsZero(m.Groups) { // not required return nil } for i := 0; i < len(m.Groups); i++ { if swag.IsZero(m.Groups[i]) { // not required continue } if m.Groups[i] != nil { if err := m.Groups[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("groups" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("groups" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *LdapEntities) validatePolicies(formats strfmt.Registry) error { if swag.IsZero(m.Policies) { // not required return nil } for i := 0; i < len(m.Policies); i++ { if swag.IsZero(m.Policies[i]) { // not required continue } if m.Policies[i] != nil { if err := m.Policies[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("policies" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("policies" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *LdapEntities) validateUsers(formats strfmt.Registry) error { if swag.IsZero(m.Users) { // not required return nil } for i := 0; i < len(m.Users); i++ { if swag.IsZero(m.Users[i]) { // not required continue } if m.Users[i] != nil { if err := m.Users[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("users" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("users" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this ldap entities based on the context it is used func (m *LdapEntities) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateGroups(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidatePolicies(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateUsers(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *LdapEntities) contextValidateGroups(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Groups); i++ { if m.Groups[i] != nil { if swag.IsZero(m.Groups[i]) { // not required return nil } if err := m.Groups[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("groups" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("groups" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *LdapEntities) contextValidatePolicies(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Policies); i++ { if m.Policies[i] != nil { if swag.IsZero(m.Policies[i]) { // not required return nil } if err := m.Policies[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("policies" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("policies" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *LdapEntities) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Users); i++ { if m.Users[i] != nil { if swag.IsZero(m.Users[i]) { // not required return nil } if err := m.Users[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("users" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("users" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *LdapEntities) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LdapEntities) UnmarshalBinary(b []byte) error { var res LdapEntities if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/ldap_entities_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LdapEntitiesRequest ldap entities request // // swagger:model ldapEntitiesRequest type LdapEntitiesRequest struct { // groups Groups []string `json:"groups"` // policies Policies []string `json:"policies"` // users Users []string `json:"users"` } // Validate validates this ldap entities request func (m *LdapEntitiesRequest) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this ldap entities request based on context it is used func (m *LdapEntitiesRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *LdapEntitiesRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LdapEntitiesRequest) UnmarshalBinary(b []byte) error { var res LdapEntitiesRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/ldap_group_policy_entity.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LdapGroupPolicyEntity ldap group policy entity // // swagger:model ldapGroupPolicyEntity type LdapGroupPolicyEntity struct { // group Group string `json:"group,omitempty"` // policies Policies []string `json:"policies"` } // Validate validates this ldap group policy entity func (m *LdapGroupPolicyEntity) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this ldap group policy entity based on context it is used func (m *LdapGroupPolicyEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *LdapGroupPolicyEntity) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LdapGroupPolicyEntity) UnmarshalBinary(b []byte) error { var res LdapGroupPolicyEntity if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/ldap_policy_entity.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LdapPolicyEntity ldap policy entity // // swagger:model ldapPolicyEntity type LdapPolicyEntity struct { // groups Groups []string `json:"groups"` // policy Policy string `json:"policy,omitempty"` // users Users []string `json:"users"` } // Validate validates this ldap policy entity func (m *LdapPolicyEntity) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this ldap policy entity based on context it is used func (m *LdapPolicyEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *LdapPolicyEntity) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LdapPolicyEntity) UnmarshalBinary(b []byte) error { var res LdapPolicyEntity if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/ldap_user_policy_entity.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LdapUserPolicyEntity ldap user policy entity // // swagger:model ldapUserPolicyEntity type LdapUserPolicyEntity struct { // policies Policies []string `json:"policies"` // user User string `json:"user,omitempty"` } // Validate validates this ldap user policy entity func (m *LdapUserPolicyEntity) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this ldap user policy entity based on context it is used func (m *LdapUserPolicyEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *LdapUserPolicyEntity) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LdapUserPolicyEntity) UnmarshalBinary(b []byte) error { var res LdapUserPolicyEntity if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/lifecycle_tag.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LifecycleTag lifecycle tag // // swagger:model lifecycleTag type LifecycleTag struct { // key Key string `json:"key,omitempty"` // value Value string `json:"value,omitempty"` } // Validate validates this lifecycle tag func (m *LifecycleTag) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this lifecycle tag based on context it is used func (m *LifecycleTag) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *LifecycleTag) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LifecycleTag) UnmarshalBinary(b []byte) error { var res LifecycleTag if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/list_access_rules_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ListAccessRulesResponse list access rules response // // swagger:model listAccessRulesResponse type ListAccessRulesResponse struct { // list of policies AccessRules []*AccessRule `json:"accessRules"` // total number of policies Total int64 `json:"total,omitempty"` } // Validate validates this list access rules response func (m *ListAccessRulesResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAccessRules(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListAccessRulesResponse) validateAccessRules(formats strfmt.Registry) error { if swag.IsZero(m.AccessRules) { // not required return nil } for i := 0; i < len(m.AccessRules); i++ { if swag.IsZero(m.AccessRules[i]) { // not required continue } if m.AccessRules[i] != nil { if err := m.AccessRules[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("accessRules" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("accessRules" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this list access rules response based on the context it is used func (m *ListAccessRulesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateAccessRules(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListAccessRulesResponse) contextValidateAccessRules(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.AccessRules); i++ { if m.AccessRules[i] != nil { if swag.IsZero(m.AccessRules[i]) { // not required return nil } if err := m.AccessRules[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("accessRules" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("accessRules" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ListAccessRulesResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ListAccessRulesResponse) UnmarshalBinary(b []byte) error { var res ListAccessRulesResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/list_bucket_events_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ListBucketEventsResponse list bucket events response // // swagger:model listBucketEventsResponse type ListBucketEventsResponse struct { // events Events []*NotificationConfig `json:"events"` // total number of bucket events Total int64 `json:"total,omitempty"` } // Validate validates this list bucket events response func (m *ListBucketEventsResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateEvents(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListBucketEventsResponse) validateEvents(formats strfmt.Registry) error { if swag.IsZero(m.Events) { // not required return nil } for i := 0; i < len(m.Events); i++ { if swag.IsZero(m.Events[i]) { // not required continue } if m.Events[i] != nil { if err := m.Events[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("events" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("events" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this list bucket events response based on the context it is used func (m *ListBucketEventsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateEvents(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListBucketEventsResponse) contextValidateEvents(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Events); i++ { if m.Events[i] != nil { if swag.IsZero(m.Events[i]) { // not required return nil } if err := m.Events[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("events" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("events" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ListBucketEventsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ListBucketEventsResponse) UnmarshalBinary(b []byte) error { var res ListBucketEventsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/list_buckets_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ListBucketsResponse list buckets response // // swagger:model listBucketsResponse type ListBucketsResponse struct { // list of resulting buckets Buckets []*Bucket `json:"buckets"` // number of buckets accessible to the user Total int64 `json:"total,omitempty"` } // Validate validates this list buckets response func (m *ListBucketsResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateBuckets(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListBucketsResponse) validateBuckets(formats strfmt.Registry) error { if swag.IsZero(m.Buckets) { // not required return nil } for i := 0; i < len(m.Buckets); i++ { if swag.IsZero(m.Buckets[i]) { // not required continue } if m.Buckets[i] != nil { if err := m.Buckets[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("buckets" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("buckets" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this list buckets response based on the context it is used func (m *ListBucketsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateBuckets(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListBucketsResponse) contextValidateBuckets(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Buckets); i++ { if m.Buckets[i] != nil { if swag.IsZero(m.Buckets[i]) { // not required return nil } if err := m.Buckets[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("buckets" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("buckets" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ListBucketsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ListBucketsResponse) UnmarshalBinary(b []byte) error { var res ListBucketsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/list_config_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ListConfigResponse list config response // // swagger:model listConfigResponse type ListConfigResponse struct { // configurations Configurations []*ConfigDescription `json:"configurations"` // total number of configurations Total int64 `json:"total,omitempty"` } // Validate validates this list config response func (m *ListConfigResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateConfigurations(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListConfigResponse) validateConfigurations(formats strfmt.Registry) error { if swag.IsZero(m.Configurations) { // not required return nil } for i := 0; i < len(m.Configurations); i++ { if swag.IsZero(m.Configurations[i]) { // not required continue } if m.Configurations[i] != nil { if err := m.Configurations[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("configurations" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("configurations" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this list config response based on the context it is used func (m *ListConfigResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateConfigurations(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListConfigResponse) contextValidateConfigurations(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Configurations); i++ { if m.Configurations[i] != nil { if swag.IsZero(m.Configurations[i]) { // not required return nil } if err := m.Configurations[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("configurations" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("configurations" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ListConfigResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ListConfigResponse) UnmarshalBinary(b []byte) error { var res ListConfigResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/list_external_buckets_params.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ListExternalBucketsParams list external buckets params // // swagger:model listExternalBucketsParams type ListExternalBucketsParams struct { // access key // Required: true // Min Length: 3 AccessKey *string `json:"accessKey"` // region Region string `json:"region,omitempty"` // secret key // Required: true // Min Length: 8 SecretKey *string `json:"secretKey"` // target URL // Required: true TargetURL *string `json:"targetURL"` // use TLS // Required: true UseTLS *bool `json:"useTLS"` } // Validate validates this list external buckets params func (m *ListExternalBucketsParams) 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 err := m.validateTargetURL(formats); err != nil { res = append(res, err) } if err := m.validateUseTLS(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListExternalBucketsParams) validateAccessKey(formats strfmt.Registry) error { if err := validate.Required("accessKey", "body", m.AccessKey); err != nil { return err } if err := validate.MinLength("accessKey", "body", *m.AccessKey, 3); err != nil { return err } return nil } func (m *ListExternalBucketsParams) validateSecretKey(formats strfmt.Registry) error { if err := validate.Required("secretKey", "body", m.SecretKey); err != nil { return err } if err := validate.MinLength("secretKey", "body", *m.SecretKey, 8); err != nil { return err } return nil } func (m *ListExternalBucketsParams) validateTargetURL(formats strfmt.Registry) error { if err := validate.Required("targetURL", "body", m.TargetURL); err != nil { return err } return nil } func (m *ListExternalBucketsParams) validateUseTLS(formats strfmt.Registry) error { if err := validate.Required("useTLS", "body", m.UseTLS); err != nil { return err } return nil } // ContextValidate validates this list external buckets params based on context it is used func (m *ListExternalBucketsParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ListExternalBucketsParams) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ListExternalBucketsParams) UnmarshalBinary(b []byte) error { var res ListExternalBucketsParams if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/list_groups_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ListGroupsResponse list groups response // // swagger:model listGroupsResponse type ListGroupsResponse struct { // list of groups Groups []string `json:"groups"` // total number of groups Total int64 `json:"total,omitempty"` } // Validate validates this list groups response func (m *ListGroupsResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this list groups response based on context it is used func (m *ListGroupsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ListGroupsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ListGroupsResponse) UnmarshalBinary(b []byte) error { var res ListGroupsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/list_objects_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ListObjectsResponse list objects response // // swagger:model listObjectsResponse type ListObjectsResponse struct { // list of resulting objects Objects []*BucketObject `json:"objects"` // number of objects Total int64 `json:"total,omitempty"` } // Validate validates this list objects response func (m *ListObjectsResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateObjects(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListObjectsResponse) validateObjects(formats strfmt.Registry) error { if swag.IsZero(m.Objects) { // not required return nil } for i := 0; i < len(m.Objects); i++ { if swag.IsZero(m.Objects[i]) { // not required continue } if m.Objects[i] != nil { if err := m.Objects[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("objects" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("objects" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this list objects response based on the context it is used func (m *ListObjectsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateObjects(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListObjectsResponse) contextValidateObjects(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Objects); i++ { if m.Objects[i] != nil { if swag.IsZero(m.Objects[i]) { // not required return nil } if err := m.Objects[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("objects" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("objects" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ListObjectsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ListObjectsResponse) UnmarshalBinary(b []byte) error { var res ListObjectsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/list_policies_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ListPoliciesResponse list policies response // // swagger:model listPoliciesResponse type ListPoliciesResponse struct { // list of policies Policies []*Policy `json:"policies"` // total number of policies Total int64 `json:"total,omitempty"` } // Validate validates this list policies response func (m *ListPoliciesResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validatePolicies(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListPoliciesResponse) validatePolicies(formats strfmt.Registry) error { if swag.IsZero(m.Policies) { // not required return nil } for i := 0; i < len(m.Policies); i++ { if swag.IsZero(m.Policies[i]) { // not required continue } if m.Policies[i] != nil { if err := m.Policies[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("policies" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("policies" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this list policies response based on the context it is used func (m *ListPoliciesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidatePolicies(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListPoliciesResponse) contextValidatePolicies(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Policies); i++ { if m.Policies[i] != nil { if swag.IsZero(m.Policies[i]) { // not required return nil } if err := m.Policies[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("policies" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("policies" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ListPoliciesResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ListPoliciesResponse) UnmarshalBinary(b []byte) error { var res ListPoliciesResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/list_remote_buckets_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ListRemoteBucketsResponse list remote buckets response // // swagger:model listRemoteBucketsResponse type ListRemoteBucketsResponse struct { // list of remote buckets Buckets []*RemoteBucket `json:"buckets"` // number of remote buckets accessible to user Total int64 `json:"total,omitempty"` } // Validate validates this list remote buckets response func (m *ListRemoteBucketsResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateBuckets(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListRemoteBucketsResponse) validateBuckets(formats strfmt.Registry) error { if swag.IsZero(m.Buckets) { // not required return nil } for i := 0; i < len(m.Buckets); i++ { if swag.IsZero(m.Buckets[i]) { // not required continue } if m.Buckets[i] != nil { if err := m.Buckets[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("buckets" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("buckets" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this list remote buckets response based on the context it is used func (m *ListRemoteBucketsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateBuckets(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListRemoteBucketsResponse) contextValidateBuckets(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Buckets); i++ { if m.Buckets[i] != nil { if swag.IsZero(m.Buckets[i]) { // not required return nil } if err := m.Buckets[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("buckets" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("buckets" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ListRemoteBucketsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ListRemoteBucketsResponse) UnmarshalBinary(b []byte) error { var res ListRemoteBucketsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/list_users_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ListUsersResponse list users response // // swagger:model listUsersResponse type ListUsersResponse struct { // list of resulting users Users []*User `json:"users"` } // Validate validates this list users response func (m *ListUsersResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateUsers(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListUsersResponse) validateUsers(formats strfmt.Registry) error { if swag.IsZero(m.Users) { // not required return nil } for i := 0; i < len(m.Users); i++ { if swag.IsZero(m.Users[i]) { // not required continue } if m.Users[i] != nil { if err := m.Users[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("users" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("users" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this list users response based on the context it is used func (m *ListUsersResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateUsers(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ListUsersResponse) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Users); i++ { if m.Users[i] != nil { if swag.IsZero(m.Users[i]) { // not required return nil } if err := m.Users[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("users" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("users" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ListUsersResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ListUsersResponse) UnmarshalBinary(b []byte) error { var res ListUsersResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/log_search_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LogSearchResponse log search response // // swagger:model logSearchResponse type LogSearchResponse struct { // list of log search responses Results any `json:"results,omitempty"` } // Validate validates this log search response func (m *LogSearchResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this log search response based on context it is used func (m *LogSearchResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *LogSearchResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LogSearchResponse) UnmarshalBinary(b []byte) error { var res LogSearchResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/login_details.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // LoginDetails login details // // swagger:model loginDetails type LoginDetails struct { // is k8 s IsK8S bool `json:"isK8S,omitempty"` // ldap enabled LdapEnabled bool `json:"ldap_enabled,omitempty"` // login strategy // Enum: ["form","redirect","service-account","redirect-service-account"] LoginStrategy string `json:"loginStrategy,omitempty"` // redirect rules RedirectRules []*RedirectRule `json:"redirectRules"` } // Validate validates this login details func (m *LoginDetails) Validate(formats strfmt.Registry) error { var res []error if err := m.validateLoginStrategy(formats); err != nil { res = append(res, err) } if err := m.validateRedirectRules(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } var loginDetailsTypeLoginStrategyPropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["form","redirect","service-account","redirect-service-account"]`), &res); err != nil { panic(err) } for _, v := range res { loginDetailsTypeLoginStrategyPropEnum = append(loginDetailsTypeLoginStrategyPropEnum, v) } } const ( // LoginDetailsLoginStrategyForm captures enum value "form" LoginDetailsLoginStrategyForm string = "form" // LoginDetailsLoginStrategyRedirect captures enum value "redirect" LoginDetailsLoginStrategyRedirect string = "redirect" // LoginDetailsLoginStrategyServiceDashAccount captures enum value "service-account" LoginDetailsLoginStrategyServiceDashAccount string = "service-account" // LoginDetailsLoginStrategyRedirectDashServiceDashAccount captures enum value "redirect-service-account" LoginDetailsLoginStrategyRedirectDashServiceDashAccount string = "redirect-service-account" ) // prop value enum func (m *LoginDetails) validateLoginStrategyEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, loginDetailsTypeLoginStrategyPropEnum, true); err != nil { return err } return nil } func (m *LoginDetails) validateLoginStrategy(formats strfmt.Registry) error { if swag.IsZero(m.LoginStrategy) { // not required return nil } // value enum if err := m.validateLoginStrategyEnum("loginStrategy", "body", m.LoginStrategy); err != nil { return err } return nil } func (m *LoginDetails) validateRedirectRules(formats strfmt.Registry) error { if swag.IsZero(m.RedirectRules) { // not required return nil } for i := 0; i < len(m.RedirectRules); i++ { if swag.IsZero(m.RedirectRules[i]) { // not required continue } if m.RedirectRules[i] != nil { if err := m.RedirectRules[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("redirectRules" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("redirectRules" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this login details based on the context it is used func (m *LoginDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateRedirectRules(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *LoginDetails) contextValidateRedirectRules(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.RedirectRules); i++ { if m.RedirectRules[i] != nil { if swag.IsZero(m.RedirectRules[i]) { // not required return nil } if err := m.RedirectRules[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("redirectRules" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("redirectRules" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *LoginDetails) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LoginDetails) UnmarshalBinary(b []byte) error { var res LoginDetails if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/login_oauth2_auth_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // LoginOauth2AuthRequest login oauth2 auth request // // swagger:model loginOauth2AuthRequest type LoginOauth2AuthRequest struct { // code // Required: true Code *string `json:"code"` // state // Required: true State *string `json:"state"` } // Validate validates this login oauth2 auth request func (m *LoginOauth2AuthRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateCode(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 *LoginOauth2AuthRequest) validateCode(formats strfmt.Registry) error { if err := validate.Required("code", "body", m.Code); err != nil { return err } return nil } func (m *LoginOauth2AuthRequest) validateState(formats strfmt.Registry) error { if err := validate.Required("state", "body", m.State); err != nil { return err } return nil } // ContextValidate validates this login oauth2 auth request based on context it is used func (m *LoginOauth2AuthRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *LoginOauth2AuthRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LoginOauth2AuthRequest) UnmarshalBinary(b []byte) error { var res LoginOauth2AuthRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/login_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LoginRequest login request // // swagger:model loginRequest type LoginRequest struct { // access key AccessKey string `json:"accessKey,omitempty"` // features Features *LoginRequestFeatures `json:"features,omitempty"` // secret key SecretKey string `json:"secretKey,omitempty"` // sts Sts string `json:"sts,omitempty"` } // Validate validates this login request func (m *LoginRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateFeatures(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *LoginRequest) validateFeatures(formats strfmt.Registry) error { if swag.IsZero(m.Features) { // not required return nil } if m.Features != nil { if err := m.Features.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("features") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("features") } return err } } return nil } // ContextValidate validate this login request based on the context it is used func (m *LoginRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateFeatures(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *LoginRequest) contextValidateFeatures(ctx context.Context, formats strfmt.Registry) error { if m.Features != nil { if swag.IsZero(m.Features) { // not required return nil } if err := m.Features.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("features") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("features") } return err } } return nil } // MarshalBinary interface implementation func (m *LoginRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LoginRequest) UnmarshalBinary(b []byte) error { var res LoginRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // LoginRequestFeatures login request features // // swagger:model LoginRequestFeatures type LoginRequestFeatures struct { // hide menu HideMenu bool `json:"hide_menu,omitempty"` } // Validate validates this login request features func (m *LoginRequestFeatures) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this login request features based on context it is used func (m *LoginRequestFeatures) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *LoginRequestFeatures) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LoginRequestFeatures) UnmarshalBinary(b []byte) error { var res LoginRequestFeatures if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/login_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LoginResponse login response // // swagger:model loginResponse type LoginResponse struct { // ID p refresh token IDPRefreshToken string `json:"IDPRefreshToken,omitempty"` // session Id SessionID string `json:"sessionId,omitempty"` } // Validate validates this login response func (m *LoginResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this login response based on context it is used func (m *LoginResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *LoginResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LoginResponse) UnmarshalBinary(b []byte) error { var res LoginResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/logout_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LogoutRequest logout request // // swagger:model logoutRequest type LogoutRequest struct { // state State string `json:"state,omitempty"` } // Validate validates this logout request func (m *LogoutRequest) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this logout request based on context it is used func (m *LogoutRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *LogoutRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *LogoutRequest) UnmarshalBinary(b []byte) error { var res LogoutRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/make_bucket_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // MakeBucketRequest make bucket request // // swagger:model makeBucketRequest type MakeBucketRequest struct { // locking Locking bool `json:"locking,omitempty"` // name // Required: true Name *string `json:"name"` // quota Quota *SetBucketQuota `json:"quota,omitempty"` // retention Retention *PutBucketRetentionRequest `json:"retention,omitempty"` // versioning Versioning *SetBucketVersioning `json:"versioning,omitempty"` } // Validate validates this make bucket request func (m *MakeBucketRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateName(formats); err != nil { res = append(res, err) } if err := m.validateQuota(formats); err != nil { res = append(res, err) } if err := m.validateRetention(formats); err != nil { res = append(res, err) } if err := m.validateVersioning(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *MakeBucketRequest) validateName(formats strfmt.Registry) error { if err := validate.Required("name", "body", m.Name); err != nil { return err } return nil } func (m *MakeBucketRequest) validateQuota(formats strfmt.Registry) error { if swag.IsZero(m.Quota) { // not required return nil } if m.Quota != nil { if err := m.Quota.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("quota") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("quota") } return err } } return nil } func (m *MakeBucketRequest) validateRetention(formats strfmt.Registry) error { if swag.IsZero(m.Retention) { // not required return nil } if m.Retention != nil { if err := m.Retention.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("retention") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("retention") } return err } } return nil } func (m *MakeBucketRequest) validateVersioning(formats strfmt.Registry) error { if swag.IsZero(m.Versioning) { // not required return nil } if m.Versioning != nil { if err := m.Versioning.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("versioning") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("versioning") } return err } } return nil } // ContextValidate validate this make bucket request based on the context it is used func (m *MakeBucketRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateQuota(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateRetention(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateVersioning(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *MakeBucketRequest) contextValidateQuota(ctx context.Context, formats strfmt.Registry) error { if m.Quota != nil { if swag.IsZero(m.Quota) { // not required return nil } if err := m.Quota.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("quota") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("quota") } return err } } return nil } func (m *MakeBucketRequest) contextValidateRetention(ctx context.Context, formats strfmt.Registry) error { if m.Retention != nil { if swag.IsZero(m.Retention) { // not required return nil } if err := m.Retention.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("retention") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("retention") } return err } } return nil } func (m *MakeBucketRequest) contextValidateVersioning(ctx context.Context, formats strfmt.Registry) error { if m.Versioning != nil { if swag.IsZero(m.Versioning) { // not required return nil } if err := m.Versioning.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("versioning") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("versioning") } return err } } return nil } // MarshalBinary interface implementation func (m *MakeBucketRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *MakeBucketRequest) UnmarshalBinary(b []byte) error { var res MakeBucketRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/make_buckets_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // MakeBucketsResponse make buckets response // // swagger:model makeBucketsResponse type MakeBucketsResponse struct { // bucket name BucketName string `json:"bucketName,omitempty"` } // Validate validates this make buckets response func (m *MakeBucketsResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this make buckets response based on context it is used func (m *MakeBucketsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *MakeBucketsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *MakeBucketsResponse) UnmarshalBinary(b []byte) error { var res MakeBucketsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/max_share_link_exp_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // MaxShareLinkExpResponse max share link exp response // // swagger:model maxShareLinkExpResponse type MaxShareLinkExpResponse struct { // exp // Required: true Exp *int64 `json:"exp"` } // Validate validates this max share link exp response func (m *MaxShareLinkExpResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateExp(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *MaxShareLinkExpResponse) validateExp(formats strfmt.Registry) error { if err := validate.Required("exp", "body", m.Exp); err != nil { return err } return nil } // ContextValidate validates this max share link exp response based on context it is used func (m *MaxShareLinkExpResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *MaxShareLinkExpResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *MaxShareLinkExpResponse) UnmarshalBinary(b []byte) error { var res MaxShareLinkExpResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/metadata.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Metadata metadata // // swagger:model metadata type Metadata struct { // object metadata ObjectMetadata any `json:"objectMetadata,omitempty"` } // Validate validates this metadata func (m *Metadata) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this metadata based on context it is used func (m *Metadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *Metadata) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Metadata) UnmarshalBinary(b []byte) error { var res Metadata if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/multi_bucket_replication.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // MultiBucketReplication multi bucket replication // // swagger:model multiBucketReplication type MultiBucketReplication struct { // access key // Required: true // Min Length: 3 AccessKey *string `json:"accessKey"` // bandwidth Bandwidth int64 `json:"bandwidth,omitempty"` // buckets relation // Required: true BucketsRelation []*MultiBucketsRelation `json:"bucketsRelation"` // health check period HealthCheckPeriod int32 `json:"healthCheckPeriod,omitempty"` // prefix Prefix string `json:"prefix,omitempty"` // priority Priority int32 `json:"priority,omitempty"` // region Region string `json:"region,omitempty"` // replicate delete markers ReplicateDeleteMarkers bool `json:"replicateDeleteMarkers,omitempty"` // replicate deletes ReplicateDeletes bool `json:"replicateDeletes,omitempty"` // replicate existing objects ReplicateExistingObjects bool `json:"replicateExistingObjects,omitempty"` // replicate metadata ReplicateMetadata bool `json:"replicateMetadata,omitempty"` // secret key // Required: true // Min Length: 8 SecretKey *string `json:"secretKey"` // storage class StorageClass string `json:"storageClass,omitempty"` // sync mode // Enum: ["async","sync"] SyncMode *string `json:"syncMode,omitempty"` // tags Tags string `json:"tags,omitempty"` // target URL // Required: true TargetURL *string `json:"targetURL"` } // Validate validates this multi bucket replication func (m *MultiBucketReplication) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAccessKey(formats); err != nil { res = append(res, err) } if err := m.validateBucketsRelation(formats); err != nil { res = append(res, err) } if err := m.validateSecretKey(formats); err != nil { res = append(res, err) } if err := m.validateSyncMode(formats); err != nil { res = append(res, err) } if err := m.validateTargetURL(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *MultiBucketReplication) validateAccessKey(formats strfmt.Registry) error { if err := validate.Required("accessKey", "body", m.AccessKey); err != nil { return err } if err := validate.MinLength("accessKey", "body", *m.AccessKey, 3); err != nil { return err } return nil } func (m *MultiBucketReplication) validateBucketsRelation(formats strfmt.Registry) error { if err := validate.Required("bucketsRelation", "body", m.BucketsRelation); err != nil { return err } for i := 0; i < len(m.BucketsRelation); i++ { if swag.IsZero(m.BucketsRelation[i]) { // not required continue } if m.BucketsRelation[i] != nil { if err := m.BucketsRelation[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("bucketsRelation" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("bucketsRelation" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *MultiBucketReplication) validateSecretKey(formats strfmt.Registry) error { if err := validate.Required("secretKey", "body", m.SecretKey); err != nil { return err } if err := validate.MinLength("secretKey", "body", *m.SecretKey, 8); err != nil { return err } return nil } var multiBucketReplicationTypeSyncModePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["async","sync"]`), &res); err != nil { panic(err) } for _, v := range res { multiBucketReplicationTypeSyncModePropEnum = append(multiBucketReplicationTypeSyncModePropEnum, v) } } const ( // MultiBucketReplicationSyncModeAsync captures enum value "async" MultiBucketReplicationSyncModeAsync string = "async" // MultiBucketReplicationSyncModeSync captures enum value "sync" MultiBucketReplicationSyncModeSync string = "sync" ) // prop value enum func (m *MultiBucketReplication) validateSyncModeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, multiBucketReplicationTypeSyncModePropEnum, true); err != nil { return err } return nil } func (m *MultiBucketReplication) validateSyncMode(formats strfmt.Registry) error { if swag.IsZero(m.SyncMode) { // not required return nil } // value enum if err := m.validateSyncModeEnum("syncMode", "body", *m.SyncMode); err != nil { return err } return nil } func (m *MultiBucketReplication) validateTargetURL(formats strfmt.Registry) error { if err := validate.Required("targetURL", "body", m.TargetURL); err != nil { return err } return nil } // ContextValidate validate this multi bucket replication based on the context it is used func (m *MultiBucketReplication) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateBucketsRelation(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *MultiBucketReplication) contextValidateBucketsRelation(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.BucketsRelation); i++ { if m.BucketsRelation[i] != nil { if swag.IsZero(m.BucketsRelation[i]) { // not required return nil } if err := m.BucketsRelation[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("bucketsRelation" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("bucketsRelation" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *MultiBucketReplication) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *MultiBucketReplication) UnmarshalBinary(b []byte) error { var res MultiBucketReplication if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/multi_bucket_replication_edit.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // MultiBucketReplicationEdit multi bucket replication edit // // swagger:model multiBucketReplicationEdit type MultiBucketReplicationEdit struct { // arn Arn string `json:"arn,omitempty"` // prefix Prefix string `json:"prefix,omitempty"` // priority Priority int32 `json:"priority,omitempty"` // replicate delete markers ReplicateDeleteMarkers bool `json:"replicateDeleteMarkers,omitempty"` // replicate deletes ReplicateDeletes bool `json:"replicateDeletes,omitempty"` // replicate existing objects ReplicateExistingObjects bool `json:"replicateExistingObjects,omitempty"` // replicate metadata ReplicateMetadata bool `json:"replicateMetadata,omitempty"` // rule state RuleState bool `json:"ruleState,omitempty"` // storage class StorageClass string `json:"storageClass,omitempty"` // tags Tags string `json:"tags,omitempty"` } // Validate validates this multi bucket replication edit func (m *MultiBucketReplicationEdit) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this multi bucket replication edit based on context it is used func (m *MultiBucketReplicationEdit) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *MultiBucketReplicationEdit) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *MultiBucketReplicationEdit) UnmarshalBinary(b []byte) error { var res MultiBucketReplicationEdit if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/multi_bucket_response_item.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // MultiBucketResponseItem multi bucket response item // // swagger:model multiBucketResponseItem type MultiBucketResponseItem struct { // error string ErrorString string `json:"errorString,omitempty"` // origin bucket OriginBucket string `json:"originBucket,omitempty"` // target bucket TargetBucket string `json:"targetBucket,omitempty"` } // Validate validates this multi bucket response item func (m *MultiBucketResponseItem) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this multi bucket response item based on context it is used func (m *MultiBucketResponseItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *MultiBucketResponseItem) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *MultiBucketResponseItem) UnmarshalBinary(b []byte) error { var res MultiBucketResponseItem if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/multi_bucket_response_state.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // MultiBucketResponseState multi bucket response state // // swagger:model multiBucketResponseState type MultiBucketResponseState struct { // replication state ReplicationState []*MultiBucketResponseItem `json:"replicationState"` } // Validate validates this multi bucket response state func (m *MultiBucketResponseState) Validate(formats strfmt.Registry) error { var res []error if err := m.validateReplicationState(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *MultiBucketResponseState) validateReplicationState(formats strfmt.Registry) error { if swag.IsZero(m.ReplicationState) { // not required return nil } for i := 0; i < len(m.ReplicationState); i++ { if swag.IsZero(m.ReplicationState[i]) { // not required continue } if m.ReplicationState[i] != nil { if err := m.ReplicationState[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("replicationState" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("replicationState" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this multi bucket response state based on the context it is used func (m *MultiBucketResponseState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateReplicationState(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *MultiBucketResponseState) contextValidateReplicationState(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.ReplicationState); i++ { if m.ReplicationState[i] != nil { if swag.IsZero(m.ReplicationState[i]) { // not required return nil } if err := m.ReplicationState[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("replicationState" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("replicationState" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *MultiBucketResponseState) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *MultiBucketResponseState) UnmarshalBinary(b []byte) error { var res MultiBucketResponseState if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/multi_buckets_relation.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // MultiBucketsRelation multi buckets relation // // swagger:model multiBucketsRelation type MultiBucketsRelation struct { // destination bucket DestinationBucket string `json:"destinationBucket,omitempty"` // origin bucket OriginBucket string `json:"originBucket,omitempty"` } // Validate validates this multi buckets relation func (m *MultiBucketsRelation) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this multi buckets relation based on context it is used func (m *MultiBucketsRelation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *MultiBucketsRelation) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *MultiBucketsRelation) UnmarshalBinary(b []byte) error { var res MultiBucketsRelation if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/multi_lifecycle_result.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // MultiLifecycleResult multi lifecycle result // // swagger:model multiLifecycleResult type MultiLifecycleResult struct { // results Results []*MulticycleResultItem `json:"results"` } // Validate validates this multi lifecycle result func (m *MultiLifecycleResult) Validate(formats strfmt.Registry) error { var res []error if err := m.validateResults(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *MultiLifecycleResult) validateResults(formats strfmt.Registry) error { if swag.IsZero(m.Results) { // not required return nil } for i := 0; i < len(m.Results); i++ { if swag.IsZero(m.Results[i]) { // not required continue } if m.Results[i] != nil { if err := m.Results[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("results" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("results" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this multi lifecycle result based on the context it is used func (m *MultiLifecycleResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateResults(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *MultiLifecycleResult) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Results); i++ { if m.Results[i] != nil { if swag.IsZero(m.Results[i]) { // not required return nil } if err := m.Results[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("results" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("results" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *MultiLifecycleResult) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *MultiLifecycleResult) UnmarshalBinary(b []byte) error { var res MultiLifecycleResult if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/multicycle_result_item.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // MulticycleResultItem multicycle result item // // swagger:model multicycleResultItem type MulticycleResultItem struct { // bucket name BucketName string `json:"bucketName,omitempty"` // error Error string `json:"error,omitempty"` } // Validate validates this multicycle result item func (m *MulticycleResultItem) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this multicycle result item based on context it is used func (m *MulticycleResultItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *MulticycleResultItem) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *MulticycleResultItem) UnmarshalBinary(b []byte) error { var res MulticycleResultItem if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/nofitication_service.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // NofiticationService nofitication service // // swagger:model nofiticationService type NofiticationService string func NewNofiticationService(value NofiticationService) *NofiticationService { return &value } // Pointer returns a pointer to a freshly-allocated NofiticationService. func (m NofiticationService) Pointer() *NofiticationService { return &m } const ( // NofiticationServiceWebhook captures enum value "webhook" NofiticationServiceWebhook NofiticationService = "webhook" // NofiticationServiceAmqp captures enum value "amqp" NofiticationServiceAmqp NofiticationService = "amqp" // NofiticationServiceKafka captures enum value "kafka" NofiticationServiceKafka NofiticationService = "kafka" // NofiticationServiceMqtt captures enum value "mqtt" NofiticationServiceMqtt NofiticationService = "mqtt" // NofiticationServiceNats captures enum value "nats" NofiticationServiceNats NofiticationService = "nats" // NofiticationServiceNsq captures enum value "nsq" NofiticationServiceNsq NofiticationService = "nsq" // NofiticationServiceMysql captures enum value "mysql" NofiticationServiceMysql NofiticationService = "mysql" // NofiticationServicePostgres captures enum value "postgres" NofiticationServicePostgres NofiticationService = "postgres" // NofiticationServiceElasticsearch captures enum value "elasticsearch" NofiticationServiceElasticsearch NofiticationService = "elasticsearch" // NofiticationServiceRedis captures enum value "redis" NofiticationServiceRedis NofiticationService = "redis" ) // for schema var nofiticationServiceEnum []any func init() { var res []NofiticationService if err := json.Unmarshal([]byte(`["webhook","amqp","kafka","mqtt","nats","nsq","mysql","postgres","elasticsearch","redis"]`), &res); err != nil { panic(err) } for _, v := range res { nofiticationServiceEnum = append(nofiticationServiceEnum, v) } } func (m NofiticationService) validateNofiticationServiceEnum(path, location string, value NofiticationService) error { if err := validate.EnumCase(path, location, value, nofiticationServiceEnum, true); err != nil { return err } return nil } // Validate validates this nofitication service func (m NofiticationService) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validateNofiticationServiceEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ContextValidate validates this nofitication service based on context it is used func (m NofiticationService) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/notif_endpoint_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // NotifEndpointResponse notif endpoint response // // swagger:model notifEndpointResponse type NotifEndpointResponse struct { // notification endpoints NotificationEndpoints []*NotificationEndpointItem `json:"notification_endpoints"` } // Validate validates this notif endpoint response func (m *NotifEndpointResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateNotificationEndpoints(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NotifEndpointResponse) validateNotificationEndpoints(formats strfmt.Registry) error { if swag.IsZero(m.NotificationEndpoints) { // not required return nil } for i := 0; i < len(m.NotificationEndpoints); i++ { if swag.IsZero(m.NotificationEndpoints[i]) { // not required continue } if m.NotificationEndpoints[i] != nil { if err := m.NotificationEndpoints[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("notification_endpoints" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("notification_endpoints" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this notif endpoint response based on the context it is used func (m *NotifEndpointResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateNotificationEndpoints(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NotifEndpointResponse) contextValidateNotificationEndpoints(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.NotificationEndpoints); i++ { if m.NotificationEndpoints[i] != nil { if swag.IsZero(m.NotificationEndpoints[i]) { // not required return nil } if err := m.NotificationEndpoints[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("notification_endpoints" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("notification_endpoints" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *NotifEndpointResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *NotifEndpointResponse) UnmarshalBinary(b []byte) error { var res NotifEndpointResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/notification_config.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NotificationConfig notification config // // swagger:model notificationConfig type NotificationConfig struct { // arn // Required: true Arn *string `json:"arn"` // filter specific type of event. Defaults to all event (default: '[put,delete,get]') Events []NotificationEventType `json:"events"` // id ID string `json:"id,omitempty"` // filter event associated to the specified prefix Prefix string `json:"prefix,omitempty"` // filter event associated to the specified suffix Suffix string `json:"suffix,omitempty"` } // Validate validates this notification config func (m *NotificationConfig) Validate(formats strfmt.Registry) error { var res []error if err := m.validateArn(formats); err != nil { res = append(res, err) } if err := m.validateEvents(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NotificationConfig) validateArn(formats strfmt.Registry) error { if err := validate.Required("arn", "body", m.Arn); err != nil { return err } return nil } func (m *NotificationConfig) validateEvents(formats strfmt.Registry) error { if swag.IsZero(m.Events) { // not required return nil } for i := 0; i < len(m.Events); i++ { if err := m.Events[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("events" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("events" + "." + strconv.Itoa(i)) } return err } } return nil } // ContextValidate validate this notification config based on the context it is used func (m *NotificationConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateEvents(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NotificationConfig) contextValidateEvents(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Events); i++ { if swag.IsZero(m.Events[i]) { // not required return nil } if err := m.Events[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("events" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("events" + "." + strconv.Itoa(i)) } return err } } return nil } // MarshalBinary interface implementation func (m *NotificationConfig) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *NotificationConfig) UnmarshalBinary(b []byte) error { var res NotificationConfig if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/notification_delete_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NotificationDeleteRequest notification delete request // // swagger:model notificationDeleteRequest type NotificationDeleteRequest struct { // filter specific type of event. Defaults to all event (default: '[put,delete,get]') // Required: true Events []NotificationEventType `json:"events"` // filter event associated to the specified prefix // Required: true Prefix *string `json:"prefix"` // filter event associated to the specified suffix // Required: true Suffix *string `json:"suffix"` } // Validate validates this notification delete request func (m *NotificationDeleteRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateEvents(formats); err != nil { res = append(res, err) } if err := m.validatePrefix(formats); err != nil { res = append(res, err) } if err := m.validateSuffix(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NotificationDeleteRequest) validateEvents(formats strfmt.Registry) error { if err := validate.Required("events", "body", m.Events); err != nil { return err } for i := 0; i < len(m.Events); i++ { if err := m.Events[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("events" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("events" + "." + strconv.Itoa(i)) } return err } } return nil } func (m *NotificationDeleteRequest) validatePrefix(formats strfmt.Registry) error { if err := validate.Required("prefix", "body", m.Prefix); err != nil { return err } return nil } func (m *NotificationDeleteRequest) validateSuffix(formats strfmt.Registry) error { if err := validate.Required("suffix", "body", m.Suffix); err != nil { return err } return nil } // ContextValidate validate this notification delete request based on the context it is used func (m *NotificationDeleteRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateEvents(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NotificationDeleteRequest) contextValidateEvents(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Events); i++ { if swag.IsZero(m.Events[i]) { // not required return nil } if err := m.Events[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("events" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("events" + "." + strconv.Itoa(i)) } return err } } return nil } // MarshalBinary interface implementation func (m *NotificationDeleteRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *NotificationDeleteRequest) UnmarshalBinary(b []byte) error { var res NotificationDeleteRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/notification_endpoint.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NotificationEndpoint notification endpoint // // swagger:model notificationEndpoint type NotificationEndpoint struct { // account id // Required: true AccountID *string `json:"account_id"` // properties // Required: true Properties map[string]string `json:"properties"` // service // Required: true Service *NofiticationService `json:"service"` } // Validate validates this notification endpoint func (m *NotificationEndpoint) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAccountID(formats); err != nil { res = append(res, err) } if err := m.validateProperties(formats); err != nil { res = append(res, err) } if err := m.validateService(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NotificationEndpoint) validateAccountID(formats strfmt.Registry) error { if err := validate.Required("account_id", "body", m.AccountID); err != nil { return err } return nil } func (m *NotificationEndpoint) validateProperties(formats strfmt.Registry) error { if err := validate.Required("properties", "body", m.Properties); err != nil { return err } return nil } func (m *NotificationEndpoint) validateService(formats strfmt.Registry) error { if err := validate.Required("service", "body", m.Service); err != nil { return err } if m.Service != nil { if err := m.Service.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("service") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("service") } return err } } return nil } // ContextValidate validate this notification endpoint based on the context it is used func (m *NotificationEndpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateService(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NotificationEndpoint) contextValidateService(ctx context.Context, formats strfmt.Registry) error { if m.Service != nil { if err := m.Service.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("service") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("service") } return err } } return nil } // MarshalBinary interface implementation func (m *NotificationEndpoint) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *NotificationEndpoint) UnmarshalBinary(b []byte) error { var res NotificationEndpoint if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/notification_endpoint_item.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // NotificationEndpointItem notification endpoint item // // swagger:model notificationEndpointItem type NotificationEndpointItem struct { // account id AccountID string `json:"account_id,omitempty"` // service Service NofiticationService `json:"service,omitempty"` // status Status string `json:"status,omitempty"` } // Validate validates this notification endpoint item func (m *NotificationEndpointItem) Validate(formats strfmt.Registry) error { var res []error if err := m.validateService(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NotificationEndpointItem) validateService(formats strfmt.Registry) error { if swag.IsZero(m.Service) { // not required return nil } if err := m.Service.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("service") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("service") } return err } return nil } // ContextValidate validate this notification endpoint item based on the context it is used func (m *NotificationEndpointItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateService(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *NotificationEndpointItem) contextValidateService(ctx context.Context, formats strfmt.Registry) error { if swag.IsZero(m.Service) { // not required return nil } if err := m.Service.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("service") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("service") } return err } return nil } // MarshalBinary interface implementation func (m *NotificationEndpointItem) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *NotificationEndpointItem) UnmarshalBinary(b []byte) error { var res NotificationEndpointItem if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/notification_event_type.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // NotificationEventType notification event type // // swagger:model notificationEventType type NotificationEventType string func NewNotificationEventType(value NotificationEventType) *NotificationEventType { return &value } // Pointer returns a pointer to a freshly-allocated NotificationEventType. func (m NotificationEventType) Pointer() *NotificationEventType { return &m } const ( // NotificationEventTypePut captures enum value "put" NotificationEventTypePut NotificationEventType = "put" // NotificationEventTypeDelete captures enum value "delete" NotificationEventTypeDelete NotificationEventType = "delete" // NotificationEventTypeGet captures enum value "get" NotificationEventTypeGet NotificationEventType = "get" // NotificationEventTypeReplica captures enum value "replica" NotificationEventTypeReplica NotificationEventType = "replica" // NotificationEventTypeIlm captures enum value "ilm" NotificationEventTypeIlm NotificationEventType = "ilm" // NotificationEventTypeScanner captures enum value "scanner" NotificationEventTypeScanner NotificationEventType = "scanner" ) // for schema var notificationEventTypeEnum []any func init() { var res []NotificationEventType if err := json.Unmarshal([]byte(`["put","delete","get","replica","ilm","scanner"]`), &res); err != nil { panic(err) } for _, v := range res { notificationEventTypeEnum = append(notificationEventTypeEnum, v) } } func (m NotificationEventType) validateNotificationEventTypeEnum(path, location string, value NotificationEventType) error { if err := validate.EnumCase(path, location, value, notificationEventTypeEnum, true); err != nil { return err } return nil } // Validate validates this notification event type func (m NotificationEventType) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validateNotificationEventTypeEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ContextValidate validates this notification event type based on context it is used func (m NotificationEventType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/object_bucket_lifecycle.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ObjectBucketLifecycle object bucket lifecycle // // swagger:model objectBucketLifecycle type ObjectBucketLifecycle struct { // expiration Expiration *ExpirationResponse `json:"expiration,omitempty"` // id ID string `json:"id,omitempty"` // prefix Prefix string `json:"prefix,omitempty"` // status Status string `json:"status,omitempty"` // tags Tags []*LifecycleTag `json:"tags"` // transition Transition *TransitionResponse `json:"transition,omitempty"` } // Validate validates this object bucket lifecycle func (m *ObjectBucketLifecycle) Validate(formats strfmt.Registry) error { var res []error if err := m.validateExpiration(formats); err != nil { res = append(res, err) } if err := m.validateTags(formats); err != nil { res = append(res, err) } if err := m.validateTransition(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ObjectBucketLifecycle) validateExpiration(formats strfmt.Registry) error { if swag.IsZero(m.Expiration) { // not required return nil } if m.Expiration != nil { if err := m.Expiration.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("expiration") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("expiration") } return err } } return nil } func (m *ObjectBucketLifecycle) validateTags(formats strfmt.Registry) error { if swag.IsZero(m.Tags) { // not required return nil } for i := 0; i < len(m.Tags); i++ { if swag.IsZero(m.Tags[i]) { // not required continue } if m.Tags[i] != nil { if err := m.Tags[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("tags" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("tags" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *ObjectBucketLifecycle) validateTransition(formats strfmt.Registry) error { if swag.IsZero(m.Transition) { // not required return nil } if m.Transition != nil { if err := m.Transition.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("transition") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("transition") } return err } } return nil } // ContextValidate validate this object bucket lifecycle based on the context it is used func (m *ObjectBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateExpiration(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateTags(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateTransition(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ObjectBucketLifecycle) contextValidateExpiration(ctx context.Context, formats strfmt.Registry) error { if m.Expiration != nil { if swag.IsZero(m.Expiration) { // not required return nil } if err := m.Expiration.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("expiration") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("expiration") } return err } } return nil } func (m *ObjectBucketLifecycle) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Tags); i++ { if m.Tags[i] != nil { if swag.IsZero(m.Tags[i]) { // not required return nil } if err := m.Tags[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("tags" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("tags" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *ObjectBucketLifecycle) contextValidateTransition(ctx context.Context, formats strfmt.Registry) error { if m.Transition != nil { if swag.IsZero(m.Transition) { // not required return nil } if err := m.Transition.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("transition") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("transition") } return err } } return nil } // MarshalBinary interface implementation func (m *ObjectBucketLifecycle) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ObjectBucketLifecycle) UnmarshalBinary(b []byte) error { var res ObjectBucketLifecycle if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/object_legal_hold_status.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // ObjectLegalHoldStatus object legal hold status // // swagger:model objectLegalHoldStatus type ObjectLegalHoldStatus string func NewObjectLegalHoldStatus(value ObjectLegalHoldStatus) *ObjectLegalHoldStatus { return &value } // Pointer returns a pointer to a freshly-allocated ObjectLegalHoldStatus. func (m ObjectLegalHoldStatus) Pointer() *ObjectLegalHoldStatus { return &m } const ( // ObjectLegalHoldStatusEnabled captures enum value "enabled" ObjectLegalHoldStatusEnabled ObjectLegalHoldStatus = "enabled" // ObjectLegalHoldStatusDisabled captures enum value "disabled" ObjectLegalHoldStatusDisabled ObjectLegalHoldStatus = "disabled" ) // for schema var objectLegalHoldStatusEnum []any func init() { var res []ObjectLegalHoldStatus if err := json.Unmarshal([]byte(`["enabled","disabled"]`), &res); err != nil { panic(err) } for _, v := range res { objectLegalHoldStatusEnum = append(objectLegalHoldStatusEnum, v) } } func (m ObjectLegalHoldStatus) validateObjectLegalHoldStatusEnum(path, location string, value ObjectLegalHoldStatus) error { if err := validate.EnumCase(path, location, value, objectLegalHoldStatusEnum, true); err != nil { return err } return nil } // Validate validates this object legal hold status func (m ObjectLegalHoldStatus) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validateObjectLegalHoldStatusEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ContextValidate validates this object legal hold status based on context it is used func (m ObjectLegalHoldStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/object_retention_mode.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // ObjectRetentionMode object retention mode // // swagger:model objectRetentionMode type ObjectRetentionMode string func NewObjectRetentionMode(value ObjectRetentionMode) *ObjectRetentionMode { return &value } // Pointer returns a pointer to a freshly-allocated ObjectRetentionMode. func (m ObjectRetentionMode) Pointer() *ObjectRetentionMode { return &m } const ( // ObjectRetentionModeGovernance captures enum value "governance" ObjectRetentionModeGovernance ObjectRetentionMode = "governance" // ObjectRetentionModeCompliance captures enum value "compliance" ObjectRetentionModeCompliance ObjectRetentionMode = "compliance" ) // for schema var objectRetentionModeEnum []any func init() { var res []ObjectRetentionMode if err := json.Unmarshal([]byte(`["governance","compliance"]`), &res); err != nil { panic(err) } for _, v := range res { objectRetentionModeEnum = append(objectRetentionModeEnum, v) } } func (m ObjectRetentionMode) validateObjectRetentionModeEnum(path, location string, value ObjectRetentionMode) error { if err := validate.EnumCase(path, location, value, objectRetentionModeEnum, true); err != nil { return err } return nil } // Validate validates this object retention mode func (m ObjectRetentionMode) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validateObjectRetentionModeEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ContextValidate validates this object retention mode based on context it is used func (m ObjectRetentionMode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/object_retention_unit.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // ObjectRetentionUnit object retention unit // // swagger:model objectRetentionUnit type ObjectRetentionUnit string func NewObjectRetentionUnit(value ObjectRetentionUnit) *ObjectRetentionUnit { return &value } // Pointer returns a pointer to a freshly-allocated ObjectRetentionUnit. func (m ObjectRetentionUnit) Pointer() *ObjectRetentionUnit { return &m } const ( // ObjectRetentionUnitDays captures enum value "days" ObjectRetentionUnitDays ObjectRetentionUnit = "days" // ObjectRetentionUnitYears captures enum value "years" ObjectRetentionUnitYears ObjectRetentionUnit = "years" ) // for schema var objectRetentionUnitEnum []any func init() { var res []ObjectRetentionUnit if err := json.Unmarshal([]byte(`["days","years"]`), &res); err != nil { panic(err) } for _, v := range res { objectRetentionUnitEnum = append(objectRetentionUnitEnum, v) } } func (m ObjectRetentionUnit) validateObjectRetentionUnitEnum(path, location string, value ObjectRetentionUnit) error { if err := validate.EnumCase(path, location, value, objectRetentionUnitEnum, true); err != nil { return err } return nil } // Validate validates this object retention unit func (m ObjectRetentionUnit) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validateObjectRetentionUnitEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ContextValidate validates this object retention unit based on context it is used func (m ObjectRetentionUnit) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/peer_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PeerInfo peer info // // swagger:model peerInfo type PeerInfo struct { // deployment ID DeploymentID string `json:"deploymentID,omitempty"` // endpoint Endpoint string `json:"endpoint,omitempty"` // name Name string `json:"name,omitempty"` } // Validate validates this peer info func (m *PeerInfo) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this peer info based on context it is used func (m *PeerInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PeerInfo) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PeerInfo) UnmarshalBinary(b []byte) error { var res PeerInfo if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/peer_info_remove.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PeerInfoRemove peer info remove // // swagger:model peerInfoRemove type PeerInfoRemove struct { // all All bool `json:"all,omitempty"` // sites // Required: true Sites []string `json:"sites"` } // Validate validates this peer info remove func (m *PeerInfoRemove) Validate(formats strfmt.Registry) error { var res []error if err := m.validateSites(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PeerInfoRemove) validateSites(formats strfmt.Registry) error { if err := validate.Required("sites", "body", m.Sites); err != nil { return err } return nil } // ContextValidate validates this peer info remove based on context it is used func (m *PeerInfoRemove) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PeerInfoRemove) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PeerInfoRemove) UnmarshalBinary(b []byte) error { var res PeerInfoRemove if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/peer_site.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PeerSite peer site // // swagger:model peerSite type PeerSite struct { // access key AccessKey string `json:"accessKey,omitempty"` // endpoint Endpoint string `json:"endpoint,omitempty"` // name Name string `json:"name,omitempty"` // secret key SecretKey string `json:"secretKey,omitempty"` } // Validate validates this peer site func (m *PeerSite) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this peer site based on context it is used func (m *PeerSite) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PeerSite) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PeerSite) UnmarshalBinary(b []byte) error { var res PeerSite if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/peer_site_edit_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PeerSiteEditResponse peer site edit response // // swagger:model peerSiteEditResponse type PeerSiteEditResponse struct { // error detail ErrorDetail string `json:"errorDetail,omitempty"` // status Status string `json:"status,omitempty"` // success Success bool `json:"success,omitempty"` } // Validate validates this peer site edit response func (m *PeerSiteEditResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this peer site edit response based on context it is used func (m *PeerSiteEditResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PeerSiteEditResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PeerSiteEditResponse) UnmarshalBinary(b []byte) error { var res PeerSiteEditResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/peer_site_remove_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PeerSiteRemoveResponse peer site remove response // // swagger:model peerSiteRemoveResponse type PeerSiteRemoveResponse struct { // error detail ErrorDetail string `json:"errorDetail,omitempty"` // status Status string `json:"status,omitempty"` } // Validate validates this peer site remove response func (m *PeerSiteRemoveResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this peer site remove response based on context it is used func (m *PeerSiteRemoveResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PeerSiteRemoveResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PeerSiteRemoveResponse) UnmarshalBinary(b []byte) error { var res PeerSiteRemoveResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/permission_resource.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PermissionResource permission resource // // swagger:model permissionResource type PermissionResource struct { // condition operator ConditionOperator string `json:"conditionOperator,omitempty"` // prefixes Prefixes []string `json:"prefixes"` // resource Resource string `json:"resource,omitempty"` } // Validate validates this permission resource func (m *PermissionResource) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this permission resource based on context it is used func (m *PermissionResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PermissionResource) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PermissionResource) UnmarshalBinary(b []byte) error { var res PermissionResource if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/policy.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Policy policy // // swagger:model policy type Policy struct { // name Name string `json:"name,omitempty"` // policy Policy string `json:"policy,omitempty"` } // Validate validates this policy func (m *Policy) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this policy based on context it is used func (m *Policy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *Policy) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Policy) UnmarshalBinary(b []byte) error { var res Policy if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/policy_args.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PolicyArgs policy args // // swagger:model policyArgs type PolicyArgs struct { // action Action string `json:"action,omitempty"` // bucket name BucketName string `json:"bucket_name,omitempty"` // id ID string `json:"id,omitempty"` } // Validate validates this policy args func (m *PolicyArgs) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this policy args based on context it is used func (m *PolicyArgs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PolicyArgs) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PolicyArgs) UnmarshalBinary(b []byte) error { var res PolicyArgs if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/policy_entity.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // PolicyEntity policy entity // // swagger:model policyEntity type PolicyEntity string func NewPolicyEntity(value PolicyEntity) *PolicyEntity { return &value } // Pointer returns a pointer to a freshly-allocated PolicyEntity. func (m PolicyEntity) Pointer() *PolicyEntity { return &m } const ( // PolicyEntityUser captures enum value "user" PolicyEntityUser PolicyEntity = "user" // PolicyEntityGroup captures enum value "group" PolicyEntityGroup PolicyEntity = "group" ) // for schema var policyEntityEnum []any func init() { var res []PolicyEntity if err := json.Unmarshal([]byte(`["user","group"]`), &res); err != nil { panic(err) } for _, v := range res { policyEntityEnum = append(policyEntityEnum, v) } } func (m PolicyEntity) validatePolicyEntityEnum(path, location string, value PolicyEntity) error { if err := validate.EnumCase(path, location, value, policyEntityEnum, true); err != nil { return err } return nil } // Validate validates this policy entity func (m PolicyEntity) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validatePolicyEntityEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ContextValidate validates this policy entity based on context it is used func (m PolicyEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/prefix_access_pair.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PrefixAccessPair prefix access pair // // swagger:model prefixAccessPair type PrefixAccessPair struct { // access Access string `json:"access,omitempty"` // prefix Prefix string `json:"prefix,omitempty"` } // Validate validates this prefix access pair func (m *PrefixAccessPair) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this prefix access pair based on context it is used func (m *PrefixAccessPair) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PrefixAccessPair) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PrefixAccessPair) UnmarshalBinary(b []byte) error { var res PrefixAccessPair if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/prefix_wrapper.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PrefixWrapper prefix wrapper // // swagger:model prefixWrapper type PrefixWrapper struct { // prefix Prefix string `json:"prefix,omitempty"` } // Validate validates this prefix wrapper func (m *PrefixWrapper) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this prefix wrapper based on context it is used func (m *PrefixWrapper) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PrefixWrapper) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PrefixWrapper) UnmarshalBinary(b []byte) error { var res PrefixWrapper if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/principal.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Principal principal // // swagger:model principal type Principal struct { // s t s access key ID STSAccessKeyID string `json:"STSAccessKeyID,omitempty"` // s t s secret access key STSSecretAccessKey string `json:"STSSecretAccessKey,omitempty"` // s t s session token STSSessionToken string `json:"STSSessionToken,omitempty"` // account access key AccountAccessKey string `json:"accountAccessKey,omitempty"` // custom style ob CustomStyleOb string `json:"customStyleOb,omitempty"` // hm Hm bool `json:"hm,omitempty"` // ob Ob bool `json:"ob,omitempty"` } // Validate validates this principal func (m *Principal) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this principal based on context it is used func (m *Principal) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *Principal) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Principal) UnmarshalBinary(b []byte) error { var res Principal if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/profiling_start_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ProfilingStartRequest profiling start request // // swagger:model profilingStartRequest type ProfilingStartRequest struct { // type // Required: true Type *string `json:"type"` } // Validate validates this profiling start request func (m *ProfilingStartRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ProfilingStartRequest) validateType(formats strfmt.Registry) error { if err := validate.Required("type", "body", m.Type); err != nil { return err } return nil } // ContextValidate validates this profiling start request based on context it is used func (m *ProfilingStartRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ProfilingStartRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ProfilingStartRequest) UnmarshalBinary(b []byte) error { var res ProfilingStartRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/put_bucket_retention_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PutBucketRetentionRequest put bucket retention request // // swagger:model putBucketRetentionRequest type PutBucketRetentionRequest struct { // mode // Required: true Mode *ObjectRetentionMode `json:"mode"` // unit // Required: true Unit *ObjectRetentionUnit `json:"unit"` // validity // Required: true Validity *int32 `json:"validity"` } // Validate validates this put bucket retention request func (m *PutBucketRetentionRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateMode(formats); err != nil { res = append(res, err) } if err := m.validateUnit(formats); err != nil { res = append(res, err) } if err := m.validateValidity(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PutBucketRetentionRequest) validateMode(formats strfmt.Registry) error { if err := validate.Required("mode", "body", m.Mode); err != nil { return err } if m.Mode != nil { if err := m.Mode.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("mode") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("mode") } return err } } return nil } func (m *PutBucketRetentionRequest) validateUnit(formats strfmt.Registry) error { if err := validate.Required("unit", "body", m.Unit); err != nil { return err } if m.Unit != nil { if err := m.Unit.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("unit") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("unit") } return err } } return nil } func (m *PutBucketRetentionRequest) validateValidity(formats strfmt.Registry) error { if err := validate.Required("validity", "body", m.Validity); err != nil { return err } return nil } // ContextValidate validate this put bucket retention request based on the context it is used func (m *PutBucketRetentionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateMode(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateUnit(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PutBucketRetentionRequest) contextValidateMode(ctx context.Context, formats strfmt.Registry) error { if m.Mode != nil { if err := m.Mode.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("mode") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("mode") } return err } } return nil } func (m *PutBucketRetentionRequest) contextValidateUnit(ctx context.Context, formats strfmt.Registry) error { if m.Unit != nil { if err := m.Unit.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("unit") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("unit") } return err } } return nil } // MarshalBinary interface implementation func (m *PutBucketRetentionRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PutBucketRetentionRequest) UnmarshalBinary(b []byte) error { var res PutBucketRetentionRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/put_bucket_tags_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PutBucketTagsRequest put bucket tags request // // swagger:model putBucketTagsRequest type PutBucketTagsRequest struct { // tags Tags map[string]string `json:"tags,omitempty"` } // Validate validates this put bucket tags request func (m *PutBucketTagsRequest) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this put bucket tags request based on context it is used func (m *PutBucketTagsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PutBucketTagsRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PutBucketTagsRequest) UnmarshalBinary(b []byte) error { var res PutBucketTagsRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/put_object_legal_hold_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PutObjectLegalHoldRequest put object legal hold request // // swagger:model putObjectLegalHoldRequest type PutObjectLegalHoldRequest struct { // status // Required: true Status *ObjectLegalHoldStatus `json:"status"` } // Validate validates this put object legal hold request func (m *PutObjectLegalHoldRequest) 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 } func (m *PutObjectLegalHoldRequest) validateStatus(formats strfmt.Registry) error { if err := validate.Required("status", "body", m.Status); err != nil { return err } if m.Status != nil { if err := m.Status.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("status") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("status") } return err } } return nil } // ContextValidate validate this put object legal hold request based on the context it is used func (m *PutObjectLegalHoldRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateStatus(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PutObjectLegalHoldRequest) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { if m.Status != nil { if err := m.Status.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("status") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("status") } return err } } return nil } // MarshalBinary interface implementation func (m *PutObjectLegalHoldRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PutObjectLegalHoldRequest) UnmarshalBinary(b []byte) error { var res PutObjectLegalHoldRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/put_object_retention_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PutObjectRetentionRequest put object retention request // // swagger:model putObjectRetentionRequest type PutObjectRetentionRequest struct { // expires // Required: true Expires *string `json:"expires"` // governance bypass GovernanceBypass bool `json:"governance_bypass,omitempty"` // mode // Required: true Mode *ObjectRetentionMode `json:"mode"` } // Validate validates this put object retention request func (m *PutObjectRetentionRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateExpires(formats); err != nil { res = append(res, err) } if err := m.validateMode(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PutObjectRetentionRequest) validateExpires(formats strfmt.Registry) error { if err := validate.Required("expires", "body", m.Expires); err != nil { return err } return nil } func (m *PutObjectRetentionRequest) validateMode(formats strfmt.Registry) error { if err := validate.Required("mode", "body", m.Mode); err != nil { return err } if m.Mode != nil { if err := m.Mode.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("mode") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("mode") } return err } } return nil } // ContextValidate validate this put object retention request based on the context it is used func (m *PutObjectRetentionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateMode(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PutObjectRetentionRequest) contextValidateMode(ctx context.Context, formats strfmt.Registry) error { if m.Mode != nil { if err := m.Mode.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("mode") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("mode") } return err } } return nil } // MarshalBinary interface implementation func (m *PutObjectRetentionRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PutObjectRetentionRequest) UnmarshalBinary(b []byte) error { var res PutObjectRetentionRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/put_object_tags_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PutObjectTagsRequest put object tags request // // swagger:model putObjectTagsRequest type PutObjectTagsRequest struct { // tags Tags map[string]string `json:"tags,omitempty"` } // Validate validates this put object tags request func (m *PutObjectTagsRequest) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this put object tags request based on context it is used func (m *PutObjectTagsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PutObjectTagsRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PutObjectTagsRequest) UnmarshalBinary(b []byte) error { var res PutObjectTagsRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/redirect_rule.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // RedirectRule redirect rule // // swagger:model redirectRule type RedirectRule struct { // display name DisplayName string `json:"displayName,omitempty"` // redirect Redirect string `json:"redirect,omitempty"` // service type ServiceType string `json:"serviceType,omitempty"` } // Validate validates this redirect rule func (m *RedirectRule) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this redirect rule based on context it is used func (m *RedirectRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *RedirectRule) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *RedirectRule) UnmarshalBinary(b []byte) error { var res RedirectRule if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/release_author.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ReleaseAuthor release author // // swagger:model releaseAuthor type ReleaseAuthor struct { // avatar url AvatarURL string `json:"avatar_url,omitempty"` // events url EventsURL string `json:"events_url,omitempty"` // followers url FollowersURL string `json:"followers_url,omitempty"` // following url FollowingURL string `json:"following_url,omitempty"` // gists url GistsURL string `json:"gists_url,omitempty"` // gravatar id GravatarID string `json:"gravatar_id,omitempty"` // html url HTMLURL string `json:"html_url,omitempty"` // id ID int64 `json:"id,omitempty"` // login Login string `json:"login,omitempty"` // node id NodeID string `json:"node_id,omitempty"` // organizations url OrganizationsURL string `json:"organizations_url,omitempty"` // received events url ReceivedEventsURL string `json:"receivedEvents_url,omitempty"` // repos url ReposURL string `json:"repos_url,omitempty"` // site admin SiteAdmin bool `json:"site_admin,omitempty"` // starred url StarredURL string `json:"starred_url,omitempty"` // subscriptions url SubscriptionsURL string `json:"subscriptions_url,omitempty"` // type Type string `json:"type,omitempty"` // url URL string `json:"url,omitempty"` } // Validate validates this release author func (m *ReleaseAuthor) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this release author based on context it is used func (m *ReleaseAuthor) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ReleaseAuthor) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ReleaseAuthor) UnmarshalBinary(b []byte) error { var res ReleaseAuthor if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/release_info.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ReleaseInfo release info // // swagger:model releaseInfo type ReleaseInfo struct { // breaking changes content BreakingChangesContent string `json:"breakingChangesContent,omitempty"` // context content ContextContent string `json:"contextContent,omitempty"` // metadata Metadata *ReleaseMetadata `json:"metadata,omitempty"` // new features content NewFeaturesContent string `json:"newFeaturesContent,omitempty"` // notes content NotesContent string `json:"notesContent,omitempty"` // security content SecurityContent string `json:"securityContent,omitempty"` } // Validate validates this release info func (m *ReleaseInfo) Validate(formats strfmt.Registry) error { var res []error if err := m.validateMetadata(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ReleaseInfo) validateMetadata(formats strfmt.Registry) error { if swag.IsZero(m.Metadata) { // not required return nil } if m.Metadata != nil { if err := m.Metadata.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("metadata") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("metadata") } return err } } return nil } // ContextValidate validate this release info based on the context it is used func (m *ReleaseInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateMetadata(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ReleaseInfo) contextValidateMetadata(ctx context.Context, formats strfmt.Registry) error { if m.Metadata != nil { if swag.IsZero(m.Metadata) { // not required return nil } if err := m.Metadata.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("metadata") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("metadata") } return err } } return nil } // MarshalBinary interface implementation func (m *ReleaseInfo) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ReleaseInfo) UnmarshalBinary(b []byte) error { var res ReleaseInfo if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/release_list_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ReleaseListResponse release list response // // swagger:model releaseListResponse type ReleaseListResponse struct { // results Results []*ReleaseInfo `json:"results"` } // Validate validates this release list response func (m *ReleaseListResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateResults(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ReleaseListResponse) validateResults(formats strfmt.Registry) error { if swag.IsZero(m.Results) { // not required return nil } for i := 0; i < len(m.Results); i++ { if swag.IsZero(m.Results[i]) { // not required continue } if m.Results[i] != nil { if err := m.Results[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("results" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("results" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this release list response based on the context it is used func (m *ReleaseListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateResults(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ReleaseListResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Results); i++ { if m.Results[i] != nil { if swag.IsZero(m.Results[i]) { // not required return nil } if err := m.Results[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("results" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("results" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ReleaseListResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ReleaseListResponse) UnmarshalBinary(b []byte) error { var res ReleaseListResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/release_metadata.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ReleaseMetadata release metadata // // swagger:model releaseMetadata type ReleaseMetadata struct { // assets url AssetsURL string `json:"assets_url,omitempty"` // author Author *ReleaseAuthor `json:"author,omitempty"` // created at CreatedAt string `json:"created_at,omitempty"` // draft Draft bool `json:"draft,omitempty"` // html url HTMLURL string `json:"html_url,omitempty"` // id ID int64 `json:"id,omitempty"` // name Name string `json:"name,omitempty"` // node id NodeID string `json:"node_id,omitempty"` // prerelease Prerelease bool `json:"prerelease,omitempty"` // published at PublishedAt string `json:"published_at,omitempty"` // tag name TagName string `json:"tag_name,omitempty"` // tarball url TarballURL string `json:"tarball_url,omitempty"` // target commitish TargetCommitish string `json:"target_commitish,omitempty"` // upload url UploadURL string `json:"upload_url,omitempty"` // url URL string `json:"url,omitempty"` // zipball url ZipballURL string `json:"zipball_url,omitempty"` } // Validate validates this release metadata func (m *ReleaseMetadata) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAuthor(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ReleaseMetadata) validateAuthor(formats strfmt.Registry) error { if swag.IsZero(m.Author) { // not required return nil } if m.Author != nil { if err := m.Author.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("author") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("author") } return err } } return nil } // ContextValidate validate this release metadata based on the context it is used func (m *ReleaseMetadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateAuthor(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ReleaseMetadata) contextValidateAuthor(ctx context.Context, formats strfmt.Registry) error { if m.Author != nil { if swag.IsZero(m.Author) { // not required return nil } if err := m.Author.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("author") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("author") } return err } } return nil } // MarshalBinary interface implementation func (m *ReleaseMetadata) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ReleaseMetadata) UnmarshalBinary(b []byte) error { var res ReleaseMetadata if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/remote_bucket.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // RemoteBucket remote bucket // // swagger:model remoteBucket type RemoteBucket struct { // access key // Required: true // Min Length: 3 AccessKey *string `json:"accessKey"` // bandwidth Bandwidth int64 `json:"bandwidth,omitempty"` // health check period HealthCheckPeriod int64 `json:"healthCheckPeriod,omitempty"` // remote a r n // Required: true RemoteARN *string `json:"remoteARN"` // secret key // Min Length: 8 SecretKey string `json:"secretKey,omitempty"` // service // Enum: ["replication"] Service string `json:"service,omitempty"` // source bucket // Required: true SourceBucket *string `json:"sourceBucket"` // status Status string `json:"status,omitempty"` // sync mode SyncMode string `json:"syncMode,omitempty"` // target bucket TargetBucket string `json:"targetBucket,omitempty"` // target URL TargetURL string `json:"targetURL,omitempty"` } // Validate validates this remote bucket func (m *RemoteBucket) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAccessKey(formats); err != nil { res = append(res, err) } if err := m.validateRemoteARN(formats); err != nil { res = append(res, err) } if err := m.validateSecretKey(formats); err != nil { res = append(res, err) } if err := m.validateService(formats); err != nil { res = append(res, err) } if err := m.validateSourceBucket(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *RemoteBucket) validateAccessKey(formats strfmt.Registry) error { if err := validate.Required("accessKey", "body", m.AccessKey); err != nil { return err } if err := validate.MinLength("accessKey", "body", *m.AccessKey, 3); err != nil { return err } return nil } func (m *RemoteBucket) validateRemoteARN(formats strfmt.Registry) error { if err := validate.Required("remoteARN", "body", m.RemoteARN); err != nil { return err } return nil } func (m *RemoteBucket) validateSecretKey(formats strfmt.Registry) error { if swag.IsZero(m.SecretKey) { // not required return nil } if err := validate.MinLength("secretKey", "body", m.SecretKey, 8); err != nil { return err } return nil } var remoteBucketTypeServicePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["replication"]`), &res); err != nil { panic(err) } for _, v := range res { remoteBucketTypeServicePropEnum = append(remoteBucketTypeServicePropEnum, v) } } const ( // RemoteBucketServiceReplication captures enum value "replication" RemoteBucketServiceReplication string = "replication" ) // prop value enum func (m *RemoteBucket) validateServiceEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, remoteBucketTypeServicePropEnum, true); err != nil { return err } return nil } func (m *RemoteBucket) validateService(formats strfmt.Registry) error { if swag.IsZero(m.Service) { // not required return nil } // value enum if err := m.validateServiceEnum("service", "body", m.Service); err != nil { return err } return nil } func (m *RemoteBucket) validateSourceBucket(formats strfmt.Registry) error { if err := validate.Required("sourceBucket", "body", m.SourceBucket); err != nil { return err } return nil } // ContextValidate validates this remote bucket based on context it is used func (m *RemoteBucket) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *RemoteBucket) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *RemoteBucket) UnmarshalBinary(b []byte) error { var res RemoteBucket if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/result_target.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ResultTarget result target // // swagger:model resultTarget type ResultTarget struct { // legend format LegendFormat string `json:"legendFormat,omitempty"` // result Result []*WidgetResult `json:"result"` // result type ResultType string `json:"resultType,omitempty"` } // Validate validates this result target func (m *ResultTarget) Validate(formats strfmt.Registry) error { var res []error if err := m.validateResult(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ResultTarget) validateResult(formats strfmt.Registry) error { if swag.IsZero(m.Result) { // not required return nil } for i := 0; i < len(m.Result); i++ { if swag.IsZero(m.Result[i]) { // not required continue } if m.Result[i] != nil { if err := m.Result[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("result" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("result" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this result target based on the context it is used func (m *ResultTarget) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateResult(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ResultTarget) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Result); i++ { if m.Result[i] != nil { if swag.IsZero(m.Result[i]) { // not required return nil } if err := m.Result[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("result" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("result" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ResultTarget) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ResultTarget) UnmarshalBinary(b []byte) error { var res ResultTarget if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/rewind_item.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // RewindItem rewind item // // swagger:model rewindItem type RewindItem struct { // action Action string `json:"action,omitempty"` // delete flag DeleteFlag bool `json:"delete_flag,omitempty"` // is latest IsLatest bool `json:"is_latest,omitempty"` // last modified LastModified string `json:"last_modified,omitempty"` // name Name string `json:"name,omitempty"` // size Size int64 `json:"size,omitempty"` // version id VersionID string `json:"version_id,omitempty"` } // Validate validates this rewind item func (m *RewindItem) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this rewind item based on context it is used func (m *RewindItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *RewindItem) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *RewindItem) UnmarshalBinary(b []byte) error { var res RewindItem if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/rewind_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // RewindResponse rewind response // // swagger:model rewindResponse type RewindResponse struct { // objects Objects []*RewindItem `json:"objects"` } // Validate validates this rewind response func (m *RewindResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateObjects(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *RewindResponse) validateObjects(formats strfmt.Registry) error { if swag.IsZero(m.Objects) { // not required return nil } for i := 0; i < len(m.Objects); i++ { if swag.IsZero(m.Objects[i]) { // not required continue } if m.Objects[i] != nil { if err := m.Objects[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("objects" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("objects" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this rewind response based on the context it is used func (m *RewindResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateObjects(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *RewindResponse) contextValidateObjects(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Objects); i++ { if m.Objects[i] != nil { if swag.IsZero(m.Objects[i]) { // not required return nil } if err := m.Objects[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("objects" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("objects" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *RewindResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *RewindResponse) UnmarshalBinary(b []byte) error { var res RewindResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/selected_s_as.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" ) // SelectedSAs selected s as // // swagger:model selectedSAs type SelectedSAs []string // Validate validates this selected s as func (m SelectedSAs) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this selected s as based on context it is used func (m SelectedSAs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/selected_users.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" ) // SelectedUsers selected users // // swagger:model selectedUsers type SelectedUsers []string // Validate validates this selected users func (m SelectedUsers) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this selected users based on context it is used func (m SelectedUsers) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } ================================================ FILE: models/server_drives.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServerDrives server drives // // swagger:model serverDrives type ServerDrives struct { // available space AvailableSpace int64 `json:"availableSpace,omitempty"` // drive path DrivePath string `json:"drivePath,omitempty"` // endpoint Endpoint string `json:"endpoint,omitempty"` // healing Healing bool `json:"healing,omitempty"` // model Model string `json:"model,omitempty"` // root disk RootDisk bool `json:"rootDisk,omitempty"` // state State string `json:"state,omitempty"` // total space TotalSpace int64 `json:"totalSpace,omitempty"` // used space UsedSpace int64 `json:"usedSpace,omitempty"` // uuid UUID string `json:"uuid,omitempty"` } // Validate validates this server drives func (m *ServerDrives) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this server drives based on context it is used func (m *ServerDrives) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ServerDrives) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ServerDrives) UnmarshalBinary(b []byte) error { var res ServerDrives if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/server_properties.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServerProperties server properties // // swagger:model serverProperties type ServerProperties struct { // commit ID CommitID string `json:"commitID,omitempty"` // drives Drives []*ServerDrives `json:"drives"` // endpoint Endpoint string `json:"endpoint,omitempty"` // network Network map[string]string `json:"network,omitempty"` // pool number PoolNumber int64 `json:"poolNumber,omitempty"` // state State string `json:"state,omitempty"` // uptime Uptime int64 `json:"uptime,omitempty"` // version Version string `json:"version,omitempty"` } // Validate validates this server properties func (m *ServerProperties) 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 *ServerProperties) 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 { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("drives" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("drives" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this server properties based on the context it is used func (m *ServerProperties) 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 *ServerProperties) contextValidateDrives(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Drives); i++ { if m.Drives[i] != nil { if swag.IsZero(m.Drives[i]) { // not required return nil } if err := m.Drives[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("drives" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("drives" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ServerProperties) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ServerProperties) UnmarshalBinary(b []byte) error { var res ServerProperties if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/service_account.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceAccount service account // // swagger:model serviceAccount type ServiceAccount struct { // account status AccountStatus string `json:"accountStatus,omitempty"` // description Description string `json:"description,omitempty"` // expiration Expiration string `json:"expiration,omitempty"` // implied policy ImpliedPolicy bool `json:"impliedPolicy,omitempty"` // name Name string `json:"name,omitempty"` // parent user ParentUser string `json:"parentUser,omitempty"` // policy Policy string `json:"policy,omitempty"` } // Validate validates this service account func (m *ServiceAccount) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this service account based on context it is used func (m *ServiceAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ServiceAccount) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ServiceAccount) UnmarshalBinary(b []byte) error { var res ServiceAccount if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/service_account_creds.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceAccountCreds service account creds // // swagger:model serviceAccountCreds type ServiceAccountCreds struct { // access key AccessKey string `json:"accessKey,omitempty"` // secret key SecretKey string `json:"secretKey,omitempty"` // url URL string `json:"url,omitempty"` } // Validate validates this service account creds func (m *ServiceAccountCreds) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this service account creds based on context it is used func (m *ServiceAccountCreds) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ServiceAccountCreds) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ServiceAccountCreds) UnmarshalBinary(b []byte) error { var res ServiceAccountCreds if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/service_account_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceAccountRequest service account request // // swagger:model serviceAccountRequest type ServiceAccountRequest struct { // comment Comment string `json:"comment,omitempty"` // description Description string `json:"description,omitempty"` // expiry Expiry string `json:"expiry,omitempty"` // name Name string `json:"name,omitempty"` // policy to be applied to the Service Account if any Policy string `json:"policy,omitempty"` } // Validate validates this service account request func (m *ServiceAccountRequest) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this service account request based on context it is used func (m *ServiceAccountRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ServiceAccountRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ServiceAccountRequest) UnmarshalBinary(b []byte) error { var res ServiceAccountRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/service_account_request_creds.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceAccountRequestCreds service account request creds // // swagger:model serviceAccountRequestCreds type ServiceAccountRequestCreds struct { // access key AccessKey string `json:"accessKey,omitempty"` // comment Comment string `json:"comment,omitempty"` // description Description string `json:"description,omitempty"` // expiry Expiry string `json:"expiry,omitempty"` // name Name string `json:"name,omitempty"` // policy to be applied to the Service Account if any Policy string `json:"policy,omitempty"` // secret key SecretKey string `json:"secretKey,omitempty"` } // Validate validates this service account request creds func (m *ServiceAccountRequestCreds) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this service account request creds based on context it is used func (m *ServiceAccountRequestCreds) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ServiceAccountRequestCreds) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ServiceAccountRequestCreds) UnmarshalBinary(b []byte) error { var res ServiceAccountRequestCreds if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/service_accounts.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceAccounts service accounts // // swagger:model serviceAccounts type ServiceAccounts []*ServiceAccountsItems0 // Validate validates this service accounts func (m ServiceAccounts) 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 { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName(strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName(strconv.Itoa(i)) } return err } } } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ContextValidate validate this service accounts based on the context it is used func (m ServiceAccounts) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error for i := 0; i < len(m); i++ { if m[i] != nil { if swag.IsZero(m[i]) { // not required return nil } if err := m[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName(strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName(strconv.Itoa(i)) } return err } } } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ServiceAccountsItems0 service accounts items0 // // swagger:model ServiceAccountsItems0 type ServiceAccountsItems0 struct { // access key AccessKey string `json:"accessKey,omitempty"` // account status AccountStatus string `json:"accountStatus,omitempty"` // description Description string `json:"description,omitempty"` // expiration Expiration string `json:"expiration,omitempty"` // name Name string `json:"name,omitempty"` } // Validate validates this service accounts items0 func (m *ServiceAccountsItems0) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this service accounts items0 based on context it is used func (m *ServiceAccountsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *ServiceAccountsItems0) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ServiceAccountsItems0) UnmarshalBinary(b []byte) error { var res ServiceAccountsItems0 if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/session_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SessionResponse session response // // swagger:model sessionResponse type SessionResponse struct { // allow resources AllowResources []*PermissionResource `json:"allowResources"` // custom styles CustomStyles string `json:"customStyles,omitempty"` // distributed mode DistributedMode bool `json:"distributedMode,omitempty"` // env constants EnvConstants *EnvironmentConstants `json:"envConstants,omitempty"` // features Features []string `json:"features"` // operator Operator bool `json:"operator,omitempty"` // permissions Permissions map[string][]string `json:"permissions,omitempty"` // server end point ServerEndPoint string `json:"serverEndPoint,omitempty"` // status // Enum: ["ok"] Status string `json:"status,omitempty"` } // Validate validates this session response func (m *SessionResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAllowResources(formats); err != nil { res = append(res, err) } if err := m.validateEnvConstants(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 *SessionResponse) validateAllowResources(formats strfmt.Registry) error { if swag.IsZero(m.AllowResources) { // not required return nil } for i := 0; i < len(m.AllowResources); i++ { if swag.IsZero(m.AllowResources[i]) { // not required continue } if m.AllowResources[i] != nil { if err := m.AllowResources[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("allowResources" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("allowResources" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *SessionResponse) validateEnvConstants(formats strfmt.Registry) error { if swag.IsZero(m.EnvConstants) { // not required return nil } if m.EnvConstants != nil { if err := m.EnvConstants.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("envConstants") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("envConstants") } return err } } return nil } var sessionResponseTypeStatusPropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["ok"]`), &res); err != nil { panic(err) } for _, v := range res { sessionResponseTypeStatusPropEnum = append(sessionResponseTypeStatusPropEnum, v) } } const ( // SessionResponseStatusOk captures enum value "ok" SessionResponseStatusOk string = "ok" ) // prop value enum func (m *SessionResponse) validateStatusEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, sessionResponseTypeStatusPropEnum, true); err != nil { return err } return nil } func (m *SessionResponse) 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 validate this session response based on the context it is used func (m *SessionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateAllowResources(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateEnvConstants(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SessionResponse) contextValidateAllowResources(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.AllowResources); i++ { if m.AllowResources[i] != nil { if swag.IsZero(m.AllowResources[i]) { // not required return nil } if err := m.AllowResources[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("allowResources" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("allowResources" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *SessionResponse) contextValidateEnvConstants(ctx context.Context, formats strfmt.Registry) error { if m.EnvConstants != nil { if swag.IsZero(m.EnvConstants) { // not required return nil } if err := m.EnvConstants.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("envConstants") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("envConstants") } return err } } return nil } // MarshalBinary interface implementation func (m *SessionResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SessionResponse) UnmarshalBinary(b []byte) error { var res SessionResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/set_bucket_policy_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SetBucketPolicyRequest set bucket policy request // // swagger:model setBucketPolicyRequest type SetBucketPolicyRequest struct { // access // Required: true Access *BucketAccess `json:"access"` // definition Definition string `json:"definition,omitempty"` } // Validate validates this set bucket policy request func (m *SetBucketPolicyRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAccess(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetBucketPolicyRequest) validateAccess(formats strfmt.Registry) error { if err := validate.Required("access", "body", m.Access); err != nil { return err } if m.Access != nil { if err := m.Access.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("access") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("access") } return err } } return nil } // ContextValidate validate this set bucket policy request based on the context it is used func (m *SetBucketPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateAccess(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetBucketPolicyRequest) contextValidateAccess(ctx context.Context, formats strfmt.Registry) error { if m.Access != nil { if err := m.Access.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("access") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("access") } return err } } return nil } // MarshalBinary interface implementation func (m *SetBucketPolicyRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SetBucketPolicyRequest) UnmarshalBinary(b []byte) error { var res SetBucketPolicyRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/set_bucket_quota.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SetBucketQuota set bucket quota // // swagger:model setBucketQuota type SetBucketQuota struct { // amount Amount int64 `json:"amount,omitempty"` // enabled // Required: true Enabled *bool `json:"enabled"` // quota type // Enum: ["hard"] QuotaType string `json:"quota_type,omitempty"` } // Validate validates this set bucket quota func (m *SetBucketQuota) Validate(formats strfmt.Registry) error { var res []error if err := m.validateEnabled(formats); err != nil { res = append(res, err) } if err := m.validateQuotaType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetBucketQuota) validateEnabled(formats strfmt.Registry) error { if err := validate.Required("enabled", "body", m.Enabled); err != nil { return err } return nil } var setBucketQuotaTypeQuotaTypePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["hard"]`), &res); err != nil { panic(err) } for _, v := range res { setBucketQuotaTypeQuotaTypePropEnum = append(setBucketQuotaTypeQuotaTypePropEnum, v) } } const ( // SetBucketQuotaQuotaTypeHard captures enum value "hard" SetBucketQuotaQuotaTypeHard string = "hard" ) // prop value enum func (m *SetBucketQuota) validateQuotaTypeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, setBucketQuotaTypeQuotaTypePropEnum, true); err != nil { return err } return nil } func (m *SetBucketQuota) validateQuotaType(formats strfmt.Registry) error { if swag.IsZero(m.QuotaType) { // not required return nil } // value enum if err := m.validateQuotaTypeEnum("quota_type", "body", m.QuotaType); err != nil { return err } return nil } // ContextValidate validates this set bucket quota based on context it is used func (m *SetBucketQuota) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *SetBucketQuota) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SetBucketQuota) UnmarshalBinary(b []byte) error { var res SetBucketQuota if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/set_bucket_versioning.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SetBucketVersioning set bucket versioning // // swagger:model setBucketVersioning type SetBucketVersioning struct { // enabled Enabled bool `json:"enabled,omitempty"` // exclude folders ExcludeFolders bool `json:"excludeFolders,omitempty"` // exclude prefixes ExcludePrefixes []string `json:"excludePrefixes"` } // Validate validates this set bucket versioning func (m *SetBucketVersioning) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this set bucket versioning based on context it is used func (m *SetBucketVersioning) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *SetBucketVersioning) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SetBucketVersioning) UnmarshalBinary(b []byte) error { var res SetBucketVersioning if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/set_config_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SetConfigRequest set config request // // swagger:model setConfigRequest type SetConfigRequest struct { // Used if configuration is an event notification's target ArnResourceID string `json:"arn_resource_id,omitempty"` // key values // Required: true // Min Items: 1 KeyValues []*ConfigurationKV `json:"key_values"` } // Validate validates this set config request func (m *SetConfigRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateKeyValues(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetConfigRequest) validateKeyValues(formats strfmt.Registry) error { if err := validate.Required("key_values", "body", m.KeyValues); err != nil { return err } iKeyValuesSize := int64(len(m.KeyValues)) if err := validate.MinItems("key_values", "body", iKeyValuesSize, 1); err != nil { return err } for i := 0; i < len(m.KeyValues); i++ { if swag.IsZero(m.KeyValues[i]) { // not required continue } if m.KeyValues[i] != nil { if err := m.KeyValues[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("key_values" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("key_values" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this set config request based on the context it is used func (m *SetConfigRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateKeyValues(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetConfigRequest) contextValidateKeyValues(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.KeyValues); i++ { if m.KeyValues[i] != nil { if swag.IsZero(m.KeyValues[i]) { // not required return nil } if err := m.KeyValues[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("key_values" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("key_values" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *SetConfigRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SetConfigRequest) UnmarshalBinary(b []byte) error { var res SetConfigRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/set_config_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SetConfigResponse set config response // // swagger:model setConfigResponse type SetConfigResponse struct { // Returns wheter server needs to restart to apply changes or not Restart bool `json:"restart,omitempty"` } // Validate validates this set config response func (m *SetConfigResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this set config response based on context it is used func (m *SetConfigResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *SetConfigResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SetConfigResponse) UnmarshalBinary(b []byte) error { var res SetConfigResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/set_id_p_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SetIDPResponse set ID p response // // swagger:model setIDPResponse type SetIDPResponse struct { // restart Restart bool `json:"restart,omitempty"` } // Validate validates this set ID p response func (m *SetIDPResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this set ID p response based on context it is used func (m *SetIDPResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *SetIDPResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SetIDPResponse) UnmarshalBinary(b []byte) error { var res SetIDPResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/set_notification_endpoint_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SetNotificationEndpointResponse set notification endpoint response // // swagger:model setNotificationEndpointResponse type SetNotificationEndpointResponse struct { // account id // Required: true AccountID *string `json:"account_id"` // properties // Required: true Properties map[string]string `json:"properties"` // restart Restart bool `json:"restart,omitempty"` // service // Required: true Service *NofiticationService `json:"service"` } // Validate validates this set notification endpoint response func (m *SetNotificationEndpointResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAccountID(formats); err != nil { res = append(res, err) } if err := m.validateProperties(formats); err != nil { res = append(res, err) } if err := m.validateService(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetNotificationEndpointResponse) validateAccountID(formats strfmt.Registry) error { if err := validate.Required("account_id", "body", m.AccountID); err != nil { return err } return nil } func (m *SetNotificationEndpointResponse) validateProperties(formats strfmt.Registry) error { if err := validate.Required("properties", "body", m.Properties); err != nil { return err } return nil } func (m *SetNotificationEndpointResponse) validateService(formats strfmt.Registry) error { if err := validate.Required("service", "body", m.Service); err != nil { return err } if m.Service != nil { if err := m.Service.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("service") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("service") } return err } } return nil } // ContextValidate validate this set notification endpoint response based on the context it is used func (m *SetNotificationEndpointResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateService(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetNotificationEndpointResponse) contextValidateService(ctx context.Context, formats strfmt.Registry) error { if m.Service != nil { if err := m.Service.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("service") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("service") } return err } } return nil } // MarshalBinary interface implementation func (m *SetNotificationEndpointResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SetNotificationEndpointResponse) UnmarshalBinary(b []byte) error { var res SetNotificationEndpointResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/set_policy_multiple_name_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SetPolicyMultipleNameRequest set policy multiple name request // // swagger:model setPolicyMultipleNameRequest type SetPolicyMultipleNameRequest struct { // groups Groups []IamEntity `json:"groups"` // name Name []string `json:"name"` // users Users []IamEntity `json:"users"` } // Validate validates this set policy multiple name request func (m *SetPolicyMultipleNameRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateGroups(formats); err != nil { res = append(res, err) } if err := m.validateUsers(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetPolicyMultipleNameRequest) validateGroups(formats strfmt.Registry) error { if swag.IsZero(m.Groups) { // not required return nil } for i := 0; i < len(m.Groups); i++ { if err := m.Groups[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("groups" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("groups" + "." + strconv.Itoa(i)) } return err } } return nil } func (m *SetPolicyMultipleNameRequest) validateUsers(formats strfmt.Registry) error { if swag.IsZero(m.Users) { // not required return nil } for i := 0; i < len(m.Users); i++ { if err := m.Users[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("users" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("users" + "." + strconv.Itoa(i)) } return err } } return nil } // ContextValidate validate this set policy multiple name request based on the context it is used func (m *SetPolicyMultipleNameRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateGroups(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateUsers(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetPolicyMultipleNameRequest) contextValidateGroups(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Groups); i++ { if swag.IsZero(m.Groups[i]) { // not required return nil } if err := m.Groups[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("groups" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("groups" + "." + strconv.Itoa(i)) } return err } } return nil } func (m *SetPolicyMultipleNameRequest) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Users); i++ { if swag.IsZero(m.Users[i]) { // not required return nil } if err := m.Users[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("users" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("users" + "." + strconv.Itoa(i)) } return err } } return nil } // MarshalBinary interface implementation func (m *SetPolicyMultipleNameRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SetPolicyMultipleNameRequest) UnmarshalBinary(b []byte) error { var res SetPolicyMultipleNameRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/set_policy_name_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SetPolicyNameRequest set policy name request // // swagger:model setPolicyNameRequest type SetPolicyNameRequest struct { // entity name // Required: true EntityName *string `json:"entityName"` // entity type // Required: true EntityType *PolicyEntity `json:"entityType"` // name // Required: true Name []string `json:"name"` } // Validate validates this set policy name request func (m *SetPolicyNameRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateEntityName(formats); err != nil { res = append(res, err) } if err := m.validateEntityType(formats); err != nil { res = append(res, err) } if err := m.validateName(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetPolicyNameRequest) validateEntityName(formats strfmt.Registry) error { if err := validate.Required("entityName", "body", m.EntityName); err != nil { return err } return nil } func (m *SetPolicyNameRequest) validateEntityType(formats strfmt.Registry) error { if err := validate.Required("entityType", "body", m.EntityType); err != nil { return err } if m.EntityType != nil { if err := m.EntityType.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("entityType") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("entityType") } return err } } return nil } func (m *SetPolicyNameRequest) validateName(formats strfmt.Registry) error { if err := validate.Required("name", "body", m.Name); err != nil { return err } return nil } // ContextValidate validate this set policy name request based on the context it is used func (m *SetPolicyNameRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateEntityType(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetPolicyNameRequest) contextValidateEntityType(ctx context.Context, formats strfmt.Registry) error { if m.EntityType != nil { if err := m.EntityType.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("entityType") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("entityType") } return err } } return nil } // MarshalBinary interface implementation func (m *SetPolicyNameRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SetPolicyNameRequest) UnmarshalBinary(b []byte) error { var res SetPolicyNameRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/set_policy_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SetPolicyRequest set policy request // // swagger:model setPolicyRequest type SetPolicyRequest struct { // entity name // Required: true EntityName *string `json:"entityName"` // entity type // Required: true EntityType *PolicyEntity `json:"entityType"` } // Validate validates this set policy request func (m *SetPolicyRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateEntityName(formats); err != nil { res = append(res, err) } if err := m.validateEntityType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetPolicyRequest) validateEntityName(formats strfmt.Registry) error { if err := validate.Required("entityName", "body", m.EntityName); err != nil { return err } return nil } func (m *SetPolicyRequest) validateEntityType(formats strfmt.Registry) error { if err := validate.Required("entityType", "body", m.EntityType); err != nil { return err } if m.EntityType != nil { if err := m.EntityType.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("entityType") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("entityType") } return err } } return nil } // ContextValidate validate this set policy request based on the context it is used func (m *SetPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateEntityType(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SetPolicyRequest) contextValidateEntityType(ctx context.Context, formats strfmt.Registry) error { if m.EntityType != nil { if err := m.EntityType.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("entityType") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("entityType") } return err } } return nil } // MarshalBinary interface implementation func (m *SetPolicyRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SetPolicyRequest) UnmarshalBinary(b []byte) error { var res SetPolicyRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/site_replication_add_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SiteReplicationAddRequest site replication add request // // swagger:model siteReplicationAddRequest type SiteReplicationAddRequest []*PeerSite // Validate validates this site replication add request func (m SiteReplicationAddRequest) 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 { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName(strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName(strconv.Itoa(i)) } return err } } } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // ContextValidate validate this site replication add request based on the context it is used func (m SiteReplicationAddRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error for i := 0; i < len(m); i++ { if m[i] != nil { if swag.IsZero(m[i]) { // not required return nil } if err := m[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName(strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName(strconv.Itoa(i)) } return err } } } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } ================================================ FILE: models/site_replication_add_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SiteReplicationAddResponse site replication add response // // swagger:model siteReplicationAddResponse type SiteReplicationAddResponse struct { // error detail ErrorDetail string `json:"errorDetail,omitempty"` // initial sync error message InitialSyncErrorMessage string `json:"initialSyncErrorMessage,omitempty"` // status Status string `json:"status,omitempty"` // success Success bool `json:"success,omitempty"` } // Validate validates this site replication add response func (m *SiteReplicationAddResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this site replication add response based on context it is used func (m *SiteReplicationAddResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *SiteReplicationAddResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SiteReplicationAddResponse) UnmarshalBinary(b []byte) error { var res SiteReplicationAddResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/site_replication_info_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SiteReplicationInfoResponse site replication info response // // swagger:model siteReplicationInfoResponse type SiteReplicationInfoResponse struct { // enabled Enabled bool `json:"enabled,omitempty"` // name Name string `json:"name,omitempty"` // service account access key ServiceAccountAccessKey string `json:"serviceAccountAccessKey,omitempty"` // sites Sites []*PeerInfo `json:"sites"` } // Validate validates this site replication info response func (m *SiteReplicationInfoResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateSites(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SiteReplicationInfoResponse) validateSites(formats strfmt.Registry) error { if swag.IsZero(m.Sites) { // not required return nil } for i := 0; i < len(m.Sites); i++ { if swag.IsZero(m.Sites[i]) { // not required continue } if m.Sites[i] != nil { if err := m.Sites[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("sites" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("sites" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this site replication info response based on the context it is used func (m *SiteReplicationInfoResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateSites(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *SiteReplicationInfoResponse) contextValidateSites(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Sites); i++ { if m.Sites[i] != nil { if swag.IsZero(m.Sites[i]) { // not required return nil } if err := m.Sites[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("sites" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("sites" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *SiteReplicationInfoResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SiteReplicationInfoResponse) UnmarshalBinary(b []byte) error { var res SiteReplicationInfoResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/site_replication_status_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SiteReplicationStatusResponse site replication status response // // swagger:model siteReplicationStatusResponse type SiteReplicationStatusResponse struct { // bucket stats BucketStats any `json:"bucketStats,omitempty"` // enabled Enabled bool `json:"enabled,omitempty"` // group stats GroupStats any `json:"groupStats,omitempty"` // max buckets MaxBuckets int64 `json:"maxBuckets,omitempty"` // max groups MaxGroups int64 `json:"maxGroups,omitempty"` // max policies MaxPolicies int64 `json:"maxPolicies,omitempty"` // max users MaxUsers int64 `json:"maxUsers,omitempty"` // policy stats PolicyStats any `json:"policyStats,omitempty"` // sites Sites any `json:"sites,omitempty"` // stats summary StatsSummary any `json:"statsSummary,omitempty"` // user stats UserStats any `json:"userStats,omitempty"` } // Validate validates this site replication status response func (m *SiteReplicationStatusResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this site replication status response based on context it is used func (m *SiteReplicationStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *SiteReplicationStatusResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *SiteReplicationStatusResponse) UnmarshalBinary(b []byte) error { var res SiteReplicationStatusResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/start_profiling_item.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // StartProfilingItem start profiling item // // swagger:model startProfilingItem type StartProfilingItem struct { // error Error string `json:"error,omitempty"` // node name NodeName string `json:"nodeName,omitempty"` // success Success bool `json:"success,omitempty"` } // Validate validates this start profiling item func (m *StartProfilingItem) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this start profiling item based on context it is used func (m *StartProfilingItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *StartProfilingItem) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *StartProfilingItem) UnmarshalBinary(b []byte) error { var res StartProfilingItem if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/start_profiling_list.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // StartProfilingList start profiling list // // swagger:model startProfilingList type StartProfilingList struct { // start results StartResults []*StartProfilingItem `json:"startResults"` // number of start results Total int64 `json:"total,omitempty"` } // Validate validates this start profiling list func (m *StartProfilingList) Validate(formats strfmt.Registry) error { var res []error if err := m.validateStartResults(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *StartProfilingList) validateStartResults(formats strfmt.Registry) error { if swag.IsZero(m.StartResults) { // not required return nil } for i := 0; i < len(m.StartResults); i++ { if swag.IsZero(m.StartResults[i]) { // not required continue } if m.StartResults[i] != nil { if err := m.StartResults[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("startResults" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("startResults" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this start profiling list based on the context it is used func (m *StartProfilingList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateStartResults(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *StartProfilingList) contextValidateStartResults(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.StartResults); i++ { if m.StartResults[i] != nil { if swag.IsZero(m.StartResults[i]) { // not required return nil } if err := m.StartResults[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("startResults" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("startResults" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *StartProfilingList) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *StartProfilingList) UnmarshalBinary(b []byte) error { var res StartProfilingList if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/tier.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" stderrors "errors" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Tier tier // // swagger:model tier type Tier struct { // azure Azure *TierAzure `json:"azure,omitempty"` // gcs Gcs *TierGcs `json:"gcs,omitempty"` // minio Minio *TierMinio `json:"minio,omitempty"` // s3 S3 *TierS3 `json:"s3,omitempty"` // status Status bool `json:"status,omitempty"` // type // Enum: ["s3","gcs","azure","minio","unsupported"] Type string `json:"type,omitempty"` } // Validate validates this tier func (m *Tier) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAzure(formats); err != nil { res = append(res, err) } if err := m.validateGcs(formats); err != nil { res = append(res, err) } if err := m.validateMinio(formats); err != nil { res = append(res, err) } if err := m.validateS3(formats); err != nil { res = append(res, err) } if err := m.validateType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Tier) 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 { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("azure") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("azure") } return err } } return nil } func (m *Tier) validateGcs(formats strfmt.Registry) error { if swag.IsZero(m.Gcs) { // not required return nil } if m.Gcs != nil { if err := m.Gcs.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("gcs") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("gcs") } return err } } return nil } func (m *Tier) validateMinio(formats strfmt.Registry) error { if swag.IsZero(m.Minio) { // not required return nil } if m.Minio != nil { if err := m.Minio.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("minio") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("minio") } return err } } return nil } func (m *Tier) validateS3(formats strfmt.Registry) error { if swag.IsZero(m.S3) { // not required return nil } if m.S3 != nil { if err := m.S3.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("s3") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("s3") } return err } } return nil } var tierTypeTypePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["s3","gcs","azure","minio","unsupported"]`), &res); err != nil { panic(err) } for _, v := range res { tierTypeTypePropEnum = append(tierTypeTypePropEnum, v) } } const ( // TierTypeS3 captures enum value "s3" TierTypeS3 string = "s3" // TierTypeGcs captures enum value "gcs" TierTypeGcs string = "gcs" // TierTypeAzure captures enum value "azure" TierTypeAzure string = "azure" // TierTypeMinio captures enum value "minio" TierTypeMinio string = "minio" // TierTypeUnsupported captures enum value "unsupported" TierTypeUnsupported string = "unsupported" ) // prop value enum func (m *Tier) validateTypeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, tierTypeTypePropEnum, true); err != nil { return err } return nil } func (m *Tier) validateType(formats strfmt.Registry) error { if swag.IsZero(m.Type) { // not required return nil } // value enum if err := m.validateTypeEnum("type", "body", m.Type); err != nil { return err } return nil } // ContextValidate validate this tier based on the context it is used func (m *Tier) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateAzure(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateGcs(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateMinio(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateS3(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Tier) contextValidateAzure(ctx context.Context, formats strfmt.Registry) error { if m.Azure != nil { if swag.IsZero(m.Azure) { // not required return nil } if err := m.Azure.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("azure") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("azure") } return err } } return nil } func (m *Tier) contextValidateGcs(ctx context.Context, formats strfmt.Registry) error { if m.Gcs != nil { if swag.IsZero(m.Gcs) { // not required return nil } if err := m.Gcs.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("gcs") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("gcs") } return err } } return nil } func (m *Tier) contextValidateMinio(ctx context.Context, formats strfmt.Registry) error { if m.Minio != nil { if swag.IsZero(m.Minio) { // not required return nil } if err := m.Minio.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("minio") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("minio") } return err } } return nil } func (m *Tier) contextValidateS3(ctx context.Context, formats strfmt.Registry) error { if m.S3 != nil { if swag.IsZero(m.S3) { // not required return nil } if err := m.S3.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("s3") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("s3") } return err } } return nil } // MarshalBinary interface implementation func (m *Tier) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Tier) UnmarshalBinary(b []byte) error { var res Tier if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/tier_azure.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // TierAzure tier azure // // swagger:model tier_azure type TierAzure struct { // accountkey Accountkey string `json:"accountkey,omitempty"` // accountname Accountname string `json:"accountname,omitempty"` // bucket Bucket string `json:"bucket,omitempty"` // endpoint Endpoint string `json:"endpoint,omitempty"` // name Name string `json:"name,omitempty"` // objects Objects string `json:"objects,omitempty"` // prefix Prefix string `json:"prefix,omitempty"` // region Region string `json:"region,omitempty"` // usage Usage string `json:"usage,omitempty"` // versions Versions string `json:"versions,omitempty"` } // Validate validates this tier azure func (m *TierAzure) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this tier azure based on context it is used func (m *TierAzure) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *TierAzure) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *TierAzure) UnmarshalBinary(b []byte) error { var res TierAzure if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/tier_credentials_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // TierCredentialsRequest tier credentials request // // swagger:model tierCredentialsRequest type TierCredentialsRequest struct { // access key AccessKey string `json:"access_key,omitempty"` // a base64 encoded value Creds string `json:"creds,omitempty"` // secret key SecretKey string `json:"secret_key,omitempty"` } // Validate validates this tier credentials request func (m *TierCredentialsRequest) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this tier credentials request based on context it is used func (m *TierCredentialsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *TierCredentialsRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *TierCredentialsRequest) UnmarshalBinary(b []byte) error { var res TierCredentialsRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/tier_gcs.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // TierGcs tier gcs // // swagger:model tier_gcs type TierGcs struct { // bucket Bucket string `json:"bucket,omitempty"` // creds Creds string `json:"creds,omitempty"` // endpoint Endpoint string `json:"endpoint,omitempty"` // name Name string `json:"name,omitempty"` // objects Objects string `json:"objects,omitempty"` // prefix Prefix string `json:"prefix,omitempty"` // region Region string `json:"region,omitempty"` // usage Usage string `json:"usage,omitempty"` // versions Versions string `json:"versions,omitempty"` } // Validate validates this tier gcs func (m *TierGcs) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this tier gcs based on context it is used func (m *TierGcs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *TierGcs) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *TierGcs) UnmarshalBinary(b []byte) error { var res TierGcs if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/tier_list_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // TierListResponse tier list response // // swagger:model tierListResponse type TierListResponse struct { // items Items []*Tier `json:"items"` } // Validate validates this tier list response func (m *TierListResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateItems(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *TierListResponse) validateItems(formats strfmt.Registry) error { if swag.IsZero(m.Items) { // not required return nil } for i := 0; i < len(m.Items); i++ { if swag.IsZero(m.Items[i]) { // not required continue } if m.Items[i] != nil { if err := m.Items[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("items" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("items" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this tier list response based on the context it is used func (m *TierListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateItems(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *TierListResponse) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Items); i++ { if m.Items[i] != nil { if swag.IsZero(m.Items[i]) { // not required return nil } if err := m.Items[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("items" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("items" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *TierListResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *TierListResponse) UnmarshalBinary(b []byte) error { var res TierListResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/tier_minio.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // TierMinio tier minio // // swagger:model tier_minio type TierMinio struct { // accesskey Accesskey string `json:"accesskey,omitempty"` // bucket Bucket string `json:"bucket,omitempty"` // endpoint Endpoint string `json:"endpoint,omitempty"` // name Name string `json:"name,omitempty"` // objects Objects string `json:"objects,omitempty"` // prefix Prefix string `json:"prefix,omitempty"` // region Region string `json:"region,omitempty"` // secretkey Secretkey string `json:"secretkey,omitempty"` // storageclass Storageclass string `json:"storageclass,omitempty"` // usage Usage string `json:"usage,omitempty"` // versions Versions string `json:"versions,omitempty"` } // Validate validates this tier minio func (m *TierMinio) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this tier minio based on context it is used func (m *TierMinio) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *TierMinio) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *TierMinio) UnmarshalBinary(b []byte) error { var res TierMinio if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/tier_s3.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // TierS3 tier s3 // // swagger:model tier_s3 type TierS3 struct { // accesskey Accesskey string `json:"accesskey,omitempty"` // bucket Bucket string `json:"bucket,omitempty"` // endpoint Endpoint string `json:"endpoint,omitempty"` // name Name string `json:"name,omitempty"` // objects Objects string `json:"objects,omitempty"` // prefix Prefix string `json:"prefix,omitempty"` // region Region string `json:"region,omitempty"` // secretkey Secretkey string `json:"secretkey,omitempty"` // storageclass Storageclass string `json:"storageclass,omitempty"` // usage Usage string `json:"usage,omitempty"` // versions Versions string `json:"versions,omitempty"` } // Validate validates this tier s3 func (m *TierS3) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this tier s3 based on context it is used func (m *TierS3) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *TierS3) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *TierS3) UnmarshalBinary(b []byte) error { var res TierS3 if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/tiers_name_list_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // TiersNameListResponse tiers name list response // // swagger:model tiersNameListResponse type TiersNameListResponse struct { // items Items []string `json:"items"` } // Validate validates this tiers name list response func (m *TiersNameListResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this tiers name list response based on context it is used func (m *TiersNameListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *TiersNameListResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *TiersNameListResponse) UnmarshalBinary(b []byte) error { var res TiersNameListResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/transition_response.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // TransitionResponse transition response // // swagger:model transitionResponse type TransitionResponse struct { // date Date string `json:"date,omitempty"` // days Days int64 `json:"days,omitempty"` // noncurrent storage class NoncurrentStorageClass string `json:"noncurrent_storage_class,omitempty"` // noncurrent transition days NoncurrentTransitionDays int64 `json:"noncurrent_transition_days,omitempty"` // storage class StorageClass string `json:"storage_class,omitempty"` } // Validate validates this transition response func (m *TransitionResponse) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this transition response based on context it is used func (m *TransitionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *TransitionResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *TransitionResponse) UnmarshalBinary(b []byte) error { var res TransitionResponse if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/update_bucket_lifecycle.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // UpdateBucketLifecycle update bucket lifecycle // // swagger:model updateBucketLifecycle type UpdateBucketLifecycle struct { // Non required, toggle to disable or enable rule Disable bool `json:"disable,omitempty"` // Non required, toggle to disable or enable rule ExpiredObjectDeleteAll bool `json:"expired_object_delete_all,omitempty"` // Non required, toggle to disable or enable rule ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"` // Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM ExpiryDays int32 `json:"expiry_days,omitempty"` // Non required, can be set in case of expiration is enabled NoncurrentversionExpirationDays int32 `json:"noncurrentversion_expiration_days,omitempty"` // Non required, can be set in case of transition is enabled NoncurrentversionTransitionDays int32 `json:"noncurrentversion_transition_days,omitempty"` // Non required, can be set in case of transition is enabled NoncurrentversionTransitionStorageClass string `json:"noncurrentversion_transition_storage_class,omitempty"` // Non required field, it matches a prefix to perform ILM operations on it Prefix string `json:"prefix,omitempty"` // Required only in case of transition is set. it refers to a tier StorageClass string `json:"storage_class,omitempty"` // Non required field, tags to match ILM files Tags string `json:"tags,omitempty"` // Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM TransitionDays int32 `json:"transition_days,omitempty"` // ILM Rule type (Expiry or transition) // Required: true // Enum: ["expiry","transition"] Type *string `json:"type"` } // Validate validates this update bucket lifecycle func (m *UpdateBucketLifecycle) Validate(formats strfmt.Registry) error { var res []error if err := m.validateType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } var updateBucketLifecycleTypeTypePropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil { panic(err) } for _, v := range res { updateBucketLifecycleTypeTypePropEnum = append(updateBucketLifecycleTypeTypePropEnum, v) } } const ( // UpdateBucketLifecycleTypeExpiry captures enum value "expiry" UpdateBucketLifecycleTypeExpiry string = "expiry" // UpdateBucketLifecycleTypeTransition captures enum value "transition" UpdateBucketLifecycleTypeTransition string = "transition" ) // prop value enum func (m *UpdateBucketLifecycle) validateTypeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, updateBucketLifecycleTypeTypePropEnum, true); err != nil { return err } return nil } func (m *UpdateBucketLifecycle) validateType(formats strfmt.Registry) error { if err := validate.Required("type", "body", m.Type); err != nil { return err } // value enum if err := m.validateTypeEnum("type", "body", *m.Type); err != nil { return err } return nil } // ContextValidate validates this update bucket lifecycle based on context it is used func (m *UpdateBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *UpdateBucketLifecycle) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *UpdateBucketLifecycle) UnmarshalBinary(b []byte) error { var res UpdateBucketLifecycle if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/update_group_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // UpdateGroupRequest update group request // // swagger:model updateGroupRequest type UpdateGroupRequest struct { // members // Required: true Members []string `json:"members"` // status // Required: true Status *string `json:"status"` } // Validate validates this update group request func (m *UpdateGroupRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validateMembers(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 *UpdateGroupRequest) validateMembers(formats strfmt.Registry) error { if err := validate.Required("members", "body", m.Members); err != nil { return err } return nil } func (m *UpdateGroupRequest) validateStatus(formats strfmt.Registry) error { if err := validate.Required("status", "body", m.Status); err != nil { return err } return nil } // ContextValidate validates this update group request based on context it is used func (m *UpdateGroupRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *UpdateGroupRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *UpdateGroupRequest) UnmarshalBinary(b []byte) error { var res UpdateGroupRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/update_service_account_request.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // UpdateServiceAccountRequest update service account request // // swagger:model updateServiceAccountRequest type UpdateServiceAccountRequest struct { // description Description string `json:"description,omitempty"` // expiry Expiry string `json:"expiry,omitempty"` // name Name string `json:"name,omitempty"` // policy // Required: true Policy *string `json:"policy"` // secret key SecretKey string `json:"secretKey,omitempty"` // status Status string `json:"status,omitempty"` } // Validate validates this update service account request func (m *UpdateServiceAccountRequest) Validate(formats strfmt.Registry) error { var res []error if err := m.validatePolicy(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *UpdateServiceAccountRequest) validatePolicy(formats strfmt.Registry) error { if err := validate.Required("policy", "body", m.Policy); err != nil { return err } return nil } // ContextValidate validates this update service account request based on context it is used func (m *UpdateServiceAccountRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *UpdateServiceAccountRequest) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *UpdateServiceAccountRequest) UnmarshalBinary(b []byte) error { var res UpdateServiceAccountRequest if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/update_user.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // UpdateUser update user // // swagger:model updateUser type UpdateUser struct { // groups // Required: true Groups []string `json:"groups"` // status // Required: true Status *string `json:"status"` } // Validate validates this update user func (m *UpdateUser) Validate(formats strfmt.Registry) error { var res []error if err := m.validateGroups(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 *UpdateUser) validateGroups(formats strfmt.Registry) error { if err := validate.Required("groups", "body", m.Groups); err != nil { return err } return nil } func (m *UpdateUser) validateStatus(formats strfmt.Registry) error { if err := validate.Required("status", "body", m.Status); err != nil { return err } return nil } // ContextValidate validates this update user based on context it is used func (m *UpdateUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *UpdateUser) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *UpdateUser) UnmarshalBinary(b []byte) error { var res UpdateUser if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/update_user_groups.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // UpdateUserGroups update user groups // // swagger:model updateUserGroups type UpdateUserGroups struct { // groups // Required: true Groups []string `json:"groups"` } // Validate validates this update user groups func (m *UpdateUserGroups) Validate(formats strfmt.Registry) error { var res []error if err := m.validateGroups(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *UpdateUserGroups) validateGroups(formats strfmt.Registry) error { if err := validate.Required("groups", "body", m.Groups); err != nil { return err } return nil } // ContextValidate validates this update user groups based on context it is used func (m *UpdateUserGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *UpdateUserGroups) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *UpdateUserGroups) UnmarshalBinary(b []byte) error { var res UpdateUserGroups if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/user.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // User user // // swagger:model user type User struct { // access key AccessKey string `json:"accessKey,omitempty"` // has policy HasPolicy bool `json:"hasPolicy,omitempty"` // member of MemberOf []string `json:"memberOf"` // policy Policy []string `json:"policy"` // status Status string `json:"status,omitempty"` } // Validate validates this user func (m *User) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this user based on context it is used func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *User) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *User) UnmarshalBinary(b []byte) error { var res User if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/user_s_as.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // UserSAs user s as // // swagger:model userSAs type UserSAs struct { // path Path string `json:"path,omitempty"` // recursive Recursive bool `json:"recursive,omitempty"` // version ID VersionID string `json:"versionID,omitempty"` } // Validate validates this user s as func (m *UserSAs) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this user s as based on context it is used func (m *UserSAs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *UserSAs) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *UserSAs) UnmarshalBinary(b []byte) error { var res UserSAs if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/user_service_account_item.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // UserServiceAccountItem user service account item // // swagger:model userServiceAccountItem type UserServiceAccountItem struct { // num s as NumSAs int64 `json:"numSAs,omitempty"` // user name UserName string `json:"userName,omitempty"` } // Validate validates this user service account item func (m *UserServiceAccountItem) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this user service account item based on context it is used func (m *UserServiceAccountItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *UserServiceAccountItem) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *UserServiceAccountItem) UnmarshalBinary(b []byte) error { var res UserServiceAccountItem if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/user_service_account_summary.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // UserServiceAccountSummary user service account summary // // swagger:model userServiceAccountSummary type UserServiceAccountSummary struct { // has s a HasSA bool `json:"hasSA,omitempty"` // list of users with number of service accounts UserServiceAccountList []*UserServiceAccountItem `json:"userServiceAccountList"` } // Validate validates this user service account summary func (m *UserServiceAccountSummary) Validate(formats strfmt.Registry) error { var res []error if err := m.validateUserServiceAccountList(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *UserServiceAccountSummary) validateUserServiceAccountList(formats strfmt.Registry) error { if swag.IsZero(m.UserServiceAccountList) { // not required return nil } for i := 0; i < len(m.UserServiceAccountList); i++ { if swag.IsZero(m.UserServiceAccountList[i]) { // not required continue } if m.UserServiceAccountList[i] != nil { if err := m.UserServiceAccountList[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("userServiceAccountList" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("userServiceAccountList" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this user service account summary based on the context it is used func (m *UserServiceAccountSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateUserServiceAccountList(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *UserServiceAccountSummary) contextValidateUserServiceAccountList(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.UserServiceAccountList); i++ { if m.UserServiceAccountList[i] != nil { if swag.IsZero(m.UserServiceAccountList[i]) { // not required return nil } if err := m.UserServiceAccountList[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("userServiceAccountList" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("userServiceAccountList" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *UserServiceAccountSummary) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *UserServiceAccountSummary) UnmarshalBinary(b []byte) error { var res UserServiceAccountSummary if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/widget.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Widget widget // // swagger:model widget type Widget struct { // id ID int32 `json:"id,omitempty"` // options Options *WidgetOptions `json:"options,omitempty"` // targets Targets []*ResultTarget `json:"targets"` // title Title string `json:"title,omitempty"` // type Type string `json:"type,omitempty"` } // Validate validates this widget func (m *Widget) Validate(formats strfmt.Registry) error { var res []error if err := m.validateOptions(formats); err != nil { res = append(res, err) } if err := m.validateTargets(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Widget) validateOptions(formats strfmt.Registry) error { if swag.IsZero(m.Options) { // not required return nil } if m.Options != nil { if err := m.Options.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("options") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("options") } return err } } return nil } func (m *Widget) validateTargets(formats strfmt.Registry) error { if swag.IsZero(m.Targets) { // not required return nil } for i := 0; i < len(m.Targets); i++ { if swag.IsZero(m.Targets[i]) { // not required continue } if m.Targets[i] != nil { if err := m.Targets[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("targets" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("targets" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this widget based on the context it is used func (m *Widget) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateOptions(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateTargets(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Widget) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { if m.Options != nil { if swag.IsZero(m.Options) { // not required return nil } if err := m.Options.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("options") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("options") } return err } } return nil } func (m *Widget) contextValidateTargets(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Targets); i++ { if m.Targets[i] != nil { if swag.IsZero(m.Targets[i]) { // not required return nil } if err := m.Targets[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("targets" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("targets" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *Widget) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Widget) UnmarshalBinary(b []byte) error { var res Widget if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // WidgetOptions widget options // // swagger:model WidgetOptions type WidgetOptions struct { // reduce options ReduceOptions *WidgetOptionsReduceOptions `json:"reduceOptions,omitempty"` } // Validate validates this widget options func (m *WidgetOptions) Validate(formats strfmt.Registry) error { var res []error if err := m.validateReduceOptions(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *WidgetOptions) validateReduceOptions(formats strfmt.Registry) error { if swag.IsZero(m.ReduceOptions) { // not required return nil } if m.ReduceOptions != nil { if err := m.ReduceOptions.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("options" + "." + "reduceOptions") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("options" + "." + "reduceOptions") } return err } } return nil } // ContextValidate validate this widget options based on the context it is used func (m *WidgetOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateReduceOptions(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *WidgetOptions) contextValidateReduceOptions(ctx context.Context, formats strfmt.Registry) error { if m.ReduceOptions != nil { if swag.IsZero(m.ReduceOptions) { // not required return nil } if err := m.ReduceOptions.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("options" + "." + "reduceOptions") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("options" + "." + "reduceOptions") } return err } } return nil } // MarshalBinary interface implementation func (m *WidgetOptions) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *WidgetOptions) UnmarshalBinary(b []byte) error { var res WidgetOptions if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // WidgetOptionsReduceOptions widget options reduce options // // swagger:model WidgetOptionsReduceOptions type WidgetOptionsReduceOptions struct { // calcs Calcs []string `json:"calcs"` } // Validate validates this widget options reduce options func (m *WidgetOptionsReduceOptions) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this widget options reduce options based on context it is used func (m *WidgetOptionsReduceOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *WidgetOptionsReduceOptions) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *WidgetOptionsReduceOptions) UnmarshalBinary(b []byte) error { var res WidgetOptionsReduceOptions if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/widget_details.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" stderrors "errors" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // WidgetDetails widget details // // swagger:model widgetDetails type WidgetDetails struct { // id ID int32 `json:"id,omitempty"` // options Options *WidgetDetailsOptions `json:"options,omitempty"` // targets Targets []*ResultTarget `json:"targets"` // title Title string `json:"title,omitempty"` // type Type string `json:"type,omitempty"` } // Validate validates this widget details func (m *WidgetDetails) Validate(formats strfmt.Registry) error { var res []error if err := m.validateOptions(formats); err != nil { res = append(res, err) } if err := m.validateTargets(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *WidgetDetails) validateOptions(formats strfmt.Registry) error { if swag.IsZero(m.Options) { // not required return nil } if m.Options != nil { if err := m.Options.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("options") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("options") } return err } } return nil } func (m *WidgetDetails) validateTargets(formats strfmt.Registry) error { if swag.IsZero(m.Targets) { // not required return nil } for i := 0; i < len(m.Targets); i++ { if swag.IsZero(m.Targets[i]) { // not required continue } if m.Targets[i] != nil { if err := m.Targets[i].Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("targets" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("targets" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this widget details based on the context it is used func (m *WidgetDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateOptions(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateTargets(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *WidgetDetails) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { if m.Options != nil { if swag.IsZero(m.Options) { // not required return nil } if err := m.Options.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("options") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("options") } return err } } return nil } func (m *WidgetDetails) contextValidateTargets(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Targets); i++ { if m.Targets[i] != nil { if swag.IsZero(m.Targets[i]) { // not required return nil } if err := m.Targets[i].ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("targets" + "." + strconv.Itoa(i)) } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("targets" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *WidgetDetails) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *WidgetDetails) UnmarshalBinary(b []byte) error { var res WidgetDetails if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // WidgetDetailsOptions widget details options // // swagger:model WidgetDetailsOptions type WidgetDetailsOptions struct { // reduce options ReduceOptions *WidgetDetailsOptionsReduceOptions `json:"reduceOptions,omitempty"` } // Validate validates this widget details options func (m *WidgetDetailsOptions) Validate(formats strfmt.Registry) error { var res []error if err := m.validateReduceOptions(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *WidgetDetailsOptions) validateReduceOptions(formats strfmt.Registry) error { if swag.IsZero(m.ReduceOptions) { // not required return nil } if m.ReduceOptions != nil { if err := m.ReduceOptions.Validate(formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("options" + "." + "reduceOptions") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("options" + "." + "reduceOptions") } return err } } return nil } // ContextValidate validate this widget details options based on the context it is used func (m *WidgetDetailsOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateReduceOptions(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *WidgetDetailsOptions) contextValidateReduceOptions(ctx context.Context, formats strfmt.Registry) error { if m.ReduceOptions != nil { if swag.IsZero(m.ReduceOptions) { // not required return nil } if err := m.ReduceOptions.ContextValidate(ctx, formats); err != nil { ve := new(errors.Validation) if stderrors.As(err, &ve) { return ve.ValidateName("options" + "." + "reduceOptions") } ce := new(errors.CompositeError) if stderrors.As(err, &ce) { return ce.ValidateName("options" + "." + "reduceOptions") } return err } } return nil } // MarshalBinary interface implementation func (m *WidgetDetailsOptions) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *WidgetDetailsOptions) UnmarshalBinary(b []byte) error { var res WidgetDetailsOptions if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // WidgetDetailsOptionsReduceOptions widget details options reduce options // // swagger:model WidgetDetailsOptionsReduceOptions type WidgetDetailsOptionsReduceOptions struct { // calcs Calcs []string `json:"calcs"` } // Validate validates this widget details options reduce options func (m *WidgetDetailsOptionsReduceOptions) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this widget details options reduce options based on context it is used func (m *WidgetDetailsOptionsReduceOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *WidgetDetailsOptionsReduceOptions) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *WidgetDetailsOptionsReduceOptions) UnmarshalBinary(b []byte) error { var res WidgetDetailsOptionsReduceOptions if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: models/widget_result.go ================================================ // Code generated by go-swagger; DO NOT EDIT. // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License 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 import ( "context" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // WidgetResult widget result // // swagger:model widgetResult type WidgetResult struct { // metric Metric map[string]string `json:"metric,omitempty"` // values Values []any `json:"values"` } // Validate validates this widget result func (m *WidgetResult) Validate(formats strfmt.Registry) error { return nil } // ContextValidate validates this widget result based on context it is used func (m *WidgetResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *WidgetResult) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *WidgetResult) UnmarshalBinary(b []byte) error { var res WidgetResult if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } ================================================ FILE: pkg/auth/idp/oauth2/config.go ================================================ // 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 oauth2 contains all the necessary configurations to initialize the // idp communication using oauth2 protocol package oauth2 import ( "crypto/sha1" "fmt" "net/http" "strings" "github.com/minio/console/pkg/auth/token" "github.com/minio/minio-go/v7/pkg/set" "github.com/minio/pkg/v3/env" "golang.org/x/crypto/pbkdf2" "golang.org/x/oauth2" xoauth2 "golang.org/x/oauth2" ) // ProviderConfig - OpenID IDP Configuration for console. type ProviderConfig struct { URL string DisplayName string // user-provided - can be empty ClientID, ClientSecret string HMACSalt, HMACPassphrase string Scopes string Userinfo bool RedirectCallbackDynamic bool RedirectCallback string EndSessionEndpoint string RoleArn string // can be empty } // GetOauth2Provider instantiates a new oauth2 client using the configured credentials // it returns a *Provider object that contains the necessary configuration to initiate an // oauth2 authentication flow. // // We only support Authentication with the Authorization Code Flow - spec: // https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth func (pc ProviderConfig) GetOauth2Provider(name string, scopes []string, r *http.Request, clnt *http.Client) (provider *Provider, err error) { var ddoc DiscoveryDoc ddoc, err = parseDiscoveryDoc(r.Context(), pc.URL, clnt) if err != nil { return nil, err } supportedResponseTypes := set.NewStringSet() for _, responseType := range ddoc.ResponseTypesSupported { // FIXME: ResponseTypesSupported is a JSON array of strings - it // may not actually have strings with spaces inside them - // making the following code unnecessary. for _, s := range strings.Fields(responseType) { supportedResponseTypes.Add(s) } } isSupported := requiredResponseTypes.Difference(supportedResponseTypes).IsEmpty() if !isSupported { return nil, fmt.Errorf("expected 'code' response type - got %s, login not allowed", ddoc.ResponseTypesSupported) } // If provided scopes are empty we use the user configured list or a default list. if len(scopes) == 0 { for _, s := range strings.Split(pc.Scopes, ",") { w := strings.TrimSpace(s) if w == "" { continue } scopes = append(scopes, w) } if len(scopes) == 0 { scopes = defaultScopes } } redirectURL := pc.RedirectCallback if pc.RedirectCallbackDynamic { // dynamic redirect if set, will generate redirect URLs // dynamically based on incoming requests. redirectURL = getLoginCallbackURL(r) } // add "openid" scope always. scopes = append(scopes, "openid") client := new(Provider) client.oauth2Config = &xoauth2.Config{ ClientID: pc.ClientID, ClientSecret: pc.ClientSecret, RedirectURL: redirectURL, Endpoint: oauth2.Endpoint{ AuthURL: ddoc.AuthEndpoint, TokenURL: ddoc.TokenEndpoint, }, Scopes: scopes, } client.IDPName = name client.UserInfo = pc.Userinfo client.client = clnt return client, nil } // GetStateKeyFunc - return the key function used to generate the authorization // code flow state parameter. func (pc ProviderConfig) GetStateKeyFunc() StateKeyFunc { return func() []byte { return pbkdf2.Key([]byte(pc.HMACPassphrase), []byte(pc.HMACSalt), 4096, 32, sha1.New) } } func (pc ProviderConfig) GetARNInf() string { return pc.RoleArn } type OpenIDPCfg map[string]ProviderConfig func GetSTSEndpoint() string { return strings.TrimSpace(env.Get(ConsoleMinIOServer, "http://localhost:9000")) } func GetIDPURL() string { return env.Get(ConsoleIDPURL, "") } func GetIDPClientID() string { return env.Get(ConsoleIDPClientID, "") } func GetIDPUserInfo() bool { return env.Get(ConsoleIDPUserInfo, "") == "on" } func GetIDPSecret() string { return env.Get(ConsoleIDPSecret, "") } // Public endpoint used by the identity oidcProvider when redirecting // the user after identity verification func GetIDPCallbackURL() string { return env.Get(ConsoleIDPCallbackURL, "") } func GetIDPCallbackURLDynamic() bool { return env.Get(ConsoleIDPCallbackURLDynamic, "") == "on" } func IsIDPEnabled() bool { return GetIDPURL() != "" && GetIDPClientID() != "" } // GetPassphraseForIDPHmac returns passphrase for the pbkdf2 function used to sign the oauth2 state parameter func getPassphraseForIDPHmac() string { return env.Get(ConsoleIDPHmacPassphrase, token.GetPBKDFPassphrase()) } // GetSaltForIDPHmac returns salt for the pbkdf2 function used to sign the oauth2 state parameter func getSaltForIDPHmac() string { return env.Get(ConsoleIDPHmacSalt, token.GetPBKDFSalt()) } // getIDPScopes return default scopes during the IDP login request func getIDPScopes() string { return env.Get(ConsoleIDPScopes, "openid,profile,email") } ================================================ FILE: pkg/auth/idp/oauth2/const.go ================================================ // 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 oauth2 // Environment constants for console IDP/SSO configuration const ( ConsoleMinIOServer = "CONSOLE_MINIO_SERVER" ConsoleIDPURL = "CONSOLE_IDP_URL" ConsoleIDPClientID = "CONSOLE_IDP_CLIENT_ID" ConsoleIDPSecret = "CONSOLE_IDP_SECRET" ConsoleIDPCallbackURL = "CONSOLE_IDP_CALLBACK" ConsoleIDPCallbackURLDynamic = "CONSOLE_IDP_CALLBACK_DYNAMIC" ConsoleIDPHmacPassphrase = "CONSOLE_IDP_HMAC_PASSPHRASE" ConsoleIDPHmacSalt = "CONSOLE_IDP_HMAC_SALT" ConsoleIDPScopes = "CONSOLE_IDP_SCOPES" ConsoleIDPUserInfo = "CONSOLE_IDP_USERINFO" ConsoleIDPTokenExpiration = "CONSOLE_IDP_TOKEN_EXPIRATION" ) ================================================ FILE: pkg/auth/idp/oauth2/provider.go ================================================ // 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 oauth2 import ( "context" "crypto/sha1" "encoding/base64" "encoding/json" "errors" "fmt" "net/http" "net/url" "strings" "time" "github.com/minio/console/pkg/auth/token" "github.com/minio/console/pkg/auth/utils" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/set" "github.com/minio/pkg/v3/env" "golang.org/x/crypto/pbkdf2" "golang.org/x/oauth2" xoauth2 "golang.org/x/oauth2" ) type Configuration interface { Exchange(ctx context.Context, code string, opts ...xoauth2.AuthCodeOption) (*xoauth2.Token, error) AuthCodeURL(state string, opts ...xoauth2.AuthCodeOption) string PasswordCredentialsToken(ctx context.Context, username, password string) (*xoauth2.Token, error) Client(ctx context.Context, t *xoauth2.Token) *http.Client TokenSource(ctx context.Context, t *xoauth2.Token) xoauth2.TokenSource } type Config struct { xoauth2.Config } // DiscoveryDoc - parses the output from openid-configuration // for example https://accounts.google.com/.well-known/openid-configuration type DiscoveryDoc struct { Issuer string `json:"issuer,omitempty"` AuthEndpoint string `json:"authorization_endpoint,omitempty"` TokenEndpoint string `json:"token_endpoint,omitempty"` UserInfoEndpoint string `json:"userinfo_endpoint,omitempty"` RevocationEndpoint string `json:"revocation_endpoint,omitempty"` JwksURI string `json:"jwks_uri,omitempty"` ResponseTypesSupported []string `json:"response_types_supported,omitempty"` SubjectTypesSupported []string `json:"subject_types_supported,omitempty"` IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported,omitempty"` ScopesSupported []string `json:"scopes_supported,omitempty"` TokenEndpointAuthMethods []string `json:"token_endpoint_auth_methods_supported,omitempty"` ClaimsSupported []string `json:"claims_supported,omitempty"` CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported,omitempty"` } func (ac Config) Exchange(ctx context.Context, code string, opts ...xoauth2.AuthCodeOption) (*xoauth2.Token, error) { return ac.Config.Exchange(ctx, code, opts...) } func (ac Config) AuthCodeURL(state string, opts ...xoauth2.AuthCodeOption) string { return ac.Config.AuthCodeURL(state, opts...) } func (ac Config) PasswordCredentialsToken(ctx context.Context, username, password string) (*xoauth2.Token, error) { return ac.Config.PasswordCredentialsToken(ctx, username, password) } func (ac Config) Client(ctx context.Context, t *xoauth2.Token) *http.Client { return ac.Config.Client(ctx, t) } func (ac Config) TokenSource(ctx context.Context, t *xoauth2.Token) xoauth2.TokenSource { return ac.Config.TokenSource(ctx, t) } // Provider is a wrapper of the oauth2 configuration and the oidc provider type Provider struct { // oauth2Config is an interface configuration that contains the following fields // Config{ // IDPName string // ClientSecret string // RedirectURL string // Endpoint oauth2.Endpoint // Scopes []string // } // - IDPName is the public identifier for this application // - ClientSecret is a shared secret between this application and the authorization server // - RedirectURL is the URL to redirect users going through // the OAuth flow, after the resource owner's URLs. // - Endpoint contains the resource server's token endpoint // URLs. These are constants specific to each server and are // often available via site-specific packages, such as // google.Endpoint or github.Endpoint. // - Scopes specifies optional requested permissions. IDPName string // if enabled means that we need extrace access_token as well UserInfo bool RefreshToken string oauth2Config Configuration client *http.Client } // DefaultDerivedKey is the key used to compute the HMAC for signing the oauth state parameter // its derived using pbkdf on CONSOLE_IDP_HMAC_PASSPHRASE with CONSOLE_IDP_HMAC_SALT var DefaultDerivedKey = func() []byte { return pbkdf2.Key([]byte(getPassphraseForIDPHmac()), []byte(getSaltForIDPHmac()), 4096, 32, sha1.New) } const ( schemeHTTP = "http" schemeHTTPS = "https" ) func getLoginCallbackURL(r *http.Request) string { scheme := getSourceScheme(r) if scheme == "" { if r.TLS != nil { scheme = schemeHTTPS } else { scheme = schemeHTTP } } redirectURL := scheme + "://" + r.Host + "/oauth_callback" _, err := url.Parse(redirectURL) if err != nil { panic(err) } return redirectURL } var requiredResponseTypes = set.CreateStringSet("code") // NewOauth2ProviderClient instantiates a new oauth2 client using the configured credentials // it returns a *Provider object that contains the necessary configuration to initiate an // oauth2 authentication flow. // // We only support Authentication with the Authorization Code Flow - spec: // https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth func NewOauth2ProviderClient(scopes []string, r *http.Request, httpClient *http.Client) (*Provider, error) { ddoc, err := parseDiscoveryDoc(r.Context(), GetIDPURL(), httpClient) if err != nil { return nil, err } supportedResponseTypes := set.NewStringSet() for _, responseType := range ddoc.ResponseTypesSupported { // FIXME: ResponseTypesSupported is a JSON array of strings - it // may not actually have strings with spaces inside them - // making the following code unnecessary. for _, s := range strings.Fields(responseType) { supportedResponseTypes.Add(s) } } isSupported := requiredResponseTypes.Difference(supportedResponseTypes).IsEmpty() if !isSupported { return nil, fmt.Errorf("expected 'code' response type - got %s, login not allowed", ddoc.ResponseTypesSupported) } // If provided scopes are empty we use a default list or the user configured list if len(scopes) == 0 { scopes = strings.Split(getIDPScopes(), ",") } redirectURL := GetIDPCallbackURL() if GetIDPCallbackURLDynamic() { // dynamic redirect if set, will generate redirect URLs // dynamically based on incoming requests. redirectURL = getLoginCallbackURL(r) } // add "openid" scope always. scopes = append(scopes, "openid") client := new(Provider) client.oauth2Config = &xoauth2.Config{ ClientID: GetIDPClientID(), ClientSecret: GetIDPSecret(), RedirectURL: redirectURL, Endpoint: oauth2.Endpoint{ AuthURL: ddoc.AuthEndpoint, TokenURL: ddoc.TokenEndpoint, }, Scopes: scopes, } client.IDPName = GetIDPClientID() client.UserInfo = GetIDPUserInfo() client.client = httpClient return client, nil } var defaultScopes = []string{"openid", "profile", "email"} // NewOauth2ProviderClientByName returns a provider if present specified by the input name of the provider. func (ois OpenIDPCfg) NewOauth2ProviderClientByName(name string, scopes []string, r *http.Request, clnt *http.Client) (provider *Provider, err error) { oi, ok := ois[name] if !ok { return nil, fmt.Errorf("%s IDP provider does not exist", name) } return oi.GetOauth2Provider(name, scopes, r, clnt) } // NewOauth2ProviderClient instantiates a new oauth2 client using the // `OpenIDPCfg` configuration struct. It returns a *Provider object that // contains the necessary configuration to initiate an oauth2 authentication // flow. // // We only support Authentication with the Authorization Code Flow - spec: // https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth func (ois OpenIDPCfg) NewOauth2ProviderClient(scopes []string, r *http.Request, clnt *http.Client) (provider *Provider, providerCfg ProviderConfig, err error) { for name, oi := range ois { provider, err = oi.GetOauth2Provider(name, scopes, r, clnt) if err != nil { // Upon error look for the next IDP. continue } // Upon success return right away. providerCfg = oi break } return provider, providerCfg, err } type User struct { AppMetadata map[string]interface{} `json:"app_metadata"` Blocked bool `json:"blocked"` CreatedAt string `json:"created_at"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` FamilyName string `json:"family_name"` GivenName string `json:"given_name"` Identities []interface{} `json:"identities"` LastIP string `json:"last_ip"` LastLogin string `json:"last_login"` LastPasswordReset string `json:"last_password_reset"` LoginsCount int `json:"logins_count"` MultiFactor string `json:"multifactor"` Name string `json:"name"` Nickname string `json:"nickname"` PhoneNumber string `json:"phone_number"` PhoneVerified bool `json:"phone_verified"` Picture string `json:"picture"` UpdatedAt string `json:"updated_at"` UserID string `json:"user_id"` UserMetadata map[string]interface{} `json:"user_metadata"` Username string `json:"username"` } // StateKeyFunc - is a function that returns a key used in OAuth Authorization // flow state generation and verification. type StateKeyFunc func() []byte // VerifyIdentity will contact the configured IDP to the user identity based on the authorization code and state // if the user is valid, then it will contact MinIO to get valid sts credentials based on the identity provided by the IDP func (client *Provider) VerifyIdentity(ctx context.Context, code, state, roleARN string, keyFunc StateKeyFunc) (*credentials.Credentials, error) { // verify the provided state is valid (prevents CSRF attacks) if err := validateOauth2State(state, keyFunc); err != nil { return nil, err } getWebTokenExpiry := func() (*credentials.WebIdentityToken, error) { customCtx := context.WithValue(ctx, oauth2.HTTPClient, client.client) oauth2Token, err := client.oauth2Config.Exchange(customCtx, code) if err != nil { return nil, err } if !oauth2Token.Valid() { return nil, errors.New("invalid token") } client.RefreshToken = oauth2Token.RefreshToken envStsDuration := env.Get(token.ConsoleSTSDuration, "") stsDuration, err := time.ParseDuration(envStsDuration) expiration := 12 * time.Hour if err == nil && stsDuration > 0 { expiration = stsDuration } else { // Use the expiration configured in the token itself if it is closer than the configured value if exp := oauth2Token.Expiry.Sub(time.Now().UTC()); exp < expiration { expiration = exp } } // Minimum duration in S3 spec is 15 minutes, do not bother returning // an error to the user and force the minimum duration instead if expiration < 900*time.Second { expiration = 900 * time.Second } idToken := oauth2Token.Extra("id_token") if idToken == nil { return nil, errors.New("missing id_token") } token := &credentials.WebIdentityToken{ Token: idToken.(string), Expiry: int(expiration.Seconds()), } if client.UserInfo { // look for access_token only if userinfo is requested. accessToken := oauth2Token.Extra("access_token") if accessToken == nil { return nil, errors.New("missing access_token") } token.AccessToken = accessToken.(string) refreshToken := oauth2Token.Extra("refresh_token") if refreshToken != nil { token.RefreshToken = refreshToken.(string) } else { //nolint:revive,staticcheck // TODO in Nov 2026 : add an error when the refresh token is not found. // This is not done yet because users may not have access_offline scope // and this may break their deployments } } return token, nil } stsEndpoint := GetSTSEndpoint() sts := credentials.New(&credentials.STSWebIdentity{ Client: client.client, STSEndpoint: stsEndpoint, GetWebIDTokenExpiry: getWebTokenExpiry, RoleARN: roleARN, }) return sts, nil } // VerifyIdentityForOperator will contact the configured IDP and validate the user identity based on the authorization code and state func (client *Provider) VerifyIdentityForOperator(ctx context.Context, code, state string, keyFunc StateKeyFunc) (*xoauth2.Token, error) { // verify the provided state is valid (prevents CSRF attacks) if err := validateOauth2State(state, keyFunc); err != nil { return nil, err } customCtx := context.WithValue(ctx, oauth2.HTTPClient, client.client) oauth2Token, err := client.oauth2Config.Exchange(customCtx, code) if err != nil { return nil, err } if !oauth2Token.Valid() { return nil, errors.New("invalid token") } return oauth2Token, nil } // validateOauth2State validates the provided state was originated using the same // instance (or one configured using the same secrets) of Console, this is basically used to prevent CSRF attacks // https://security.stackexchange.com/questions/20187/oauth2-cross-site-request-forgery-and-state-parameter func validateOauth2State(state string, keyFunc StateKeyFunc) error { // state contains a base64 encoded string that may ends with "==", the browser encodes that to "%3D%3D" // query unescape is need it before trying to decode the base64 string encodedMessage, err := url.QueryUnescape(state) if err != nil { return err } // decode the state parameter value message, err := base64.StdEncoding.DecodeString(encodedMessage) if err != nil { return err } s := strings.Split(string(message), ":") // Validate that the decoded message has the right format "message:hmac" if len(s) != 2 { return fmt.Errorf("invalid number of tokens, expected only 2, got %d instead", len(s)) } // extract the state and hmac incomingState, incomingHmac := s[0], s[1] // validate that hmac(incomingState + pbkdf2(secret, salt)) == incomingHmac if calculatedHmac := utils.ComputeHmac256(incomingState, keyFunc()); calculatedHmac != incomingHmac { return fmt.Errorf("oauth2 state is invalid, expected %s, got %s", calculatedHmac, incomingHmac) } return nil } // parseDiscoveryDoc parses a discovery doc from an OAuth provider // into a DiscoveryDoc struct that have the correct endpoints func parseDiscoveryDoc(ctx context.Context, ustr string, httpClient *http.Client) (DiscoveryDoc, error) { d := DiscoveryDoc{} req, err := http.NewRequestWithContext(ctx, http.MethodGet, ustr, nil) if err != nil { return d, err } clnt := http.Client{ Transport: httpClient.Transport, } resp, err := clnt.Do(req) if err != nil { return d, err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return d, err } dec := json.NewDecoder(resp.Body) if err = dec.Decode(&d); err != nil { return d, err } return d, nil } // GetRandomStateWithHMAC computes message + hmac(message, pbkdf2(key, salt)) to be used as state during the oauth authorization func GetRandomStateWithHMAC(length int, keyFunc StateKeyFunc) string { state := utils.RandomCharString(length) hmac := utils.ComputeHmac256(state, keyFunc()) return base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", state, hmac))) } type LoginURLParams struct { State string `json:"state"` IDPName string `json:"idp_name"` } // GenerateLoginURL returns a new login URL based on the configured IDP func (client *Provider) GenerateLoginURL(keyFunc StateKeyFunc, iDPName string) string { // generates random state and sign it using HMAC256 state := GetRandomStateWithHMAC(25, keyFunc) configureID := "_" if iDPName != "" { configureID = iDPName } lgParams := LoginURLParams{ State: state, IDPName: configureID, } jsonEnc, err := json.Marshal(lgParams) if err != nil { return "" } stEncode := base64.StdEncoding.EncodeToString(jsonEnc) loginURL := client.oauth2Config.AuthCodeURL(stEncode) return strings.TrimSpace(loginURL) } ================================================ FILE: pkg/auth/idp/oauth2/provider_test.go ================================================ // 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 oauth2 import ( "context" "net/http" "testing" "github.com/stretchr/testify/assert" "golang.org/x/oauth2" ) type Oauth2configMock struct{} var ( oauth2ConfigExchangeMock func(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error) oauth2ConfigAuthCodeURLMock func(state string, opts ...oauth2.AuthCodeOption) string oauth2ConfigPasswordCredentialsTokenMock func(ctx context.Context, username, password string) (*oauth2.Token, error) oauth2ConfigClientMock func(ctx context.Context, t *oauth2.Token) *http.Client oauth2ConfigokenSourceMock func(ctx context.Context, t *oauth2.Token) oauth2.TokenSource ) func (ac Oauth2configMock) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error) { return oauth2ConfigExchangeMock(ctx, code, opts...) } func (ac Oauth2configMock) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string { return oauth2ConfigAuthCodeURLMock(state, opts...) } func (ac Oauth2configMock) PasswordCredentialsToken(ctx context.Context, username, password string) (*oauth2.Token, error) { return oauth2ConfigPasswordCredentialsTokenMock(ctx, username, password) } func (ac Oauth2configMock) Client(ctx context.Context, t *oauth2.Token) *http.Client { return oauth2ConfigClientMock(ctx, t) } func (ac Oauth2configMock) TokenSource(ctx context.Context, t *oauth2.Token) oauth2.TokenSource { return oauth2ConfigokenSourceMock(ctx, t) } func TestGenerateLoginURL(t *testing.T) { funcAssert := assert.New(t) oauth2Provider := Provider{ oauth2Config: Oauth2configMock{}, } // Test-1 : GenerateLoginURL() generates URL correctly with provided state oauth2ConfigAuthCodeURLMock = func(state string, _ ...oauth2.AuthCodeOption) string { // Internally we are testing the private method getRandomStateWithHMAC, this function should always returns // a non-empty string return state } url := oauth2Provider.GenerateLoginURL(DefaultDerivedKey, "testIDP") funcAssert.NotEqual("", url) } ================================================ FILE: pkg/auth/idp/oauth2/proxy.go ================================================ // 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 oauth2 import ( "net/http" "regexp" "strings" ) var ( // De-facto standard header keys. xForwardedProto = http.CanonicalHeaderKey("X-Forwarded-Proto") xForwardedScheme = http.CanonicalHeaderKey("X-Forwarded-Scheme") ) var ( // RFC7239 defines a new "Forwarded: " header designed to replace the // existing use of X-Forwarded-* headers. // e.g. Forwarded: for=192.0.2.60;proto=https;by=203.0.113.43 forwarded = http.CanonicalHeaderKey("Forwarded") // Allows for a sub-match of the first value after 'for=' to the next // comma, semi-colon or space. The match is case-insensitive. forRegex = regexp.MustCompile(`(?i)(?:for=)([^(;|,| )]+)(.*)`) // Allows for a sub-match for the first instance of scheme (http|https) // prefixed by 'proto='. The match is case-insensitive. protoRegex = regexp.MustCompile(`(?i)^(;|,| )+(?:proto=)(https|http)`) ) // getSourceScheme retrieves the scheme from the X-Forwarded-Proto and RFC7239 // Forwarded headers (in that order). func getSourceScheme(r *http.Request) string { var scheme string // Retrieve the scheme from X-Forwarded-Proto. if proto := r.Header.Get(xForwardedProto); proto != "" { scheme = strings.ToLower(proto) } else if proto = r.Header.Get(xForwardedScheme); proto != "" { scheme = strings.ToLower(proto) } else if proto := r.Header.Get(forwarded); proto != "" { // match should contain at least two elements if the protocol was // specified in the Forwarded header. The first element will always be // the 'for=', which we ignore, subsequently we proceed to look for // 'proto=' which should precede right after `for=` if not // we simply ignore the values and return empty. This is in line // with the approach we took for returning first ip from multiple // params. if match := forRegex.FindStringSubmatch(proto); len(match) > 1 { if match = protoRegex.FindStringSubmatch(match[2]); len(match) > 1 { scheme = strings.ToLower(match[2]) } } } return scheme } ================================================ FILE: pkg/auth/idp.go ================================================ // 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" "github.com/minio/console/pkg/auth/idp/oauth2" "github.com/minio/minio-go/v7/pkg/credentials" xoauth2 "golang.org/x/oauth2" ) // IdentityProviderI interface with all functions to be implemented // by mock when testing, it should include all IdentityProvider respective api calls // that are used within this project. type IdentityProviderI interface { VerifyIdentity(ctx context.Context, code, state string) (*credentials.Credentials, error) VerifyIdentityForOperator(ctx context.Context, code, state string) (*xoauth2.Token, error) GenerateLoginURL() string } // Interface implementation // // Define the structure of a IdentityProvider with Client inside and define the functions that are used // during the authentication flow. type IdentityProvider struct { KeyFunc oauth2.StateKeyFunc Client *oauth2.Provider RoleARN string } // VerifyIdentity will verify the user identity against the idp using the authorization code flow func (c IdentityProvider) VerifyIdentity(ctx context.Context, code, state string) (*credentials.Credentials, error) { return c.Client.VerifyIdentity(ctx, code, state, c.RoleARN, c.KeyFunc) } // VerifyIdentityForOperator will verify the user identity against the idp using the authorization code flow func (c IdentityProvider) VerifyIdentityForOperator(ctx context.Context, code, state string) (*xoauth2.Token, error) { return c.Client.VerifyIdentityForOperator(ctx, code, state, c.KeyFunc) } // GenerateLoginURL returns a new URL used by the user to login against the idp func (c IdentityProvider) GenerateLoginURL() string { return c.Client.GenerateLoginURL(c.KeyFunc, c.Client.IDPName) } ================================================ FILE: pkg/auth/ldap/config.go ================================================ // 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 ldap import ( "strings" "github.com/minio/pkg/v3/env" ) func GetLDAPEnabled() bool { return strings.ToLower(env.Get(ConsoleLDAPEnabled, "off")) == "on" } ================================================ FILE: pkg/auth/ldap/const.go ================================================ // 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 ldap const ( // const for ldap configuration ConsoleLDAPEnabled = "CONSOLE_LDAP_ENABLED" ) ================================================ FILE: pkg/auth/ldap.go ================================================ // 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 ( "net/http" "github.com/minio/minio-go/v7/pkg/credentials" ) // GetCredentialsFromLDAP authenticates the user against MinIO when the LDAP integration is enabled // if the authentication succeed *credentials.Login object is returned and we continue with the normal STSAssumeRole flow func GetCredentialsFromLDAP(client *http.Client, endpoint, ldapUser, ldapPassword string) (*credentials.Credentials, error) { creds := credentials.New(&credentials.LDAPIdentity{ Client: client, STSEndpoint: endpoint, LDAPUsername: ldapUser, LDAPPassword: ldapPassword, }) return creds, nil } ================================================ FILE: pkg/auth/token/config.go ================================================ // 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 token import ( "time" "github.com/minio/console/pkg/auth/utils" "github.com/minio/pkg/v3/env" ) // GetConsoleSTSDuration returns the default session duration for the STS requested tokens (defaults to 12h) func GetConsoleSTSDuration() time.Duration { duration, err := time.ParseDuration(env.Get(ConsoleSTSDuration, "12h")) if err != nil || duration <= 0 { duration = 12 * time.Hour } return duration } var defaultPBKDFPassphrase = utils.RandomCharString(64) // GetPBKDFPassphrase returns passphrase for the pbkdf2 function used to encrypt JWT payload func GetPBKDFPassphrase() string { return env.Get(ConsolePBKDFPassphrase, defaultPBKDFPassphrase) } var defaultPBKDFSalt = utils.RandomCharString(64) // GetPBKDFSalt returns salt for the pbkdf2 function used to encrypt JWT payload func GetPBKDFSalt() string { return env.Get(ConsolePBKDFSalt, defaultPBKDFSalt) } ================================================ FILE: pkg/auth/token/const.go ================================================ // 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 token const ( ConsoleSTSDuration = "CONSOLE_STS_DURATION" // time.Duration format, ie: 3600s, 2h45m, 1h, etc ConsolePBKDFPassphrase = "CONSOLE_PBKDF_PASSPHRASE" ConsolePBKDFSalt = "CONSOLE_PBKDF_SALT" ) ================================================ FILE: pkg/auth/token.go ================================================ // 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 ( "bytes" "crypto/aes" "crypto/cipher" "crypto/hmac" "crypto/sha1" "crypto/sha256" "encoding/base64" "encoding/json" "errors" "fmt" "io" "net/http" "strings" "time" "github.com/minio/console/models" "github.com/minio/console/pkg/auth/token" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/secure-io/sio-go/sioutil" "golang.org/x/crypto/chacha20" "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/pbkdf2" ) // Session token errors var ( ErrNoAuthToken = errors.New("session token missing") ErrTokenExpired = errors.New("session token has expired") ErrReadingToken = errors.New("session token internal data is malformed") ) // derivedKey is the key used to encrypt the session token claims, its derived using pbkdf on CONSOLE_PBKDF_PASSPHRASE with CONSOLE_PBKDF_SALT var derivedKey = func() []byte { return pbkdf2.Key([]byte(token.GetPBKDFPassphrase()), []byte(token.GetPBKDFSalt()), 4096, 32, sha1.New) } // IsSessionTokenValid returns true or false depending upon the provided session if the token is valid or not func IsSessionTokenValid(token string) bool { _, err := SessionTokenAuthenticate(token) return err == nil } // TokenClaims claims struct for decrypted credentials type TokenClaims struct { STSAccessKeyID string `json:"stsAccessKeyID,omitempty"` STSSecretAccessKey string `json:"stsSecretAccessKey,omitempty"` STSSessionToken string `json:"stsSessionToken,omitempty"` AccountAccessKey string `json:"accountAccessKey,omitempty"` HideMenu bool `json:"hm,omitempty"` ObjectBrowser bool `json:"ob,omitempty"` CustomStyleOB string `json:"customStyleOb,omitempty"` } // STSClaims claims struct for STS Token type STSClaims struct { AccessKey string `json:"accessKey,omitempty"` } // SessionFeatures represents features stored in the session type SessionFeatures struct { HideMenu bool ObjectBrowser bool CustomStyleOB string } // SessionTokenAuthenticate takes a session token, decode it, extract claims and validate the signature // if the session token claims are valid we proceed to decrypt the information inside // // returns claims after validation in the following format: // // type TokenClaims struct { // STSAccessKeyID // STSSecretAccessKey // STSSessionToken // AccountAccessKey // } func SessionTokenAuthenticate(token string) (*TokenClaims, error) { if token == "" { return nil, ErrNoAuthToken } decryptedToken, err := DecryptToken(token) if err != nil { // fail decrypting token return nil, ErrReadingToken } claimTokens, err := ParseClaimsFromToken(string(decryptedToken)) if err != nil { // fail unmarshalling token into data structure return nil, ErrReadingToken } // claimsTokens contains the decrypted JWT for Console return claimTokens, nil } // NewEncryptedTokenForClient generates a new session token with claims based on the provided STS credentials, first // encrypts the claims and the sign them func NewEncryptedTokenForClient(credentials *credentials.Value, accountAccessKey string, features *SessionFeatures) (string, error) { if credentials != nil { tokenClaims := &TokenClaims{ STSAccessKeyID: credentials.AccessKeyID, STSSecretAccessKey: credentials.SecretAccessKey, STSSessionToken: credentials.SessionToken, AccountAccessKey: accountAccessKey, } if features != nil { tokenClaims.HideMenu = features.HideMenu tokenClaims.ObjectBrowser = features.ObjectBrowser tokenClaims.CustomStyleOB = features.CustomStyleOB } encryptedClaims, err := encryptClaims(tokenClaims) if err != nil { return "", err } return encryptedClaims, nil } return "", errors.New("provided credentials are empty") } // encryptClaims() receives the STS claims, concatenate them and encrypt them using AES-GCM // returns a base64 encoded ciphertext func encryptClaims(credentials *TokenClaims) (string, error) { payload, err := json.Marshal(credentials) if err != nil { return "", err } ciphertext, err := encrypt(payload, []byte{}) if err != nil { return "", err } return base64.StdEncoding.EncodeToString(ciphertext), nil } // ParseClaimsFromToken receive token claims in string format, then unmarshal them to produce a *TokenClaims object func ParseClaimsFromToken(claims string) (*TokenClaims, error) { tokenClaims := &TokenClaims{} if err := json.Unmarshal([]byte(claims), tokenClaims); err != nil { return nil, err } return tokenClaims, nil } // DecryptToken receives base64 encoded ciphertext, decode it, decrypt it (AES-GCM) and produces []byte func DecryptToken(ciphertext string) (plaintext []byte, err error) { decoded, err := base64.StdEncoding.DecodeString(ciphertext) if err != nil { return nil, err } plaintext, err = decrypt(decoded, []byte{}) if err != nil { return nil, err } return plaintext, nil } const ( aesGcm = 0x00 c20p1305 = 0x01 ) // Encrypt a blob of data using AEAD scheme, AES-GCM if the executing CPU // provides AES hardware support, otherwise will use ChaCha20-Poly1305 // with a pbkdf2 derived key, this function should be used to encrypt a session // or data key provided as plaintext. // // The returned ciphertext data consists of: // // AEAD ID | iv | nonce | encrypted data // 1 16 12 ~ len(data) func encrypt(plaintext, associatedData []byte) ([]byte, error) { iv, err := sioutil.Random(16) // 16 bytes IV if err != nil { return nil, err } var algorithm byte if sioutil.NativeAES() { algorithm = aesGcm } else { algorithm = c20p1305 } var aead cipher.AEAD switch algorithm { case aesGcm: mac := hmac.New(sha256.New, derivedKey()) mac.Write(iv) sealingKey := mac.Sum(nil) var block cipher.Block block, err = aes.NewCipher(sealingKey) if err != nil { return nil, err } aead, err = cipher.NewGCM(block) if err != nil { return nil, err } case c20p1305: var sealingKey []byte sealingKey, err = chacha20.HChaCha20(derivedKey(), iv) // HChaCha20 expects nonce of 16 bytes if err != nil { return nil, err } aead, err = chacha20poly1305.New(sealingKey) if err != nil { return nil, err } } nonce, err := sioutil.Random(aead.NonceSize()) if err != nil { return nil, err } sealedBytes := aead.Seal(nil, nonce, plaintext, associatedData) // ciphertext = AEAD ID | iv | nonce | sealed bytes var buf bytes.Buffer buf.WriteByte(algorithm) buf.Write(iv) buf.Write(nonce) buf.Write(sealedBytes) return buf.Bytes(), nil } // Decrypts a blob of data using AEAD scheme AES-GCM if the executing CPU // provides AES hardware support, otherwise will use ChaCha20-Poly1305with // and a pbkdf2 derived key func decrypt(ciphertext, associatedData []byte) ([]byte, error) { var ( algorithm [1]byte iv [16]byte nonce [12]byte // This depends on the AEAD but both used ciphers have the same nonce length. ) r := bytes.NewReader(ciphertext) if _, err := io.ReadFull(r, algorithm[:]); err != nil { return nil, err } if _, err := io.ReadFull(r, iv[:]); err != nil { return nil, err } if _, err := io.ReadFull(r, nonce[:]); err != nil { return nil, err } var aead cipher.AEAD switch algorithm[0] { case aesGcm: mac := hmac.New(sha256.New, derivedKey()) mac.Write(iv[:]) sealingKey := mac.Sum(nil) block, err := aes.NewCipher(sealingKey) if err != nil { return nil, err } aead, err = cipher.NewGCM(block) if err != nil { return nil, err } case c20p1305: sealingKey, err := chacha20.HChaCha20(derivedKey(), iv[:]) // HChaCha20 expects nonce of 16 bytes if err != nil { return nil, err } aead, err = chacha20poly1305.New(sealingKey) if err != nil { return nil, err } default: return nil, fmt.Errorf("invalid algorithm: %v", algorithm) } if len(nonce) != aead.NonceSize() { return nil, fmt.Errorf("invalid nonce size %d, expected %d", len(nonce), aead.NonceSize()) } sealedBytes, err := io.ReadAll(r) if err != nil { return nil, err } plaintext, err := aead.Open(nil, nonce[:], sealedBytes, associatedData) if err != nil { return nil, err } return plaintext, nil } // GetTokenFromRequest returns a token from a http Request // either defined on a cookie `token` or on Authorization header. // // Authorization Header needs to be like "Authorization Bearer " func GetTokenFromRequest(r *http.Request) (string, error) { // Token might come either as a Cookie or as a Header // if not set in cookie, check if it is set on Header. tokenCookie, err := r.Cookie("token") if err != nil { return "", ErrNoAuthToken } currentTime := time.Now() if tokenCookie.Expires.After(currentTime) { return "", ErrTokenExpired } return strings.TrimSpace(tokenCookie.Value), nil } func GetClaimsFromTokenInRequest(req *http.Request) (*models.Principal, error) { sessionID, err := GetTokenFromRequest(req) if err != nil { return nil, err } // Perform decryption of the session token, if Console is able to decrypt the session token that means a valid session // was used in the first place to get it claims, err := SessionTokenAuthenticate(sessionID) if err != nil { return nil, err } return &models.Principal{ STSAccessKeyID: claims.STSAccessKeyID, STSSecretAccessKey: claims.STSSecretAccessKey, STSSessionToken: claims.STSSessionToken, AccountAccessKey: claims.AccountAccessKey, }, nil } ================================================ FILE: pkg/auth/token_test.go ================================================ // 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 ( "testing" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/stretchr/testify/assert" ) var creds = &credentials.Value{ AccessKeyID: "fakeAccessKeyID", SecretAccessKey: "fakeSecretAccessKey", SessionToken: "fakeSessionToken", SignerType: 0, } var ( goodToken = "" badToken = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoiRDMwYWE0ekQ1bWtFaFRyWm5yOWM3NWh0Yko0MkROOWNDZVQ5RHVHUkg1U25SR3RyTXZNOXBMdnlFSVJAAAE5eWxxekhYMXllck8xUXpzMlZzRVFKeUF2ZmpOaDkrTVdoUURWZ2FhK2R5emxzSjNpK0k1dUdoeW5DNWswUW83WEY0UWszY0RtUTdUQUVROVFEbWRKdjBkdVB5L25hQk5vM3dIdlRDZHFNRDJZN3kycktJbmVUbUlFNmVveW9EWmprcW5tckVoYmMrTlhTRU81WjZqa1kwZ1E2eXZLaWhUZGxBRS9zS1lBNlc4Q1R1cm1MU0E0b0dIcGtldFZWU0VXMHEzNU9TU1VaczRXNkxHdGMxSTFWVFZLWUo3ZTlHR2REQ3hMWGtiZHQwcjl0RDNMWUhWRndra0dSZit5ZHBzS1Y3L1Jtbkp3SHNqNVVGV0w5WGVHUkZVUjJQclJTN2plVzFXeGZuYitVeXoxNVpOMzZsZ01GNnBlWFd1LzJGcEtrb2Z2QzNpY2x5Rmp0SE45ZkxYTVpVSFhnV2lsQWVSa3oiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjkwMDAiLCJleHAiOjE1ODc1MTY1NzEsInN1YiI6ImZmYmY4YzljLTJlMjYtNGMwYS1iMmI0LTYyMmVhM2I1YjZhYiJ9.P392RUwzsrBeJOO3fS1xMZcF-lWiDvWZ5hM7LZOyFMmoG5QLccDU5eAPSm8obzPoznX1b7eCFLeEmKK-vKgjiQ" ) func TestNewJWTWithClaimsForClient(t *testing.T) { funcAssert := assert.New(t) // Test-1 : NewEncryptedTokenForClient() is generated correctly without errors function := "NewEncryptedTokenForClient()" token, err := NewEncryptedTokenForClient(creds, "", nil) if err != nil || token == "" { t.Errorf("Failed on %s:, error occurred: %s", function, err) } // saving token for future tests goodToken = token // Test-2 : NewEncryptedTokenForClient() throws error because of empty credentials if _, err = NewEncryptedTokenForClient(nil, "", nil); err != nil { funcAssert.Equal("provided credentials are empty", err.Error()) } } func TestJWTAuthenticate(t *testing.T) { funcAssert := assert.New(t) // Test-1 : SessionTokenAuthenticate() should correctly return the claims function := "SessionTokenAuthenticate()" claims, err := SessionTokenAuthenticate(goodToken) if err != nil || claims == nil { t.Errorf("Failed on %s:, error occurred: %s", function, err) } else { funcAssert.Equal(claims.STSAccessKeyID, creds.AccessKeyID) funcAssert.Equal(claims.STSSecretAccessKey, creds.SecretAccessKey) funcAssert.Equal(claims.STSSessionToken, creds.SessionToken) } // Test-2 : SessionTokenAuthenticate() return an error because of a tampered token if _, err := SessionTokenAuthenticate(badToken); err != nil { funcAssert.Equal("session token internal data is malformed", err.Error()) } // Test-3 : SessionTokenAuthenticate() return an error because of an empty token if _, err := SessionTokenAuthenticate(""); err != nil { funcAssert.Equal("session token missing", err.Error()) } } func TestSessionTokenValid(t *testing.T) { funcAssert := assert.New(t) // Test-1 : SessionTokenAuthenticate() provided token is valid funcAssert.Equal(true, IsSessionTokenValid(goodToken)) // Test-2 : SessionTokenAuthenticate() provided token is invalid funcAssert.Equal(false, IsSessionTokenValid(badToken)) } ================================================ FILE: pkg/auth/utils/utils.go ================================================ // 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 utils import ( "crypto/hmac" "crypto/rand" "crypto/sha256" "encoding/base64" "io" "strings" ) // Do not use: // https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-go // It relies on math/rand and therefore not on a cryptographically secure RNG => It must not be used // for access/secret keys. // The alphabet of random character string. Each character must be unique. // // The RandomCharString implementation requires that: 256 / len(letters) is a natural numbers. // For example: 256 / 64 = 4. However, 5 > 256/62 > 4 and therefore we must not use a alphabet // of 62 characters. // The reason is that if 256 / len(letters) is not a natural number then certain characters become // more likely then others. const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" func RandomCharString(n int) string { random := make([]byte, n) if _, err := io.ReadFull(rand.Reader, random); err != nil { panic(err) // Can only happen if we would run out of entropy. } var s strings.Builder for _, v := range random { j := v % byte(len(letters)) s.WriteByte(letters[j]) } return s.String() } func ComputeHmac256(message string, key []byte) string { h := hmac.New(sha256.New, key) h.Write([]byte(message)) return base64.StdEncoding.EncodeToString(h.Sum(nil)) } ================================================ FILE: pkg/auth/utils/utils_test.go ================================================ // 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 utils import ( "crypto/sha1" "testing" "github.com/stretchr/testify/assert" "golang.org/x/crypto/pbkdf2" ) func TestRandomCharString(t *testing.T) { funcAssert := assert.New(t) // Test-1 : RandomCharString() should return string with expected length length := 32 token := RandomCharString(length) funcAssert.Equal(length, len(token)) // Test-2 : RandomCharString() should output random string, new generated string should not be equal to the previous one newToken := RandomCharString(length) funcAssert.NotEqual(token, newToken) } func TestComputeHmac256(t *testing.T) { funcAssert := assert.New(t) // Test-1 : ComputeHmac256() should return the right Hmac256 string based on a derived key derivedKey := pbkdf2.Key([]byte("secret"), []byte("salt"), 4096, 32, sha1.New) message := "hello world" expectedHmac := "5r32q7W+0hcBnqzQwJJUDzVGoVivXGSodTcHSqG/9Q8=" hmac := ComputeHmac256(message, derivedKey) funcAssert.Equal(hmac, expectedHmac) } ================================================ FILE: pkg/build-constants.go ================================================ // 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 pkg var ( // Version - the version being released (v prefix stripped) Version = "(dev)" // ReleaseTag - the current git tag ReleaseTag = "(no tag)" // ReleaseTime - current UTC date in RFC3339 format. ReleaseTime = "(no release)" // CommitID - latest commit id. CommitID = "(dev)" // ShortCommitID - first 12 characters from CommitID. ShortCommitID = "(dev)" ) ================================================ FILE: pkg/certs/certs.go ================================================ // 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 certs import ( "bytes" "context" "crypto/tls" "crypto/x509" "encoding/pem" "errors" "fmt" "os" "path/filepath" "strings" "github.com/minio/cli" xcerts "github.com/minio/pkg/v3/certs" "github.com/minio/pkg/v3/env" "github.com/mitchellh/go-homedir" ) // ConfigDir - points to a user set directory. type ConfigDir struct { Path string } // Get - returns current directory. func (dir *ConfigDir) Get() string { return dir.Path } func getDefaultConfigDir() string { homeDir, err := homedir.Dir() if err != nil { return "" } return filepath.Join(homeDir, DefaultConsoleConfigDir) } func getDefaultCertsDir() string { return filepath.Join(getDefaultConfigDir(), CertsDir) } func getDefaultCertsCADir() string { return filepath.Join(getDefaultCertsDir(), CertsCADir) } // isFile - returns whether given Path is a file or not. func isFile(path string) bool { if fi, err := os.Stat(path); err == nil { return fi.Mode().IsRegular() } return false } var ( // DefaultCertsDir certs directory. DefaultCertsDir = &ConfigDir{Path: getDefaultCertsDir()} // DefaultCertsCADir CA directory. DefaultCertsCADir = &ConfigDir{Path: getDefaultCertsCADir()} // GlobalCertsDir points to current certs directory set by user with --certs-dir GlobalCertsDir = DefaultCertsDir // GlobalCertsCADir points to relative Path to certs directory and is /CAs GlobalCertsCADir = DefaultCertsCADir ) // ParsePublicCertFile - parses public cert into its *x509.Certificate equivalent. func ParsePublicCertFile(certFile string) (x509Certs []*x509.Certificate, err error) { // Read certificate file. var data []byte if data, err = os.ReadFile(certFile); err != nil { return nil, err } // Trimming leading and tailing white spaces. data = bytes.TrimSpace(data) // Parse all certs in the chain. current := data for len(current) > 0 { var pemBlock *pem.Block if pemBlock, current = pem.Decode(current); pemBlock == nil { return nil, fmt.Errorf("could not read PEM block from file %s", certFile) } var x509Cert *x509.Certificate if x509Cert, err = x509.ParseCertificate(pemBlock.Bytes); err != nil { return nil, err } x509Certs = append(x509Certs, x509Cert) } if len(x509Certs) == 0 { return nil, fmt.Errorf("empty public certificate file %s", certFile) } return x509Certs, nil } // MkdirAllIgnorePerm attempts to create all directories, ignores any permission denied errors. func MkdirAllIgnorePerm(path string) error { err := os.MkdirAll(path, 0o700) if err != nil { // It is possible in kubernetes like deployments this directory // is already mounted and is not writable, ignore any write errors. if os.IsPermission(err) { err = nil } } return err } func NewConfigDirFromCtx(ctx *cli.Context, option string, getDefaultDir func() string) (*ConfigDir, bool, error) { var dir string var dirSet bool switch { case ctx.IsSet(option): dir = ctx.String(option) dirSet = true case ctx.GlobalIsSet(option): dir = ctx.GlobalString(option) dirSet = true // cli package does not expose parent's option option. Below code is workaround. if dir == "" || dir == getDefaultDir() { dirSet = false // Unset to false since GlobalIsSet() true is a false positive. if ctx.Parent().GlobalIsSet(option) { dir = ctx.Parent().GlobalString(option) dirSet = true } } default: // Neither local nor global option is provided. In this case, try to use // default directory. dir = getDefaultDir() if dir == "" { return nil, false, fmt.Errorf("invalid arguments specified, %s option must be provided", option) } } if dir == "" { return nil, false, fmt.Errorf("empty directory, %s directory cannot be empty", option) } // Disallow relative paths, figure out absolute paths. dirAbs, err := filepath.Abs(dir) if err != nil { return nil, false, fmt.Errorf("%w: Unable to fetch absolute path for %s=%s", err, option, dir) } if err = MkdirAllIgnorePerm(dirAbs); err != nil { return nil, false, fmt.Errorf("%w: Unable to create directory specified %s=%s", err, option, dir) } return &ConfigDir{Path: dirAbs}, dirSet, nil } func getPublicCertFile() string { return filepath.Join(GlobalCertsDir.Get(), PublicCertFile) } func getPrivateKeyFile() string { return filepath.Join(GlobalCertsDir.Get(), PrivateKeyFile) } // EnvCertPassword is the environment variable which contains the password used // to decrypt the TLS private key. It must be set if the TLS private key is // password protected. const EnvCertPassword = "CONSOLE_CERT_PASSWD" // LoadX509KeyPair - load an X509 key pair (private key , certificate) // from the provided paths. The private key may be encrypted and is // decrypted using the ENV_VAR: MINIO_CERT_PASSWD. func LoadX509KeyPair(certFile, keyFile string) (tls.Certificate, error) { certPEMBlock, err := os.ReadFile(certFile) if err != nil { return tls.Certificate{}, err } keyPEMBlock, err := os.ReadFile(keyFile) if err != nil { return tls.Certificate{}, err } key, rest := pem.Decode(keyPEMBlock) if len(rest) > 0 { return tls.Certificate{}, errors.New("the private key contains additional data") } // nolint:staticcheck // ignore SA1019 if x509.IsEncryptedPEMBlock(key) { password := env.Get(EnvCertPassword, "") if len(password) == 0 { return tls.Certificate{}, errors.New("no password") } // nolint:staticcheck // ignore SA1019 decryptedKey, decErr := x509.DecryptPEMBlock(key, []byte(password)) if decErr != nil { return tls.Certificate{}, decErr } keyPEMBlock = pem.EncodeToMemory(&pem.Block{Type: key.Type, Bytes: decryptedKey}) } return tls.X509KeyPair(certPEMBlock, keyPEMBlock) } func GetTLSConfig() (x509Certs []*x509.Certificate, manager *xcerts.Manager, err error) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() if !(isFile(getPublicCertFile()) && isFile(getPrivateKeyFile())) { return nil, nil, nil } if x509Certs, err = ParsePublicCertFile(getPublicCertFile()); err != nil { return nil, nil, err } manager, err = xcerts.NewManager(ctx, getPublicCertFile(), getPrivateKeyFile(), LoadX509KeyPair) if err != nil { return nil, nil, err } // Console has support for multiple certificates. It expects the following structure: // certs/ // │ // ├─ public.crt // ├─ private.key // │ // ├─ example.com/ // │ │ // │ ├─ public.crt // │ └─ private.key // └─ foobar.org/ // │ // ├─ public.crt // └─ private.key // ... // // Therefore, we read all filenames in the cert directory and check // for each directory whether it contains a public.crt and private.key. // If so, we try to add it to certificate manager. root, err := os.Open(GlobalCertsDir.Get()) if err != nil { return nil, nil, err } defer root.Close() files, err := root.Readdir(-1) if err != nil { return nil, nil, err } for _, file := range files { // Ignore all // - regular files // - "CAs" directory // - any directory which starts with ".." if file.Mode().IsRegular() || file.Name() == "CAs" || strings.HasPrefix(file.Name(), "..") { continue } if file.Mode()&os.ModeSymlink == os.ModeSymlink { file, err = os.Stat(filepath.Join(root.Name(), file.Name())) if err != nil { // not accessible ignore continue } if !file.IsDir() { continue } } var ( certFile = filepath.Join(root.Name(), file.Name(), PublicCertFile) keyFile = filepath.Join(root.Name(), file.Name(), PrivateKeyFile) ) if !isFile(certFile) || !isFile(keyFile) { continue } if err = manager.AddCertificate(certFile, keyFile); err != nil { return nil, nil, fmt.Errorf("unable to load TLS certificate '%s,%s': %w", certFile, keyFile, err) } } return x509Certs, manager, nil } func GetAllCertificatesAndCAs() (*x509.CertPool, []*x509.Certificate, *xcerts.Manager, error) { // load all CAs from ~/.console/certs/CAs rootCAs, err := xcerts.GetRootCAs(GlobalCertsCADir.Get()) if err != nil { return nil, nil, nil, err } // load all certs from ~/.console/certs publicCerts, certsManager, err := GetTLSConfig() if err != nil { return nil, nil, nil, err } if rootCAs == nil { rootCAs = &x509.CertPool{} } // Add the public crts as part of root CAs to trust self. for _, publicCrt := range publicCerts { rootCAs.AddCert(publicCrt) } return rootCAs, publicCerts, certsManager, nil } // EnsureCertAndKey checks if both client certificate and key paths are provided func EnsureCertAndKey(clientCert, clientKey string) error { if (clientCert != "" && clientKey == "") || (clientCert == "" && clientKey != "") { return errors.New("cert and key must be specified as a pair") } return nil } ================================================ FILE: pkg/certs/const.go ================================================ // 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 certs const ( // Default minio configuration directory where below configuration files/directories are stored. DefaultConsoleConfigDir = ".console" // Directory contains below files/directories for HTTPS configuration. CertsDir = "certs" // Directory contains all CA certificates other than system defaults for HTTPS. CertsCADir = "CAs" // Public certificate file for HTTPS. PublicCertFile = "public.crt" // Private key file for HTTPS. PrivateKeyFile = "private.key" ) ================================================ FILE: pkg/http/headers.go ================================================ // 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 http // Standard S3 HTTP response constants const ( ETag = "ETag" ContentType = "Content-Type" ) ================================================ FILE: pkg/http/http.go ================================================ // 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 http import ( "io" "net/http" ) // ClientI interface with all functions to be implemented // by mock when testing, it should include all HttpClient respective api calls // that are used within this project. type ClientI interface { Get(url string) (resp *http.Response, err error) Post(url, contentType string, body io.Reader) (resp *http.Response, err error) Do(req *http.Request) (*http.Response, error) } // Client is an HTTP Interface implementation // // Define the structure of a http client and define the functions that are actually used type Client struct { Client *http.Client } // Get implements http.Client.Get() func (c *Client) Get(url string) (resp *http.Response, err error) { return c.Client.Get(url) } // Post implements http.Client.Post() func (c *Client) Post(url, contentType string, body io.Reader) (resp *http.Response, err error) { return c.Client.Post(url, contentType, body) } // Do implement http.Client.Do() func (c *Client) Do(req *http.Request) (*http.Response, error) { return c.Client.Do(req) } // DrainBody close non nil response with any response Body. // convenient wrapper to drain any remaining data on response body. // // Subsequently this allows golang http RoundTripper // to re-use the same connection for future requests. func DrainBody(respBody io.ReadCloser) { // Callers should close resp.Body when done reading from it. // If resp.Body is not closed, the Client's underlying RoundTripper // (typically Transport) may not be able to re-use a persistent TCP // connection to the server for a subsequent "keep-alive" request. if respBody != nil { // Drain any remaining Body and then close the connection. // Without this closing connection would disallow re-using // the same connection for future uses. // - http://stackoverflow.com/a/17961593/4465767 defer respBody.Close() io.Copy(io.Discard, respBody) } } ================================================ FILE: pkg/kes/kes.go ================================================ // 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 kes import ( "crypto/x509" "encoding/pem" "errors" "time" "github.com/minio/kes" ) type Identity = kes.Identity type TLSProxyHeader struct { ClientCert string `yaml:"cert,omitempty"` } type TLSProxy struct { Identities *[]Identity `yaml:"identities,omitempty" json:"identities,omitempty"` Header *TLSProxyHeader `yaml:"header,omitempty" json:"header,omitempty"` } type TLS struct { KeyPath string `yaml:"key,omitempty" json:"key,omitempty"` CertPath string `yaml:"cert,omitempty" json:"cert,omitempty"` Proxy *TLSProxy `yaml:"proxy,omitempty" json:"proxy,omitempty"` } type Policy struct { Paths []string `yaml:"paths,omitempty" json:"paths,omitempty"` Identities []Identity `yaml:"identities,omitempty" json:"identities,omitempty"` } type Expiry struct { Any time.Duration `yaml:"any,omitempty" json:"any,omitempty"` Unused time.Duration `yaml:"unused,omitempty" json:"unused,omitempty"` } type Cache struct { Expiry *Expiry `yaml:"expiry,omitempty" json:"expiry,omitempty"` } type Log struct { Error string `yaml:"error,omitempty" json:"error,omitempty"` Audit string `yaml:"audit,omitempty" json:"audit,omitempty"` } type Fs struct { Path string `yaml:"path,omitempty" json:"path,omitempty"` } type AppRole struct { EnginePath string `yaml:"engine,omitempty" json:"engine,omitempty"` ID string `yaml:"id,omitempty" json:"id,omitempty"` Secret string `yaml:"secret,omitempty" json:"secret,omitempty"` Retry time.Duration `yaml:"retry,omitempty" json:"retry,omitempty"` } type VaultTLS struct { KeyPath string `yaml:"key,omitempty" json:"key,omitempty"` CertPath string `yaml:"cert,omitempty" json:"cert,omitempty"` CAPath string `yaml:"ca,omitempty" json:"ca,omitempty"` } type VaultStatus struct { Ping time.Duration `yaml:"ping,omitempty" json:"ping,omitempty"` } type Vault struct { Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty"` EnginePath string `yaml:"engine,omitempty" json:"engine,omitempty"` Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"` Prefix string `yaml:"prefix,omitempty" json:"prefix,omitempty"` AppRole *AppRole `yaml:"approle,omitempty" json:"approle,omitempty"` TLS *VaultTLS `yaml:"tls,omitempty" json:"tls,omitempty"` Status *VaultStatus `yaml:"status,omitempty" json:"status,omitempty"` } type AwsSecretManagerLogin struct { AccessKey string `yaml:"accesskey" json:"accesskey"` SecretKey string `yaml:"secretkey" json:"secretkey"` SessionToken string `yaml:"token" json:"token"` } type AwsSecretManager struct { Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty"` Region string `yaml:"region,omitempty" json:"region,omitempty"` KmsKey string `yaml:"kmskey,omitempty" json:"kmskey,omitempty"` Login *AwsSecretManagerLogin `yaml:"credentials,omitempty" json:"credentials,omitempty"` } type Aws struct { SecretsManager *AwsSecretManager `yaml:"secretsmanager,omitempty" json:"secretsmanager,omitempty"` } type GemaltoCredentials struct { Token string `yaml:"token,omitempty" json:"token,omitempty"` Domain string `yaml:"domain,omitempty" json:"domain,omitempty"` Retry time.Duration `yaml:"retry,omitempty" json:"retry,omitempty"` } type GemaltoTLS struct { CAPath string `yaml:"ca,omitempty"` } type GemaltoKeySecure struct { Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty"` Credentials *GemaltoCredentials `yaml:"credentials,omitempty" json:"credentials,omitempty"` TLS *GemaltoTLS `yaml:"tls,omitempty" json:"tls,omitempty"` } type Gemalto struct { KeySecure *GemaltoKeySecure `yaml:"keysecure,omitempty" json:"keysecure,omitempty"` } type GcpCredentials struct { ClientEmail string `yaml:"client_email" json:"client_email"` ClientID string `yaml:"client_id" json:"client_id"` PrivateKeyID string `yaml:"private_key_id" json:"private_key_id"` PrivateKey string `yaml:"private_key" json:"private_key"` } type GcpSecretManager struct { ProjectID string `yaml:"project_id" json:"project_id"` Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty"` Credentials *GcpCredentials `yaml:"credentials,omitempty" json:"credentials,omitempty"` } type Gcp struct { SecretManager *GcpSecretManager `yaml:"secretmanager,omitempty" json:"secretmanager,omitempty"` } type AzureCredentials struct { TenantID string `yaml:"tenant_id" json:"tenant_id"` ClientID string `yaml:"client_id" json:"client_id"` ClientSecret string `yaml:"client_secret" json:"client_secret"` } type AzureKeyVault struct { Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty"` Credentials *AzureCredentials `yaml:"credentials,omitempty" json:"credentials,omitempty"` } type Azure struct { KeyVault *AzureKeyVault `yaml:"keyvault,omitempty" json:"keyvault,omitempty"` } type Keys struct { Fs *Fs `yaml:"fs,omitempty" json:"fs,omitempty"` Vault *Vault `yaml:"vault,omitempty" json:"vault,omitempty"` Aws *Aws `yaml:"aws,omitempty" json:"aws,omitempty"` Gemalto *Gemalto `yaml:"gemalto,omitempty" json:"gemalto,omitempty"` Gcp *Gcp `yaml:"gcp,omitempty" json:"gcp,omitempty"` Azure *Azure `yaml:"azure,omitempty" json:"azure,omitempty"` } type ServerConfig struct { Addr string `yaml:"address,omitempty" json:"address,omitempty"` Root Identity `yaml:"root,omitempty" json:"root,omitempty"` TLS TLS `yaml:"tls,omitempty" json:"tls,omitempty"` Policies map[string]Policy `yaml:"policy,omitempty" json:"policy,omitempty"` Cache Cache `yaml:"cache,omitempty" json:"cache,omitempty"` Log Log `yaml:"log,omitempty" json:"log,omitempty"` Keys Keys `yaml:"keys,omitempty" json:"keys,omitempty"` } func ParseCertificate(cert []byte) (*x509.Certificate, error) { for { var certDERBlock *pem.Block certDERBlock, cert = pem.Decode(cert) if certDERBlock == nil { break } if certDERBlock.Type == "CERTIFICATE" { return x509.ParseCertificate(certDERBlock.Bytes) } } return nil, errors.New("found no (non-CA) certificate in any PEM block") } ================================================ FILE: pkg/logger/audit.go ================================================ // 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 logger import ( "bufio" "bytes" "context" "errors" "fmt" "io" "net" "net/http" "strconv" "sync/atomic" "time" "github.com/minio/console/pkg/utils" "github.com/minio/console/pkg/logger/message/audit" ) // ResponseWriter - is a wrapper to trap the http response status code. type ResponseWriter struct { http.ResponseWriter StatusCode int Hijacked bool // Log body of 4xx or 5xx responses LogErrBody bool // Log body of all responses LogAllBody bool TimeToFirstByte time.Duration StartTime time.Time // number of bytes written bytesWritten int // Internal recording buffer headers bytes.Buffer body bytes.Buffer // Indicate if headers are written in the log headersLogged bool } // NewResponseWriter - returns a wrapped response writer to trap // http status codes for auditing purposes. func NewResponseWriter(w http.ResponseWriter) *ResponseWriter { return &ResponseWriter{ ResponseWriter: w, StatusCode: http.StatusOK, StartTime: time.Now().UTC(), } } func (lrw *ResponseWriter) Hijack() (conn net.Conn, rw *bufio.ReadWriter, err error) { hijack, ok := lrw.ResponseWriter.(http.Hijacker) if !ok { return nil, nil, errors.New("base response writer doesn't implement hijacker") } lrw.Hijacked = true return hijack.Hijack() } func (lrw *ResponseWriter) Write(p []byte) (int, error) { if !lrw.headersLogged { // We assume the response code to be '200 OK' when WriteHeader() is not called, // that way following Golang HTTP response behavior. lrw.WriteHeader(http.StatusOK) } n, err := lrw.ResponseWriter.Write(p) lrw.bytesWritten += n if lrw.TimeToFirstByte == 0 { lrw.TimeToFirstByte = time.Now().UTC().Sub(lrw.StartTime) } if (lrw.LogErrBody && lrw.StatusCode >= http.StatusBadRequest) || lrw.LogAllBody { // Always logging error responses. lrw.body.Write(p) } if err != nil { return n, err } return n, err } // Write the headers into the given buffer func (lrw *ResponseWriter) writeHeaders(w io.Writer, statusCode int, headers http.Header) { n, _ := fmt.Fprintf(w, "%d %s\n", statusCode, http.StatusText(statusCode)) lrw.bytesWritten += n for k, v := range headers { n, _ := fmt.Fprintf(w, "%s: %s\n", k, v[0]) lrw.bytesWritten += n } } // BodyPlaceHolder returns a dummy body placeholder var BodyPlaceHolder = []byte("") // Body - Return response body. func (lrw *ResponseWriter) Body() []byte { // If there was an error response or body logging is enabled // then we return the body contents if (lrw.LogErrBody && lrw.StatusCode >= http.StatusBadRequest) || lrw.LogAllBody { return lrw.body.Bytes() } // ... otherwise we return the place holder return BodyPlaceHolder } // WriteHeader - writes http status code func (lrw *ResponseWriter) WriteHeader(code int) { if !lrw.headersLogged { lrw.StatusCode = code lrw.writeHeaders(&lrw.headers, code, lrw.ResponseWriter.Header()) lrw.headersLogged = true lrw.ResponseWriter.WriteHeader(code) } } // Flush - Calls the underlying Flush. func (lrw *ResponseWriter) Flush() { lrw.ResponseWriter.(http.Flusher).Flush() } // Size - reutrns the number of bytes written func (lrw *ResponseWriter) Size() int { return lrw.bytesWritten } // SetAuditEntry sets Audit info in the context. func SetAuditEntry(ctx context.Context, audit *audit.Entry) context.Context { if ctx == nil { LogIf(context.Background(), fmt.Errorf("context is nil")) return nil } return context.WithValue(ctx, utils.ContextAuditKey, audit) } // GetAuditEntry returns Audit entry if set. func GetAuditEntry(ctx context.Context) *audit.Entry { if ctx != nil { r, ok := ctx.Value(utils.ContextAuditKey).(*audit.Entry) if ok { return r } r = &audit.Entry{ Version: audit.Version, // DeploymentID: globalDeploymentID, Time: time.Now().UTC(), } SetAuditEntry(ctx, r) return r } return nil } // AuditLog - logs audit logs to all audit targets. func AuditLog(ctx context.Context, w *ResponseWriter, r *http.Request, reqClaims map[string]interface{}, filterKeys ...string) { // Fast exit if there is not audit target configured if atomic.LoadInt32(&nAuditTargets) == 0 { return } var entry audit.Entry if w != nil && r != nil { reqInfo := GetReqInfo(ctx) if reqInfo == nil { return } entry = audit.ToEntry(w, r, reqClaims, GetGlobalDeploymentID()) // indicates all requests for this API call are inbound entry.Trigger = "incoming" for _, filterKey := range filterKeys { delete(entry.ReqClaims, filterKey) delete(entry.ReqQuery, filterKey) delete(entry.ReqHeader, filterKey) delete(entry.RespHeader, filterKey) } var ( statusCode int timeToResponse time.Duration timeToFirstByte time.Duration outputBytes int64 = -1 // -1: unknown output bytes ) if w != nil { statusCode = w.StatusCode timeToResponse = time.Now().UTC().Sub(w.StartTime) timeToFirstByte = w.TimeToFirstByte outputBytes = int64(w.Size()) } entry.API.Path = r.URL.Path entry.API.Status = http.StatusText(statusCode) entry.API.StatusCode = statusCode entry.API.Method = r.Method entry.API.InputBytes = r.ContentLength entry.API.OutputBytes = outputBytes entry.RequestID = reqInfo.RequestID entry.API.TimeToResponse = strconv.FormatInt(timeToResponse.Nanoseconds(), 10) + "ns" entry.Tags = reqInfo.GetTagsMap() // ttfb will be recorded only for GET requests, Ignore such cases where ttfb will be empty. if timeToFirstByte != 0 { entry.API.TimeToFirstByte = strconv.FormatInt(timeToFirstByte.Nanoseconds(), 10) + "ns" } } else { auditEntry := GetAuditEntry(ctx) if auditEntry != nil { entry = *auditEntry } } if anonFlag { entry.SessionID = hashString(entry.SessionID) entry.RemoteHost = hashString(entry.RemoteHost) } // Send audit logs only to http targets. for _, t := range AuditTargets() { if err := t.Send(entry, string(All)); err != nil { LogAlwaysIf(context.Background(), fmt.Errorf("event(%v) was not sent to Audit target (%v): %v", entry, t, err), All) } } } ================================================ FILE: pkg/logger/color/color.go ================================================ // 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 color import ( "fmt" "github.com/fatih/color" ) // global colors. var ( // Check if we stderr, stdout are dumb terminals, we do not apply // ansi coloring on dumb terminals. IsTerminal = func() bool { return !color.NoColor } Bold = func() func(a ...interface{}) string { if IsTerminal() { return color.New(color.Bold).SprintFunc() } return fmt.Sprint }() FgRed = func() func(a ...interface{}) string { if IsTerminal() { return color.New(color.FgRed).SprintFunc() } return fmt.Sprint }() BgRed = func() func(format string, a ...interface{}) string { if IsTerminal() { return color.New(color.BgRed).SprintfFunc() } return fmt.Sprintf }() FgWhite = func() func(format string, a ...interface{}) string { if IsTerminal() { return color.New(color.FgWhite).SprintfFunc() } return fmt.Sprintf }() ) ================================================ FILE: pkg/logger/config/bool-flag.go ================================================ // 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 config import ( "encoding/json" "fmt" "strconv" "strings" ) // BoolFlag - wrapper bool type. type BoolFlag bool // String - returns string of BoolFlag. func (bf BoolFlag) String() string { if bf { return "on" } return "off" } // MarshalJSON - converts BoolFlag into JSON data. func (bf BoolFlag) MarshalJSON() ([]byte, error) { return json.Marshal(bf.String()) } // UnmarshalJSON - parses given data into BoolFlag. func (bf *BoolFlag) UnmarshalJSON(data []byte) (err error) { var s string if err = json.Unmarshal(data, &s); err == nil { b := BoolFlag(true) if s == "" { // Empty string is treated as valid. *bf = b } else if b, err = ParseBoolFlag(s); err == nil { *bf = b } } return err } // ParseBool returns the boolean value represented by the string. func ParseBool(str string) (bool, error) { switch str { case "1", "t", "T", "true", "TRUE", "True", "on", "ON", "On": return true, nil case "0", "f", "F", "false", "FALSE", "False", "off", "OFF", "Off": return false, nil } if strings.EqualFold(str, "enabled") { return true, nil } if strings.EqualFold(str, "disabled") { return false, nil } return false, fmt.Errorf("ParseBool: parsing '%s': %w", str, strconv.ErrSyntax) } // ParseBoolFlag - parses string into BoolFlag. func ParseBoolFlag(s string) (bf BoolFlag, err error) { b, err := ParseBool(s) return BoolFlag(b), err } ================================================ FILE: pkg/logger/config/bool-flag_test.go ================================================ // 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 config import "testing" // Test BoolFlag.String() func TestBoolFlagString(t *testing.T) { var bf BoolFlag testCases := []struct { flag BoolFlag expectedResult string }{ {bf, "off"}, {BoolFlag(true), "on"}, {BoolFlag(false), "off"}, } for _, testCase := range testCases { str := testCase.flag.String() if testCase.expectedResult != str { t.Fatalf("expected: %v, got: %v", testCase.expectedResult, str) } } } // Test BoolFlag.MarshalJSON() func TestBoolFlagMarshalJSON(t *testing.T) { var bf BoolFlag testCases := []struct { flag BoolFlag expectedResult string }{ {bf, `"off"`}, {BoolFlag(true), `"on"`}, {BoolFlag(false), `"off"`}, } for _, testCase := range testCases { data, _ := testCase.flag.MarshalJSON() if testCase.expectedResult != string(data) { t.Fatalf("expected: %v, got: %v", testCase.expectedResult, string(data)) } } } // Test BoolFlag.UnmarshalJSON() func TestBoolFlagUnmarshalJSON(t *testing.T) { testCases := []struct { data []byte expectedResult BoolFlag expectedErr bool }{ {[]byte(`{}`), BoolFlag(false), true}, {[]byte(`["on"]`), BoolFlag(false), true}, {[]byte(`"junk"`), BoolFlag(false), true}, {[]byte(`""`), BoolFlag(true), false}, {[]byte(`"on"`), BoolFlag(true), false}, {[]byte(`"off"`), BoolFlag(false), false}, {[]byte(`"true"`), BoolFlag(true), false}, {[]byte(`"false"`), BoolFlag(false), false}, {[]byte(`"ON"`), BoolFlag(true), false}, {[]byte(`"OFF"`), BoolFlag(false), false}, } for _, testCase := range testCases { var flag BoolFlag err := (&flag).UnmarshalJSON(testCase.data) if !testCase.expectedErr && err != nil { t.Fatalf("error: expected = , got = %v", err) } if testCase.expectedErr && err == nil { t.Fatalf("error: expected error, got = ") } if err == nil && testCase.expectedResult != flag { t.Fatalf("result: expected: %v, got: %v", testCase.expectedResult, flag) } } } // Test ParseBoolFlag() func TestParseBoolFlag(t *testing.T) { testCases := []struct { flagStr string expectedResult BoolFlag expectedErr bool }{ {"", BoolFlag(false), true}, {"junk", BoolFlag(false), true}, {"true", BoolFlag(true), false}, {"false", BoolFlag(false), false}, {"ON", BoolFlag(true), false}, {"OFF", BoolFlag(false), false}, {"on", BoolFlag(true), false}, {"off", BoolFlag(false), false}, } for _, testCase := range testCases { bf, err := ParseBoolFlag(testCase.flagStr) if !testCase.expectedErr && err != nil { t.Fatalf("error: expected = , got = %v", err) } if testCase.expectedErr && err == nil { t.Fatalf("error: expected error, got = ") } if err == nil && testCase.expectedResult != bf { t.Fatalf("result: expected: %v, got: %v", testCase.expectedResult, bf) } } } ================================================ FILE: pkg/logger/config/certs.go ================================================ // 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 config import ( "errors" ) // EnsureCertAndKey checks if both client certificate and key paths are provided func EnsureCertAndKey(clientCert, clientKey string) error { if (clientCert != "" && clientKey == "") || (clientCert == "" && clientKey != "") { return errors.New("cert and key must be specified as a pair") } return nil } ================================================ FILE: pkg/logger/config/config.go ================================================ // 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 config import ( "github.com/minio/madmin-go/v3" ) // Default keys const ( Default = madmin.Default ) // Top level config constants. const ( LoggerWebhookSubSys = "logger_webhook" AuditWebhookSubSys = "audit_webhook" ) ================================================ FILE: pkg/logger/config.go ================================================ // 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 logger import ( "errors" "strconv" "strings" "github.com/google/uuid" "github.com/minio/console/pkg/logger/config" "github.com/minio/console/pkg/logger/target/http" "github.com/minio/pkg/v3/env" ) // NewConfig - initialize new logger config. func NewConfig() Config { cfg := Config{ HTTP: make(map[string]http.Config), AuditWebhook: make(map[string]http.Config), } return cfg } func lookupLoggerWebhookConfig() (Config, error) { cfg := NewConfig() envs := env.List(EnvLoggerWebhookEndpoint) var loggerTargets []string for _, k := range envs { target := strings.TrimPrefix(k, EnvLoggerWebhookEndpoint+config.Default) if target == EnvLoggerWebhookEndpoint { target = config.Default } loggerTargets = append(loggerTargets, target) } // Load HTTP logger from the environment if found for _, target := range loggerTargets { if v, ok := cfg.HTTP[target]; ok && v.Enabled { // This target is already enabled using the // legacy environment variables, ignore. continue } enableEnv := EnvLoggerWebhookEnable if target != config.Default { enableEnv = EnvLoggerWebhookEnable + config.Default + target } enable, err := config.ParseBool(env.Get(enableEnv, "")) if err != nil || !enable { continue } endpointEnv := EnvLoggerWebhookEndpoint if target != config.Default { endpointEnv = EnvLoggerWebhookEndpoint + config.Default + target } authTokenEnv := EnvLoggerWebhookAuthToken if target != config.Default { authTokenEnv = EnvLoggerWebhookAuthToken + config.Default + target } clientCertEnv := EnvLoggerWebhookClientCert if target != config.Default { clientCertEnv = EnvLoggerWebhookClientCert + config.Default + target } clientKeyEnv := EnvLoggerWebhookClientKey if target != config.Default { clientKeyEnv = EnvLoggerWebhookClientKey + config.Default + target } err = config.EnsureCertAndKey(env.Get(clientCertEnv, ""), env.Get(clientKeyEnv, "")) if err != nil { return cfg, err } queueSizeEnv := EnvLoggerWebhookQueueSize if target != config.Default { queueSizeEnv = EnvLoggerWebhookQueueSize + config.Default + target } queueSize, err := strconv.Atoi(env.Get(queueSizeEnv, "100000")) if err != nil { return cfg, err } if queueSize <= 0 { return cfg, errors.New("invalid queue_size value") } cfg.HTTP[target] = http.Config{ Enabled: true, Endpoint: env.Get(endpointEnv, ""), AuthToken: env.Get(authTokenEnv, ""), ClientCert: env.Get(clientCertEnv, ""), ClientKey: env.Get(clientKeyEnv, ""), QueueSize: queueSize, } } return cfg, nil } func lookupAuditWebhookConfig() (Config, error) { cfg := NewConfig() var loggerAuditTargets []string envs := env.List(EnvAuditWebhookEndpoint) for _, k := range envs { target := strings.TrimPrefix(k, EnvAuditWebhookEndpoint+config.Default) if target == EnvAuditWebhookEndpoint { target = config.Default } loggerAuditTargets = append(loggerAuditTargets, target) } for _, target := range loggerAuditTargets { if v, ok := cfg.AuditWebhook[target]; ok && v.Enabled { // This target is already enabled using the // legacy environment variables, ignore. continue } enableEnv := EnvAuditWebhookEnable if target != config.Default { enableEnv = EnvAuditWebhookEnable + config.Default + target } enable, err := config.ParseBool(env.Get(enableEnv, "")) if err != nil || !enable { continue } endpointEnv := EnvAuditWebhookEndpoint if target != config.Default { endpointEnv = EnvAuditWebhookEndpoint + config.Default + target } authTokenEnv := EnvAuditWebhookAuthToken if target != config.Default { authTokenEnv = EnvAuditWebhookAuthToken + config.Default + target } clientCertEnv := EnvAuditWebhookClientCert if target != config.Default { clientCertEnv = EnvAuditWebhookClientCert + config.Default + target } clientKeyEnv := EnvAuditWebhookClientKey if target != config.Default { clientKeyEnv = EnvAuditWebhookClientKey + config.Default + target } err = config.EnsureCertAndKey(env.Get(clientCertEnv, ""), env.Get(clientKeyEnv, "")) if err != nil { return cfg, err } queueSizeEnv := EnvAuditWebhookQueueSize if target != config.Default { queueSizeEnv = EnvAuditWebhookQueueSize + config.Default + target } queueSize, err := strconv.Atoi(env.Get(queueSizeEnv, "100000")) if err != nil { return cfg, err } if queueSize <= 0 { return cfg, errors.New("invalid queue_size value") } cfg.AuditWebhook[target] = http.Config{ Enabled: true, Endpoint: env.Get(endpointEnv, ""), AuthToken: env.Get(authTokenEnv, ""), ClientCert: env.Get(clientCertEnv, ""), ClientKey: env.Get(clientKeyEnv, ""), QueueSize: queueSize, } } return cfg, nil } // LookupConfigForSubSys - lookup logger config, override with ENVs if set, for the given sub-system func LookupConfigForSubSys(subSys string) (cfg Config, err error) { switch subSys { case config.LoggerWebhookSubSys: if cfg, err = lookupLoggerWebhookConfig(); err != nil { return cfg, err } case config.AuditWebhookSubSys: if cfg, err = lookupAuditWebhookConfig(); err != nil { return cfg, err } } return cfg, nil } // GetGlobalDeploymentID : func GetGlobalDeploymentID() string { if globalDeploymentID != "" { return globalDeploymentID } globalDeploymentID = env.Get(EnvGlobalDeploymentID, mustGetUUID()) return globalDeploymentID } // mustGetUUID - get a random UUID. func mustGetUUID() string { u, err := uuid.NewRandom() if err != nil { CriticalIf(GlobalContext, err) } return u.String() } ================================================ FILE: pkg/logger/console.go ================================================ // 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 logger import ( "encoding/json" "fmt" "os" "strings" "time" "github.com/minio/console/pkg/logger/color" "github.com/minio/console/pkg/logger/message/log" c "github.com/minio/pkg/v3/console" ) // Logger interface describes the methods that need to be implemented to satisfy the interface requirements. type Logger interface { json(msg string, args ...interface{}) quiet(msg string, args ...interface{}) pretty(msg string, args ...interface{}) } func consoleLog(console Logger, msg string, args ...interface{}) { switch { case jsonFlag: // Strip escape control characters from json message msg = ansiRE.ReplaceAllLiteralString(msg, "") console.json(msg, args...) case quietFlag: console.quiet(msg+"\n", args...) default: console.pretty(msg+"\n", args...) } } // Fatal prints only fatal errors message with no stack trace // it will be called for input validation failures func Fatal(err error, msg string, data ...interface{}) { fatal(err, msg, data...) } func fatal(err error, msg string, data ...interface{}) { var errMsg string if msg != "" { errMsg = errorFmtFunc(fmt.Sprintf(msg, data...), err, jsonFlag) } else { errMsg = err.Error() } consoleLog(fatalMessage, errMsg) } var fatalMessage fatalMsg type fatalMsg struct{} func (f fatalMsg) json(msg string, args ...interface{}) { var message string if msg != "" { message = fmt.Sprintf(msg, args...) } else { message = fmt.Sprint(args...) } logJSON, err := json.Marshal(&log.Entry{ Level: FatalLvl.String(), Message: message, Time: time.Now().UTC(), Trace: &log.Trace{Message: message, Source: []string{getSource(6)}}, }) if err != nil { panic(err) } fmt.Println(string(logJSON)) os.Exit(1) } func (f fatalMsg) quiet(msg string, args ...interface{}) { f.pretty(msg, args...) } var ( logTag = "ERROR" logBanner = color.BgRed(color.FgWhite(color.Bold(logTag))) + " " emptyBanner = color.BgRed(strings.Repeat(" ", len(logTag))) + " " bannerWidth = len(logTag) + 1 ) func (f fatalMsg) pretty(msg string, args ...interface{}) { // Build the passed errors message errMsg := fmt.Sprintf(msg, args...) tagPrinted := false // Print the errors message: the following code takes care // of splitting errors text and always pretty printing the // red banner along with the errors message. Since the errors // message itself contains some colored text, we needed // to use some ANSI control escapes to cursor color state // and freely move in the screen. for _, line := range strings.Split(errMsg, "\n") { if len(line) == 0 { // No more text to print, just quit. break } for { // Save the attributes of the current cursor helps // us save the text color of the passed errors message ansiSaveAttributes() // Print banner with or without the log tag if !tagPrinted { c.Print(logBanner) tagPrinted = true } else { c.Print(emptyBanner) } // Restore the text color of the errors message ansiRestoreAttributes() ansiMoveRight(bannerWidth) // Continue errors message printing c.Println(line) break } } // Exit because this is a fatal errors message os.Exit(1) } type infoMsg struct{} var info infoMsg func (i infoMsg) json(msg string, args ...interface{}) { var message string if msg != "" { message = fmt.Sprintf(msg, args...) } else { message = fmt.Sprint(args...) } logJSON, err := json.Marshal(&log.Entry{ Level: InformationLvl.String(), Message: message, Time: time.Now().UTC(), }) if err != nil { panic(err) } fmt.Println(string(logJSON)) } func (i infoMsg) quiet(_ string, _ ...interface{}) { } func (i infoMsg) pretty(msg string, args ...interface{}) { if msg == "" { c.Println(args...) } c.Printf(msg, args...) } type errorMsg struct{} var errorm errorMsg func (i errorMsg) json(msg string, args ...interface{}) { var message string if msg != "" { message = fmt.Sprintf(msg, args...) } else { message = fmt.Sprint(args...) } logJSON, err := json.Marshal(&log.Entry{ Level: ErrorLvl.String(), Message: message, Time: time.Now().UTC(), Trace: &log.Trace{Message: message, Source: []string{getSource(6)}}, }) if err != nil { panic(err) } fmt.Println(string(logJSON)) } func (i errorMsg) quiet(msg string, args ...interface{}) { i.pretty(msg, args...) } func (i errorMsg) pretty(msg string, args ...interface{}) { if msg == "" { c.Println(args...) } c.Printf(msg, args...) c.Printf("\n") } // Error : func Error(msg string, data ...interface{}) { consoleLog(errorm, msg, data...) } // Info : func Info(msg string, data ...interface{}) { consoleLog(info, msg, data...) } ================================================ FILE: pkg/logger/const.go ================================================ // 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 logger import ( "context" "github.com/minio/console/pkg/logger/target/http" ) // Audit/Logger constants const ( EnvLoggerJSONEnable = "CONSOLE_LOGGER_JSON_ENABLE" EnvLoggerAnonymousEnable = "CONSOLE_LOGGER_ANONYMOUS_ENABLE" EnvLoggerQuietEnable = "CONSOLE_LOGGER_QUIET_ENABLE" EnvGlobalDeploymentID = "CONSOLE_GLOBAL_DEPLOYMENT_ID" EnvLoggerWebhookEnable = "CONSOLE_LOGGER_WEBHOOK_ENABLE" EnvLoggerWebhookEndpoint = "CONSOLE_LOGGER_WEBHOOK_ENDPOINT" EnvLoggerWebhookAuthToken = "CONSOLE_LOGGER_WEBHOOK_AUTH_TOKEN" EnvLoggerWebhookClientCert = "CONSOLE_LOGGER_WEBHOOK_CLIENT_CERT" EnvLoggerWebhookClientKey = "CONSOLE_LOGGER_WEBHOOK_CLIENT_KEY" EnvLoggerWebhookQueueSize = "CONSOLE_LOGGER_WEBHOOK_QUEUE_SIZE" EnvAuditWebhookEnable = "CONSOLE_AUDIT_WEBHOOK_ENABLE" EnvAuditWebhookEndpoint = "CONSOLE_AUDIT_WEBHOOK_ENDPOINT" EnvAuditWebhookAuthToken = "CONSOLE_AUDIT_WEBHOOK_AUTH_TOKEN" EnvAuditWebhookClientCert = "CONSOLE_AUDIT_WEBHOOK_CLIENT_CERT" EnvAuditWebhookClientKey = "CONSOLE_AUDIT_WEBHOOK_CLIENT_KEY" EnvAuditWebhookQueueSize = "CONSOLE_AUDIT_WEBHOOK_QUEUE_SIZE" ) // Config console and http logger targets type Config struct { HTTP map[string]http.Config `json:"http"` AuditWebhook map[string]http.Config `json:"audit"` } var ( globalDeploymentID string GlobalContext context.Context ) ================================================ FILE: pkg/logger/logger.go ================================================ // 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 logger import ( "context" "crypto/tls" "encoding/hex" "errors" "fmt" "go/build" "net/http" "path/filepath" "reflect" "runtime" "strings" "syscall" "time" "github.com/minio/pkg/v3/env" "github.com/minio/console/pkg" "github.com/minio/pkg/v3/certs" "github.com/minio/console/pkg/logger/config" "github.com/minio/console/pkg/logger/message/log" "github.com/minio/highwayhash" "github.com/minio/minio-go/v7/pkg/set" ) // HighwayHash key for logging in anonymous mode var magicHighwayHash256Key = []byte("\x4b\xe7\x34\xfa\x8e\x23\x8a\xcd\x26\x3e\x83\xe6\xbb\x96\x85\x52\x04\x0f\x93\x5d\xa3\x9f\x44\x14\x97\xe0\x9d\x13\x22\xde\x36\xa0") // Disable disables all logging, false by default. (used for "go test") var Disable = false // Level type type Level int8 // Enumerated level types const ( InformationLvl Level = iota + 1 ErrorLvl FatalLvl ) var trimStrings []string var matchingFuncNames = [...]string{ "http.HandlerFunc.ServeHTTP", "cmd.serverMain", "cmd.StartGateway", // add more here .. } func (level Level) String() string { var lvlStr string switch level { case InformationLvl: lvlStr = "INFO" case ErrorLvl: lvlStr = "ERROR" case FatalLvl: lvlStr = "FATAL" } return lvlStr } // quietFlag: Hide startup messages if enabled // jsonFlag: Display in JSON format, if enabled var ( quietFlag, jsonFlag, anonFlag bool // Custom function to format errors errorFmtFunc func(string, error, bool) string ) // EnableQuiet - turns quiet option on. func EnableQuiet() { quietFlag = true } // EnableJSON - outputs logs in json format. func EnableJSON() { jsonFlag = true quietFlag = true } // EnableAnonymous - turns anonymous flag // to avoid printing sensitive information. func EnableAnonymous() { anonFlag = true } // IsAnonymous - returns true if anonFlag is true func IsAnonymous() bool { return anonFlag } // IsJSON - returns true if jsonFlag is true func IsJSON() bool { return jsonFlag } // IsQuiet - returns true if quietFlag is true func IsQuiet() bool { return quietFlag } // RegisterError registers the specified rendering function. This latter // will be called for a pretty rendering of fatal errors. func RegisterError(f func(string, error, bool) string) { errorFmtFunc = f } // Remove any duplicates and return unique entries. func uniqueEntries(paths []string) []string { m := make(set.StringSet) for _, p := range paths { if !m.Contains(p) { m.Add(p) } } return m.ToSlice() } // Init sets the trimStrings to possible GOPATHs // and GOROOT directories. Also append github.com/minio/minio // This is done to clean up the filename, when stack trace is // displayed when an errors happens. func Init(goPath, goRoot string) { var goPathList []string var goRootList []string var defaultgoPathList []string var defaultgoRootList []string pathSeperator := ":" // Add all possible GOPATH paths into trimStrings // Split GOPATH depending on the OS type if runtime.GOOS == "windows" { pathSeperator = ";" } goPathList = strings.Split(goPath, pathSeperator) goRootList = strings.Split(goRoot, pathSeperator) defaultgoPathList = strings.Split(build.Default.GOPATH, pathSeperator) defaultgoRootList = strings.Split(build.Default.GOROOT, pathSeperator) // Add trim string "{GOROOT}/src/" into trimStrings trimStrings = []string{filepath.Join(runtime.GOROOT(), "src") + string(filepath.Separator)} // Add all possible path from GOPATH=path1:path2...:pathN // as "{path#}/src/" into trimStrings for _, goPathString := range goPathList { trimStrings = append(trimStrings, filepath.Join(goPathString, "src")+string(filepath.Separator)) } for _, goRootString := range goRootList { trimStrings = append(trimStrings, filepath.Join(goRootString, "src")+string(filepath.Separator)) } for _, defaultgoPathString := range defaultgoPathList { trimStrings = append(trimStrings, filepath.Join(defaultgoPathString, "src")+string(filepath.Separator)) } for _, defaultgoRootString := range defaultgoRootList { trimStrings = append(trimStrings, filepath.Join(defaultgoRootString, "src")+string(filepath.Separator)) } // Remove duplicate entries. trimStrings = uniqueEntries(trimStrings) // Add "github.com/minio/minio" as the last to cover // paths like "{GOROOT}/src/github.com/minio/minio" // and "{GOPATH}/src/github.com/minio/minio" trimStrings = append(trimStrings, filepath.Join("github.com", "minio", "minio")+string(filepath.Separator)) } func trimTrace(f string) string { for _, trimString := range trimStrings { f = strings.TrimPrefix(filepath.ToSlash(f), filepath.ToSlash(trimString)) } return filepath.FromSlash(f) } func getSource(level int) string { pc, file, lineNumber, ok := runtime.Caller(level) if ok { // Clean up the common prefixes file = trimTrace(file) _, funcName := filepath.Split(runtime.FuncForPC(pc).Name()) return fmt.Sprintf("%v:%v:%v()", file, lineNumber, funcName) } return "" } // getTrace method - creates and returns stack trace func getTrace(traceLevel int) []string { var trace []string pc, file, lineNumber, ok := runtime.Caller(traceLevel) for ok && file != "" { // Clean up the common prefixes file = trimTrace(file) // Get the function name _, funcName := filepath.Split(runtime.FuncForPC(pc).Name()) // Skip duplicate traces that start with file name, "" // and also skip traces with function name that starts with "runtime." if !strings.HasPrefix(file, "") && !strings.HasPrefix(funcName, "runtime.") { // Form and append a line of stack trace into a // collection, 'trace', to build full stack trace trace = append(trace, fmt.Sprintf("%v:%v:%v()", file, lineNumber, funcName)) // Ignore trace logs beyond the following conditions for _, name := range matchingFuncNames { if funcName == name { return trace } } } traceLevel++ // Read stack trace information from PC pc, file, lineNumber, ok = runtime.Caller(traceLevel) } return trace } // Return the highway hash of the passed string func hashString(input string) string { hh, _ := highwayhash.New(magicHighwayHash256Key) hh.Write([]byte(input)) return hex.EncodeToString(hh.Sum(nil)) } // Kind specifies the kind of errors log type Kind string const ( // Minio errors Minio Kind = "CONSOLE" // All errors All Kind = "ALL" ) // LogAlwaysIf prints a detailed errors message during // the execution of the server. func LogAlwaysIf(ctx context.Context, err error, errKind ...interface{}) { if err == nil { return } logIf(ctx, err, errKind...) } // LogIf prints a detailed errors message during // the execution of the server func LogIf(ctx context.Context, err error, errKind ...interface{}) { if err == nil { return } if errors.Is(err, context.Canceled) { return } logIf(ctx, err, errKind...) } // logIf prints a detailed errors message during // the execution of the server. func logIf(ctx context.Context, err error, errKind ...interface{}) { if Disable { return } logKind := string(Minio) if len(errKind) > 0 { if ek, ok := errKind[0].(Kind); ok { logKind = string(ek) } } req := GetReqInfo(ctx) if req == nil { req = &ReqInfo{API: "SYSTEM"} } kv := req.GetTags() tags := make(map[string]interface{}, len(kv)) for _, entry := range kv { tags[entry.Key] = entry.Val } // Get full stack trace trace := getTrace(3) // Get the cause for the Error message := fmt.Sprintf("%v (%T)", err, err) if req.DeploymentID == "" { req.DeploymentID = GetGlobalDeploymentID() } entry := log.Entry{ DeploymentID: req.DeploymentID, Level: ErrorLvl.String(), LogKind: logKind, RemoteHost: req.RemoteHost, Host: req.Host, RequestID: req.RequestID, SessionID: req.SessionID, UserAgent: req.UserAgent, Time: time.Now().UTC(), Trace: &log.Trace{ Message: message, Source: trace, Variables: tags, }, } if anonFlag { entry.SessionID = hashString(entry.SessionID) entry.RemoteHost = hashString(entry.RemoteHost) entry.Trace.Message = reflect.TypeOf(err).String() entry.Trace.Variables = make(map[string]interface{}) } // Iterate over all logger targets to send the log entry for _, t := range SystemTargets() { if err := t.Send(entry, entry.LogKind); err != nil { if consoleTgt != nil { entry.Trace.Message = fmt.Sprintf("event(%#v) was not sent to Logger target (%#v): %#v", entry, t, err) consoleTgt.Send(entry, entry.LogKind) } } } } // ErrCritical is the value panic'd whenever CriticalIf is called. var ErrCritical struct{} // CriticalIf logs the provided errors on the console. It fails the // current go-routine by causing a `panic(ErrCritical)`. func CriticalIf(ctx context.Context, err error, errKind ...interface{}) { if err != nil { LogIf(ctx, err, errKind...) panic(ErrCritical) } } // FatalIf is similar to Fatal() but it ignores passed nil errors func FatalIf(err error, msg string, data ...interface{}) { if err == nil { return } fatal(err, msg, data...) } func applyDynamicConfigForSubSys(ctx context.Context, transport *http.Transport, subSys string) error { switch subSys { case config.LoggerWebhookSubSys: loggerCfg, err := LookupConfigForSubSys(config.LoggerWebhookSubSys) if err != nil { LogIf(ctx, fmt.Errorf("unable to load logger webhook config: %w", err)) return err } userAgent := getUserAgent() for n, l := range loggerCfg.HTTP { if l.Enabled { l.LogOnce = LogOnceIf l.UserAgent = userAgent l.Transport = NewHTTPTransportWithClientCerts(transport, l.ClientCert, l.ClientKey) loggerCfg.HTTP[n] = l } } err = UpdateSystemTargets(loggerCfg) if err != nil { LogIf(ctx, fmt.Errorf("unable to update logger webhook config: %w", err)) return err } case config.AuditWebhookSubSys: loggerCfg, err := LookupConfigForSubSys(config.AuditWebhookSubSys) if err != nil { LogIf(ctx, fmt.Errorf("unable to load audit webhook config: %w", err)) return err } userAgent := getUserAgent() for n, l := range loggerCfg.AuditWebhook { if l.Enabled { l.LogOnce = LogOnceIf l.UserAgent = userAgent l.Transport = NewHTTPTransportWithClientCerts(transport, l.ClientCert, l.ClientKey) loggerCfg.AuditWebhook[n] = l } } err = UpdateAuditWebhookTargets(loggerCfg) if err != nil { LogIf(ctx, fmt.Errorf("unable to update audit webhook targets: %w", err)) return err } } return nil } // InitializeLogger : func InitializeLogger(ctx context.Context, transport *http.Transport) error { err := applyDynamicConfigForSubSys(ctx, transport, config.LoggerWebhookSubSys) if err != nil { return err } err = applyDynamicConfigForSubSys(ctx, transport, config.AuditWebhookSubSys) if err != nil { return err } if enable, _ := config.ParseBool(env.Get(EnvLoggerJSONEnable, "")); enable { EnableJSON() } if enable, _ := config.ParseBool(env.Get(EnvLoggerAnonymousEnable, "")); enable { EnableAnonymous() } if enable, _ := config.ParseBool(env.Get(EnvLoggerQuietEnable, "")); enable { EnableQuiet() } return nil } func getUserAgent() string { userAgentParts := []string{} // Helper function to concisely append a pair of strings to a // the user-agent slice. uaAppend := func(p, q string) { userAgentParts = append(userAgentParts, p, q) } uaAppend("Console (", runtime.GOOS) uaAppend("; ", runtime.GOARCH) uaAppend(") Console/", pkg.Version) uaAppend(" Console/", pkg.ReleaseTag) uaAppend(" Console/", pkg.CommitID) return strings.Join(userAgentParts, "") } // NewHTTPTransportWithClientCerts returns a new http configuration // used while communicating with the cloud backends. func NewHTTPTransportWithClientCerts(parentTransport *http.Transport, clientCert, clientKey string) *http.Transport { transport := parentTransport.Clone() if clientCert != "" && clientKey != "" { ctx, cancel := context.WithCancel(context.Background()) defer cancel() c, err := certs.NewManager(ctx, clientCert, clientKey, tls.LoadX509KeyPair) if err != nil { LogIf(ctx, fmt.Errorf("failed to load client key and cert, please check your endpoint configuration: %s", err.Error())) } if c != nil { c.UpdateReloadDuration(10 * time.Second) c.ReloadOnSignal(syscall.SIGHUP) // allow reloads upon SIGHUP transport.TLSClientConfig.GetClientCertificate = c.GetClientCertificate } } return transport } ================================================ FILE: pkg/logger/logger_test.go ================================================ // 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 logger import ( "context" "fmt" "net/http" "net/http/httptest" "os" "testing" ) type testServer struct{} func (t *testServer) ServeHTTP(_ http.ResponseWriter, _ *http.Request) { } func TestInitializeLogger(t *testing.T) { srv := httptest.NewServer(&testServer{}) // use a random port loggerWebhookEnable := fmt.Sprintf("%s_TEST", EnvLoggerWebhookEnable) loggerWebhookEndpoint := fmt.Sprintf("%s_TEST", EnvLoggerWebhookEndpoint) loggerWebhookAuthToken := fmt.Sprintf("%s_TEST", EnvLoggerWebhookAuthToken) loggerWebhookClientCert := fmt.Sprintf("%s_TEST", EnvLoggerWebhookClientCert) loggerWebhookClientKey := fmt.Sprintf("%s_TEST", EnvLoggerWebhookClientKey) loggerWebhookQueueSize := fmt.Sprintf("%s_TEST", EnvLoggerWebhookQueueSize) auditWebhookEnable := fmt.Sprintf("%s_TEST", EnvAuditWebhookEnable) auditWebhookEndpoint := fmt.Sprintf("%s_TEST", EnvAuditWebhookEndpoint) auditWebhookAuthToken := fmt.Sprintf("%s_TEST", EnvAuditWebhookAuthToken) auditWebhookClientCert := fmt.Sprintf("%s_TEST", EnvAuditWebhookClientCert) auditWebhookClientKey := fmt.Sprintf("%s_TEST", EnvAuditWebhookClientKey) auditWebhookQueueSize := fmt.Sprintf("%s_TEST", EnvAuditWebhookQueueSize) type args struct { ctx context.Context transport *http.Transport } tests := []struct { name string args args wantErr bool setEnvVars func() unsetEnvVars func() }{ { name: "logger or auditlog is not enabled", args: args{ ctx: context.Background(), transport: http.DefaultTransport.(*http.Transport).Clone(), }, wantErr: false, setEnvVars: func() { }, unsetEnvVars: func() { }, }, { name: "logger webhook initialized correctly", args: args{ ctx: context.Background(), transport: http.DefaultTransport.(*http.Transport).Clone(), }, wantErr: false, setEnvVars: func() { os.Setenv(loggerWebhookEnable, "on") os.Setenv(loggerWebhookEndpoint, srv.URL+"/logger") os.Setenv(loggerWebhookAuthToken, "test") os.Setenv(loggerWebhookClientCert, "") os.Setenv(loggerWebhookClientKey, "") os.Setenv(loggerWebhookQueueSize, "1000") }, unsetEnvVars: func() { os.Unsetenv(loggerWebhookEnable) os.Unsetenv(loggerWebhookEndpoint) os.Unsetenv(loggerWebhookAuthToken) os.Unsetenv(loggerWebhookClientCert) os.Unsetenv(loggerWebhookClientKey) os.Unsetenv(loggerWebhookQueueSize) }, }, { name: "logger webhook failed to initialize", args: args{ ctx: context.Background(), transport: http.DefaultTransport.(*http.Transport).Clone(), }, wantErr: true, setEnvVars: func() { os.Setenv(loggerWebhookEnable, "on") os.Setenv(loggerWebhookEndpoint, "https://aklsjdakljdjkalsd.com") os.Setenv(loggerWebhookAuthToken, "test") os.Setenv(loggerWebhookClientCert, "") os.Setenv(loggerWebhookClientKey, "") os.Setenv(loggerWebhookQueueSize, "1000") }, unsetEnvVars: func() { os.Unsetenv(loggerWebhookEnable) os.Unsetenv(loggerWebhookEndpoint) os.Unsetenv(loggerWebhookAuthToken) os.Unsetenv(loggerWebhookClientCert) os.Unsetenv(loggerWebhookClientKey) os.Unsetenv(loggerWebhookQueueSize) }, }, { name: "auditlog webhook initialized correctly", args: args{ ctx: context.Background(), transport: http.DefaultTransport.(*http.Transport).Clone(), }, wantErr: false, setEnvVars: func() { os.Setenv(auditWebhookEnable, "on") os.Setenv(auditWebhookEndpoint, srv.URL+"/audit") os.Setenv(auditWebhookAuthToken, "test") os.Setenv(auditWebhookClientCert, "") os.Setenv(auditWebhookClientKey, "") os.Setenv(auditWebhookQueueSize, "1000") }, unsetEnvVars: func() { os.Unsetenv(auditWebhookEnable) os.Unsetenv(auditWebhookEndpoint) os.Unsetenv(auditWebhookAuthToken) os.Unsetenv(auditWebhookClientCert) os.Unsetenv(auditWebhookClientKey) os.Unsetenv(auditWebhookQueueSize) }, }, { name: "auditlog webhook failed to initialize", args: args{ ctx: context.Background(), transport: http.DefaultTransport.(*http.Transport).Clone(), }, wantErr: true, setEnvVars: func() { os.Setenv(auditWebhookEnable, "on") os.Setenv(auditWebhookEndpoint, "https://aklsjdakljdjkalsd.com") os.Setenv(auditWebhookAuthToken, "test") os.Setenv(auditWebhookClientCert, "") os.Setenv(auditWebhookClientKey, "") os.Setenv(auditWebhookQueueSize, "1000") }, unsetEnvVars: func() { os.Unsetenv(auditWebhookEnable) os.Unsetenv(auditWebhookEndpoint) os.Unsetenv(auditWebhookAuthToken) os.Unsetenv(auditWebhookClientCert) os.Unsetenv(auditWebhookClientKey) os.Unsetenv(auditWebhookQueueSize) }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if tt.setEnvVars != nil { tt.setEnvVars() } if err := InitializeLogger(tt.args.ctx, tt.args.transport); (err != nil) != tt.wantErr { t.Errorf("InitializeLogger() error = %v, wantErr %v", err, tt.wantErr) } if tt.unsetEnvVars != nil { tt.unsetEnvVars() } }) } } func TestEnableJSON(t *testing.T) { tests := []struct { name string }{ { name: "enable json", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { EnableJSON() if !IsJSON() { t.Errorf("EnableJSON() = %v, want %v", IsJSON(), true) } }) } } func TestEnableQuiet(t *testing.T) { tests := []struct { name string }{ { name: "enable quiet", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { EnableQuiet() if !IsQuiet() { t.Errorf("EnableQuiet() = %v, want %v", IsQuiet(), true) } }) } } func TestEnableAnonymous(t *testing.T) { tests := []struct { name string }{ { name: "enable anonymous", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { EnableAnonymous() if !IsAnonymous() { t.Errorf("EnableAnonymous() = %v, want %v", IsAnonymous(), true) } }) } } ================================================ FILE: pkg/logger/logonce.go ================================================ // 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 logger import ( "context" "errors" "net/http" "sync" "time" ) // Holds a map of recently logged errors. type logOnceType struct { IDMap map[interface{}]error sync.Mutex } // One log message per errors. func (l *logOnceType) logOnceIf(ctx context.Context, err error, id interface{}, errKind ...interface{}) { if err == nil { return } l.Lock() shouldLog := false prevErr := l.IDMap[id] if prevErr == nil { l.IDMap[id] = err shouldLog = true } else if prevErr.Error() != err.Error() { l.IDMap[id] = err shouldLog = true } l.Unlock() if shouldLog { LogIf(ctx, err, errKind...) } } // Cleanup the map every 30 minutes so that the log message is printed again for the user to notice. func (l *logOnceType) cleanupRoutine() { for { l.Lock() l.IDMap = make(map[interface{}]error) l.Unlock() time.Sleep(30 * time.Minute) } } // Returns logOnceType func newLogOnceType() *logOnceType { l := &logOnceType{IDMap: make(map[interface{}]error)} go l.cleanupRoutine() return l } var logOnce = newLogOnceType() // LogOnceIf - Logs notification errors - once per errors. // id is a unique identifier for related log messages, refer to cmd/notification.go // on how it is used. func LogOnceIf(ctx context.Context, err error, id interface{}, errKind ...interface{}) { if err == nil { return } if errors.Is(err, context.Canceled) { return } if err.Error() == http.ErrServerClosed.Error() || err.Error() == "disk not found" { return } logOnce.logOnceIf(ctx, err, id, errKind...) } ================================================ FILE: pkg/logger/message/audit/entry.go ================================================ // 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 audit import ( "net/http" "os" "strings" "time" "github.com/google/uuid" "github.com/golang-jwt/jwt/v4" "github.com/minio/console/pkg/utils" xhttp "github.com/minio/console/pkg/http" ) // Version - represents the current version of audit log structure. const Version = "1" // ObjectVersion object version key/versionId type ObjectVersion struct { ObjectName string `json:"objectName"` VersionID string `json:"versionId,omitempty"` } // Entry - audit entry logs. type Entry struct { Version string `json:"version"` DeploymentID string `json:"deploymentid,omitempty"` Time time.Time `json:"time"` Trigger string `json:"trigger"` API struct { Path string `json:"path,omitempty"` Status string `json:"status,omitempty"` Method string `json:"method"` StatusCode int `json:"statusCode,omitempty"` InputBytes int64 `json:"rx"` OutputBytes int64 `json:"tx"` TimeToFirstByte string `json:"timeToFirstByte,omitempty"` TimeToResponse string `json:"timeToResponse,omitempty"` } `json:"api"` RemoteHost string `json:"remotehost,omitempty"` RequestID string `json:"requestID,omitempty"` SessionID string `json:"sessionID,omitempty"` UserAgent string `json:"userAgent,omitempty"` ReqClaims map[string]interface{} `json:"requestClaims,omitempty"` ReqQuery map[string]string `json:"requestQuery,omitempty"` ReqHeader map[string]string `json:"requestHeader,omitempty"` RespHeader map[string]string `json:"responseHeader,omitempty"` Tags map[string]interface{} `json:"tags,omitempty"` } // NewEntry - constructs an audit entry object with some fields filled func NewEntry(deploymentID string) Entry { return Entry{ Version: Version, DeploymentID: deploymentID, Time: time.Now().UTC(), } } // ToEntry - constructs an audit entry from a http request func ToEntry(w http.ResponseWriter, r *http.Request, reqClaims map[string]interface{}, deploymentID string) Entry { entry := NewEntry(deploymentID) entry.RemoteHost = r.RemoteAddr entry.UserAgent = r.UserAgent() entry.ReqClaims = reqClaims q := r.URL.Query() reqQuery := make(map[string]string, len(q)) for k, v := range q { reqQuery[k] = strings.Join(v, ",") } entry.ReqQuery = reqQuery reqHeader := make(map[string]string, len(r.Header)) for k, v := range r.Header { reqHeader[k] = strings.Join(v, ",") } entry.ReqHeader = reqHeader wh := w.Header() var requestID interface{} requestID = r.Context().Value(utils.ContextRequestID) if requestID == nil { requestID = uuid.NewString() } entry.RequestID = requestID.(string) if val := r.Context().Value(utils.ContextRequestUserID); val != nil { sessionID := val.(string) if os.Getenv("CONSOLE_OPERATOR_MODE") != "" && os.Getenv("CONSOLE_OPERATOR_MODE") == "on" { claims := jwt.MapClaims{} _, _ = jwt.ParseWithClaims(sessionID, claims, nil) if sub, ok := claims["sub"]; ok { sessionID = sub.(string) } } entry.SessionID = sessionID } respHeader := make(map[string]string, len(wh)) for k, v := range wh { respHeader[k] = strings.Join(v, ",") } entry.RespHeader = respHeader if etag := respHeader[xhttp.ETag]; etag != "" { respHeader[xhttp.ETag] = strings.Trim(etag, `"`) } return entry } ================================================ FILE: pkg/logger/message/audit/entry_test.go ================================================ // 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 audit import ( "testing" "time" ) func TestNewEntry(t *testing.T) { type args struct { deploymentID string } tests := []struct { name string args args want Entry }{ { name: "constructs an audit entry object with some fields filled", args: args{ deploymentID: "1", }, want: Entry{ Version: Version, DeploymentID: "1", Time: time.Now().UTC(), }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if got := NewEntry(tt.args.deploymentID); got.DeploymentID != tt.want.DeploymentID { t.Errorf("NewEntry() = %v, want %v", got, tt.want) } }) } } // TODO: Please assist in fixing this test whenever you have the opportunity. // This test hasn't been executed for a long time. Upon its reintroduction in https://github.com/minio/console/pull/3171, // the test began to fail. I'm uncertain whether this test was passing from the outset or not, // but it should pass if utilized within our coverage. // func TestToEntry(t *testing.T) { // req := httptest.NewRequest(http.MethodGet, "/api/v1/tenants?test=xyz", nil) // req.Header.Set("Authorization", "xyz") // req.Header.Set("ETag", "\"ABCDE\"") // // applying context information // ctx := context.WithValue(req.Context(), utils.ContextRequestUserID, "eyJhbGciOiJSUzI1NiIsImtpZCI6Ing5cS0wSkEwQzFMWDJlRlR3dHo2b0t0NVNnRzJad0llMGVNczMxbjU0b2sifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJtaW5pby1vcGVyYXRvciIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJjb25zb2xlLXNhLXRva2VuLWJrZzZwIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImNvbnNvbGUtc2EiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJhZTE2ZGVkNS01MmM3LTRkZTQtOWUxYS1iNmI4NGU2OGMzM2UiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6bWluaW8tb3BlcmF0b3I6Y29uc29sZS1zYSJ9.AjhzekAPC59SQVBQL5sr-1dqr57-jH8a5LVazpnEr_cC0JqT4jXYjdfbrZSF9yaL4gHRv2l0kOhBlrjRK7y-IpMbxE71Fne_lSzaptSuqgI5I9dFvpVfZWP1yMAqav8mrlUoWkWDq9IAkyH4bvvZrVgQJGgd5t9U_7DQCVwbkQvy0wGS5zoMcZhYenn_Ub1BoxWcviADQ1aY1wQju8OP0IOwKTIMXMQqciOFdJ9T5-tQEGUrikTu_tW-1shUHzOxBcEzGVtBvBy2OmbNnRFYogbhmp-Dze6EAi035bY32bfL7XKBUNCW6_3VbN_h3pQNAuT2NJOSKuhJ3cGldCB2zg") // req = req.WithContext(ctx) // w := httptest.NewRecorder() // w.Header().Set("Authorization", "xyz") // w.Header().Set("ETag", "\"ABCDE\"") // type args struct { // w http.ResponseWriter // r *http.Request // reqClaims map[string]interface{} // deploymentID string // } // tests := []struct { // name string // args args // want Entry // preFunc func() // postFunc func() // }{ // { // preFunc: func() { // os.Setenv("CONSOLE_OPERATOR_MODE", "on") // }, // postFunc: func() { // os.Unsetenv("CONSOLE_OPERATOR_MODE") // }, // name: "constructs an audit entry from a http request", // args: args{ // w: w, // r: req, // reqClaims: map[string]interface{}{}, // deploymentID: "1", // }, // want: Entry{ // Version: "1", // DeploymentID: "1", // SessionID: "system:serviceaccount:minio-operator:console-sa", // ReqQuery: map[string]string{"test": "xyz"}, // ReqHeader: map[string]string{"test": "xyz"}, // RespHeader: map[string]string{"test": "xyz", "ETag": "ABCDE"}, // }, // }, // } // for _, tt := range tests { // t.Run(tt.name, func(_ *testing.T) { // if tt.preFunc != nil { // tt.preFunc() // } // if got := ToEntry(tt.args.w, tt.args.r, tt.args.reqClaims, tt.args.deploymentID); !reflect.DeepEqual(got, tt.want) { // t.Errorf("ToEntry() = %v, want %v", got, tt.want) // } // if tt.postFunc != nil { // tt.postFunc() // } // }) // } // } ================================================ FILE: pkg/logger/message/log/entry.go ================================================ // 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 log import ( "time" ) // ObjectVersion object version key/versionId type ObjectVersion struct { ObjectName string `json:"objectName"` VersionID string `json:"versionId,omitempty"` } // Args - defines the arguments for the API. type Args struct { Bucket string `json:"bucket,omitempty"` Object string `json:"object,omitempty"` VersionID string `json:"versionId,omitempty"` Objects []ObjectVersion `json:"objects,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` } // Trace - defines the trace. type Trace struct { Message string `json:"message,omitempty"` Source []string `json:"source,omitempty"` Variables map[string]interface{} `json:"variables,omitempty"` } // API - defines the api type and its args. type API struct { Name string `json:"name,omitempty"` } // Entry - defines fields and values of each log entry. type Entry struct { DeploymentID string `json:"deploymentid,omitempty"` Level string `json:"level"` LogKind string `json:"errKind"` Time time.Time `json:"time"` API *API `json:"api,omitempty"` RemoteHost string `json:"remotehost,omitempty"` Host string `json:"host,omitempty"` RequestID string `json:"requestID,omitempty"` SessionID string `json:"sessionID,omitempty"` UserAgent string `json:"userAgent,omitempty"` Message string `json:"message,omitempty"` Trace *Trace `json:"errors,omitempty"` } ================================================ FILE: pkg/logger/reqinfo.go ================================================ // 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 logger import ( "context" "fmt" "sync" "github.com/minio/console/pkg/utils" ) // KeyVal - appended to ReqInfo.Tags type KeyVal struct { Key string Val interface{} } // ObjectVersion object version key/versionId type ObjectVersion struct { ObjectName string VersionID string `json:"VersionId,omitempty"` } // ReqInfo stores the request info. type ReqInfo struct { RemoteHost string // Client Host/IP Host string // Node Host/IP UserAgent string // User Agent DeploymentID string // x-minio-deployment-id RequestID string // x-amz-request-id SessionID string // custom session id API string // API name - GetObject PutObject NewMultipartUpload etc. BucketName string `json:",omitempty"` // Bucket name ObjectName string `json:",omitempty"` // Object name VersionID string `json:",omitempty"` // corresponding versionID for the object Objects []ObjectVersion `json:",omitempty"` // Only set during MultiObject delete handler. AccessKey string // Access Key tags []KeyVal // Any additional info not accommodated by above fields sync.RWMutex } // GetTags - returns the user defined tags func (r *ReqInfo) GetTags() []KeyVal { if r == nil { return nil } r.RLock() defer r.RUnlock() return append([]KeyVal(nil), r.tags...) } // GetTagsMap - returns the user defined tags in a map structure func (r *ReqInfo) GetTagsMap() map[string]interface{} { if r == nil { return nil } r.RLock() defer r.RUnlock() m := make(map[string]interface{}, len(r.tags)) for _, t := range r.tags { m[t.Key] = t.Val } return m } // SetReqInfo sets ReqInfo in the context. func SetReqInfo(ctx context.Context, req *ReqInfo) context.Context { if ctx == nil { LogIf(context.Background(), fmt.Errorf("context is nil")) return nil } return context.WithValue(ctx, utils.ContextLogKey, req) } // GetReqInfo returns ReqInfo if set. func GetReqInfo(ctx context.Context) *ReqInfo { if ctx != nil { r, ok := ctx.Value(utils.ContextLogKey).(*ReqInfo) if ok { return r } r = &ReqInfo{} if val, o := ctx.Value(utils.ContextRequestID).(string); o { r.RequestID = val } if val, o := ctx.Value(utils.ContextRequestUserID).(string); o { r.SessionID = val } if val, o := ctx.Value(utils.ContextRequestUserAgent).(string); o { r.UserAgent = val } if val, o := ctx.Value(utils.ContextRequestHost).(string); o { r.Host = val } if val, o := ctx.Value(utils.ContextRequestRemoteAddr).(string); o { r.RemoteHost = val } SetReqInfo(ctx, r) return r } return nil } ================================================ FILE: pkg/logger/target/http/http.go ================================================ // 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 http import ( "bytes" "context" "encoding/json" "errors" "fmt" "net/http" "strings" "sync" "sync/atomic" "time" xhttp "github.com/minio/console/pkg/http" "github.com/minio/console/pkg/logger/target/types" ) // Timeout for the webhook http call const webhookCallTimeout = 5 * time.Second // Config http logger target type Config struct { Enabled bool `json:"enabled"` Name string `json:"name"` UserAgent string `json:"userAgent"` Endpoint string `json:"endpoint"` AuthToken string `json:"authToken"` ClientCert string `json:"clientCert"` ClientKey string `json:"clientKey"` QueueSize int `json:"queueSize"` Transport http.RoundTripper `json:"-"` // Custom logger LogOnce func(ctx context.Context, err error, id interface{}, errKind ...interface{}) `json:"-"` } // Target implements logger.Target and sends the json // format of a log entry to the configured http endpoint. // An internal buffer of logs is maintained but when the // buffer is full, new logs are just ignored and an errors // is returned to the caller. type Target struct { status int32 wg sync.WaitGroup // Channel of log entries logCh chan interface{} config Config } // Endpoint returns the backend endpoint func (h *Target) Endpoint() string { return h.config.Endpoint } func (h *Target) String() string { return h.config.Name } // Init validate and initialize the http target func (h *Target) Init() error { ctx, cancel := context.WithTimeout(context.Background(), 2*webhookCallTimeout) defer cancel() req, err := http.NewRequestWithContext(ctx, http.MethodPost, h.config.Endpoint, strings.NewReader(`{}`)) if err != nil { return err } req.Header.Set(xhttp.ContentType, "application/json") // Set user-agent to indicate MinIO release // version to the configured log endpoint req.Header.Set("User-Agent", h.config.UserAgent) if h.config.AuthToken != "" { req.Header.Set("Authorization", h.config.AuthToken) } client := http.Client{Transport: h.config.Transport} resp, err := client.Do(req) if err != nil { return err } // Drain any response. xhttp.DrainBody(resp.Body) if !acceptedResponseStatusCode(resp.StatusCode) { if resp.StatusCode == http.StatusForbidden { return fmt.Errorf("%s returned '%s', please check if your auth token is correctly set", h.config.Endpoint, resp.Status) } return fmt.Errorf("%s returned '%s', please check your endpoint configuration", h.config.Endpoint, resp.Status) } h.status = 1 go h.startHTTPLogger() return nil } // Accepted HTTP Status Codes var acceptedStatusCodeMap = map[int]bool{http.StatusOK: true, http.StatusCreated: true, http.StatusAccepted: true, http.StatusNoContent: true} func acceptedResponseStatusCode(code int) bool { return acceptedStatusCodeMap[code] } func (h *Target) logEntry(entry interface{}) { logJSON, err := json.Marshal(&entry) if err != nil { return } ctx, cancel := context.WithTimeout(context.Background(), webhookCallTimeout) req, err := http.NewRequestWithContext(ctx, http.MethodPost, h.config.Endpoint, bytes.NewReader(logJSON)) if err != nil { h.config.LogOnce(ctx, fmt.Errorf("%s returned '%w', please check your endpoint configuration", h.config.Endpoint, err), h.config.Endpoint) cancel() return } req.Header.Set(xhttp.ContentType, "application/json") // Set user-agent to indicate MinIO release // version to the configured log endpoint req.Header.Set("User-Agent", h.config.UserAgent) if h.config.AuthToken != "" { req.Header.Set("Authorization", h.config.AuthToken) } client := http.Client{Transport: h.config.Transport} resp, err := client.Do(req) cancel() if err != nil { h.config.LogOnce(ctx, fmt.Errorf("%s returned '%w', please check your endpoint configuration", h.config.Endpoint, err), h.config.Endpoint) return } // Drain any response. xhttp.DrainBody(resp.Body) if !acceptedResponseStatusCode(resp.StatusCode) { switch resp.StatusCode { case http.StatusForbidden: h.config.LogOnce(ctx, fmt.Errorf("%s returned '%s', please check if your auth token is correctly set", h.config.Endpoint, resp.Status), h.config.Endpoint) default: h.config.LogOnce(ctx, fmt.Errorf("%s returned '%s', please check your endpoint configuration", h.config.Endpoint, resp.Status), h.config.Endpoint) } } } func (h *Target) startHTTPLogger() { // Create a routine which sends json logs received // from an internal channel. h.wg.Add(1) go func() { defer h.wg.Done() for entry := range h.logCh { h.logEntry(entry) } }() } // New initializes a new logger target which // sends log over http to the specified endpoint func New(config Config) *Target { h := &Target{ logCh: make(chan interface{}, config.QueueSize), config: config, } return h } // Send log message 'e' to http target. func (h *Target) Send(entry interface{}, _ string) error { if atomic.LoadInt32(&h.status) == 0 { // Channel was closed or used before init. return nil } select { case h.logCh <- entry: default: // log channel is full, do not wait and return // an errors immediately to the caller return errors.New("log buffer full") } return nil } // Cancel - cancels the target func (h *Target) Cancel() { if atomic.CompareAndSwapInt32(&h.status, 1, 0) { close(h.logCh) } h.wg.Wait() } // Type - returns type of the target func (h *Target) Type() types.TargetType { return types.TargetHTTP } ================================================ FILE: pkg/logger/target/types/types.go ================================================ // 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 types // TargetType indicates type of the target e.g. console, http, kafka type TargetType uint8 // Constants for target types const ( _ TargetType = iota TargetConsole TargetHTTP ) ================================================ FILE: pkg/logger/targets.go ================================================ // 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 logger import ( "sync" "sync/atomic" "github.com/minio/console/pkg/logger/target/http" "github.com/minio/console/pkg/logger/target/types" ) // Target is the entity that we will receive // a single log entry and Send it to the log target // e.g. Send the log to a http server type Target interface { String() string Endpoint() string Init() error Cancel() Send(entry interface{}, errKind string) error Type() types.TargetType } var ( // swapMu must be held while reading slice info or swapping targets or auditTargets. swapMu sync.Mutex // systemTargets is the set of enabled loggers. // Must be immutable at all times. // Can be swapped to another while holding swapMu systemTargets = []Target{} // This is always set represent /dev/console target consoleTgt Target nTargets int32 // atomic count of len(targets) ) // SystemTargets returns active targets. // Returned slice may not be modified in any way. func SystemTargets() []Target { if atomic.LoadInt32(&nTargets) == 0 { // Lock free if none... return nil } swapMu.Lock() res := systemTargets swapMu.Unlock() return res } // AuditTargets returns active audit targets. // Returned slice may not be modified in any way. func AuditTargets() []Target { if atomic.LoadInt32(&nAuditTargets) == 0 { // Lock free if none... return nil } swapMu.Lock() res := auditTargets swapMu.Unlock() return res } // auditTargets is the list of enabled audit loggers // Must be immutable at all times. // Can be swapped to another while holding swapMu var ( auditTargets = []Target{} nAuditTargets int32 // atomic count of len(auditTargets) ) func cancelAllSystemTargets() { for _, tgt := range systemTargets { tgt.Cancel() } } func initSystemTargets(cfgMap map[string]http.Config) (tgts []Target, err error) { for _, l := range cfgMap { if l.Enabled { t := http.New(l) if err = t.Init(); err != nil { return tgts, err } tgts = append(tgts, t) } } return tgts, err } // UpdateSystemTargets swaps targets with newly loaded ones from the cfg func UpdateSystemTargets(cfg Config) error { updated, err := initSystemTargets(cfg.HTTP) if err != nil { return err } swapMu.Lock() for _, tgt := range systemTargets { // Preserve console target when dynamically updating // other HTTP targets, console target is always present. if tgt.Type() == types.TargetConsole { updated = append(updated, tgt) break } } atomic.StoreInt32(&nTargets, int32(len(updated))) cancelAllSystemTargets() // cancel running targets systemTargets = updated swapMu.Unlock() return nil } func cancelAuditTargetType(t types.TargetType) { for _, tgt := range auditTargets { if tgt.Type() == t { tgt.Cancel() } } } // UpdateAuditWebhookTargets swaps audit webhook targets with newly loaded ones from the cfg func UpdateAuditWebhookTargets(cfg Config) error { updated, err := initSystemTargets(cfg.AuditWebhook) if err != nil { return err } swapMu.Lock() atomic.StoreInt32(&nAuditTargets, int32(len(updated))) cancelAuditTargetType(types.TargetHTTP) // cancel running targets auditTargets = updated swapMu.Unlock() return nil } ================================================ FILE: pkg/logger/utils.go ================================================ // 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 logger import ( "fmt" "regexp" "runtime" "github.com/minio/console/pkg/logger/color" ) var ansiRE = regexp.MustCompile("(\x1b[^m]*m)") // Print ANSI Control escape func ansiEscape(format string, args ...interface{}) { Esc := "\x1b" fmt.Printf("%s%s", Esc, fmt.Sprintf(format, args...)) } func ansiMoveRight(n int) { if runtime.GOOS == "windows" { return } if color.IsTerminal() { ansiEscape("[%dC", n) } } func ansiSaveAttributes() { if runtime.GOOS == "windows" { return } if color.IsTerminal() { ansiEscape("7") } } func ansiRestoreAttributes() { if runtime.GOOS == "windows" { return } if color.IsTerminal() { ansiEscape("8") } } ================================================ FILE: pkg/utils/parity.go ================================================ // 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 utils import ( "errors" "fmt" "sort" "github.com/minio/pkg/v3/ellipses" ) // This file implements and supports ellipses pattern for // `minio server` command line arguments. // Supported set sizes this is used to find the optimal // single set size. var setSizes = []uint64{4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} // getDivisibleSize - returns a greatest common divisor of // all the ellipses sizes. func getDivisibleSize(totalSizes []uint64) (result uint64) { gcd := func(x, y uint64) uint64 { for y != 0 { x, y = y, x%y } return x } result = totalSizes[0] for i := 1; i < len(totalSizes); i++ { result = gcd(result, totalSizes[i]) } return result } // isValidSetSize - checks whether given count is a valid set size for erasure coding. var isValidSetSize = func(count uint64) bool { return (count >= setSizes[0] && count <= setSizes[len(setSizes)-1]) } // possibleSetCountsWithSymmetry returns symmetrical setCounts based on the // input argument patterns, the symmetry calculation is to ensure that // we also use uniform number of drives common across all ellipses patterns. func possibleSetCountsWithSymmetry(setCounts []uint64, argPatterns []ellipses.ArgPattern) []uint64 { newSetCounts := make(map[uint64]struct{}) for _, ss := range setCounts { var symmetry bool for _, argPattern := range argPatterns { for _, p := range argPattern { if uint64(len(p.Seq)) > ss { symmetry = uint64(len(p.Seq))%ss == 0 } else { symmetry = ss%uint64(len(p.Seq)) == 0 } } } // With no arg patterns, it is expected that user knows // the right symmetry, so either ellipses patterns are // provided (recommended) or no ellipses patterns. if _, ok := newSetCounts[ss]; !ok && (symmetry || argPatterns == nil) { newSetCounts[ss] = struct{}{} } } setCounts = []uint64{} for setCount := range newSetCounts { setCounts = append(setCounts, setCount) } // Not necessarily needed but it ensures to the readers // eyes that we prefer a sorted setCount slice for the // subsequent function to figure out the right common // divisor, it avoids loops. sort.Slice(setCounts, func(i, j int) bool { return setCounts[i] < setCounts[j] }) return setCounts } func commonSetDriveCount(divisibleSize uint64, setCounts []uint64) (setSize uint64) { // prefers setCounts to be sorted for optimal behavior. if divisibleSize < setCounts[len(setCounts)-1] { return divisibleSize } // Figure out largest value of total_drives_in_erasure_set which results // in least number of total_drives/total_drives_erasure_set ratio. prevD := divisibleSize / setCounts[0] for _, cnt := range setCounts { if divisibleSize%cnt == 0 { d := divisibleSize / cnt if d <= prevD { prevD = d setSize = cnt } } } return setSize } // getSetIndexes returns list of indexes which provides the set size // on each index, this function also determines the final set size // The final set size has the affinity towards choosing smaller // indexes (total sets) func getSetIndexes(args []string, totalSizes []uint64, argPatterns []ellipses.ArgPattern) (setIndexes [][]uint64, err error) { if len(totalSizes) == 0 || len(args) == 0 { return nil, errors.New("invalid argument") } setIndexes = make([][]uint64, len(totalSizes)) for _, totalSize := range totalSizes { // Check if totalSize has minimum range upto setSize if totalSize < setSizes[0] { return nil, fmt.Errorf("incorrect number of endpoints provided %s", args) } } commonSize := getDivisibleSize(totalSizes) possibleSetCounts := func(setSize uint64) (ss []uint64) { for _, s := range setSizes { if setSize%s == 0 { ss = append(ss, s) } } return ss } setCounts := possibleSetCounts(commonSize) if len(setCounts) == 0 { err = fmt.Errorf("incorrect number of endpoints provided %s, number of disks %d is not divisible by any supported erasure set sizes %d", args, commonSize, setSizes) return nil, err } // Returns possible set counts with symmetry. setCounts = possibleSetCountsWithSymmetry(setCounts, argPatterns) if len(setCounts) == 0 { err = fmt.Errorf("no symmetric distribution detected with input endpoints provided %s, disks %d cannot be spread symmetrically by any supported erasure set sizes %d", args, commonSize, setSizes) return nil, err } // Final set size with all the symmetry accounted for. setSize := commonSetDriveCount(commonSize, setCounts) // Check whether setSize is with the supported range. if !isValidSetSize(setSize) { err = fmt.Errorf("incorrect number of endpoints provided %s, number of disks %d is not divisible by any supported erasure set sizes %d", args, commonSize, setSizes) return nil, err } for i := range totalSizes { for j := uint64(0); j < totalSizes[i]/setSize; j++ { setIndexes[i] = append(setIndexes[i], setSize) } } return setIndexes, nil } // Return the total size for each argument patterns. func getTotalSizes(argPatterns []ellipses.ArgPattern) []uint64 { var totalSizes []uint64 for _, argPattern := range argPatterns { var totalSize uint64 = 1 for _, p := range argPattern { totalSize *= uint64(len(p.Seq)) } totalSizes = append(totalSizes, totalSize) } return totalSizes } // PossibleParityValues returns possible parities for input args, // parties are calculated in uniform manner for one pool or // multiple pools, ensuring that parities returned are common // and applicable across all pools. func PossibleParityValues(args ...string) ([]string, error) { setIndexes, err := parseEndpointSet(args...) if err != nil { return nil, err } maximumParity := setIndexes[0][0] / 2 var parities []string for maximumParity >= 2 { parities = append(parities, fmt.Sprintf("EC:%d", maximumParity)) maximumParity-- } return parities, nil } // Parses all arguments and returns an endpointSet which is a collection // of endpoints following the ellipses pattern, this is what is used // by the object layer for initializing itself. func parseEndpointSet(args ...string) (setIndexes [][]uint64, err error) { argPatterns := make([]ellipses.ArgPattern, len(args)) for i, arg := range args { patterns, err := ellipses.FindEllipsesPatterns(arg) if err != nil { return nil, err } argPatterns[i] = patterns } return getSetIndexes(args, getTotalSizes(argPatterns), argPatterns) } ================================================ FILE: pkg/utils/parity_test.go ================================================ // 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 utils import ( "reflect" "testing" "github.com/minio/pkg/v3/ellipses" ) func TestGetDivisibleSize(t *testing.T) { testCases := []struct { totalSizes []uint64 result uint64 }{ {[]uint64{24, 32, 16}, 8}, {[]uint64{32, 8, 4}, 4}, {[]uint64{8, 8, 8}, 8}, {[]uint64{24}, 24}, } for _, testCase := range testCases { testCase := testCase t.Run("", func(_ *testing.T) { gotGCD := getDivisibleSize(testCase.totalSizes) if testCase.result != gotGCD { t.Errorf("Expected %v, got %v", testCase.result, gotGCD) } }) } } // Test tests calculating set indexes. func TestGetSetIndexes(t *testing.T) { testCases := []struct { args []string totalSizes []uint64 indexes [][]uint64 success bool }{ // Invalid inputs. { []string{"data{1...3}"}, []uint64{3}, nil, false, }, { []string{"data/controller1/export{1...2}, data/controller2/export{1...4}, data/controller3/export{1...8}"}, []uint64{2, 4, 8}, nil, false, }, { []string{"data{1...17}/export{1...52}"}, []uint64{14144}, nil, false, }, // Valid inputs. { []string{"data{1...27}"}, []uint64{27}, [][]uint64{{9, 9, 9}}, true, }, { []string{"http://host{1...3}/data{1...180}"}, []uint64{540}, [][]uint64{{15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}}, true, }, { []string{"http://host{1...2}.rack{1...4}/data{1...180}"}, []uint64{1440}, [][]uint64{{16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}}, true, }, { []string{"http://host{1...2}/data{1...180}"}, []uint64{360}, [][]uint64{{12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12}}, true, }, { []string{"data/controller1/export{1...4}, data/controller2/export{1...8}, data/controller3/export{1...12}"}, []uint64{4, 8, 12}, [][]uint64{{4}, {4, 4}, {4, 4, 4}}, true, }, { []string{"data{1...64}"}, []uint64{64}, [][]uint64{{16, 16, 16, 16}}, true, }, { []string{"data{1...24}"}, []uint64{24}, [][]uint64{{12, 12}}, true, }, { []string{"data/controller{1...11}/export{1...8}"}, []uint64{88}, [][]uint64{{11, 11, 11, 11, 11, 11, 11, 11}}, true, }, { []string{"data{1...4}"}, []uint64{4}, [][]uint64{{4}}, true, }, { []string{"data/controller1/export{1...10}, data/controller2/export{1...10}, data/controller3/export{1...10}"}, []uint64{10, 10, 10}, [][]uint64{{10}, {10}, {10}}, true, }, { []string{"data{1...16}/export{1...52}"}, []uint64{832}, [][]uint64{{16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}}, true, }, } for _, testCase := range testCases { testCase := testCase t.Run("", func(_ *testing.T) { argPatterns := make([]ellipses.ArgPattern, len(testCase.args)) for i, arg := range testCase.args { patterns, err := ellipses.FindEllipsesPatterns(arg) if err != nil { t.Fatalf("Unexpected failure %s", err) } argPatterns[i] = patterns } gotIndexes, err := getSetIndexes(testCase.args, testCase.totalSizes, argPatterns) if err != nil && testCase.success { t.Errorf("Expected success but failed instead %s", err) } if err == nil && !testCase.success { t.Errorf("Expected failure but passed instead") } if !reflect.DeepEqual(testCase.indexes, gotIndexes) { t.Errorf("Expected %v, got %v", testCase.indexes, gotIndexes) } }) } } // Test tests possible parities returned for any input args func TestPossibleParities(t *testing.T) { testCases := []struct { arg string parities []string success bool }{ // Tests invalid inputs. { "...", nil, false, }, // No range specified. { "{...}", nil, false, }, // Invalid range. { "http://minio{2...3}/export/set{1...0}", nil, false, }, // Range cannot be smaller than 4 minimum. { "/export{1..2}", nil, false, }, // Unsupported characters. { "/export/test{1...2O}", nil, false, }, // Tests valid inputs. { "{1...27}", []string{"EC:4", "EC:3", "EC:2"}, true, }, { "/export/set{1...64}", []string{"EC:8", "EC:7", "EC:6", "EC:5", "EC:4", "EC:3", "EC:2"}, true, }, // Valid input for distributed setup. { "http://minio{2...3}/export/set{1...64}", []string{"EC:8", "EC:7", "EC:6", "EC:5", "EC:4", "EC:3", "EC:2"}, true, }, // Supporting some advanced cases. { "http://minio{1...64}.mydomain.net/data", []string{"EC:8", "EC:7", "EC:6", "EC:5", "EC:4", "EC:3", "EC:2"}, true, }, { "http://rack{1...4}.mydomain.minio{1...16}/data", []string{"EC:8", "EC:7", "EC:6", "EC:5", "EC:4", "EC:3", "EC:2"}, true, }, // Supporting kubernetes cases. { "http://minio{0...15}.mydomain.net/data{0...1}", []string{"EC:8", "EC:7", "EC:6", "EC:5", "EC:4", "EC:3", "EC:2"}, true, }, // No host regex, just disks. { "http://server1/data{1...32}", []string{"EC:8", "EC:7", "EC:6", "EC:5", "EC:4", "EC:3", "EC:2"}, true, }, // No host regex, just disks with two position numerics. { "http://server1/data{01...32}", []string{"EC:8", "EC:7", "EC:6", "EC:5", "EC:4", "EC:3", "EC:2"}, true, }, // More than 2 ellipses are supported as well. { "http://minio{2...3}/export/set{1...64}/test{1...2}", []string{"EC:8", "EC:7", "EC:6", "EC:5", "EC:4", "EC:3", "EC:2"}, true, }, // More than 1 ellipses per argument for standalone setup. { "/export{1...10}/disk{1...10}", []string{"EC:5", "EC:4", "EC:3", "EC:2"}, true, }, // IPv6 ellipses with hexadecimal expansion { "http://[2001:3984:3989::{1...a}]/disk{1...10}", []string{"EC:5", "EC:4", "EC:3", "EC:2"}, true, }, // IPv6 ellipses with hexadecimal expansion with 3 position numerics. { "http://[2001:3984:3989::{001...00a}]/disk{1...10}", []string{"EC:5", "EC:4", "EC:3", "EC:2"}, true, }, } for _, testCase := range testCases { testCase := testCase t.Run("", func(_ *testing.T) { gotPs, err := PossibleParityValues(testCase.arg) if err != nil && testCase.success { t.Errorf("Expected success but failed instead %s", err) } if err == nil && !testCase.success { t.Errorf("Expected failure but passed instead") } if !reflect.DeepEqual(testCase.parities, gotPs) { t.Errorf("Expected %v, got %v", testCase.parities, gotPs) } }) } } ================================================ FILE: pkg/utils/utils.go ================================================ // 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 utils import ( "context" ) // Key used for Get/SetReqInfo type key string const ( ContextLogKey = key("console-log") ContextRequestID = key("request-id") ContextRequestUserID = key("request-user-id") ContextRequestUserAgent = key("request-user-agent") ContextRequestHost = key("request-host") ContextRequestRemoteAddr = key("request-remote-addr") ContextAuditKey = key("request-audit-entry") ContextClientIP = key("client-ip") ) // ClientIPFromContext attempts to get the Client IP from a context, if it's not present, it returns // 127.0.0.1 func ClientIPFromContext(ctx context.Context) string { val := ctx.Value(ContextClientIP) if val != nil { return val.(string) } return "127.0.0.1" } ================================================ FILE: pkg/utils/utils_test.go ================================================ // 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 utils import ( "context" "net/url" "testing" ) func TestDecodeInput(t *testing.T) { type args struct { s string } tests := []struct { name string args args want string wantErr bool }{ { name: "chinese characters", args: args{ s: "%E5%B0%8F%E9%A3%BC%E5%BC%BE%E5%B0%8F%E9%A3%BC%E5%BC%BE%E5%B0%8F%E9%A3%BC%E5%BC%BE%2F%E5%B0%8F%E9%A3%BC%E5%BC%BE%E5%B0%8F%E9%A3%BC%E5%BC%BE%E5%B0%8F%E9%A3%BC%E5%BC%BE", }, want: "小飼弾小飼弾小飼弾/小飼弾小飼弾小飼弾", wantErr: false, }, { name: "spaces and & symbol", args: args{ s: "a%20a%20-%20a%20a%20%26%20a%20a%20-%20a%20a%20a", }, want: "a a - a a & a a - a a a", wantErr: false, }, { name: "the infamous fly me to the moon", args: args{ s: "02%2520-%2520FLY%2520ME%2520TO%2520THE%2520MOON%2520", }, want: "02%20-%20FLY%20ME%20TO%20THE%20MOON%20", wantErr: false, }, { name: "random symbols", args: args{ s: "!%40%23%24%25%5E%26*()_%2B", }, want: "!@#$%^&*()_+", wantErr: false, }, { name: "name with / symbols", args: args{ s: "test%2Ftest2%2F%E5%B0%8F%E9%A3%BC%E5%BC%BE%E5%B0%8F%E9%A3%BC%E5%BC%BE%E5%B0%8F%E9%A3%BC%E5%BC%BE.jpg", }, want: "test/test2/小飼弾小飼弾小飼弾.jpg", wantErr: false, }, { name: "decoding fails", args: args{ s: "%%this should fail%%", }, want: "", wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { got, err := url.QueryUnescape(tt.args.s) if (err != nil) != tt.wantErr { t.Errorf("DecodeBase64() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("DecodeBase64() got = %v, want %v", got, tt.want) } }) } } func TestClientIPFromContext(t *testing.T) { type args struct { ctx context.Context } tests := []struct { name string args args want string }{ { name: "working return", args: args{ ctx: context.Background(), }, want: "127.0.0.1", }, { name: "context contains ip", args: args{ ctx: context.WithValue(context.Background(), ContextClientIP, "10.0.0.1"), }, want: "10.0.0.1", }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { if got := ClientIPFromContext(tt.args.ctx); got != tt.want { t.Errorf("ClientIPFromContext() = %v, want %v", got, tt.want) } }) } } ================================================ FILE: policies/mcsTestUserAddOnly.json ================================================ { "name": "consoleTestUserAddOnly", "Statement": [ { "Action": ["admin:CreateUser"], "Effect": "Allow", "Resource": ["arn:aws:s3:::*"] } ], "version": "2012-10-17" } ================================================ FILE: replication/admin_api_int_replication_test.go ================================================ // 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 . // These tests are for AdminAPI Tag based on swagger-console.yml package replication import ( "bytes" "encoding/json" "fmt" "io" "log" "net/http" "testing" "time" "github.com/minio/console/models" "github.com/stretchr/testify/assert" ) const apiURL = "http://localhost:9090/api/v1/admin/site-replication" func makeExecuteReq(method string, body io.Reader) (*http.Response, error) { client := &http.Client{ Timeout: 10 * time.Second, } request, err := http.NewRequest( method, apiURL, body, ) if err != nil { return nil, err } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { return nil, err } return response, nil } func AddSiteReplicationInfo(sites []map[string]interface{}) (int, error) { requestDataJSON, _ := json.Marshal(sites) requestDataBody := bytes.NewReader(requestDataJSON) response, err := makeExecuteReq("POST", requestDataBody) if err != nil { log.Println(response) return -1, err } if response != nil { return response.StatusCode, nil } return -1, nil } func EditSiteReplicationInfo(editedSite map[string]interface{}) (int, error) { requestDataJSON, _ := json.Marshal(editedSite) requestDataBody := bytes.NewReader(requestDataJSON) response, err := makeExecuteReq("PUT", requestDataBody) if err != nil { return -1, err } if response != nil { return response.StatusCode, nil } return -1, nil } func DeleteSiteReplicationInfo(delReq map[string]interface{}) (int, error) { requestDataJSON, _ := json.Marshal(delReq) requestDataBody := bytes.NewReader(requestDataJSON) response, err := makeExecuteReq("DELETE", requestDataBody) if err != nil { return -1, err } if response != nil { return response.StatusCode, nil } return -1, nil } func TestGetSiteReplicationInfo(t *testing.T) { assert := assert.New(t) response, err := makeExecuteReq("GET", nil) // defer response.Body.Close() tgt := &models.SiteReplicationInfoResponse{} json.NewDecoder(response.Body).Decode(tgt) if err != nil { log.Println(err) return } if response != nil { assert.Equal(200, response.StatusCode, "Status Code is incorrect") } } func TestAddSiteReplicationInfo(t *testing.T) { assert := assert.New(t) fmt.Println("Add Site Replication") sites := make([]map[string]interface{}, 2) sites[0] = map[string]interface{}{ "accessKey": "minioadmin", "endpoint": "http://localhost:9000", "secretKey": "minioadmin", "name": "sitellhost9000", } sites[1] = map[string]interface{}{ "accessKey": "minioadmin", "endpoint": "http://minio1:9001", // Docker container . // "endpoint": "http://localhost:9001", for local development "secretKey": "minioadmin", "name": "sitellhost9001", } errorSites1 := make([]map[string]interface{}, 2) errorSites1[0] = map[string]interface{}{ "accessKey": "minioadmin", "endpoint": "http://localhost:9000", "secretKey": "minioadmin", "name": "sitellhost9000", } errorSites1[1] = map[string]interface{}{ "accessKey": "minioadmin", "endpoint": "http://non-existent:9001", "secretKey": "minioadmin", "name": "sitellhost9001", } errorSites2 := make([]map[string]interface{}, 2) errorSites2[0] = map[string]interface{}{ "accessKey": "minioadmin", "endpoint": "http://localhost:9000", "secretKey": "minioadmin", "name": "sitellhost9000", } errorSites2[1] = map[string]interface{}{ "accessKey": "minioadmin", "endpoint": "http://localhost:9000", "secretKey": "minioadmin", "name": "sitellhost9000", } type args struct { sites []map[string]interface{} } tests := []struct { name string args args expStatusCode int expectedError bool }{ // valid sites for replication config { name: "Add Two sites for Replication", args: args{ sites: sites, }, expStatusCode: 200, expectedError: false, }, // context deadline error { name: "Add Invalid Site name for Replication", args: args{ sites: errorSites1, }, expStatusCode: 500, expectedError: true, }, // site already added error 500 { name: "Add same Site name for Replication", args: args{ sites: errorSites2, }, expStatusCode: 500, expectedError: true, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { actualStatusCode, err := AddSiteReplicationInfo(tt.args.sites) fmt.Println("TestAddSiteReplicationInfo: ", actualStatusCode) if tt.expStatusCode > 0 { assert.Equal(tt.expStatusCode, actualStatusCode, "Expected Status Code is incorrect") return } if tt.expectedError { assert.NotEmpty(err) return } }) } } func TestEditSiteReplicationInfo(t *testing.T) { assert := assert.New(t) getResponse, err := makeExecuteReq("GET", nil) if err != nil { assert.Fail("Unable to get Site replication info") } getResObj := &models.SiteReplicationInfoResponse{} json.NewDecoder(getResponse.Body).Decode(getResObj) var secondDeploymentID string fmt.Println("Edit Site Replication") fmt.Println("Editing a valid site deployment id::", secondDeploymentID) updatedSiteInfo := map[string]interface{}{ "deploymentID": secondDeploymentID, "endpoint": "http://minio2:9002", // replace it with docker name // "endpoint": "http://localhost:9002", // local dev "name": "sitellhost9002", } invalidUpdatedSiteInfo := map[string]interface{}{ "deploymentID": secondDeploymentID, "endpoint": "non-existenet:9002", "name": "sitellhost9002", } invalidUpdatedSiteInfo1 := map[string]interface{}{} tests := []struct { name string args map[string]interface{} expStatusCode int expectedError bool }{ { name: "Edit an existing valid site", args: updatedSiteInfo, expStatusCode: -1, expectedError: false, }, { name: "Edit with an invalid site endpoint", args: invalidUpdatedSiteInfo, expStatusCode: 500, expectedError: false, }, { name: "Edit with an invalid empty site ", args: invalidUpdatedSiteInfo1, expStatusCode: 500, expectedError: true, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { actualStatusCode, err := EditSiteReplicationInfo(tt.args) fmt.Println("TestEditSiteReplicationInfo: ", actualStatusCode) if tt.expStatusCode > 0 { assert.Equal(tt.expStatusCode, actualStatusCode, "Expected Status Code is incorrect") return } if tt.expectedError { assert.NotEmpty(err) return } }) } } func TestDeleteSiteReplicationInfo(t *testing.T) { assert := assert.New(t) delReq := map[string]interface{}{ "all": true, "sites": []string{ "sitellhost9000", "sitellhost9001", "sitellhost9002", }, } invalidDelReq := map[string]interface{}{ "all": false, "sites": []string{ "sitellhost9000", }, } invalidDelReq1 := map[string]interface{}{ "all": true, "sites": []string{}, } tests := []struct { name string args map[string]interface{} expStatusCode int expectedError bool }{ { name: "Delete Valid Sites already added", args: delReq, expStatusCode: 204, expectedError: false, }, { name: "Delete Invalid Sites ", args: invalidDelReq, expStatusCode: 500, expectedError: true, }, { name: "Invalid delete request", args: invalidDelReq1, expStatusCode: 500, expectedError: true, }, } fmt.Println("Delete Site Replication") for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { actualStatusCode, err := DeleteSiteReplicationInfo(tt.args) fmt.Println("TestDeleteSiteReplicationInfo: ", actualStatusCode) if tt.expStatusCode > 0 { assert.Equal(tt.expStatusCode, actualStatusCode, "Expected Status Code is incorrect") return } if tt.expectedError { assert.NotEmpty(err) return } }) } } // Status API func makeStatusExecuteReq(method string, url string) (*http.Response, error) { client := &http.Client{ Timeout: 10 * time.Second, } request, err := http.NewRequest( method, url, nil, ) if err != nil { return nil, err } request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { return nil, err } return response, nil } func TestGetSiteReplicationStatus(t *testing.T) { assert := assert.New(t) const ( baseAPIURL = "http://localhost:9090/api/v1/admin/site-replication/status?" lookupDefaultParams = "users=false&groups=false&buckets=false&policies=false&" ) tests := []struct { name string args string expStatusCode int expectedError bool }{ { name: "Default replication status", args: baseAPIURL + "users=true&groups=true&buckets=true&policies=true", expStatusCode: 200, expectedError: false, }, { name: "Specific bucket lookup replication status", args: baseAPIURL + lookupDefaultParams + "entityValue=test-bucket&entityType=bucket", expStatusCode: 200, expectedError: false, }, { name: "Invalid specific bucket lookup replication status", args: baseAPIURL + lookupDefaultParams + "entityValue=test-bucket-non-existent&entityType=bucket", expStatusCode: 200, expectedError: true, }, { name: "Specific user lookup replication status", args: baseAPIURL + lookupDefaultParams + "entityValue=test-user&entityType=user", expStatusCode: 200, expectedError: false, }, { name: "Invalid user lookup replication status", args: baseAPIURL + lookupDefaultParams + "entityValue=test-user-non-existent&entityType=user", expStatusCode: 200, expectedError: false, }, { name: "Specific group lookup replication status", args: baseAPIURL + lookupDefaultParams + "entityValue=test-group&entityType=group", expStatusCode: 200, expectedError: false, }, { name: "Invalid group lookup replication status", args: baseAPIURL + lookupDefaultParams + "entityValue=test-group-non-existent&entityType=group", expStatusCode: 200, expectedError: false, }, { name: "Specific policy replication status", args: baseAPIURL + lookupDefaultParams + "entityValue=consoleAdmin&entityType=policy", expStatusCode: 200, expectedError: false, }, { name: "Invalid policy replication status", args: baseAPIURL + lookupDefaultParams + "entityValue=test-policies&entityType=policy", expStatusCode: 200, expectedError: false, }, } for ti, tt := range tests { t.Run(tt.name, func(_ *testing.T) { response, err := makeStatusExecuteReq("GET", tt.args) tgt := &models.SiteReplicationStatusResponse{} json.NewDecoder(response.Body).Decode(tgt) log.Println(err, response) if err != nil { log.Println(err) if tt.expectedError { assert.NotEmpty(err) } return } if response != nil { assert.Equal(tt.expStatusCode, response.StatusCode, "Status Code for", ti) } }) } } ================================================ FILE: replication/replication_test.go ================================================ // 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 replication import ( "bytes" "encoding/json" "fmt" "log" "net/http" "os" "strconv" "testing" "time" "github.com/go-openapi/loads" "github.com/minio/console/api" "github.com/minio/console/api/operations" ) var token string func initConsoleServer() (*api.Server, error) { // os.Setenv("CONSOLE_MINIO_SERVER", "localhost:9000") swaggerSpec, err := loads.Embedded(api.SwaggerJSON, api.FlatSwaggerJSON) if err != nil { return nil, err } noLog := func(string, ...interface{}) { // nothing to log } // Initialize MinIO loggers api.LogInfo = noLog api.LogError = noLog consoleAPI := operations.NewConsoleAPI(swaggerSpec) consoleAPI.Logger = noLog server := api.NewServer(consoleAPI) // register all APIs server.ConfigureAPI() // api.GlobalRootCAs, api.GlobalPublicCerts, api.GlobalTLSCertsManager = globalRootCAs, globalPublicCerts, globalTLSCerts consolePort, _ := strconv.Atoi("9090") server.Host = "0.0.0.0" server.Port = consolePort api.Port = "9090" api.Hostname = "0.0.0.0" return server, nil } func TestMain(m *testing.M) { // start console server go func() { fmt.Println("start server") srv, err := initConsoleServer() if err != nil { log.Println(err) log.Println("init fail") return } srv.Serve() }() fmt.Println("sleeping") time.Sleep(2 * time.Second) client := &http.Client{ Timeout: 2 * time.Second, } // get login credentials requestData := map[string]string{ "accessKey": "minioadmin", "secretKey": "minioadmin", } requestDataJSON, _ := json.Marshal(requestData) requestDataBody := bytes.NewReader(requestDataJSON) request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login", requestDataBody) if err != nil { log.Println(err) return } request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) 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() os.Exit(code) } ================================================ FILE: semgrep.yaml ================================================ rules: - id: js-func-encode-uri patterns: - pattern: encodeURI($X) message: Use encodeURIComponent() instead of encodeURI() languages: - typescript - javascript severity: WARNING fix: encodeURIComponent($X) - id: js-dangerous-func-document-write patterns: - pattern: document.write(...) message: Don't render html directly into the page, use React components instead languages: - typescript - javascript severity: WARNING - id: js-dangerous-func-assign-document-write patterns: - pattern: | $X1 = document ... $X1.write(...) message: Don't render html directly into the page, use React components instead languages: - typescript - javascript severity: WARNING - id: js-dangerous-func-document-writeln patterns: - pattern: document.writeln(...) message: Don't render html directly into the page, use React components instead languages: - typescript - javascript severity: WARNING - id: js-dangerous-func-assign-document-writeln patterns: - pattern: | $X1 = document ... $X1.writeln(...) message: Don't render html directly into the page, use React components instead languages: - typescript - javascript severity: WARNING - id: react-dangerouslysetinnerhtml languages: - typescript - javascript message: "Setting HTML from code is risky because it’s easy to inadvertently expose your users to a cross-site scripting (XSS) attack." pattern-either: - pattern: | <$X dangerouslySetInnerHTML=... /> - pattern: | {dangerouslySetInnerHTML: ...} - pattern: | $X1.innerHTML=... - pattern: | $X1.outerHTML=... - pattern: | $X1.insertAdjacentHTML=... severity: WARNING ================================================ FILE: sso-integration/Dockerfile ================================================ FROM ghcr.io/dexidp/dex:latest ADD config.docker.yaml /etc/dex/ ================================================ FILE: sso-integration/allaccess.json ================================================ { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::*" ] } ] } ================================================ FILE: sso-integration/config.docker.yaml ================================================ issuer: http://dex:5556/dex storage: type: sqlite3 config: file: /var/dex/dex.db web: http: 0.0.0.0:5556 staticClients: - id: minio-client-app secret: minio-client-app-secret name: 'MinIO Example Client App' redirectURIs: - 'http://127.0.0.1:9001/oauth_callback' connectors: - type: mockCallback id: mock name: Example enablePasswordDB: true staticPasswords: - email: "admin@example.com" hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W" username: "admin" userID: "08a8684b-db88-4b73-90a9-3cd1661f5466" ================================================ FILE: sso-integration/dex-requests.py ================================================ #!/usr/bin/env python # -*- coding: utf-8 -*- import pdb, sys, requests from bs4 import BeautifulSoup # Log in to Your Account via OpenLDAP Connector result = requests.get(sys.argv[1]) soup = BeautifulSoup(result.text, "html.parser") url = "http://dex:5556" + soup.findAll('a')[1].get('href') result = requests.get(url) soup = BeautifulSoup(result.text, "html.parser") url = "http://dex:5556" + soup.form.get('action') print(url) ================================================ FILE: sso-integration/set-sso.sh ================================================ #!/bin/sh echo "127.0.0.1 dex" | sudo tee -a /etc/hosts echo " " echo " " echo "/etc/hosts:" cat /etc/hosts echo " " echo " " ================================================ FILE: sso-integration/sso_test.go ================================================ // 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 ssointegration import ( "bytes" "encoding/base64" "encoding/json" "fmt" "io" "log" "net/http" "net/url" "os" "os/exec" "strings" "testing" "time" "github.com/minio/console/models" "github.com/go-openapi/loads" "github.com/minio/console/api" "github.com/minio/console/api/operations" consoleoauth2 "github.com/minio/console/pkg/auth/idp/oauth2" "github.com/stretchr/testify/assert" ) var token string func initConsoleServer(consoleIDPURL string) (*api.Server, error) { // Configure Console Server with vars to get the idp config from the container pcfg := map[string]consoleoauth2.ProviderConfig{ "_": { URL: consoleIDPURL, ClientID: "minio-client-app", ClientSecret: "minio-client-app-secret", RedirectCallback: "http://127.0.0.1:9090/oauth_callback", }, } swaggerSpec, err := loads.Embedded(api.SwaggerJSON, api.FlatSwaggerJSON) if err != nil { return nil, err } noLog := func(string, ...interface{}) { // nothing to log } // Initialize MinIO loggers api.LogInfo = noLog api.LogError = noLog consoleAPI := operations.NewConsoleAPI(swaggerSpec) consoleAPI.Logger = noLog api.GlobalMinIOConfig = api.MinIOConfig{ OpenIDProviders: pcfg, } server := api.NewServer(consoleAPI) // register all APIs server.ConfigureAPI() server.Host = "0.0.0.0" server.Port = 9090 api.Port = "9090" api.Hostname = "0.0.0.0" return server, nil } func TestMain(t *testing.T) { assert := assert.New(t) // start console server go func() { fmt.Println("start server") srv, err := initConsoleServer("http://dex:5556/dex/.well-known/openid-configuration") if err != nil { log.Println(err) log.Println("init fail") return } srv.Serve() }() fmt.Println("sleeping") time.Sleep(2 * time.Second) client := &http.Client{ Timeout: 2 * time.Second, } // Let's move this API here to increment our coverage getRequest, getError := http.NewRequest("GET", "http://localhost:9090/api/v1/login", nil) if getError != nil { log.Println(getError) return } getRequest.Header.Add("Content-Type", "application/json") getResponse, getErr := client.Do(getRequest) // current value: // {"loginStrategy":"form"} // but we want our console server to provide loginStrategy = redirect for SSO if getErr != nil { log.Println(getErr) return } body, err := io.ReadAll(getResponse.Body) getResponse.Body.Close() if getResponse.StatusCode > 299 { log.Fatalf("Response failed with status code: %d and\nbody: %s\n", getResponse.StatusCode, body) } if err != nil { log.Fatal(err) } var jsonMap models.LoginDetails fmt.Println(body) err = json.Unmarshal(body, &jsonMap) if err != nil { fmt.Printf("error JSON Unmarshal %s\n", err) } redirectRule := jsonMap.RedirectRules[0] redirectAsString := fmt.Sprint(redirectRule.Redirect) fmt.Println(redirectAsString) // execute script to get the code and state cmd, err := exec.Command("python3", "dex-requests.py", redirectAsString).Output() if err != nil { fmt.Printf("error %s\n", err) } urlOutput := string(cmd) fmt.Println("url output:", urlOutput) requestLoginBody := bytes.NewReader([]byte("login=dillon%40example.io&password=dillon")) // parse url remove carriage return temp2 := strings.Split(urlOutput, "\n") fmt.Println("temp2: ", temp2) urlOutput = temp2[0] // remove carriage return to avoid invalid control character in url // validate url urlParseResult, urlParseError := url.Parse(urlOutput) if urlParseError != nil { panic(urlParseError) } fmt.Println(urlParseResult) // prepare for post httpRequestLogin, newRequestError := http.NewRequest( "POST", urlOutput, requestLoginBody, ) if newRequestError != nil { fmt.Println(newRequestError) } httpRequestLogin.Header.Add("Content-Type", "application/x-www-form-urlencoded") responseLogin, errorLogin := client.Do(httpRequestLogin) if errorLogin != nil { log.Println(errorLogin) } rawQuery := responseLogin.Request.URL.RawQuery fmt.Println(rawQuery) splitRawQuery := strings.Split(rawQuery, "&state=") codeValue := strings.ReplaceAll(splitRawQuery[0], "code=", "") stateValue := splitRawQuery[1] fmt.Println("stop", splitRawQuery, codeValue, stateValue) // get login credentials codeVarIable := strings.TrimSpace(codeValue) stateVarIabl := strings.TrimSpace(stateValue) requestData := map[string]string{ "code": codeVarIable, "state": stateVarIabl, } requestDataJSON, _ := json.Marshal(requestData) requestDataBody := bytes.NewReader(requestDataJSON) request, _ := http.NewRequest( "POST", "http://localhost:9090/api/v1/login/oauth2/auth", requestDataBody, ) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) } if response != nil { for _, cookie := range response.Cookies() { if cookie.Name == "token" { token = cookie.Value break } } } fmt.Println(response.Status) if token == "" { assert.Fail("authentication token not found in cookies response") } else { fmt.Println(token) } } func TestBadLogin(t *testing.T) { assert := assert.New(t) // start console server go func() { fmt.Println("start server") srv, err := initConsoleServer("http://dex:5556") if err != nil { log.Println(err) log.Println("init fail") return } srv.Serve() }() fmt.Println("sleeping") time.Sleep(2 * time.Second) client := &http.Client{ Timeout: 2 * time.Second, } encodeItem := consoleoauth2.LoginURLParams{ State: "invalidState", IDPName: "_", } jsonState, err := json.Marshal(encodeItem) if err != nil { log.Println(err) assert.Nil(err) } // get login credentials stateVarIable := base64.StdEncoding.EncodeToString(jsonState) codeVarIable := "invalidCode" requestData := map[string]string{ "code": codeVarIable, "state": stateVarIable, } requestDataJSON, _ := json.Marshal(requestData) requestDataBody := bytes.NewReader(requestDataJSON) request, _ := http.NewRequest( "POST", "http://localhost:9090/api/v1/login/oauth2/auth", requestDataBody, ) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) fmt.Println(response) fmt.Println(err) expectedError := response.Status assert.Equal("400 Bad Request", expectedError) bodyBytes, _ := io.ReadAll(response.Body) result2 := models.APIError{} err = json.Unmarshal(bodyBytes, &result2) if err != nil { log.Println(err) assert.Nil(err) } } func initConsoleServerEnv(consoleIDPURL string) (*api.Server, error) { // Configure Console Server with vars to get the idp config from the container os.Setenv("CONSOLE_IDP_URL", consoleIDPURL) os.Setenv("CONSOLE_IDP_CLIENT_ID", "minio-client-app") os.Setenv("CONSOLE_IDP_SECRET", "minio-client-app-secret") os.Setenv("CONSOLE_IDP_CALLBACK", "http://127.0.0.1:9090") swaggerSpec, err := loads.Embedded(api.SwaggerJSON, api.FlatSwaggerJSON) if err != nil { return nil, err } noLog := func(string, ...interface{}) { // nothing to log } // Initialize MinIO loggers api.LogInfo = noLog api.LogError = noLog consoleAPI := operations.NewConsoleAPI(swaggerSpec) consoleAPI.Logger = noLog api.GlobalMinIOConfig = api.MinIOConfig{ OpenIDProviders: api.BuildOpenIDConsoleConfig(), } server := api.NewServer(consoleAPI) // register all APIs server.ConfigureAPI() server.Host = "0.0.0.0" server.Port = 9090 api.Port = "9090" api.Hostname = "0.0.0.0" return server, nil } func TestEnv(t *testing.T) { assert := assert.New(t) // start console server go func() { fmt.Println("start server") srv, err := initConsoleServerEnv("http://dex:5556/dex/.well-known/openid-configuration") if err != nil { log.Println(err) log.Println("init fail") return } srv.Serve() }() fmt.Println("sleeping") time.Sleep(2 * time.Second) client := &http.Client{ Timeout: 2 * time.Second, } // Let's move this API here to increment our coverage getRequest, getError := http.NewRequest("GET", "http://localhost:9090/api/v1/login", nil) if getError != nil { log.Println(getError) return } getRequest.Header.Add("Content-Type", "application/json") getResponse, getErr := client.Do(getRequest) // current value: // {"loginStrategy":"form"} // but we want our console server to provide loginStrategy = redirect for SSO if getErr != nil { log.Println(getErr) return } body, err := io.ReadAll(getResponse.Body) getResponse.Body.Close() if getResponse.StatusCode > 299 { log.Fatalf("Response failed with status code: %d and\nbody: %s\n", getResponse.StatusCode, body) } if err != nil { log.Fatal(err) } var jsonMap models.LoginDetails fmt.Println(body) err = json.Unmarshal(body, &jsonMap) if err != nil { fmt.Printf("error JSON Unmarshal %s\n", err) } redirectRule := jsonMap.RedirectRules[0] redirectAsString := fmt.Sprint(redirectRule.Redirect) fmt.Println(redirectAsString) // execute script to get the code and state cmd, err := exec.Command("python3", "dex-requests.py", redirectAsString).Output() if err != nil { fmt.Printf("error %s\n", err) } urlOutput := string(cmd) fmt.Println("url output:", urlOutput) requestLoginBody := bytes.NewReader([]byte("login=dillon%40example.io&password=dillon")) // parse url remove carriage return temp2 := strings.Split(urlOutput, "\n") fmt.Println("temp2: ", temp2) urlOutput = temp2[0] // remove carriage return to avoid invalid control character in url // validate url urlParseResult, urlParseError := url.Parse(urlOutput) if urlParseError != nil { panic(urlParseError) } fmt.Println(urlParseResult) // prepare for post httpRequestLogin, newRequestError := http.NewRequest( "POST", urlOutput, requestLoginBody, ) if newRequestError != nil { fmt.Println(newRequestError) } httpRequestLogin.Header.Add("Content-Type", "application/x-www-form-urlencoded") responseLogin, errorLogin := client.Do(httpRequestLogin) if errorLogin != nil { log.Println(errorLogin) } rawQuery := responseLogin.Request.URL.RawQuery fmt.Println(rawQuery) splitRawQuery := strings.Split(rawQuery, "&state=") codeValue := strings.ReplaceAll(splitRawQuery[0], "code=", "") stateValue := splitRawQuery[1] fmt.Println("stop", splitRawQuery, codeValue, stateValue) // get login credentials codeVarIable := strings.TrimSpace(codeValue) stateVarIabl := strings.TrimSpace(stateValue) requestData := map[string]string{ "code": codeVarIable, "state": stateVarIabl, } requestDataJSON, _ := json.Marshal(requestData) requestDataBody := bytes.NewReader(requestDataJSON) request, _ := http.NewRequest( "POST", "http://localhost:9090/api/v1/login/oauth2/auth", requestDataBody, ) request.Header.Add("Content-Type", "application/json") response, err := client.Do(request) if err != nil { log.Println(err) } if response != nil { for _, cookie := range response.Cookies() { if cookie.Name == "token" { token = cookie.Value break } } } fmt.Println(response.Status) if token == "" { assert.Fail("authentication token not found in cookies response") } else { fmt.Println(token) } } ================================================ FILE: swagger.yml ================================================ # @format swagger: "2.0" info: title: Console Server version: 0.1.0 consumes: - application/json produces: - application/json schemes: - http - ws basePath: /api/v1 # We are going to be taking `Authorization: Bearer TOKEN` header for our authentication securityDefinitions: key: type: oauth2 flow: accessCode authorizationUrl: http://min.io tokenUrl: http://min.io anonymous: name: X-Anonymous in: header type: apiKey # Apply the key security definition to all APIs security: - key: [] parameters: limit: name: limit in: query type: number format: int32 default: 20 offset: name: offset in: query type: number format: int32 default: 0 paths: /login: get: 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/ApiError" # Exclude this API from the authentication requirement security: [] tags: - Auth post: summary: Login to Console operationId: Login parameters: - name: body in: body required: true schema: $ref: "#/definitions/loginRequest" responses: 204: description: A successful login. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" # Exclude this API from the authentication requirement security: [] tags: - Auth /login/oauth2/auth: post: 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/ApiError" security: [] tags: - Auth /logout: post: summary: Logout from Console. operationId: Logout parameters: - name: body in: body required: true schema: $ref: "#/definitions/logoutRequest" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Auth /session: get: summary: Endpoint to check if your session is still valid operationId: SessionCheck responses: 200: description: A successful response. schema: $ref: "#/definitions/sessionResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Auth /account/change-password: post: summary: Change password of currently logged in user. operationId: AccountChangePassword parameters: - name: body in: body required: true schema: $ref: "#/definitions/accountChangePasswordRequest" responses: 204: description: A successful login. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Account /account/change-user-password: post: summary: Change password of currently logged in user. operationId: ChangeUserPassword parameters: - name: body in: body required: true schema: $ref: "#/definitions/changeUserPasswordRequest" responses: 201: description: Password successfully changed. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Account /buckets: get: summary: List Buckets operationId: ListBuckets responses: 200: description: A successful response. schema: $ref: "#/definitions/listBucketsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket post: summary: Make bucket operationId: MakeBucket parameters: - name: body in: body required: true schema: $ref: "#/definitions/makeBucketRequest" responses: 200: description: A successful response. schema: $ref: "#/definitions/makeBucketsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{name}: get: summary: Bucket Info operationId: BucketInfo parameters: - name: name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/bucket" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket delete: summary: Delete Bucket operationId: DeleteBucket parameters: - name: name in: path required: true type: string responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/retention: get: summary: Get Bucket's retention config operationId: GetBucketRetentionConfig parameters: - name: bucket_name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/getBucketRetentionConfig" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket put: summary: Set Bucket's retention config operationId: SetBucketRetentionConfig parameters: - name: bucket_name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/putBucketRetentionRequest" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/objects: get: summary: List Objects security: - key: [] - anonymous: [] operationId: ListObjects parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query required: false type: string - name: recursive in: query required: false type: boolean - name: with_versions in: query required: false type: boolean - name: with_metadata in: query required: false type: boolean - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: $ref: "#/definitions/listObjectsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object delete: summary: Delete Object operationId: DeleteObject parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query required: true type: string - name: version_id in: query required: false type: string - name: recursive in: query required: false type: boolean - name: all_versions in: query required: false type: boolean - name: non_current_versions in: query required: false type: boolean - name: bypass in: query required: false type: boolean responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/delete-objects: post: summary: Delete Multiple Objects operationId: DeleteMultipleObjects parameters: - name: bucket_name in: path required: true type: string - name: all_versions in: query required: false type: boolean - name: bypass in: query required: false type: boolean - name: files in: body required: true schema: type: array items: $ref: "#/definitions/deleteFile" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/objects/upload: post: summary: Uploads an Object. security: - key: [] - anonymous: [] consumes: - multipart/form-data parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query type: string responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/objects/download-multiple: post: summary: Download Multiple Objects operationId: DownloadMultipleObjects security: - key: [] - anonymous: [] produces: - application/octet-stream parameters: - name: bucket_name in: path required: true type: string - name: objectList in: body required: true schema: type: array items: type: string responses: 200: description: A successful response. schema: type: file default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/objects/download: get: summary: Download Object operationId: Download Object security: - key: [] - anonymous: [] produces: - application/octet-stream parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query required: true type: string - name: version_id in: query required: false type: string - name: preview in: query required: false type: boolean default: false - name: override_file_name in: query required: false type: string default: "" responses: 200: description: A successful response. schema: type: file default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/objects/share: get: summary: Shares an Object on a url operationId: ShareObject parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query required: true type: string - name: version_id in: query required: true type: string - name: expires in: query required: false type: string - name: toggle_url in: query required: false type: boolean responses: 200: description: A successful response. schema: type: string default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/objects/legalhold: put: summary: Put Object's legalhold status operationId: PutObjectLegalHold parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query required: true type: string - name: version_id in: query required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/putObjectLegalHoldRequest" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/objects/retention: put: summary: Put Object's retention status operationId: PutObjectRetention parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query required: true type: string - name: version_id in: query required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/putObjectRetentionRequest" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object delete: summary: Delete Object retention from an object operationId: DeleteObjectRetention parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query required: true type: string - name: version_id in: query required: true type: string responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/objects/tags: put: summary: Put Object's tags operationId: PutObjectTags parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query required: true type: string - name: version_id in: query required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/putObjectTagsRequest" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/objects/restore: put: summary: Restore Object to a selected version operationId: PutObjectRestore parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query required: true type: string - name: version_id in: query required: true type: string responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/objects/metadata: get: summary: Gets the metadata of an object operationId: GetObjectMetadata parameters: - name: bucket_name in: path required: true type: string - name: prefix in: query required: true type: string - name: versionID in: query type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/metadata" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Object /buckets/{bucket_name}/tags: put: summary: Put Bucket's tags operationId: PutBucketTags parameters: - name: bucket_name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/putBucketTagsRequest" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{name}/set-policy: put: summary: Bucket Set Policy operationId: BucketSetPolicy parameters: - name: name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/setBucketPolicyRequest" responses: 200: description: A successful response. schema: $ref: "#/definitions/bucket" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{name}/quota: get: summary: Get Bucket Quota operationId: GetBucketQuota parameters: - name: name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/bucketQuota" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket put: summary: Bucket Quota operationId: SetBucketQuota parameters: - name: name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/setBucketQuota" responses: 200: description: A successful response. schema: $ref: "#/definitions/bucket" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/events: get: summary: List Bucket Events operationId: ListBucketEvents parameters: - name: bucket_name in: path required: true type: string - $ref: "#/parameters/offset" - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: $ref: "#/definitions/listBucketEventsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket post: summary: Create Bucket Event operationId: CreateBucketEvent parameters: - name: bucket_name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/bucketEventRequest" responses: 201: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/events/{arn}: delete: summary: Delete Bucket Event operationId: DeleteBucketEvent parameters: - name: bucket_name in: path required: true type: string - name: arn in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/notificationDeleteRequest" responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/replication: get: summary: Bucket Replication operationId: GetBucketReplication parameters: - name: bucket_name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/bucketReplicationResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/replication/{rule_id}: get: summary: Bucket Replication operationId: GetBucketReplicationRule parameters: - name: bucket_name in: path required: true type: string - name: rule_id in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/bucketReplicationRule" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket put: summary: Update Replication rule operationId: UpdateMultiBucketReplication parameters: - name: bucket_name in: path required: true type: string - name: rule_id in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/multiBucketReplicationEdit" responses: 201: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket delete: summary: Bucket Replication Rule Delete operationId: DeleteBucketReplicationRule parameters: - name: bucket_name in: path required: true type: string - name: rule_id in: path required: true type: string responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/delete-all-replication-rules: delete: summary: Deletes all replication rules from a bucket operationId: DeleteAllReplicationRules parameters: - name: bucket_name in: path required: true type: string responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/delete-selected-replication-rules: delete: summary: Deletes selected replication rules from a bucket operationId: DeleteSelectedReplicationRules parameters: - name: bucket_name in: path required: true type: string - name: rules in: body required: true schema: $ref: "#/definitions/bucketReplicationRuleList" responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/versioning: get: summary: Bucket Versioning operationId: GetBucketVersioning parameters: - name: bucket_name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/bucketVersioningResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket put: summary: Set Bucket Versioning operationId: SetBucketVersioning parameters: - name: bucket_name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/setBucketVersioning" responses: 201: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/object-locking: get: summary: Returns the status of object locking support on the bucket operationId: GetBucketObjectLockingStatus parameters: - name: bucket_name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/bucketObLockingResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/encryption/enable: post: summary: Enable bucket encryption. operationId: EnableBucketEncryption parameters: - name: bucket_name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/bucketEncryptionRequest" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/encryption/disable: post: summary: Disable bucket encryption. operationId: DisableBucketEncryption parameters: - name: bucket_name in: path required: true type: string responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/encryption/info: get: summary: Get bucket encryption information. operationId: GetBucketEncryptionInfo parameters: - name: bucket_name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/bucketEncryptionInfo" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/lifecycle: get: summary: Bucket Lifecycle operationId: GetBucketLifecycle parameters: - name: bucket_name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/bucketLifecycleResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket post: summary: Add Bucket Lifecycle operationId: AddBucketLifecycle parameters: - name: bucket_name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/addBucketLifecycle" responses: 201: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/multi-lifecycle: post: summary: Add Multi Bucket Lifecycle operationId: AddMultiBucketLifecycle parameters: - name: body in: body required: true schema: $ref: "#/definitions/addMultiBucketLifecycle" responses: 200: description: A successful response. schema: $ref: "#/definitions/multiLifecycleResult" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/lifecycle/{lifecycle_id}: put: summary: Update Lifecycle rule operationId: UpdateBucketLifecycle parameters: - name: bucket_name in: path required: true type: string - name: lifecycle_id in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/updateBucketLifecycle" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket delete: summary: Delete Lifecycle rule operationId: DeleteBucketLifecycleRule parameters: - name: bucket_name in: path required: true type: string - name: lifecycle_id in: path required: true type: string responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/{bucket_name}/rewind/{date}: get: summary: Get objects in a bucket for a rewind date operationId: GetBucketRewind parameters: - name: bucket_name in: path required: true type: string - name: date in: path required: true type: string - name: prefix in: query required: false type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/rewindResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets/max-share-exp: get: summary: Get max expiration time for share link in seconds operationId: GetMaxShareLinkExp responses: 200: description: A successful response. schema: $ref: "#/definitions/maxShareLinkExpResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /list-external-buckets: post: summary: Lists an External list of buckets using custom credentials operationId: ListExternalBuckets parameters: - name: body in: body required: true schema: $ref: "#/definitions/listExternalBucketsParams" responses: 200: description: A successful response. schema: $ref: "#/definitions/listBucketsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /buckets-replication: post: summary: Sets Multi Bucket Replication in multiple Buckets operationId: SetMultiBucketReplication parameters: - name: body in: body required: true schema: $ref: "#/definitions/multiBucketReplication" responses: 200: description: A successful response. schema: $ref: "#/definitions/multiBucketResponseState" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /service-accounts: get: summary: List User's Service Accounts operationId: ListUserServiceAccounts parameters: - $ref: "#/parameters/offset" - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: $ref: "#/definitions/serviceAccounts" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - ServiceAccount post: summary: Create Service Account operationId: CreateServiceAccount parameters: - name: body in: body required: true schema: $ref: "#/definitions/serviceAccountRequest" responses: 201: description: A successful response. schema: $ref: "#/definitions/serviceAccountCreds" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - ServiceAccount /service-account-credentials: post: summary: Create Service Account With Credentials operationId: CreateServiceAccountCreds parameters: - name: body in: body required: true schema: $ref: "#/definitions/serviceAccountRequestCreds" responses: 201: description: A successful response. schema: $ref: "#/definitions/serviceAccountCreds" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - ServiceAccount /service-accounts/delete-multi: delete: summary: Delete Multiple Service Accounts operationId: DeleteMultipleServiceAccounts parameters: - name: selectedSA in: body required: true schema: $ref: "#/definitions/selectedSAs" responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - ServiceAccount /service-accounts/{access_key}: get: summary: Get Service Account operationId: GetServiceAccount parameters: - name: access_key in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/serviceAccount" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - ServiceAccount put: summary: Set Service Account Policy operationId: UpdateServiceAccount parameters: - name: access_key in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/updateServiceAccountRequest" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - ServiceAccount delete: summary: Delete Service Account operationId: DeleteServiceAccount parameters: - name: access_key in: path required: true type: string responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - ServiceAccount /users: get: summary: List Users operationId: ListUsers parameters: - $ref: "#/parameters/offset" - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: $ref: "#/definitions/listUsersResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User post: summary: Add User operationId: AddUser parameters: - name: body in: body required: true schema: $ref: "#/definitions/addUserRequest" responses: 201: description: A successful response. schema: $ref: "#/definitions/user" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User /users/service-accounts: post: summary: Check number of service accounts for each user specified operationId: CheckUserServiceAccounts parameters: - name: selectedUsers in: body required: true schema: $ref: "#/definitions/selectedUsers" responses: 200: description: A successful response. schema: $ref: "#/definitions/userServiceAccountSummary" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User /user/{name}: get: summary: Get User Info operationId: GetUserInfo parameters: - name: name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/user" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User put: summary: Update User Info operationId: UpdateUserInfo parameters: - name: name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/updateUser" responses: 200: description: A successful response. schema: $ref: "#/definitions/user" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User delete: summary: Remove user operationId: RemoveUser parameters: - name: name in: path required: true type: string responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User /user/{name}/groups: put: summary: Update Groups for a user operationId: UpdateUserGroups parameters: - name: name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/updateUserGroups" responses: 200: description: A successful response. schema: $ref: "#/definitions/user" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User /user/policy: get: summary: returns policies for logged in user operationId: GetUserPolicy responses: 200: description: A successful response. schema: type: string default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Policy /user/{name}/policies: get: summary: returns policies assigned for a specified user operationId: GetSAUserPolicy parameters: - name: name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/aUserPolicyResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Policy /user/{name}/service-accounts: get: summary: returns a list of service accounts for a user operationId: ListAUserServiceAccounts parameters: - name: name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/serviceAccounts" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User post: summary: Create Service Account for User operationId: CreateAUserServiceAccount parameters: - name: name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/serviceAccountRequest" responses: 201: description: A successful response. schema: $ref: "#/definitions/serviceAccountCreds" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User /user/{name}/service-account-credentials: post: summary: Create Service Account for User With Credentials operationId: CreateServiceAccountCredentials parameters: - name: name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/serviceAccountRequestCreds" responses: 201: description: A successful response. schema: $ref: "#/definitions/serviceAccountCreds" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User /users-groups-bulk: put: summary: Bulk functionality to Add Users to Groups operationId: BulkUpdateUsersGroups parameters: - name: body in: body required: true schema: $ref: "#/definitions/bulkUserGroups" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - User /groups: get: summary: List Groups operationId: ListGroups parameters: - $ref: "#/parameters/offset" - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: $ref: "#/definitions/listGroupsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Group post: summary: Add Group operationId: AddGroup parameters: - name: body in: body required: true schema: $ref: "#/definitions/addGroupRequest" responses: 201: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Group /group/{name}: get: summary: Group info operationId: GroupInfo parameters: - name: name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/group" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Group delete: summary: Remove group operationId: RemoveGroup parameters: - name: name in: path required: true type: string responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Group put: summary: Update Group Members or Status operationId: UpdateGroup parameters: - name: name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/updateGroupRequest" responses: 200: description: A successful response. schema: $ref: "#/definitions/group" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Group /policies: get: summary: List Policies operationId: ListPolicies parameters: - $ref: "#/parameters/offset" - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: $ref: "#/definitions/listPoliciesResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Policy post: summary: Add Policy operationId: AddPolicy parameters: - name: body in: body required: true schema: $ref: "#/definitions/addPolicyRequest" responses: 201: description: A successful response. schema: $ref: "#/definitions/policy" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Policy /policies/{policy}/users: get: summary: List Users for a Policy operationId: ListUsersForPolicy parameters: - name: policy in: path required: true type: string responses: 200: description: A successful response. schema: type: array items: type: string default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Policy /policies/{policy}/groups: get: summary: List Groups for a Policy operationId: ListGroupsForPolicy parameters: - name: policy in: path required: true type: string responses: 200: description: A successful response. schema: type: array items: type: string default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Policy /bucket-policy/{bucket}: get: summary: List Policies With Given Bucket operationId: ListPoliciesWithBucket parameters: - name: bucket in: path required: true type: string - $ref: "#/parameters/offset" - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: $ref: "#/definitions/listPoliciesResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /bucket/{bucket}/access-rules: put: summary: Add Access Rule To Given Bucket operationId: SetAccessRuleWithBucket parameters: - name: bucket in: path required: true type: string - name: prefixaccess in: body required: true schema: $ref: "#/definitions/prefixAccessPair" responses: 200: description: A successful response. schema: type: boolean default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket get: summary: List Access Rules With Given Bucket operationId: ListAccessRulesWithBucket parameters: - name: bucket in: path required: true type: string - $ref: "#/parameters/offset" - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: $ref: "#/definitions/listAccessRulesResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket delete: summary: Delete Access Rule From Given Bucket operationId: DeleteAccessRuleWithBucket parameters: - name: bucket in: path required: true type: string - name: prefix in: body required: true schema: $ref: "#/definitions/prefixWrapper" responses: 200: description: A successful response. schema: type: boolean default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /bucket-users/{bucket}: get: summary: List Users With Access to a Given Bucket operationId: ListUsersWithAccessToBucket parameters: - name: bucket in: path required: true type: string - $ref: "#/parameters/offset" - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: type: array items: type: string default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /policy/{name}: get: summary: Policy info operationId: PolicyInfo parameters: - name: name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/policy" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Policy delete: summary: Remove policy operationId: RemovePolicy parameters: - name: name in: path required: true type: string responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Policy /configs: get: summary: List Configurations operationId: ListConfig parameters: - $ref: "#/parameters/offset" - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: $ref: "#/definitions/listConfigResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Configuration /set-policy: put: summary: Set policy operationId: SetPolicy parameters: - name: body in: body required: true schema: $ref: "#/definitions/setPolicyNameRequest" responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Policy /set-policy-multi: put: summary: Set policy to multiple users/groups operationId: SetPolicyMultiple parameters: - name: body in: body required: true schema: $ref: "#/definitions/setPolicyMultipleNameRequest" responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Policy /configs/{name}: get: summary: Configuration info operationId: ConfigInfo parameters: - name: name in: path required: true type: string responses: 200: description: A successful response. schema: type: array items: $ref: "#/definitions/configuration" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Configuration put: summary: Set Configuration operationId: SetConfig parameters: - name: name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/setConfigRequest" responses: 200: description: A successful response. schema: $ref: "#/definitions/setConfigResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Configuration /configs/{name}/reset: post: summary: Configuration reset operationId: ResetConfig parameters: - name: name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/setConfigResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Configuration /configs/export: get: summary: Export the current config from MinIO server operationId: ExportConfig responses: 200: description: A successful response. schema: $ref: "#/definitions/configExportResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Configuration /configs/import: post: summary: Uploads a file to import MinIO server config. consumes: - multipart/form-data parameters: - name: file in: formData required: true type: file responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Configuration /service/restart: post: summary: Restart Service operationId: RestartService responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Service /profiling/start: post: summary: Start recording profile data operationId: ProfilingStart parameters: - name: body in: body required: true schema: $ref: "#/definitions/profilingStartRequest" responses: 201: description: A successful response. schema: $ref: "#/definitions/startProfilingList" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Profile /profiling/stop: post: summary: Stop and download profile data operationId: ProfilingStop produces: - application/zip responses: 201: description: A successful response. schema: type: file default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Profile /admin/info: get: summary: Returns information about the deployment operationId: AdminInfo parameters: - name: defaultOnly in: query required: false type: boolean default: false responses: 200: description: A successful response. schema: $ref: "#/definitions/adminInfoResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - System /admin/info/widgets/{widgetId}: get: summary: Returns information about the deployment operationId: DashboardWidgetDetails parameters: - name: widgetId in: path type: integer format: int32 required: true - name: start in: query type: integer - name: end in: query type: integer - name: step in: query type: integer format: int32 responses: 200: description: A successful response. schema: $ref: "#/definitions/widgetDetails" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - System /admin/arns: get: summary: Returns a list of active ARNs in the instance operationId: ArnList responses: 200: description: A successful response. schema: $ref: "#/definitions/arnsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - System /admin/notification_endpoints: get: summary: Returns a list of active notification endpoints operationId: NotificationEndpointList responses: 200: description: A successful response. schema: $ref: "#/definitions/notifEndpointResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Configuration post: summary: Allows to configure a new notification endpoint operationId: AddNotificationEndpoint parameters: - name: body in: body required: true schema: $ref: "#/definitions/notificationEndpoint" responses: 201: description: A successful response. schema: $ref: "#/definitions/setNotificationEndpointResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Configuration /admin/site-replication: get: summary: Get list of Replication Sites operationId: GetSiteReplicationInfo responses: 200: description: A successful response. schema: $ref: "#/definitions/siteReplicationInfoResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - SiteReplication post: summary: Add a Replication Site operationId: SiteReplicationInfoAdd parameters: - name: body in: body required: true schema: $ref: "#/definitions/siteReplicationAddRequest" responses: 200: description: A successful response. schema: $ref: "#/definitions/siteReplicationAddResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - SiteReplication put: summary: Edit a Replication Site operationId: SiteReplicationEdit parameters: - name: body in: body required: true schema: $ref: "#/definitions/peerInfo" responses: 200: description: A successful response. schema: $ref: "#/definitions/peerSiteEditResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - SiteReplication delete: summary: Remove a Replication Site operationId: SiteReplicationRemove parameters: - name: body in: body required: true schema: $ref: "#/definitions/peerInfoRemove" responses: 204: description: A successful response. schema: $ref: "#/definitions/peerSiteRemoveResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - SiteReplication /admin/site-replication/status: get: summary: Display overall site replication status operationId: GetSiteReplicationStatus parameters: - name: buckets description: Include Bucket stats in: query type: boolean default: true - name: groups description: Include Group stats in: query type: boolean default: true - name: policies description: Include Policies stats in: query type: boolean default: true - name: users description: Include Policies stats in: query type: boolean default: true - name: entityType description: Entity Type to lookup in: query type: string required: false - name: entityValue description: Entity Value to lookup in: query type: string required: false responses: 200: description: A successful response. schema: $ref: "#/definitions/siteReplicationStatusResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - SiteReplication /admin/tiers: get: summary: Returns a list of tiers for ilm operationId: TiersList responses: 200: description: A successful response. schema: $ref: "#/definitions/tierListResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Tiering post: summary: Allows to configure a new tier operationId: AddTier parameters: - name: body in: body required: true schema: $ref: "#/definitions/tier" responses: 201: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Tiering /admin/tiers/names: get: summary: Returns a list of tiers' names for ilm operationId: TiersListNames responses: 200: description: A successful response. schema: $ref: "#/definitions/tiersNameListResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Tiering /admin/tiers/{type}/{name}: get: summary: Get Tier operationId: GetTier parameters: - name: type in: path required: true type: string enum: - s3 - gcs - azure - minio - name: name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/tier" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Tiering /admin/tiers/{type}/{name}/credentials: put: summary: Edit Tier Credentials operationId: EditTierCredentials parameters: - name: type in: path required: true type: string enum: - s3 - gcs - azure - minio - name: name in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/tierCredentialsRequest" responses: 200: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Tiering /admin/tiers/{name}/remove: delete: summary: Remove Tier operationId: RemoveTier parameters: - name: name in: path required: true type: string responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Tiering /nodes: get: summary: Lists Nodes operationId: ListNodes responses: 200: description: A successful response. schema: type: array items: type: string default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - System /remote-buckets: get: summary: List Remote Buckets operationId: ListRemoteBuckets responses: 200: description: A successful response. schema: $ref: "#/definitions/listRemoteBucketsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket post: summary: Add Remote Bucket operationId: AddRemoteBucket parameters: - name: body in: body required: true schema: $ref: "#/definitions/createRemoteBucket" responses: 201: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /remote-buckets/{name}: get: summary: Remote Bucket Details operationId: RemoteBucketDetails parameters: - name: name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/remoteBucket" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /remote-buckets/{source_bucket_name}/{arn}: delete: summary: Delete Remote Bucket operationId: DeleteRemoteBucket parameters: - name: source_bucket_name in: path required: true type: string - name: arn in: path required: true type: string responses: 204: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket /logs/search: get: summary: Search the logs operationId: LogSearch parameters: - name: fp description: Filter Parameters in: query collectionFormat: multi type: array items: type: string - name: pageSize in: query type: number format: int32 default: 10 - name: pageNo in: query type: number format: int32 default: 0 - name: order in: query type: string enum: [timeDesc, timeAsc] default: timeDesc - name: timeStart in: query type: string - name: timeEnd in: query type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/logSearchResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Logging /kms/status: get: summary: KMS status operationId: KMSStatus responses: 200: description: A successful response. schema: $ref: "#/definitions/kmsStatusResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - KMS /kms/metrics: get: summary: KMS metrics operationId: KMSMetrics responses: 200: description: A successful response. schema: $ref: "#/definitions/kmsMetricsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - KMS /kms/apis: get: summary: KMS apis operationId: KMSAPIs responses: 200: description: A successful response. schema: $ref: "#/definitions/kmsAPIsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - KMS /kms/version: get: summary: KMS version operationId: KMSVersion responses: 200: description: A successful response. schema: $ref: "#/definitions/kmsVersionResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - KMS /kms/keys: post: summary: KMS create key operationId: KMSCreateKey parameters: - name: body in: body required: true schema: $ref: "#/definitions/kmsCreateKeyRequest" responses: 201: description: A successful response. default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - KMS get: summary: KMS list keys operationId: KMSListKeys parameters: - name: pattern description: pattern to retrieve keys in: query type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/kmsListKeysResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - KMS /kms/keys/{name}: get: summary: KMS key status operationId: KMSKeyStatus parameters: - name: name description: KMS key name in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/kmsKeyStatusResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - KMS /admin/inspect: get: summary: Inspect Files on Drive operationId: Inspect produces: - application/octet-stream parameters: - name: file in: query required: true type: string - name: volume in: query required: true type: string - name: encrypt in: query required: false type: boolean responses: 200: description: A successful response. schema: type: file default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Inspect /idp/{type}: post: summary: Create IDP Configuration operationId: CreateConfiguration consumes: - application/json parameters: - name: type description: IDP Configuration Type in: path required: true type: string - name: body in: body required: true schema: $ref: "#/definitions/idpServerConfiguration" responses: 201: description: A successful response. schema: $ref: "#/definitions/setIDPResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - idp get: summary: List IDP Configurations operationId: ListConfigurations parameters: - name: type description: IDP Configuration Type in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/idpListConfigurationsResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - idp /idp/{type}/{name}: get: summary: Get IDP Configuration operationId: GetConfiguration parameters: - name: name description: IDP Configuration Name in: path required: true type: string - name: type description: IDP Configuration Type in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/idpServerConfiguration" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - idp delete: summary: Delete IDP Configuration operationId: DeleteConfiguration parameters: - name: name description: IDP Configuration Name in: path required: true type: string - name: type description: IDP Configuration Type in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/setIDPResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - idp put: summary: Update IDP Configuration operationId: UpdateConfiguration consumes: - application/json parameters: - name: body in: body required: true schema: $ref: "#/definitions/idpServerConfiguration" - name: name description: IDP Configuration Name in: path required: true type: string - name: type description: IDP Configuration Type in: path required: true type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/setIDPResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - idp /ldap-entities: post: summary: Get LDAP Entities operationId: GetLDAPEntities parameters: - name: body in: body required: true schema: $ref: "#/definitions/ldapEntitiesRequest" responses: 200: description: A successful response. schema: $ref: "#/definitions/ldapEntities" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - idp /releases: get: summary: Get repo releases for a given version operationId: ListReleases parameters: - name: repo description: repo name in: query type: string required: true - name: current description: Current Release in: query type: string - name: search description: search content in: query type: string - name: filter description: filter releases in: query type: string responses: 200: description: A successful response. schema: $ref: "#/definitions/releaseListResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - release /download-shared-object/{url}: get: summary: Downloads an object from a presigned url operationId: DownloadSharedObject security: [] produces: - application/octet-stream parameters: - name: url in: path required: true type: string responses: 200: description: A successful response. schema: type: file default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Public definitions: accountChangePasswordRequest: type: object required: - current_secret_key - new_secret_key properties: current_secret_key: type: string new_secret_key: type: string changeUserPasswordRequest: type: object required: - selectedUser - newSecretKey properties: selectedUser: type: string newSecretKey: type: string bucketEncryptionType: type: string enum: - sse-s3 - sse-kms default: sse-s3 bucketAccess: type: string enum: - PRIVATE - PUBLIC - CUSTOM default: PRIVATE userServiceAccountItem: type: object properties: userName: type: string numSAs: type: integer format: int64 bucket: type: object required: - name properties: name: type: string minLength: 3 size: type: integer format: int64 access: $ref: "#/definitions/bucketAccess" definition: type: string rw_access: type: object properties: write: type: boolean read: type: boolean objects: type: integer format: int64 details: type: object properties: versioning: type: boolean versioningSuspended: type: boolean locking: type: boolean replication: type: boolean tags: type: object additionalProperties: type: string quota: type: object properties: quota: type: integer format: int64 type: type: string enum: - hard creation_date: type: string bucketEncryptionRequest: type: object properties: encType: $ref: "#/definitions/bucketEncryptionType" kmsKeyID: type: string bucketEncryptionInfo: type: object properties: kmsMasterKeyID: type: string algorithm: type: string listBucketsResponse: type: object properties: buckets: type: array items: $ref: "#/definitions/bucket" title: list of resulting buckets total: type: integer format: int64 title: number of buckets accessible to the user userServiceAccountSummary: type: object properties: userServiceAccountList: type: array items: $ref: "#/definitions/userServiceAccountItem" title: list of users with number of service accounts hasSA: type: boolean listObjectsResponse: type: object properties: objects: type: array items: $ref: "#/definitions/bucketObject" title: list of resulting objects total: type: integer format: int64 title: number of objects bucketObject: type: object properties: name: type: string size: type: integer format: int64 content_type: type: string last_modified: type: string is_latest: type: boolean is_delete_marker: type: boolean version_id: type: string user_tags: type: object additionalProperties: type: string expiration: type: string expiration_rule_id: type: string legal_hold_status: type: string retention_mode: type: string retention_until_date: type: string etag: type: string tags: type: object additionalProperties: type: string metadata: type: object additionalProperties: type: string user_metadata: type: object additionalProperties: type: string makeBucketRequest: type: object required: - name properties: name: type: string locking: type: boolean versioning: $ref: "#/definitions/setBucketVersioning" quota: $ref: "#/definitions/setBucketQuota" retention: $ref: "#/definitions/putBucketRetentionRequest" ApiError: type: object properties: message: type: string detailedMessage: type: string user: type: object properties: accessKey: type: string policy: type: array items: type: string memberOf: type: array items: type: string status: type: string hasPolicy: type: boolean listUsersResponse: type: object properties: users: type: array items: $ref: "#/definitions/user" title: list of resulting users selectedUsers: type: array items: type: string addUserRequest: type: object required: - accessKey - secretKey - groups - policies properties: accessKey: type: string secretKey: type: string groups: type: array items: type: string policies: type: array items: type: string group: type: object properties: name: type: string status: type: string members: type: array items: type: string policy: type: string addGroupRequest: type: object required: - group - members properties: group: type: string members: type: array items: type: string listGroupsResponse: type: object properties: groups: type: array items: type: string title: list of groups total: type: integer format: int64 title: total number of groups policy: type: object properties: name: type: string policy: type: string policyEntity: type: string enum: - user - group default: user setPolicyRequest: type: object required: - entityType - entityName properties: entityType: $ref: "#/definitions/policyEntity" entityName: type: string setPolicyNameRequest: type: object required: - name - entityType - entityName properties: name: type: array items: type: string entityType: $ref: "#/definitions/policyEntity" entityName: type: string setPolicyMultipleNameRequest: type: object properties: name: type: array items: type: string users: type: array items: $ref: "#/definitions/iamEntity" groups: type: array items: $ref: "#/definitions/iamEntity" iamEntity: type: string addPolicyRequest: type: object required: - name - policy properties: name: type: string policy: type: string updateServiceAccountRequest: type: object required: - policy properties: policy: type: string secretKey: type: string name: type: string description: type: string expiry: type: string status: type: string listPoliciesResponse: type: object properties: policies: type: array items: $ref: "#/definitions/policy" title: list of policies total: type: integer format: int64 title: total number of policies listAccessRulesResponse: type: object properties: accessRules: type: array items: $ref: "#/definitions/accessRule" title: list of policies total: type: integer format: int64 title: total number of policies accessRule: type: object properties: prefix: type: string access: type: string updateGroupRequest: type: object required: - members - status properties: members: type: array items: type: string status: type: string configDescription: type: object properties: key: type: string description: type: string configurationKV: type: object properties: key: type: string value: type: string env_override: $ref: "#/definitions/envOverride" envOverride: type: object properties: name: type: string value: type: string configuration: type: object properties: name: type: string key_values: type: array items: $ref: "#/definitions/configurationKV" listConfigResponse: type: object properties: configurations: type: array items: $ref: "#/definitions/configDescription" total: type: integer format: int64 title: total number of configurations setConfigRequest: type: object required: - key_values properties: key_values: type: array minItems: 1 items: $ref: "#/definitions/configurationKV" arn_resource_id: type: string title: Used if configuration is an event notification's target notificationEventType: type: string enum: - put - delete - get - replica - ilm - scanner notificationConfig: type: object required: - arn properties: id: type: string arn: type: string events: type: array items: $ref: "#/definitions/notificationEventType" title: "filter specific type of event. Defaults to all event (default: '[put,delete,get]')" prefix: type: string title: "filter event associated to the specified prefix" suffix: type: string title: "filter event associated to the specified suffix" notificationDeleteRequest: type: object required: - events - prefix - suffix properties: events: type: array minLength: 1 items: $ref: "#/definitions/notificationEventType" title: "filter specific type of event. Defaults to all event (default: '[put,delete,get]')" prefix: type: string title: "filter event associated to the specified prefix" suffix: type: string title: "filter event associated to the specified suffix" bucketEventRequest: type: object required: - configuration properties: configuration: $ref: "#/definitions/notificationConfig" ignoreExisting: type: boolean bucketReplicationDestination: type: object properties: bucket: type: string bucketReplicationRule: type: object properties: id: type: string status: type: string enum: - Enabled - Disabled priority: type: integer format: int32 syncMode: type: string enum: - async - sync default: async bandwidth: type: string healthCheckPeriod: type: integer delete_marker_replication: type: boolean deletes_replication: type: boolean existingObjects: type: boolean metadata_replication: type: boolean prefix: type: string tags: type: string storageClass: type: string destination: $ref: "#/definitions/bucketReplicationDestination" bucketReplicationRuleList: type: object properties: rules: type: array items: type: string bucketReplicationResponse: type: object properties: rules: type: array items: $ref: "#/definitions/bucketReplicationRule" # missing # "Filter": { # "And": {}, # "Tag": {} # } # } #} listExternalBucketsParams: required: - accessKey - secretKey - targetURL - useTLS properties: accessKey: type: string minLength: 3 secretKey: type: string minLength: 8 targetURL: type: string useTLS: type: boolean region: type: string multiBucketReplication: required: - accessKey - secretKey - targetURL - bucketsRelation properties: accessKey: type: string minLength: 3 secretKey: type: string minLength: 8 targetURL: type: string region: type: string syncMode: type: string enum: - async - sync default: async bandwidth: type: integer format: int64 healthCheckPeriod: type: integer format: int32 prefix: type: string tags: type: string replicateExistingObjects: type: boolean replicateDeleteMarkers: type: boolean replicateDeletes: type: boolean replicateMetadata: type: boolean priority: type: integer format: int32 default: 0 storageClass: type: string default: "" bucketsRelation: type: array minLength: 1 items: $ref: "#/definitions/multiBucketsRelation" multiBucketReplicationEdit: properties: ruleState: type: boolean arn: type: string prefix: type: string tags: type: string default: "" replicateDeleteMarkers: type: boolean replicateDeletes: type: boolean replicateMetadata: type: boolean replicateExistingObjects: type: boolean priority: type: integer format: int32 default: 0 storageClass: type: string default: "" multiBucketsRelation: type: object properties: originBucket: type: string destinationBucket: type: string multiBucketResponseItem: type: object properties: originBucket: type: string targetBucket: type: string errorString: type: string multiBucketResponseState: type: object properties: replicationState: type: array items: $ref: "#/definitions/multiBucketResponseItem" addBucketReplication: type: object properties: arn: type: string destination_bucket: type: string makeBucketsResponse: type: object properties: bucketName: type: string listBucketEventsResponse: type: object properties: events: type: array items: $ref: "#/definitions/notificationConfig" total: type: integer format: int64 title: total number of bucket events setBucketPolicyRequest: type: object required: - access properties: access: $ref: "#/definitions/bucketAccess" definition: type: string bucketQuota: type: object properties: quota: type: integer type: type: string enum: - hard setBucketQuota: type: object required: - enabled properties: enabled: type: boolean quota_type: type: string enum: - hard amount: type: integer loginDetails: type: object properties: loginStrategy: type: string enum: [form, redirect, service-account, redirect-service-account] redirectRules: type: array items: $ref: "#/definitions/redirectRule" isK8S: type: boolean ldap_enabled: type: boolean loginOauth2AuthRequest: type: object required: - state - code properties: state: type: string code: type: string loginRequest: type: object properties: accessKey: type: string secretKey: type: string sts: type: string features: type: object properties: hide_menu: type: boolean loginResponse: type: object properties: sessionId: type: string IDPRefreshToken: type: string logoutRequest: type: object properties: state: type: string # Structure that holds the `Bearer {TOKEN}` present on authenticated requests principal: type: object properties: STSAccessKeyID: type: string STSSecretAccessKey: type: string STSSessionToken: type: string accountAccessKey: type: string hm: type: boolean ob: type: boolean customStyleOb: type: string startProfilingItem: type: object properties: nodeName: type: string success: type: boolean error: type: string startProfilingList: type: object properties: total: type: integer format: int64 title: number of start results startResults: type: array items: $ref: "#/definitions/startProfilingItem" profilingStartRequest: type: object required: - type properties: type: type: string sessionResponse: type: object properties: features: type: array items: type: string status: type: string enum: [ok] operator: type: boolean distributedMode: type: boolean serverEndPoint: type: string permissions: type: object additionalProperties: type: array items: type: string customStyles: type: string allowResources: type: array items: $ref: "#/definitions/permissionResource" envConstants: $ref: "#/definitions/environmentConstants" widgetResult: type: object properties: metric: type: object additionalProperties: type: string values: type: array items: {} resultTarget: type: object properties: legendFormat: type: string resultType: type: string result: type: array items: $ref: "#/definitions/widgetResult" widget: type: object properties: title: type: string type: type: string id: type: integer format: int32 options: type: object properties: reduceOptions: type: object properties: calcs: type: array items: type: string targets: type: array items: $ref: "#/definitions/resultTarget" widgetDetails: type: object properties: title: type: string type: type: string id: type: integer format: int32 options: type: object properties: reduceOptions: type: object properties: calcs: type: array items: type: string targets: type: array items: $ref: "#/definitions/resultTarget" adminInfoResponse: type: object properties: buckets: type: integer objects: type: integer usage: type: integer advancedMetricsStatus: type: string enum: - not configured - available - unavailable widgets: type: array items: $ref: "#/definitions/widget" servers: type: array items: $ref: "#/definitions/serverProperties" backend: $ref: "#/definitions/BackendProperties" serverProperties: type: object properties: state: type: string endpoint: type: string uptime: type: integer version: type: string commitID: type: string poolNumber: type: integer network: type: object additionalProperties: type: string drives: type: array items: $ref: "#/definitions/serverDrives" serverDrives: type: object properties: uuid: type: string state: type: string endpoint: type: string drivePath: type: string rootDisk: type: boolean healing: type: boolean model: type: string totalSpace: type: integer usedSpace: type: integer availableSpace: type: integer BackendProperties: type: object properties: backendType: type: string rrSCParity: type: integer standardSCParity: type: integer onlineDrives: type: integer offlineDrives: type: integer arnsResponse: type: object properties: arns: type: array items: type: string updateUserGroups: type: object required: - groups properties: groups: type: array items: type: string nofiticationService: type: string enum: - webhook - amqp - kafka - mqtt - nats - nsq - mysql - postgres - elasticsearch - redis notificationEndpointItem: type: object properties: service: $ref: "#/definitions/nofiticationService" account_id: type: string status: type: string notificationEndpoint: type: object required: - service - account_id - properties properties: service: $ref: "#/definitions/nofiticationService" account_id: type: string properties: type: object additionalProperties: type: string setNotificationEndpointResponse: type: object required: - service - account_id - properties properties: service: $ref: "#/definitions/nofiticationService" account_id: type: string properties: type: object additionalProperties: type: string restart: type: boolean notifEndpointResponse: type: object properties: notification_endpoints: type: array items: $ref: "#/definitions/notificationEndpointItem" peerSiteRemoveResponse: type: object properties: status: type: string errorDetail: type: string peerSiteEditResponse: type: object properties: success: type: boolean status: type: string errorDetail: type: string peerSite: type: object properties: name: type: string endpoint: type: string accessKey: type: string secretKey: type: string peerInfo: type: object properties: endpoint: type: string name: type: string deploymentID: type: string peerInfoRemove: type: object required: - sites properties: all: type: boolean sites: type: array items: type: string siteReplicationAddRequest: type: array items: $ref: "#/definitions/peerSite" siteReplicationAddResponse: type: object properties: success: type: boolean status: type: string errorDetail: type: string initialSyncErrorMessage: type: string siteReplicationInfoResponse: type: object properties: enabled: type: boolean name: type: string sites: type: array items: $ref: "#/definitions/peerInfo" serviceAccountAccessKey: type: string siteReplicationStatusResponse: type: object properties: enabled: type: boolean maxBuckets: type: integer maxUsers: type: integer maxGroups: type: integer maxPolicies: type: integer sites: type: object statsSummary: type: object bucketStats: type: object policyStats: type: object userStats: type: object groupStats: type: object updateUser: type: object required: - status - groups properties: status: type: string groups: type: array items: type: string bulkUserGroups: type: object required: - users - groups properties: users: type: array items: type: string groups: type: array items: type: string serviceAccount: type: object properties: parentUser: type: string accountStatus: type: string impliedPolicy: type: boolean policy: type: string name: type: string description: type: string expiration: type: string serviceAccounts: type: array items: type: object properties: accountStatus: type: string name: type: string description: type: string expiration: type: string accessKey: type: string serviceAccountRequest: type: object properties: policy: type: string title: "policy to be applied to the Service Account if any" name: type: string description: type: string expiry: type: string comment: type: string serviceAccountRequestCreds: type: object properties: policy: type: string title: "policy to be applied to the Service Account if any" accessKey: type: string secretKey: type: string name: type: string description: type: string expiry: type: string comment: type: string serviceAccountCreds: type: object properties: accessKey: type: string secretKey: type: string url: type: string remoteBucket: type: object required: - accessKey - sourceBucket - remoteARN properties: accessKey: type: string minLength: 3 secretKey: type: string minLength: 8 sourceBucket: type: string targetURL: type: string targetBucket: type: string remoteARN: type: string status: type: string service: type: string enum: [replication] syncMode: type: string bandwidth: type: integer format: int64 healthCheckPeriod: type: integer createRemoteBucket: required: - accessKey - secretKey - targetURL - sourceBucket - targetBucket properties: accessKey: type: string minLength: 3 secretKey: type: string minLength: 8 targetURL: type: string sourceBucket: type: string targetBucket: type: string region: type: string syncMode: type: string enum: - async - sync default: async bandwidth: type: integer format: int64 healthCheckPeriod: type: integer format: int32 listRemoteBucketsResponse: type: object properties: buckets: type: array items: $ref: "#/definitions/remoteBucket" title: list of remote buckets total: type: integer format: int64 title: number of remote buckets accessible to user bucketVersioningResponse: type: object properties: status: type: string MFADelete: type: string excludedPrefixes: type: array items: type: object properties: prefix: type: string excludeFolders: type: boolean setBucketVersioning: type: object properties: enabled: type: boolean excludePrefixes: type: array maxLength: 10 items: type: string excludeFolders: type: boolean bucketObLockingResponse: type: object properties: object_locking_enabled: type: boolean logSearchResponse: type: object properties: results: type: object title: list of log search responses objectLegalHoldStatus: type: string enum: - enabled - disabled putObjectLegalHoldRequest: type: object required: - status properties: status: $ref: "#/definitions/objectLegalHoldStatus" objectRetentionMode: type: string enum: - governance - compliance putObjectRetentionRequest: type: object required: - mode - expires properties: mode: $ref: "#/definitions/objectRetentionMode" expires: type: string governance_bypass: type: boolean putObjectTagsRequest: type: object properties: tags: additionalProperties: type: string putBucketTagsRequest: type: object properties: tags: additionalProperties: type: string objectRetentionUnit: type: string enum: - days - years putBucketRetentionRequest: type: object required: - mode - unit - validity properties: mode: $ref: "#/definitions/objectRetentionMode" unit: $ref: "#/definitions/objectRetentionUnit" validity: type: integer format: int32 getBucketRetentionConfig: type: object properties: mode: $ref: "#/definitions/objectRetentionMode" unit: $ref: "#/definitions/objectRetentionUnit" validity: type: integer format: int32 bucketLifecycleResponse: type: object properties: lifecycle: type: array items: $ref: "#/definitions/objectBucketLifecycle" expirationResponse: type: object properties: date: type: string days: type: integer format: int64 delete_marker: type: boolean delete_all: type: boolean noncurrent_expiration_days: type: integer format: int64 newer_noncurrent_expiration_versions: type: integer format: int64 transitionResponse: type: object properties: date: type: string storage_class: type: string days: type: integer format: int64 noncurrent_transition_days: type: integer format: int64 noncurrent_storage_class: type: string lifecycleTag: type: object properties: key: type: string value: type: string objectBucketLifecycle: type: object properties: id: type: string prefix: type: string status: type: string expiration: $ref: "#/definitions/expirationResponse" transition: $ref: "#/definitions/transitionResponse" tags: type: array items: $ref: "#/definitions/lifecycleTag" addBucketLifecycle: type: object properties: type: description: ILM Rule type (Expiry or transition) type: string enum: - expiry - transition prefix: description: Non required field, it matches a prefix to perform ILM operations on it type: string tags: description: Non required field, tags to match ILM files type: string expiry_days: description: Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM type: integer format: int32 default: 0 transition_days: description: Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM type: integer format: int32 default: 0 storage_class: description: Required only in case of transition is set. it refers to a tier type: string disable: description: Non required, toggle to disable or enable rule type: boolean expired_object_delete_marker: description: Non required, toggle to disable or enable rule type: boolean expired_object_delete_all: description: Non required, toggle to disable or enable rule type: boolean noncurrentversion_expiration_days: description: Non required, can be set in case of expiration is enabled type: integer format: int32 default: 0 noncurrentversion_transition_days: description: Non required, can be set in case of transition is enabled type: integer format: int32 default: 0 newer_noncurrentversion_expiration_versions: description: Non required, can be set in case of expiration is enabled type: integer format: int32 default: 0 noncurrentversion_transition_storage_class: description: Non required, can be set in case of transition is enabled type: string updateBucketLifecycle: type: object required: - type properties: type: description: ILM Rule type (Expiry or transition) type: string enum: - expiry - transition prefix: description: Non required field, it matches a prefix to perform ILM operations on it type: string tags: description: Non required field, tags to match ILM files type: string expiry_days: description: Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM type: integer format: int32 default: 0 transition_days: description: Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM type: integer format: int32 default: 0 storage_class: description: Required only in case of transition is set. it refers to a tier type: string disable: description: Non required, toggle to disable or enable rule type: boolean expired_object_delete_marker: description: Non required, toggle to disable or enable rule type: boolean expired_object_delete_all: description: Non required, toggle to disable or enable rule type: boolean noncurrentversion_expiration_days: description: Non required, can be set in case of expiration is enabled type: integer format: int32 default: 0 noncurrentversion_transition_days: description: Non required, can be set in case of transition is enabled type: integer format: int32 default: 0 noncurrentversion_transition_storage_class: description: Non required, can be set in case of transition is enabled type: string addMultiBucketLifecycle: type: object required: - buckets - type properties: buckets: type: array items: type: string type: description: ILM Rule type (Expiry or transition) type: string enum: - expiry - transition prefix: description: Non required field, it matches a prefix to perform ILM operations on it type: string tags: description: Non required field, tags to match ILM files type: string expiry_days: description: Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM type: integer format: int32 default: 0 transition_days: description: Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM type: integer format: int32 default: 0 storage_class: description: Required only in case of transition is set. it refers to a tier type: string expired_object_delete_marker: description: Non required, toggle to disable or enable rule type: boolean expired_object_delete_all: description: Non required, toggle to disable or enable rule type: boolean noncurrentversion_expiration_days: description: Non required, can be set in case of expiration is enabled type: integer format: int32 default: 0 noncurrentversion_transition_days: description: Non required, can be set in case of transition is enabled type: integer format: int32 default: 0 noncurrentversion_transition_storage_class: description: Non required, can be set in case of transition is enabled type: string multicycleResultItem: type: object properties: bucketName: type: string error: type: string multiLifecycleResult: properties: results: type: array items: $ref: "#/definitions/multicycleResultItem" prefixAccessPair: type: object properties: prefix: type: string access: type: string prefixWrapper: type: object properties: prefix: type: string setConfigResponse: type: object properties: restart: description: Returns wheter server needs to restart to apply changes or not type: boolean configExportResponse: type: object properties: value: description: Returns base64 encoded value type: string status: type: string apiKey: type: object properties: apiKey: type: string policyArgs: type: object properties: id: type: string action: type: string bucket_name: type: string tier_s3: type: object properties: name: type: string endpoint: type: string accesskey: type: string secretkey: type: string bucket: type: string prefix: type: string region: type: string storageclass: type: string usage: type: string objects: type: string versions: type: string tier_minio: type: object properties: name: type: string endpoint: type: string accesskey: type: string secretkey: type: string bucket: type: string prefix: type: string region: type: string storageclass: type: string usage: type: string objects: type: string versions: type: string tier_azure: type: object properties: name: type: string endpoint: type: string accountname: type: string accountkey: type: string bucket: type: string prefix: type: string region: type: string usage: type: string objects: type: string versions: type: string tier_gcs: type: object properties: name: type: string endpoint: type: string creds: type: string bucket: type: string prefix: type: string region: type: string usage: type: string objects: type: string versions: type: string deleteFile: type: object properties: path: type: string versionID: type: string recursive: type: boolean userSAs: type: object properties: path: type: string versionID: type: string recursive: type: boolean tier: type: object properties: status: type: boolean type: type: string enum: - s3 - gcs - azure - minio - unsupported s3: type: object $ref: "#/definitions/tier_s3" gcs: type: object $ref: "#/definitions/tier_gcs" azure: type: object $ref: "#/definitions/tier_azure" minio: type: object $ref: "#/definitions/tier_minio" tierListResponse: type: object properties: items: type: array items: $ref: "#/definitions/tier" tiersNameListResponse: type: object properties: items: type: array items: type: string tierCredentialsRequest: type: object properties: access_key: type: string secret_key: type: string creds: type: string description: a base64 encoded value rewindItem: type: object properties: last_modified: type: string size: type: integer format: int64 version_id: type: string delete_flag: type: boolean action: type: string name: type: string is_latest: type: boolean rewindResponse: type: object properties: objects: type: array items: $ref: "#/definitions/rewindItem" iamPolicy: type: object properties: version: type: string statement: type: array items: $ref: "#/definitions/iamPolicyStatement" iamPolicyStatement: type: object properties: effect: type: string action: type: array items: type: string resource: type: array items: type: string condition: type: object additionalProperties: type: object metadata: type: object properties: objectMetadata: type: object additionalProperties: true permissionResource: type: object properties: resource: type: string conditionOperator: type: string prefixes: type: array items: type: string aUserPolicyResponse: type: object properties: policy: type: string kmsStatusResponse: type: object properties: name: type: string defaultKeyID: type: string endpoints: type: array items: $ref: "#/definitions/kmsEndpoint" kmsEndpoint: type: object properties: url: type: string status: type: string kmsKeyStatusResponse: type: object properties: keyID: type: string encryptionErr: type: string decryptionErr: type: string kmsCreateKeyRequest: type: object required: - key properties: key: type: string kmsListKeysResponse: type: object properties: results: type: array items: $ref: "#/definitions/kmsKeyInfo" kmsKeyInfo: type: object properties: name: type: string createdAt: type: string createdBy: type: string kmsMetricsResponse: type: object required: - requestOK - requestErr - requestFail - requestActive - auditEvents - errorEvents - latencyHistogram - uptime - cpus - usableCPUs - threads - heapAlloc - stackAlloc properties: requestOK: type: integer requestErr: type: integer requestFail: type: integer requestActive: type: integer auditEvents: type: integer errorEvents: type: integer latencyHistogram: type: array items: $ref: "#/definitions/kmsLatencyHistogram" uptime: type: integer cpus: type: integer usableCPUs: type: integer threads: type: integer heapAlloc: type: integer heapObjects: type: integer stackAlloc: type: integer kmsLatencyHistogram: type: object properties: duration: type: integer total: type: integer kmsAPIsResponse: type: object properties: results: type: array items: $ref: "#/definitions/kmsAPI" kmsAPI: type: object properties: method: type: string path: type: string maxBody: type: integer timeout: type: integer kmsVersionResponse: type: object properties: version: type: string environmentConstants: type: object properties: maxConcurrentUploads: type: integer maxConcurrentDownloads: type: integer redirectRule: type: object properties: redirect: type: string displayName: type: string serviceType: type: string idpServerConfiguration: type: object properties: name: type: string input: type: string type: type: string enabled: type: boolean info: type: array items: $ref: "#/definitions/idpServerConfigurationInfo" idpServerConfigurationInfo: type: object properties: key: type: string value: type: string isCfg: type: boolean isEnv: type: boolean idpListConfigurationsResponse: type: object properties: results: type: array items: $ref: "#/definitions/idpServerConfiguration" setIDPResponse: type: object properties: restart: type: boolean releaseListResponse: type: object properties: results: type: array items: $ref: "#/definitions/releaseInfo" releaseInfo: type: object properties: metadata: $ref: "#/definitions/releaseMetadata" notesContent: type: string securityContent: type: string breakingChangesContent: type: string contextContent: type: string newFeaturesContent: type: string releaseMetadata: type: object properties: tag_name: type: string target_commitish: type: string name: type: string draft: type: boolean prerelease: type: boolean id: type: integer created_at: type: string published_at: type: string url: type: string html_url: type: string assets_url: type: string upload_url: type: string zipball_url: type: string tarball_url: type: string author: $ref: "#/definitions/releaseAuthor" node_id: type: string releaseAuthor: type: object properties: login: type: string id: type: integer node_id: type: string avatar_url: type: string html_url: type: string gravatar_id: type: string type: type: string site_admin: type: boolean url: type: string events_url: type: string following_url: type: string followers_url: type: string gists_url: type: string organizations_url: type: string receivedEvents_url: type: string repos_url: type: string starred_url: type: string subscriptions_url: type: string ldapEntitiesRequest: type: object properties: users: type: array items: type: string groups: type: array items: type: string policies: type: array items: type: string ldapEntities: type: object properties: timestamp: type: string users: type: array items: $ref: "#/definitions/ldapUserPolicyEntity" groups: type: array items: $ref: "#/definitions/ldapGroupPolicyEntity" policies: type: array items: $ref: "#/definitions/ldapPolicyEntity" ldapUserPolicyEntity: type: object properties: user: type: string policies: type: array items: type: string ldapGroupPolicyEntity: type: object properties: group: type: string policies: type: array items: type: string ldapPolicyEntity: type: object properties: policy: type: string users: type: array items: type: string groups: type: array items: type: string maxShareLinkExpResponse: type: object properties: exp: type: number format: int64 required: - exp selectedSAs: type: array items: type: string ================================================ FILE: systemd/README.md ================================================ # Systemd service for Console Systemd script for Console. ## Installation - Systemd script is configured to run the binary from `/usr/local/bin/`. - Systemd script is configured to run the binary as `console-user`, make sure you create this user prior using service script. - Download the binary. Find the relevant links for the binary in the [README](https://github.com/georgmangold/console#binary-releases) or latest [Release Page](https://github.com/georgmangold/console/releases/latest/).. - DEB and RPM Packages will install the systemd service file to `/etc/systemd/system/minio-console.service`. ## Create the Environment configuration file This file serves as input to Console systemd service. ```sh $ cat <> /etc/default/console # Special opts CONSOLE_OPTS="--port 8443" # salt to encrypt JWT payload CONSOLE_PBKDF_PASSPHRASE=CHANGEME # required to encrypt JWT payload CONSOLE_PBKDF_SALT=CHANGEME # MinIO Endpoint CONSOLE_MINIO_SERVER=http://minio.endpoint:9000 EOT ``` ## Systemctl Download `console.service` in `/etc/systemd/system/` ``` ( cd /etc/systemd/system/; curl -O https://raw.githubusercontent.com/georgmangold/console/main/systemd/console.service ) ``` Enable startup on boot ``` systemctl enable console.service ``` ## Note - Replace ``User=console-user`` and ``Group=console-user`` in console.service file with your local setup. - Ensure that ``CONSOLE_PBKDF_PASSPHRASE`` and ``CONSOLE_PBKDF_SALT`` are set to appropriate values. - Ensure that ``CONSOLE_MINIO_SERVER`` is set to appropriate server endpoint. ================================================ FILE: systemd/console.service ================================================ [Unit] Description=Console UI for MinIO Documentation=https://github.com/georgmangold/console Wants=network-online.target After=network-online.target AssertFileIsExecutable=/usr/local/bin/console [Service] WorkingDirectory=/usr/local/ User=console-user Group=console-user EnvironmentFile=/etc/default/console ExecStart=/usr/local/bin/console server $CONSOLE_OPTS # Let systemd restart this service always Restart=always StartLimitBurst=2 StartLimitInterval=5 # Specifies the maximum file descriptor number that can be opened by this process LimitNOFILE=65536 # Disable timeout logic and wait until process is stopped TimeoutStopSec=infinity SendSIGKILL=no [Install] WantedBy=multi-user.target ================================================ FILE: verify-gofmt.sh ================================================ #!/bin/bash # Expanding gofmt to cover more areas. # This will include auto generated files created by Swagger. # Catching the difference due to https://github.com/golang/go/issues/46289 DIFF=$(GO111MODULE=on gofmt -d .) if [[ -n $DIFF ]]; then echo "$DIFF"; echo "please run gofmt"; exit 1; fi ================================================ FILE: web-app/.dockerignore ================================================ node_modules/ ================================================ FILE: web-app/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies node_modules/ /.pnp .pnp.js # testing /coverage # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* # Yarn (see https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored) .yarn/* !.yarn/cache !.yarn/patches !.yarn/plugins !.yarn/releases !.yarn/sdks !.yarn/versions yarn.log ================================================ FILE: web-app/.prettierignore ================================================ build coverage .nyc_output public/scripts/pdf.worker.min.mjs /src/api/consoleApi.ts ================================================ FILE: web-app/.yarnrc.yml ================================================ checksumBehavior: reset nodeLinker: node-modules ================================================ FILE: web-app/Makefile ================================================ default: build-static yarn-dep: @(corepack enable) @(yarn install) build-static: @echo "Building frontend static assets to 'build'" @if [ -f "${NVM_DIR}/nvm.sh" ]; then \. "${NVM_DIR}/nvm.sh" && nvm install && nvm use; fi && \ yarn build build-static-istanbul-coverage: @echo "Building frontend static assets to 'build'" @if [ -f "${NVM_DIR}/nvm.sh" ]; then \. "${NVM_DIR}/nvm.sh" && nvm install && nvm use; fi && \ yarn buildistanbulcoverage test-warnings: ./check-warnings.sh test-prettier: ./check-prettier.sh find-deadcode: ./check-deadcode.sh prettify: yarn prettier --write . --log-level warn pretty: prettify ================================================ FILE: web-app/README.md ================================================ # Console Frontend WebApp This Folder contains the Web Frontend for Console using React/TypeScript. ```mermaid graph TD; A(User Browser) -- HTTPS/HTTP --> B["Console
Frontend Application
(React/TypeScript)"]; B -- REST API Calls HTTPS/HTTP --> D["Console
Backend Server
(Go)"]; D -- "HTTPS/HTTP
Admin Operations" --> E["MinIO Server
Object Storage"]; E@{ shape: cyl} ``` Also refer to [DEVELOPMENT.md](../DEVELOPMENT.md) and [CONTRIBUTING.md](../CONTRIBUTING.md) for more Information on how to build this whole project. This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app) now using [Vite](https://vite.dev/) to build. Requirements: `yarn` and [node](https://nodejs.org/en/download) ## Available Scripts In the `/web-app` directory, you can run: ### `yarn start` Runs the app in the development mode. Needs Console local running in Dev Mode on Port 9090.
```bash CONSOLE_ACCESS_KEY= CONSOLE_SECRET_KEY= CONSOLE_MINIO_SERVER= CONSOLE_DEV_MODE=on ./console server ``` Opens [http://localhost:5005](http://localhost:5005) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. > [!NOTE] > If it's the first time running `yarn`, you might need to run `yarn install` before the `start` command. ### `yarn build` or `make build-static` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. Your app is ready to be deployed! > [!IMPORTANT] > Don´t commit and push changes in the `build` folder if its not a release. Discard this changes. ### `yarn vitebuild` Fast build without typechecking during development. ### `yarn typecheck` Runs typescript `tsc` to check for type errors. ### `yarn tscwatch` Runs typescript `tsc` in watch mode `--watch` ### `yarn preview` Preview the bundled output in the `build` folder with an Webserver. ### `make test-warnings`: Runs ./check-warnings.sh builds and looks for warnings during build. ### `make test-prettier`: Runs ./check-prettier.sh and checks formating with prettier. ### `make find-deadcode`: Runs ./check-deadcode.sh using knip. ### `make pretty`: Runs prettier with `yarn prettier --write . --log-level warn`. ## Learn More You can learn more in the [Vite documentation](https://vite.dev/guide/). To learn React, check out the [React documentation](https://react.dev/). ================================================ FILE: web-app/assets.go ================================================ // 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 portalui import "embed" //go:embed build/* var fs embed.FS func GetStaticAssets() embed.FS { return fs } ================================================ FILE: web-app/build/asset-manifest.json ================================================ { "files": { "main.css": "./static/css/main.849b542e.css", "main.js": "./static/js/main.b547a4b9.js", "static/js/4186.1b3f78a1.chunk.js": "./static/js/4186.1b3f78a1.chunk.js", "static/js/5354.36064e92.chunk.js": "./static/js/5354.36064e92.chunk.js", "static/js/830.04e6023f.chunk.js": "./static/js/830.04e6023f.chunk.js", "static/js/5412.b0127d7a.chunk.js": "./static/js/5412.b0127d7a.chunk.js", "static/js/6644.3349262e.chunk.js": "./static/js/6644.3349262e.chunk.js", "static/js/1378.ffc1d661.chunk.js": "./static/js/1378.ffc1d661.chunk.js", "static/js/2928.af13ae72.chunk.js": "./static/js/2928.af13ae72.chunk.js", "static/js/6777.1a21cf18.chunk.js": "./static/js/6777.1a21cf18.chunk.js", "static/js/7445.06fee929.chunk.js": "./static/js/7445.06fee929.chunk.js", "static/js/4121.672bbdc8.chunk.js": "./static/js/4121.672bbdc8.chunk.js", "static/js/6215.3dec8894.chunk.js": "./static/js/6215.3dec8894.chunk.js", "static/js/2643.b6d050d3.chunk.js": "./static/js/2643.b6d050d3.chunk.js", "static/js/5028.833420c4.chunk.js": "./static/js/5028.833420c4.chunk.js", "static/js/4169.3a4d800e.chunk.js": "./static/js/4169.3a4d800e.chunk.js", "static/js/9185.d32ef307.chunk.js": "./static/js/9185.d32ef307.chunk.js", "static/js/68.5a8e7ba6.chunk.js": "./static/js/68.5a8e7ba6.chunk.js", "static/js/7401.cd4f5830.chunk.js": "./static/js/7401.cd4f5830.chunk.js", "static/js/8308.c3429aec.chunk.js": "./static/js/8308.c3429aec.chunk.js", "static/js/4860.8173be96.chunk.js": "./static/js/4860.8173be96.chunk.js", "static/js/2684.cee177f0.chunk.js": "./static/js/2684.cee177f0.chunk.js", "static/js/4857.67bcd6f9.chunk.js": "./static/js/4857.67bcd6f9.chunk.js", "static/js/3126.ab390859.chunk.js": "./static/js/3126.ab390859.chunk.js", "static/js/9010.7725b372.chunk.js": "./static/js/9010.7725b372.chunk.js", "static/js/2258.bea2d07d.chunk.js": "./static/js/2258.bea2d07d.chunk.js", "static/js/669.866766bf.chunk.js": "./static/js/669.866766bf.chunk.js", "static/js/7478.9b6bd422.chunk.js": "./static/js/7478.9b6bd422.chunk.js", "static/js/4274.d6ff493f.chunk.js": "./static/js/4274.d6ff493f.chunk.js", "static/js/7726.c9f4960e.chunk.js": "./static/js/7726.c9f4960e.chunk.js", "static/js/583.e6916889.chunk.js": "./static/js/583.e6916889.chunk.js", "static/js/2587.58909bb0.chunk.js": "./static/js/2587.58909bb0.chunk.js", "static/js/6681.f34cfbfa.chunk.js": "./static/js/6681.f34cfbfa.chunk.js", "static/js/9117.7b97d98c.chunk.js": "./static/js/9117.7b97d98c.chunk.js", "static/js/6243.51dc4462.chunk.js": "./static/js/6243.51dc4462.chunk.js", "static/js/1715.61cf86b7.chunk.js": "./static/js/1715.61cf86b7.chunk.js", "static/js/9287.b2ca0f5b.chunk.js": "./static/js/9287.b2ca0f5b.chunk.js", "static/js/6481.1beeaf32.chunk.js": "./static/js/6481.1beeaf32.chunk.js", "static/js/8796.ac13ad63.chunk.js": "./static/js/8796.ac13ad63.chunk.js", "static/js/4388.c0e588bd.chunk.js": "./static/js/4388.c0e588bd.chunk.js", "static/js/8682.65338008.chunk.js": "./static/js/8682.65338008.chunk.js", "static/js/1634.23887961.chunk.js": "./static/js/1634.23887961.chunk.js", "static/js/5169.56e4888a.chunk.js": "./static/js/5169.56e4888a.chunk.js", "static/js/4517.15f50225.chunk.js": "./static/js/4517.15f50225.chunk.js", "static/js/7852.bfb1c5b8.chunk.js": "./static/js/7852.bfb1c5b8.chunk.js", "static/js/9459.730903fb.chunk.js": "./static/js/9459.730903fb.chunk.js", "static/js/3541.34ae70ef.chunk.js": "./static/js/3541.34ae70ef.chunk.js", "static/js/593.fb5ea6de.chunk.js": "./static/js/593.fb5ea6de.chunk.js", "static/js/3477.939cdb31.chunk.js": "./static/js/3477.939cdb31.chunk.js", "static/js/1366.a5842d56.chunk.js": "./static/js/1366.a5842d56.chunk.js", "static/js/9506.7c8601f3.chunk.js": "./static/js/9506.7c8601f3.chunk.js", "static/js/1004.94dbce53.chunk.js": "./static/js/1004.94dbce53.chunk.js", "static/js/6242.25b871ee.chunk.js": "./static/js/6242.25b871ee.chunk.js", "static/js/5238.898e912e.chunk.js": "./static/js/5238.898e912e.chunk.js", "static/js/7958.d5f7989a.chunk.js": "./static/js/7958.d5f7989a.chunk.js", "static/js/5465.15dfdf24.chunk.js": "./static/js/5465.15dfdf24.chunk.js", "static/js/6582.fb2dceaa.chunk.js": "./static/js/6582.fb2dceaa.chunk.js", "static/js/2896.27ff0208.chunk.js": "./static/js/2896.27ff0208.chunk.js", "static/js/7356.1ab60708.chunk.js": "./static/js/7356.1ab60708.chunk.js", "static/js/9559.466e0cc4.chunk.js": "./static/js/9559.466e0cc4.chunk.js", "static/js/4758.afaddc33.chunk.js": "./static/js/4758.afaddc33.chunk.js", "static/js/66.6c94b445.chunk.js": "./static/js/66.6c94b445.chunk.js", "static/js/3697.280e7ecf.chunk.js": "./static/js/3697.280e7ecf.chunk.js", "static/js/2797.c53d9c9c.chunk.js": "./static/js/2797.c53d9c9c.chunk.js", "static/js/4402.d8bb81a3.chunk.js": "./static/js/4402.d8bb81a3.chunk.js", "static/js/7102.48ea23c8.chunk.js": "./static/js/7102.48ea23c8.chunk.js", "static/js/5692.b701d50d.chunk.js": "./static/js/5692.b701d50d.chunk.js", "static/js/7945.1d42d287.chunk.js": "./static/js/7945.1d42d287.chunk.js", "static/js/9033.aff6b0dd.chunk.js": "./static/js/9033.aff6b0dd.chunk.js", "static/js/3576.48953e5a.chunk.js": "./static/js/3576.48953e5a.chunk.js", "static/js/8231.bab4a43e.chunk.js": "./static/js/8231.bab4a43e.chunk.js", "static/js/4043.e97d09a3.chunk.js": "./static/js/4043.e97d09a3.chunk.js", "static/js/4945.b4f6f750.chunk.js": "./static/js/4945.b4f6f750.chunk.js", "static/js/4803.2a486f1b.chunk.js": "./static/js/4803.2a486f1b.chunk.js", "static/js/5938.d0dc8bf3.chunk.js": "./static/js/5938.d0dc8bf3.chunk.js", "static/js/4540.316758ac.chunk.js": "./static/js/4540.316758ac.chunk.js", "static/js/3214.fea55249.chunk.js": "./static/js/3214.fea55249.chunk.js", "static/js/8350.64629895.chunk.js": "./static/js/8350.64629895.chunk.js", "static/js/1988.2b6fa00d.chunk.js": "./static/js/1988.2b6fa00d.chunk.js", "static/js/8814.7ba6f8b7.chunk.js": "./static/js/8814.7ba6f8b7.chunk.js", "static/js/2499.a423e5db.chunk.js": "./static/js/2499.a423e5db.chunk.js", "static/js/8399.dbae1106.chunk.js": "./static/js/8399.dbae1106.chunk.js", "static/js/1869.0f80c90a.chunk.js": "./static/js/1869.0f80c90a.chunk.js", "static/js/5503.a9d9da00.chunk.js": "./static/js/5503.a9d9da00.chunk.js", "static/js/116.d72fac0b.chunk.js": "./static/js/116.d72fac0b.chunk.js", "static/js/4599.93da78de.chunk.js": "./static/js/4599.93da78de.chunk.js", "static/js/9636.04da1350.chunk.js": "./static/js/9636.04da1350.chunk.js", "static/js/8894.9c332859.chunk.js": "./static/js/8894.9c332859.chunk.js", "static/js/8530.2dee5b9d.chunk.js": "./static/js/8530.2dee5b9d.chunk.js", "static/js/4964.f7712fa8.chunk.js": "./static/js/4964.f7712fa8.chunk.js", "static/js/1621.35fa42d6.chunk.js": "./static/js/1621.35fa42d6.chunk.js", "static/js/7470.4b28f453.chunk.js": "./static/js/7470.4b28f453.chunk.js", "static/js/2979.d9dd067b.chunk.js": "./static/js/2979.d9dd067b.chunk.js", "static/media/Inter-BoldItalic.woff": "./static/media/Inter-BoldItalic.b376885042f6c961a541.woff", "static/media/Inter-LightItalic.woff": "./static/media/Inter-LightItalic.ef9f65d91d2b0ba9b2e4.woff", "static/media/Inter-BlackItalic.woff": "./static/media/Inter-BlackItalic.ca1e738e4f349f27514d.woff", "static/media/Inter-Italic.woff": "./static/media/Inter-Italic.890025e726861dba417f.woff", "static/media/Inter-Bold.woff": "./static/media/Inter-Bold.93c1301bd9f486c573b3.woff", "static/media/Inter-Light.woff": "./static/media/Inter-Light.994e34451cc19ede31d3.woff", "static/media/Inter-Black.woff": "./static/media/Inter-Black.c6938660eec019fefd68.woff", "static/media/Inter-Thin.woff": "./static/media/Inter-Thin.29b9c616a95a912abf73.woff", "static/media/Inter-Regular.woff": "./static/media/Inter-Regular.8c206db99195777c6769.woff", "static/media/Inter-BoldItalic.woff2": "./static/media/Inter-BoldItalic.2d26c56a606662486796.woff2", "static/media/Inter-LightItalic.woff2": "./static/media/Inter-LightItalic.f86952265d7b0f02c921.woff2", "static/media/Inter-BlackItalic.woff2": "./static/media/Inter-BlackItalic.cb2a7335650c690077fe.woff2", "static/media/Inter-Italic.woff2": "./static/media/Inter-Italic.cb10ffd7684cd9836a05.woff2", "static/media/Inter-Bold.woff2": "./static/media/Inter-Bold.ec64ea577b0349e055ad.woff2", "static/media/Inter-Light.woff2": "./static/media/Inter-Light.2d5198822ab091ce4305.woff2", "static/media/Inter-Black.woff2": "./static/media/Inter-Black.15ca31c0a2a68f76d2d1.woff2", "static/media/Inter-Thin.woff2": "./static/media/Inter-Thin.fff2a096db014f6239d4.woff2", "static/media/Inter-Regular.woff2": "./static/media/Inter-Regular.c8ba52b05a9ef10f4758.woff2", "static/media/background.jpg": "./static/media/background.435dd27a31c18d712ec4.jpg", "index.html": "./index.html" }, "entrypoints": [ "static/css/main.849b542e.css", "static/js/main.b547a4b9.js" ] } ================================================ FILE: web-app/build/index.html ================================================ Console
================================================ FILE: web-app/build/manifest.json ================================================ { "name": "Console", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" }, { "src": "logo192.png", "type": "image/png", "sizes": "192x192" }, { "src": "logo512.png", "type": "image/png", "sizes": "512x512" }, { "src": "android-icon-36x36.png", "sizes": "36x36", "type": "image/png", "density": "0.75" }, { "src": "android-icon-48x48.png", "sizes": "48x48", "type": "image/png", "density": "1.0" }, { "src": "android-icon-72x72.png", "sizes": "72x72", "type": "image/png", "density": "1.5" }, { "src": "android-icon-96x96.png", "sizes": "96x96", "type": "image/png", "density": "2.0" }, { "src": "android-icon-144x144.png", "sizes": "144x144", "type": "image/png", "density": "3.0" } ] } ================================================ FILE: web-app/build/robots.txt ================================================ User-agent: * Disallow: / ================================================ FILE: web-app/build/scripts/pdf.worker.min.mjs ================================================ /** * @licstart The following is the entire license notice for the * JavaScript code in this page * * Copyright 2024 Mozilla Foundation * * 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. * * @licend The above is the entire license notice for the * JavaScript code in this page */ /** * pdfjsVersion = 5.4.296 * pdfjsBuild = f56dc8601 */const e=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),t=[.001,0,0,.001,0,0],a=1.35,r=.35,i=.25925925925925924,n=1,s=2,o=4,c=8,l=16,h=64,u=128,d=256,f="pdfjs_internal_editor_",g=3,p=9,m=13,b=15,y=101,w={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},x=0,S=4,k=1,C=2,v=3,F={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},T="Group",O="R",M=1,D=2,R=4,N=16,E=32,L=128,_=512,j=1,U=2,X=4096,q=8192,H=32768,W=65536,z=131072,$=1048576,G=2097152,V=8388608,K=16777216,J=1,Y=2,Z=3,Q=4,ee=5,te={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},ae={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},re={O:"PageOpen",C:"PageClose"},ie=1,ne=5,se=1,oe=2,ce=3,le=4,he=5,ue=6,de=7,fe=8,ge=9,pe=10,me=11,be=12,ye=13,we=14,xe=15,Se=16,Ae=17,ke=18,Ce=19,ve=20,Fe=21,Ie=22,Te=23,Oe=24,Me=25,De=26,Be=27,Re=28,Ne=29,Ee=30,Pe=31,Le=32,_e=33,je=34,Ue=35,Xe=36,qe=37,He=38,We=39,ze=40,$e=41,Ge=42,Ve=43,Ke=44,Je=45,Ye=46,Ze=47,Qe=48,et=49,tt=50,at=51,rt=52,it=53,nt=54,st=55,ot=56,ct=57,lt=58,ht=59,ut=60,dt=61,ft=62,gt=63,pt=64,mt=65,bt=66,yt=67,wt=68,xt=69,St=70,At=71,kt=72,Ct=73,vt=74,Ft=75,It=76,Tt=77,Ot=80,Mt=81,Dt=83,Bt=84,Rt=85,Nt=86,Et=87,Pt=88,Lt=89,_t=90,jt=91,Ut=92,Xt=93,qt=94,Ht=0,Wt=1,zt=2,$t=3,Gt=1,Vt=2;let Kt=ie;function getVerbosityLevel(){return Kt}function info(e){Kt>=ne&&console.info(`Info: ${e}`)}function warn(e){Kt>=ie&&console.warn(`Warning: ${e}`)}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function createValidAbsoluteUrl(e,t=null,a=null){if(!e)return null;if(a&&"string"==typeof e){if(a.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(a.tryConvertEncoding)try{e=stringToUTF8String(e)}catch{}}const r=t?URL.parse(e,t):URL.parse(e);return function _isValidProtocol(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r)?r:null}function shadow(e,t,a,r=!1){Object.defineProperty(e,t,{value:a,enumerable:!r,configurable:!0,writable:!1});return a}const Jt=function BaseExceptionClosure(){function BaseException(e,t){this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();class PasswordException extends Jt{constructor(e,t){super(e,"PasswordException");this.code=t}}class UnknownErrorException extends Jt{constructor(e,t){super(e,"UnknownErrorException");this.details=t}}class InvalidPDFException extends Jt{constructor(e){super(e,"InvalidPDFException")}}class ResponseException extends Jt{constructor(e,t,a){super(e,"ResponseException");this.status=t;this.missing=a}}class FormatError extends Jt{constructor(e){super(e,"FormatError")}}class AbortException extends Jt{constructor(e){super(e,"AbortException")}}function bytesToString(e){"object"==typeof e&&void 0!==e?.length||unreachable("Invalid argument for bytesToString");const t=e.length,a=8192;if(t>24&255,e>>16&255,e>>8&255,255&e)}function objectSize(e){return Object.keys(e).length}class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return shadow(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get platform(){const{platform:e,userAgent:t}=navigator;return shadow(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCSSRoundSupported(){return shadow(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const Yt=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0"));class Util{static makeHexColor(e,t,a){return`#${Yt[e]}${Yt[t]}${Yt[a]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}static scaleMinMax(e,t){let a;if(e[0]){if(e[0]<0){a=t[0];t[0]=t[2];t[2]=a}t[0]*=e[0];t[2]*=e[0];if(e[3]<0){a=t[1];t[1]=t[3];t[3]=a}t[1]*=e[3];t[3]*=e[3]}else{a=t[0];t[0]=t[1];t[1]=a;a=t[2];t[2]=t[3];t[3]=a;if(e[1]<0){a=t[1];t[1]=t[3];t[3]=a}t[1]*=e[1];t[3]*=e[1];if(e[2]<0){a=t[0];t[0]=t[2];t[2]=a}t[0]*=e[2];t[2]*=e[2]}t[0]+=e[4];t[1]+=e[5];t[2]+=e[4];t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,a=0){const r=e[a],i=e[a+1];e[a]=r*t[0]+i*t[2]+t[4];e[a+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,a=0){const r=t[0],i=t[1],n=t[2],s=t[3],o=t[4],c=t[5];for(let t=0;t<6;t+=2){const l=e[a+t],h=e[a+t+1];e[a+t]=l*r+h*n+o;e[a+t+1]=l*i+h*s+c}}static applyInverseTransform(e,t){const a=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(a*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i;e[1]=(-a*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,a){const r=t[0],i=t[1],n=t[2],s=t[3],o=t[4],c=t[5],l=e[0],h=e[1],u=e[2],d=e[3];let f=r*l+o,g=f,p=r*u+o,m=p,b=s*h+c,y=b,w=s*d+c,x=w;if(0!==i||0!==n){const e=i*l,t=i*u,a=n*h,r=n*d;f+=a;m+=a;p+=r;g+=r;b+=e;x+=e;w+=t;y+=t}a[0]=Math.min(a[0],f,p,g,m);a[1]=Math.min(a[1],b,w,y,x);a[2]=Math.max(a[2],f,p,g,m);a[3]=Math.max(a[3],b,w,y,x)}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){const a=e[0],r=e[1],i=e[2],n=e[3],s=a**2+r**2,o=a*i+r*n,c=i**2+n**2,l=(s+c)/2,h=Math.sqrt(l**2-(s*c-o**2));t[0]=Math.sqrt(l+h||1);t[1]=Math.sqrt(l-h||1)}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){const a=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(a>r)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),n=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>n?null:[a,i,r,n]}static pointBoundingBox(e,t,a){a[0]=Math.min(a[0],e);a[1]=Math.min(a[1],t);a[2]=Math.max(a[2],e);a[3]=Math.max(a[3],t)}static rectBoundingBox(e,t,a,r,i){i[0]=Math.min(i[0],e,a);i[1]=Math.min(i[1],t,r);i[2]=Math.max(i[2],e,a);i[3]=Math.max(i[3],t,r)}static#e(e,t,a,r,i,n,s,o,c,l){if(c<=0||c>=1)return;const h=1-c,u=c*c,d=u*c,f=h*(h*(h*e+3*c*t)+3*u*a)+d*r,g=h*(h*(h*i+3*c*n)+3*u*s)+d*o;l[0]=Math.min(l[0],f);l[1]=Math.min(l[1],g);l[2]=Math.max(l[2],f);l[3]=Math.max(l[3],g)}static#t(e,t,a,r,i,n,s,o,c,l,h,u){if(Math.abs(c)<1e-12){Math.abs(l)>=1e-12&&this.#e(e,t,a,r,i,n,s,o,-h/l,u);return}const d=l**2-4*h*c;if(d<0)return;const f=Math.sqrt(d),g=2*c;this.#e(e,t,a,r,i,n,s,o,(-l+f)/g,u);this.#e(e,t,a,r,i,n,s,o,(-l-f)/g,u)}static bezierBoundingBox(e,t,a,r,i,n,s,o,c){c[0]=Math.min(c[0],e,s);c[1]=Math.min(c[1],t,o);c[2]=Math.max(c[2],e,s);c[3]=Math.max(c[3],t,o);this.#t(e,a,i,s,t,r,n,o,3*(3*(a-i)-e+s),6*(e-2*a+i),3*(a-e),c);this.#t(e,a,i,s,t,r,n,o,3*(3*(r-n)-t+o),6*(t-2*r+n),3*(r-t),c)}}const Zt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToPDFString(e,t=!1){if(e[0]>="ï"){let a;if("þ"===e[0]&&"ÿ"===e[1]){a="utf-16be";e.length%2==1&&(e=e.slice(0,-1))}else if("ÿ"===e[0]&&"þ"===e[1]){a="utf-16le";e.length%2==1&&(e=e.slice(0,-1))}else"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(a="utf-8");if(a)try{const r=new TextDecoder(a,{fatal:!0}),i=stringToBytes(e),n=r.decode(i);return t||!n.includes("")?n:n.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g,"")}catch(e){warn(`stringToPDFString: "${e}".`)}}const a=[];for(let r=0,i=e.length;rYt[e]).join("")}"function"!=typeof Promise.try&&(Promise.try=function(e,...t){return new Promise(a=>{a(e(...t))})});"function"!=typeof Math.sumPrecise&&(Math.sumPrecise=function(e){return e.reduce((e,t)=>e+t,0)});const ta=Symbol("CIRCULAR_REF"),aa=Symbol("EOF");let ra=Object.create(null),ia=Object.create(null),na=Object.create(null);class Name{constructor(e){this.name=e}static get(e){return ia[e]||=new Name(e)}}class Cmd{constructor(e){this.cmd=e}static get(e){return ra[e]||=new Cmd(e)}}const sa=function nonSerializableClosure(){return sa};class Dict{constructor(e=null){this._map=new Map;this.xref=e;this.objId=null;this.suppressEncryption=!1;this.__nonSerializable__=sa}assignXref(e){this.xref=e}get size(){return this._map.size}get(e,t,a){let r=this._map.get(e);if(void 0===r&&void 0!==t){r=this._map.get(t);void 0===r&&void 0!==a&&(r=this._map.get(a))}return r instanceof Ref&&this.xref?this.xref.fetch(r,this.suppressEncryption):r}async getAsync(e,t,a){let r=this._map.get(e);if(void 0===r&&void 0!==t){r=this._map.get(t);void 0===r&&void 0!==a&&(r=this._map.get(a))}return r instanceof Ref&&this.xref?this.xref.fetchAsync(r,this.suppressEncryption):r}getArray(e,t,a){let r=this._map.get(e);if(void 0===r&&void 0!==t){r=this._map.get(t);void 0===r&&void 0!==a&&(r=this._map.get(a))}r instanceof Ref&&this.xref&&(r=this.xref.fetch(r,this.suppressEncryption));if(Array.isArray(r)){r=r.slice();for(let e=0,t=r.length;e{unreachable("Should not call `set` on the empty dictionary.")};return shadow(this,"empty",e)}static merge({xref:e,dictArray:t,mergeSubDicts:a=!1}){const r=new Dict(e),i=new Map;for(const e of t)if(e instanceof Dict)for(const[t,r]of e._map){let e=i.get(t);if(void 0===e){e=[];i.set(t,e)}else if(!(a&&r instanceof Dict))continue;e.push(r)}for(const[t,a]of i){if(1===a.length||!(a[0]instanceof Dict)){r._map.set(t,a[0]);continue}const i=new Dict(e);for(const e of a)for(const[t,a]of e._map)i._map.has(t)||i._map.set(t,a);i.size>0&&r._map.set(t,i)}i.clear();return r.size>0?r:Dict.empty}clone(){const e=new Dict(this.xref);for(const t of this.getKeys())e.set(t,this.getRaw(t));return e}delete(e){this._map.delete(e)}}class Ref{constructor(e,t){this.num=e;this.gen=t}toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(e){const t=na[e];if(t)return t;const a=/^(\d+)R(\d*)$/.exec(e);return a&&"0"!==a[1]?na[e]=new Ref(parseInt(a[1]),a[2]?parseInt(a[2]):0):null}static get(e,t){const a=0===t?`${e}R`:`${e}R${t}`;return na[a]||=new Ref(e,t)}}class RefSet{constructor(e=null){this._set=new Set(e?._set)}has(e){return this._set.has(e.toString())}put(e){this._set.add(e.toString())}remove(e){this._set.delete(e.toString())}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear()}}class RefSetCache{constructor(){this._map=new Map}get size(){return this._map.size}get(e){return this._map.get(e.toString())}has(e){return this._map.has(e.toString())}put(e,t){this._map.set(e.toString(),t)}putAlias(e,t){this._map.set(e.toString(),this.get(t))}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear()}*values(){yield*this._map.values()}*items(){for(const[e,t]of this._map)yield[Ref.fromString(e),t]}}function isName(e,t){return e instanceof Name&&(void 0===t||e.name===t)}function isCmd(e,t){return e instanceof Cmd&&(void 0===t||e.cmd===t)}function isDict(e,t){return e instanceof Dict&&(void 0===t||isName(e.get("Type"),t))}function isRefsEqual(e,t){return e.num===t.num&&e.gen===t.gen}class BaseStream{get length(){unreachable("Abstract getter `length` accessed")}get isEmpty(){unreachable("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return shadow(this,"isDataLoaded",!0)}getByte(){unreachable("Abstract method `getByte` called")}getBytes(e){unreachable("Abstract method `getBytes` called")}async getImageData(e,t){return this.getBytes(e,t)}async asyncGetBytes(){unreachable("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get isAsyncDecoder(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}async getTransferableImage(){return null}peekByte(){const e=this.getByte();-1!==e&&this.pos--;return e}peekBytes(e){const t=this.getBytes(e);this.pos-=t.length;return t}getUint16(){const e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(e,t){unreachable("Abstract method `getByteRange` called")}getString(e){return bytesToString(this.getBytes(e))}skip(e){this.pos+=e||1}reset(){unreachable("Abstract method `reset` called")}moveStart(){unreachable("Abstract method `moveStart` called")}makeSubStream(e,t,a=null){unreachable("Abstract method `makeSubStream` called")}getBaseStreams(){return null}}const oa=/^[1-9]\.\d$/,ca=2**31-1,la=[1,0,0,1,0,0],ha=["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"],ua=["ExtGState","Font","Properties","XObject"];function getLookupTableFactory(e){let t;return function(){if(e){t=Object.create(null);e(t);e=null}return t}}class MissingDataException extends Jt{constructor(e,t){super(`Missing data [${e}, ${t})`,"MissingDataException");this.begin=e;this.end=t}}class ParserEOFException extends Jt{constructor(e){super(e,"ParserEOFException")}}class XRefEntryException extends Jt{constructor(e){super(e,"XRefEntryException")}}class XRefParseException extends Jt{constructor(e){super(e,"XRefParseException")}}function arrayBuffersToBytes(e){const t=e.length;if(0===t)return new Uint8Array(0);if(1===t)return new Uint8Array(e[0]);let a=0;for(let r=0;r0,"The number should be a positive integer.");const a="M".repeat(e/1e3|0)+da[e%1e3/100|0]+da[10+(e%100/10|0)]+da[20+e%10];return t?a.toLowerCase():a}function log2(e){return e>0?Math.ceil(Math.log2(e)):0}function readInt8(e,t){return e[t]<<24>>24}function readInt16(e,t){return(e[t]<<24|e[t+1]<<16)>>16}function readUint16(e,t){return e[t]<<8|e[t+1]}function readUint32(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function isWhiteSpace(e){return 32===e||9===e||13===e||10===e}function isNumberArray(e,t){return Array.isArray(e)?(null===t||e.length===t)&&e.every(e=>"number"==typeof e):ArrayBuffer.isView(e)&&!(e instanceof BigInt64Array||e instanceof BigUint64Array)&&(null===t||e.length===t)}function lookupMatrix(e,t){return isNumberArray(e,6)?e:t}function lookupRect(e,t){return isNumberArray(e,4)?e:t}function lookupNormalRect(e,t){return isNumberArray(e,4)?Util.normalizeRect(e):t}function parseXFAPath(e){const t=/(.+)\[(\d+)\]$/;return e.split(".").map(e=>{const a=e.match(t);return a?{name:a[1],pos:parseInt(a[2],10)}:{name:e,pos:0}})}function escapePDFName(e){const t=[];let a=0;for(let r=0,i=e.length;r126||35===i||40===i||41===i||60===i||62===i||91===i||93===i||123===i||125===i||47===i||37===i){a"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`)}function _collectJS(e,t,a,r){if(!e)return;let i=null;if(e instanceof Ref){if(r.has(e))return;i=e;r.put(i);e=t.fetch(e)}if(Array.isArray(e))for(const i of e)_collectJS(i,t,a,r);else if(e instanceof Dict){if(isName(e.get("S"),"JavaScript")){const t=e.get("JS");let r;t instanceof BaseStream?r=t.getString():"string"==typeof t&&(r=t);r&&=stringToPDFString(r,!0).replaceAll("\0","");r&&a.push(r.trim())}_collectJS(e.getRaw("Next"),t,a,r)}i&&r.remove(i)}function collectActions(e,t,a){const r=Object.create(null),i=getInheritableProperty({dict:t,key:"AA",stopWhenFound:!1});if(i)for(let t=i.length-1;t>=0;t--){const n=i[t];if(n instanceof Dict)for(const t of n.getKeys()){const i=a[t];if(!i)continue;const s=[];_collectJS(n.getRaw(t),e,s,new RefSet);s.length>0&&(r[i]=s)}}if(t.has("A")){const a=[];_collectJS(t.get("A"),e,a,new RefSet);a.length>0&&(r.Action=a)}return objectSize(r)>0?r:null}const fa={60:"<",62:">",38:"&",34:""",39:"'"};function*codePointIter(e){for(let t=0,a=e.length;t55295&&(a<57344||a>65533)&&t++;yield a}}function encodeToXmlString(e){const t=[];let a=0;for(let r=0,i=e.length;r55295&&(i<57344||i>65533)&&r++;a=r+1}}if(0===t.length)return e;a: ${e}.`);return!1}return!0}function validateCSSFont(e){const t=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:a,fontWeight:r,italicAngle:i}=e;if(!validateFontName(a,!0))return!1;const n=r?r.toString():"";e.fontWeight=t.has(n)?n:"400";const s=parseFloat(i);e.italicAngle=isNaN(s)||s<-90||s>90?"14":i.toString();return!0}function recoverJsURL(e){const t=new RegExp("^\\s*("+["app.launchURL","window.open","xfa.host.gotoURL"].join("|").replaceAll(".","\\.")+")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))","i").exec(e);return t?.[2]?{url:t[2],newWindow:"app.launchURL"===t[1]&&"true"===t[3]}:null}function numberToString(e){if(Number.isInteger(e))return e.toString();const t=Math.round(100*e);return t%100==0?(t/100).toString():t%10==0?e.toFixed(1):e.toFixed(2)}function getNewAnnotationsMap(e){if(!e)return null;const t=new Map;for(const[a,r]of e){if(!a.startsWith(f))continue;let e=t.get(r.pageIndex);if(!e){e=[];t.set(r.pageIndex,e)}e.push(r)}return t.size>0?t:null}function stringToAsciiOrUTF16BE(e){return null==e||function isAscii(e){if("string"!=typeof e)return!1;return!e||/^[\x00-\x7F]*$/.test(e)}(e)?e:stringToUTF16String(e,!0)}function stringToUTF16HexString(e){const t=[];for(let a=0,r=e.length;a>8&255],Yt[255&r])}return t.join("")}function stringToUTF16String(e,t=!1){const a=[];t&&a.push("þÿ");for(let t=0,r=e.length;t>8&255),String.fromCharCode(255&r))}return a.join("")}function getRotationMatrix(e,t,a){switch(e){case 90:return[0,1,-1,0,t,0];case 180:return[-1,0,0,-1,t,a];case 270:return[0,-1,1,0,0,a];default:throw new Error("Invalid rotation")}}function getSizeInBytes(e){return Math.ceil(Math.ceil(Math.log2(1+e))/8)}class QCMS{static#a=null;static _memory=null;static _mustAddAlpha=!1;static _destBuffer=null;static _destOffset=0;static _destLength=0;static _cssColor="";static _makeHexColor=null;static get _memoryArray(){const e=this.#a;return e?.byteLength?e:this.#a=new Uint8Array(this._memory.buffer)}}let ga;const pa="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};"undefined"!=typeof TextDecoder&&pa.decode();let ma=null;function getUint8ArrayMemory0(){null!==ma&&0!==ma.byteLength||(ma=new Uint8Array(ga.memory.buffer));return ma}let ba=0;function passArray8ToWasm0(e,t){const a=t(1*e.length,1)>>>0;getUint8ArrayMemory0().set(e,a/1);ba=e.length;return a}const ya=Object.freeze({RGB8:0,0:"RGB8",RGBA8:1,1:"RGBA8",BGRA8:2,2:"BGRA8",Gray8:3,3:"Gray8",GrayA8:4,4:"GrayA8",CMYK:5,5:"CMYK"}),wa=Object.freeze({Perceptual:0,0:"Perceptual",RelativeColorimetric:1,1:"RelativeColorimetric",Saturation:2,2:"Saturation",AbsoluteColorimetric:3,3:"AbsoluteColorimetric"});function __wbg_get_imports(){const e={wbg:{}};e.wbg.__wbg_copyresult_b08ee7d273f295dd=function(e,t){!function copy_result(e,t){const{_mustAddAlpha:a,_destBuffer:r,_destOffset:i,_destLength:n,_memoryArray:s}=QCMS;if(t!==n)if(a)for(let a=e,n=e+t,o=i;a>>0,t>>>0)};e.wbg.__wbg_copyrgb_d60ce17bb05d9b67=function(e){!function copy_rgb(e){const{_destBuffer:t,_destOffset:a,_memoryArray:r}=QCMS;t[a]=r[e];t[a+1]=r[e+1];t[a+2]=r[e+2]}(e>>>0)};e.wbg.__wbg_makecssRGB_893bf0cd9fdb302d=function(e){!function make_cssRGB(e){const{_memoryArray:t}=QCMS;QCMS._cssColor=QCMS._makeHexColor(t[e],t[e+1],t[e+2])}(e>>>0)};e.wbg.__wbindgen_init_externref_table=function(){const e=ga.__wbindgen_export_0,t=e.grow(4);e.set(0,void 0);e.set(t+0,void 0);e.set(t+1,null);e.set(t+2,!0);e.set(t+3,!1)};e.wbg.__wbindgen_throw=function(e,t){throw new Error(function getStringFromWasm0(e,t){e>>>=0;return pa.decode(getUint8ArrayMemory0().subarray(e,e+t))}(e,t))};return e}function __wbg_finalize_init(e,t){ga=e.exports;__wbg_init.__wbindgen_wasm_module=t;ma=null;ga.__wbindgen_start();return ga}async function __wbg_init(e){if(void 0!==ga)return ga;void 0!==e&&(Object.getPrototypeOf(e)===Object.prototype?({module_or_path:e}=e):console.warn("using deprecated parameters for the initialization function; pass a single object instead"));const t=__wbg_get_imports();("string"==typeof e||"function"==typeof Request&&e instanceof Request||"function"==typeof URL&&e instanceof URL)&&(e=fetch(e));const{instance:a,module:r}=await async function __wbg_load(e,t){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const a=await e.arrayBuffer();return await WebAssembly.instantiate(a,t)}{const a=await WebAssembly.instantiate(e,t);return a instanceof WebAssembly.Instance?{instance:a,module:e}:a}}(await e,t);return __wbg_finalize_init(a,r)}class ColorSpace{static#r=new Uint8ClampedArray(3);constructor(e,t){this.name=e;this.numComps=t}getRgb(e,t,a=new Uint8ClampedArray(3)){this.getRgbItem(e,t,a,0);return a}getRgbHex(e,t){const a=this.getRgb(e,t,ColorSpace.#r);return Util.makeHexColor(a[0],a[1],a[2])}getRgbItem(e,t,a,r){unreachable("Should not call ColorSpace.getRgbItem")}getRgbBuffer(e,t,a,r,i,n,s){unreachable("Should not call ColorSpace.getRgbBuffer")}getOutputLength(e,t){unreachable("Should not call ColorSpace.getOutputLength")}isPassthrough(e){return!1}isDefaultDecode(e,t){return ColorSpace.isDefaultDecode(e,this.numComps)}fillRgb(e,t,a,r,i,n,s,o,c){const l=t*a;let h=null;const u=1<u&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){const t=s<=8?new Uint8Array(u):new Uint16Array(u);for(let e=0;e=.99554525?1:MathClamp(1.055*e**(1/2.4)-.055,0,1)}#b(e){return e<0?-this.#b(-e):e>8?((e+16)/116)**3:e*CalRGBCS.#d}#y(e,t,a){if(0===e[0]&&0===e[1]&&0===e[2]){a[0]=t[0];a[1]=t[1];a[2]=t[2];return}const r=this.#b(0),i=(1-r)/(1-this.#b(e[0])),n=1-i,s=(1-r)/(1-this.#b(e[1])),o=1-s,c=(1-r)/(1-this.#b(e[2])),l=1-c;a[0]=t[0]*i+n;a[1]=t[1]*s+o;a[2]=t[2]*c+l}#w(e,t,a){if(1===e[0]&&1===e[2]){a[0]=t[0];a[1]=t[1];a[2]=t[2];return}const r=a;this.#f(CalRGBCS.#n,t,r);const i=CalRGBCS.#l;this.#g(e,r,i);this.#f(CalRGBCS.#s,i,a)}#x(e,t,a){const r=a;this.#f(CalRGBCS.#n,t,r);const i=CalRGBCS.#l;this.#p(e,r,i);this.#f(CalRGBCS.#s,i,a)}#i(e,t,a,r,i){const n=MathClamp(e[t]*i,0,1),s=MathClamp(e[t+1]*i,0,1),o=MathClamp(e[t+2]*i,0,1),c=1===n?1:n**this.GR,l=1===s?1:s**this.GG,h=1===o?1:o**this.GB,u=this.MXA*c+this.MXB*l+this.MXC*h,d=this.MYA*c+this.MYB*l+this.MYC*h,f=this.MZA*c+this.MZB*l+this.MZC*h,g=CalRGBCS.#h;g[0]=u;g[1]=d;g[2]=f;const p=CalRGBCS.#u;this.#w(this.whitePoint,g,p);const m=CalRGBCS.#h;this.#y(this.blackPoint,p,m);const b=CalRGBCS.#u;this.#x(CalRGBCS.#c,m,b);const y=CalRGBCS.#h;this.#f(CalRGBCS.#o,b,y);a[r]=255*this.#m(y[0]);a[r+1]=255*this.#m(y[1]);a[r+2]=255*this.#m(y[2])}getRgbItem(e,t,a,r){this.#i(e,t,a,r,1)}getRgbBuffer(e,t,a,r,i,n,s){const o=1/((1<this.amax||this.bmin>this.bmax){info("Invalid Range, falling back to defaults");this.amin=-100;this.amax=100;this.bmin=-100;this.bmax=100}}#S(e){return e>=6/29?e**3:108/841*(e-4/29)}#A(e,t,a,r){return a+e*(r-a)/t}#i(e,t,a,r,i){let n=e[t],s=e[t+1],o=e[t+2];if(!1!==a){n=this.#A(n,a,0,100);s=this.#A(s,a,this.amin,this.amax);o=this.#A(o,a,this.bmin,this.bmax)}s>this.amax?s=this.amax:sthis.bmax?o=this.bmax:ofunction qcms_convert_one(e,t,a){ga.qcms_convert_one(e,t,a)}(this.#k,255*e[t],a);break;case 3:r=ya.RGB8;this.#C=(e,t,a)=>function qcms_convert_three(e,t,a,r,i){ga.qcms_convert_three(e,t,a,r,i)}(this.#k,255*e[t],255*e[t+1],255*e[t+2],a);break;case 4:r=ya.CMYK;this.#C=(e,t,a)=>function qcms_convert_four(e,t,a,r,i,n){ga.qcms_convert_four(e,t,a,r,i,n)}(this.#k,255*e[t],255*e[t+1],255*e[t+2],255*e[t+3],a);break;default:throw new Error(`Unsupported number of components: ${a}`)}this.#k=function qcms_transformer_from_memory(e,t,a){const r=passArray8ToWasm0(e,ga.__wbindgen_malloc),i=ba;return ga.qcms_transformer_from_memory(r,i,t,a)>>>0}(e,r,wa.Perceptual);if(!this.#k)throw new Error("Failed to create ICC color space");IccColorSpace.#I||=new FinalizationRegistry(e=>{!function qcms_drop_transformer(e){ga.qcms_drop_transformer(e)}(e)});IccColorSpace.#I.register(this,this.#k)}getRgbHex(e,t){this.#C(e,t,!0);return QCMS._cssColor}getRgbItem(e,t,a,r){QCMS._destBuffer=a;QCMS._destOffset=r;QCMS._destLength=3;this.#C(e,t,!1);QCMS._destBuffer=null}getRgbBuffer(e,t,a,r,i,n,s){e=e.subarray(t,t+a*this.numComps);if(8!==n){const t=255/((1<=this.end?-1:this.bytes[this.pos++]}getBytes(e){const t=this.bytes,a=this.pos,r=this.end;if(!e)return t.subarray(a,r);let i=a+e;i>r&&(i=r);this.pos=i;return t.subarray(a,i)}getByteRange(e,t){e<0&&(e=0);t>this.end&&(t=this.end);return this.bytes.subarray(e,t)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(e,t,a=null){return new Stream(this.bytes.buffer,e,t,a)}}class StringStream extends Stream{constructor(e){super(stringToBytes(e))}}class NullStream extends Stream{constructor(){super(new Uint8Array(0))}}class ChunkedStream extends Stream{constructor(e,t,a){super(new Uint8Array(e),0,e,null);this.chunkSize=t;this._loadedChunks=new Set;this.numChunks=Math.ceil(e/t);this.manager=a;this.progressiveDataLength=0;this.lastSuccessfulEnsureByteChunk=-1}getMissingChunks(){const e=[];for(let t=0,a=this.numChunks;t=this.end?this.numChunks:Math.floor(t/this.chunkSize);for(let e=a;ethis.numChunks)&&t!==this.lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(t))throw new MissingDataException(e,e+1);this.lastSuccessfulEnsureByteChunk=t}}ensureRange(e,t){if(e>=t)return;if(t<=this.progressiveDataLength)return;const a=Math.floor(e/this.chunkSize);if(a>this.numChunks)return;const r=Math.min(Math.floor((t-1)/this.chunkSize)+1,this.numChunks);for(let i=a;i=this.end)return-1;e>=this.progressiveDataLength&&this.ensureByte(e);return this.bytes[this.pos++]}getBytes(e){const t=this.bytes,a=this.pos,r=this.end;if(!e){r>this.progressiveDataLength&&this.ensureRange(a,r);return t.subarray(a,r)}let i=a+e;i>r&&(i=r);i>this.progressiveDataLength&&this.ensureRange(a,i);this.pos=i;return t.subarray(a,i)}getByteRange(e,t){e<0&&(e=0);t>this.end&&(t=this.end);t>this.progressiveDataLength&&this.ensureRange(e,t);return this.bytes.subarray(e,t)}makeSubStream(e,t,a=null){t?e+t>this.progressiveDataLength&&this.ensureRange(e,e+t):e>=this.progressiveDataLength&&this.ensureByte(e);function ChunkedStreamSubstream(){}ChunkedStreamSubstream.prototype=Object.create(this);ChunkedStreamSubstream.prototype.getMissingChunks=function(){const e=this.chunkSize,t=Math.floor(this.start/e),a=Math.floor((this.end-1)/e)+1,r=[];for(let e=t;e{const readChunk=({value:n,done:s})=>{try{if(s){const t=arrayBuffersToBytes(r);r=null;e(t);return}i+=n.byteLength;a.isStreamingSupported&&this.onProgress({loaded:i});r.push(n);a.read().then(readChunk,t)}catch(e){t(e)}};a.read().then(readChunk,t)}).then(t=>{this.aborted||this.onReceiveData({chunk:t,begin:e})})}requestAllChunks(e=!1){if(!e){const e=this.stream.getMissingChunks();this._requestChunks(e)}return this._loadedStreamCapability.promise}_requestChunks(e){const t=this.currRequestId++,a=new Set;this._chunksNeededByRequest.set(t,a);for(const t of e)this.stream.hasChunk(t)||a.add(t);if(0===a.size)return Promise.resolve();const r=Promise.withResolvers();this._promisesByRequest.set(t,r);const i=[];for(const e of a){let a=this._requestsByChunk.get(e);if(!a){a=[];this._requestsByChunk.set(e,a);i.push(e)}a.push(t)}if(i.length>0){const e=this.groupChunks(i);for(const t of e){const e=t.beginChunk*this.chunkSize,a=Math.min(t.endChunk*this.chunkSize,this.length);this.sendRequest(e,a).catch(r.reject)}}return r.promise.catch(e=>{if(!this.aborted)throw e})}getStream(){return this.stream}requestRange(e,t){t=Math.min(t,this.length);const a=this.getBeginChunk(e),r=this.getEndChunk(t),i=[];for(let e=a;ee-t);return this._requestChunks(t)}groupChunks(e){const t=[];let a=-1,r=-1;for(let i=0,n=e.length;i=0&&r+1!==n){t.push({beginChunk:a,endChunk:r+1});a=n}i+1===e.length&&t.push({beginChunk:a,endChunk:n+1});r=n}return t}onProgress(e){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+e.loaded,total:this.length})}onReceiveData(e){const t=e.chunk,a=void 0===e.begin,r=a?this.progressiveDataLength:e.begin,i=r+t.byteLength,n=Math.floor(r/this.chunkSize),s=i0||o.push(a)}}}if(!this.disableAutoFetch&&0===this._requestsByChunk.size){let e;if(1===this.stream.numChunksLoaded){const t=this.stream.numChunks-1;this.stream.hasChunk(t)||(e=t)}else e=this.stream.nextEmptyChunk(s);Number.isInteger(e)&&this._requestChunks([e])}for(const e of o){const t=this._promisesByRequest.get(e);this._promisesByRequest.delete(e);t.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})}onError(e){this._loadedStreamCapability.reject(e)}getBeginChunk(e){return Math.floor(e/this.chunkSize)}getEndChunk(e){return Math.floor((e-1)/this.chunkSize)+1}abort(e){this.aborted=!0;this.pdfNetworkStream?.cancelAllRequests(e);for(const t of this._promisesByRequest.values())t.reject(e)}}function convertToRGBA(e){switch(e.kind){case k:return convertBlackAndWhiteToRGBA(e);case C:return function convertRGBToRGBA({src:e,srcPos:t=0,dest:a,destPos:r=0,width:i,height:n}){let s=0;const o=i*n*3,c=o>>2,l=new Uint32Array(e.buffer,t,c);if(FeatureTest.isLittleEndian){for(;s>>24|t<<8|4278190080;a[r+2]=t>>>16|i<<16|4278190080;a[r+3]=i>>>8|4278190080}for(let i=4*s,n=t+o;i>>8|255;a[r+2]=t<<16|i>>>16|255;a[r+3]=i<<8|255}for(let i=4*s,n=t+o;i>3,u=7&r,d=e.length;a=new Uint32Array(a.buffer);let f=0;for(let r=0;ra||t>a)return!0;const r=e*t;if(this._hasMaxArea)return r>this.MAX_AREA;if(r(this.MAX_AREA=this.#O**2)}static getReducePowerForJPX(e,t,a){const r=e*t,i=2**30/(4*a);if(!this.needsToBeResized(e,t))return r>i?Math.ceil(Math.log2(r/i)):0;const{MAX_DIM:n,MAX_AREA:s}=this,o=Math.max(e/n,t/n,Math.sqrt(r/Math.min(i,s)));return Math.ceil(Math.log2(o))}static get MAX_DIM(){return shadow(this,"MAX_DIM",this._guessMax(2048,65537,0,1))}static get MAX_AREA(){this._hasMaxArea=!0;return shadow(this,"MAX_AREA",this._guessMax(this.#O,this.MAX_DIM,128,0)**2)}static set MAX_AREA(e){if(e>=0){this._hasMaxArea=!0;shadow(this,"MAX_AREA",e)}}static setOptions({canvasMaxAreaInBytes:e=-1,isImageDecoderSupported:t=!1}){this._hasMaxArea||(this.MAX_AREA=e>>2);this.#M=t}static _areGoodDims(e,t){try{const a=new OffscreenCanvas(e,t),r=a.getContext("2d");r.fillRect(0,0,1,1);const i=r.getImageData(0,0,1,1).data[3];a.width=a.height=1;return 0!==i}catch{return!1}}static _guessMax(e,t,a,r){for(;e+a+1ca){const e=this.#D();if(e)return e}const r=this._encodeBMP();let i,n;if(await ImageResizer.canUseImageDecoder){i=new ImageDecoder({data:r,type:"image/bmp",preferAnimation:!1,transfer:[r.buffer]});n=i.decode().catch(e=>{warn(`BMP image decoding failed: ${e}`);return createImageBitmap(new Blob([this._encodeBMP().buffer],{type:"image/bmp"}))}).finally(()=>{i.close()})}else n=createImageBitmap(new Blob([r.buffer],{type:"image/bmp"}));const{MAX_AREA:s,MAX_DIM:o}=ImageResizer,c=Math.max(t/o,a/o,Math.sqrt(t*a/s)),l=Math.max(c,2),h=Math.round(10*(c+1.25))/10/l,u=Math.floor(Math.log2(h)),d=new Array(u+2).fill(2);d[0]=l;d.splice(-1,1,h/(1<>s,c=r>>s;let l,h=r;try{l=new Uint8Array(n)}catch{let e=Math.floor(Math.log2(n+1));for(;;)try{l=new Uint8Array(2**e-1);break}catch{e-=1}h=Math.floor((2**e-1)/(4*a));const t=a*h*4;t>s;e>3,s=a+3&-4;if(a!==s){const e=new Uint8Array(s*t);let r=0;for(let n=0,o=t*a;ni&&(r=i)}else{for(;!this.eof;)this.readBlock(t);r=this.bufferLength}this.pos=r;return this.buffer.subarray(a,r)}async getImageData(e,t){if(!this.canAsyncDecodeImageFromBuffer)return this.isAsyncDecoder?this.decodeImage(null,t):this.getBytes(e,t);const a=await this.stream.asyncGetBytes();return this.decodeImage(a,t)}reset(){this.pos=0}makeSubStream(e,t,a=null){if(void 0===t)for(;!this.eof;)this.readBlock();else{const a=e+t;for(;this.bufferLength<=a&&!this.eof;)this.readBlock()}return new Stream(this.buffer,e,t,a)}getBaseStreams(){return this.str?this.str.getBaseStreams():null}}class StreamsSequenceStream extends DecodeStream{constructor(e,t=null){e=e.filter(e=>e instanceof BaseStream);let a=0;for(const t of e)a+=t instanceof DecodeStream?t._rawMinBufferLength:t.length;super(a);this.streams=e;this._onError=t}readBlock(){const e=this.streams;if(0===e.length){this.eof=!0;return}const t=e.shift();let a;try{a=t.getBytes()}catch(e){if(this._onError){this._onError(e,t.dict?.objId);return}throw e}const r=this.bufferLength,i=r+a.length;this.ensureBuffer(i).set(a,r);this.bufferLength=i}getBaseStreams(){const e=[];for(const t of this.streams){const a=t.getBaseStreams();a&&e.push(...a)}return e.length>0?e:null}}class ColorSpaceUtils{static parse({cs:e,xref:t,resources:a=null,pdfFunctionFactory:r,globalColorSpaceCache:i,localColorSpaceCache:n,asyncIfNotCached:s=!1}){const o={xref:t,resources:a,pdfFunctionFactory:r,globalColorSpaceCache:i,localColorSpaceCache:n};let c,l,h;if(e instanceof Ref){l=e;const a=i.getByRef(l)||n.getByRef(l);if(a)return a;e=t.fetch(e)}if(e instanceof Name){c=e.name;const t=n.getByName(c);if(t)return t}try{h=this.#B(e,o)}catch(e){if(s&&!(e instanceof MissingDataException))return Promise.reject(e);throw e}if(c||l){n.set(c,l,h);l&&i.set(null,l,h)}return s?Promise.resolve(h):h}static#R(e,t){const{globalColorSpaceCache:a}=t;let r;if(e instanceof Ref){r=e;const t=a.getByRef(r);if(t)return t}const i=this.#B(e,t);r&&a.set(null,r,i);return i}static#B(e,t){const{xref:a,resources:r,pdfFunctionFactory:i,globalColorSpaceCache:n}=t;if((e=a.fetchIfRef(e))instanceof Name)switch(e.name){case"G":case"DeviceGray":return this.gray;case"RGB":case"DeviceRGB":return this.rgb;case"DeviceRGBA":return this.rgba;case"CMYK":case"DeviceCMYK":return this.cmyk;case"Pattern":return new PatternCS(null);default:if(r instanceof Dict){const a=r.get("ColorSpace");if(a instanceof Dict){const r=a.get(e.name);if(r){if(r instanceof Name)return this.#B(r,t);e=r;break}}}warn(`Unrecognized ColorSpace: ${e.name}`);return this.gray}if(Array.isArray(e)){const r=a.fetchIfRef(e[0]).name;let s,o,c,l,h,u;switch(r){case"G":case"DeviceGray":return this.gray;case"RGB":case"DeviceRGB":return this.rgb;case"CMYK":case"DeviceCMYK":return this.cmyk;case"CalGray":s=a.fetchIfRef(e[1]);l=s.getArray("WhitePoint");h=s.getArray("BlackPoint");u=s.get("Gamma");return new CalGrayCS(l,h,u);case"CalRGB":s=a.fetchIfRef(e[1]);l=s.getArray("WhitePoint");h=s.getArray("BlackPoint");u=s.getArray("Gamma");const d=s.getArray("Matrix");return new CalRGBCS(l,h,u,d);case"ICCBased":const f=e[1]instanceof Ref;if(f){const t=n.getByRef(e[1]);if(t)return t}const g=a.fetchIfRef(e[1]),p=g.dict;o=p.get("N");if(IccColorSpace.isUsable)try{const t=new IccColorSpace(g.getBytes(),"ICCBased",o);f&&n.set(null,e[1],t);return t}catch(t){if(t instanceof MissingDataException)throw t;warn(`ICCBased color space (${e[1]}): "${t}".`)}const m=p.getRaw("Alternate");if(m){const e=this.#R(m,t);if(e.numComps===o)return e;warn("ICCBased color space: Ignoring incorrect /Alternate entry.")}if(1===o)return this.gray;if(3===o)return this.rgb;if(4===o)return this.cmyk;break;case"Pattern":c=e[1]||null;c&&(c=this.#R(c,t));return new PatternCS(c);case"I":case"Indexed":c=this.#R(e[1],t);const b=MathClamp(a.fetchIfRef(e[2]),0,255),y=a.fetchIfRef(e[3]);return new IndexedCS(c,b,y);case"Separation":case"DeviceN":const w=a.fetchIfRef(e[1]);o=Array.isArray(w)?w.length:1;c=this.#R(e[2],t);const x=i.create(e[3]);return new AlternateCS(o,c,x);case"Lab":s=a.fetchIfRef(e[1]);l=s.getArray("WhitePoint");h=s.getArray("BlackPoint");const S=s.getArray("Range");return new LabCS(l,h,S);default:warn(`Unimplemented ColorSpace object: ${r}`);return this.gray}}warn(`Unrecognized ColorSpace object: ${e}`);return this.gray}static get gray(){return shadow(this,"gray",new DeviceGrayCS)}static get rgb(){return shadow(this,"rgb",new DeviceRgbCS)}static get rgba(){return shadow(this,"rgba",new DeviceRgbaCS)}static get cmyk(){if(CmykICCBasedCS.isUsable)try{return shadow(this,"cmyk",new CmykICCBasedCS)}catch{warn("CMYK fallback: DeviceCMYK")}return shadow(this,"cmyk",new DeviceCmykCS)}}class JpegError extends Jt{constructor(e){super(e,"JpegError")}}class DNLMarkerError extends Jt{constructor(e,t){super(e,"DNLMarkerError");this.scanLines=t}}class EOIMarkerError extends Jt{constructor(e){super(e,"EOIMarkerError")}}const Sa=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),Aa=4017,ka=799,Ca=3406,va=2276,Fa=1567,Ia=3784,Ta=5793,Oa=2896;function buildHuffmanTable(e,t){let a,r,i=0,n=16;for(;n>0&&!e[n-1];)n--;const s=[{children:[],index:0}];let o,c=s[0];for(a=0;a0;)c=s.pop();c.index++;s.push(c);for(;s.length<=a;){s.push(o={children:[],index:0});c.children[c.index]=o.children;c=o}i++}if(a+10){g--;return f>>g&1}f=e[t++];if(255===f){const r=e[t++];if(r){if(220===r&&l){const r=readUint16(e,t+=2);t+=2;if(r>0&&r!==a.scanLines)throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data",r)}else if(217===r){if(l){const e=y*(8===a.precision?8:0);if(e>0&&Math.round(a.scanLines/e)>=5)throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",e)}throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data")}throw new JpegError(`unexpected marker ${(f<<8|r).toString(16)}`)}}g=7;return f>>>7}function decodeHuffman(e){let t=e;for(;;){t=t[readBit()];switch(typeof t){case"number":return t;case"object":continue}throw new JpegError("invalid huffman sequence")}}function receive(e){let t=0;for(;e>0;){t=t<<1|readBit();e--}return t}function receiveAndExtend(e){if(1===e)return 1===readBit()?1:-1;const t=receive(e);return t>=1<0){p--;return}let a=n;const r=s;for(;a<=r;){const r=decodeHuffman(e.huffmanTableAC),i=15&r,n=r>>4;if(0===i){if(n<15){p=receive(n)+(1<>4;if(0===i)if(l<15){p=receive(l)+(1<>4;if(0===r){if(n<15)break;i+=16;continue}i+=n;const s=Sa[i];e.blockData[t+s]=receiveAndExtend(r);i++}};let T,O=0;const M=1===w?r[0].blocksPerLine*r[0].blocksPerColumn:h*a.mcusPerColumn;let D,R;for(;O<=M;){const a=i?Math.min(M-O,i):M;if(a>0){for(S=0;S0?"unexpected":"excessive"} MCU data, current marker is: ${T.invalid}`);t=T.offset}if(!(T.marker>=65488&&T.marker<=65495))break;t+=2}return t-d}function quantizeAndInverse(e,t,a){const r=e.quantizationTable,i=e.blockData;let n,s,o,c,l,h,u,d,f,g,p,m,b,y,w,x,S;if(!r)throw new JpegError("missing required Quantization Table.");for(let e=0;e<64;e+=8){f=i[t+e];g=i[t+e+1];p=i[t+e+2];m=i[t+e+3];b=i[t+e+4];y=i[t+e+5];w=i[t+e+6];x=i[t+e+7];f*=r[e];if(0!==(g|p|m|b|y|w|x)){g*=r[e+1];p*=r[e+2];m*=r[e+3];b*=r[e+4];y*=r[e+5];w*=r[e+6];x*=r[e+7];n=Ta*f+128>>8;s=Ta*b+128>>8;o=p;c=w;l=Oa*(g-x)+128>>8;d=Oa*(g+x)+128>>8;h=m<<4;u=y<<4;n=n+s+1>>1;s=n-s;S=o*Ia+c*Fa+128>>8;o=o*Fa-c*Ia+128>>8;c=S;l=l+u+1>>1;u=l-u;d=d+h+1>>1;h=d-h;n=n+c+1>>1;c=n-c;s=s+o+1>>1;o=s-o;S=l*va+d*Ca+2048>>12;l=l*Ca-d*va+2048>>12;d=S;S=h*ka+u*Aa+2048>>12;h=h*Aa-u*ka+2048>>12;u=S;a[e]=n+d;a[e+7]=n-d;a[e+1]=s+u;a[e+6]=s-u;a[e+2]=o+h;a[e+5]=o-h;a[e+3]=c+l;a[e+4]=c-l}else{S=Ta*f+512>>10;a[e]=S;a[e+1]=S;a[e+2]=S;a[e+3]=S;a[e+4]=S;a[e+5]=S;a[e+6]=S;a[e+7]=S}}for(let e=0;e<8;++e){f=a[e];g=a[e+8];p=a[e+16];m=a[e+24];b=a[e+32];y=a[e+40];w=a[e+48];x=a[e+56];if(0!==(g|p|m|b|y|w|x)){n=Ta*f+2048>>12;s=Ta*b+2048>>12;o=p;c=w;l=Oa*(g-x)+2048>>12;d=Oa*(g+x)+2048>>12;h=m;u=y;n=4112+(n+s+1>>1);s=n-s;S=o*Ia+c*Fa+2048>>12;o=o*Fa-c*Ia+2048>>12;c=S;l=l+u+1>>1;u=l-u;d=d+h+1>>1;h=d-h;n=n+c+1>>1;c=n-c;s=s+o+1>>1;o=s-o;S=l*va+d*Ca+2048>>12;l=l*Ca-d*va+2048>>12;d=S;S=h*ka+u*Aa+2048>>12;h=h*Aa-u*ka+2048>>12;u=S;f=n+d;x=n-d;g=s+u;w=s-u;p=o+h;y=o-h;m=c+l;b=c-l;f<16?f=0:f>=4080?f=255:f>>=4;g<16?g=0:g>=4080?g=255:g>>=4;p<16?p=0:p>=4080?p=255:p>>=4;m<16?m=0:m>=4080?m=255:m>>=4;b<16?b=0:b>=4080?b=255:b>>=4;y<16?y=0:y>=4080?y=255:y>>=4;w<16?w=0:w>=4080?w=255:w>>=4;x<16?x=0:x>=4080?x=255:x>>=4;i[t+e]=f;i[t+e+8]=g;i[t+e+16]=p;i[t+e+24]=m;i[t+e+32]=b;i[t+e+40]=y;i[t+e+48]=w;i[t+e+56]=x}else{S=Ta*f+8192>>14;S=S<-2040?0:S>=2024?255:S+2056>>4;i[t+e]=S;i[t+e+8]=S;i[t+e+16]=S;i[t+e+24]=S;i[t+e+32]=S;i[t+e+40]=S;i[t+e+48]=S;i[t+e+56]=S}}}function buildComponentData(e,t){const a=t.blocksPerLine,r=t.blocksPerColumn,i=new Int16Array(64);for(let e=0;e=r)return null;const n=readUint16(e,t);if(n>=65472&&n<=65534)return{invalid:null,marker:n,offset:t};let s=readUint16(e,i);for(;!(s>=65472&&s<=65534);){if(++i>=r)return null;s=readUint16(e,i)}return{invalid:n.toString(16),marker:s,offset:i}}function prepareComponents(e){const t=Math.ceil(e.samplesPerLine/8/e.maxH),a=Math.ceil(e.scanLines/8/e.maxV);for(const r of e.components){const i=Math.ceil(Math.ceil(e.samplesPerLine/8)*r.h/e.maxH),n=Math.ceil(Math.ceil(e.scanLines/8)*r.v/e.maxV),s=t*r.h,o=64*(a*r.v)*(s+1);r.blockData=new Int16Array(o);r.blocksPerLine=i;r.blocksPerColumn=n}e.mcusPerLine=t;e.mcusPerColumn=a}function readDataBlock(e,t){const a=readUint16(e,t);let r=(t+=2)+a-2;const i=findNextFileMarker(e,r,t);if(i?.invalid){warn("readDataBlock - incorrect length, current marker is: "+i.invalid);r=i.offset}const n=e.subarray(t,r);return{appData:n,oldOffset:t,newOffset:t+n.length}}function skipData(e,t){const a=readUint16(e,t),r=(t+=2)+a-2,i=findNextFileMarker(e,r,t);return i?.invalid?i.offset:r}class JpegImage{constructor({decodeTransform:e=null,colorTransform:t=-1}={}){this._decodeTransform=e;this._colorTransform=t}static canUseImageDecoder(e,t=-1){let a=null,r=0,i=null,n=readUint16(e,r);r+=2;if(65496!==n)throw new JpegError("SOI not found");n=readUint16(e,r);r+=2;e:for(;65497!==n;){switch(n){case 65505:const{appData:t,oldOffset:s,newOffset:o}=readDataBlock(e,r);r=o;if(69===t[0]&&120===t[1]&&105===t[2]&&102===t[3]&&0===t[4]&&0===t[5]){if(a)throw new JpegError("Duplicate EXIF-blocks found.");a={exifStart:s+6,exifEnd:o}}n=readUint16(e,r);r+=2;continue;case 65472:case 65473:case 65474:i=e[r+7];break e;case 65535:255!==e[r]&&r--}r=skipData(e,r);n=readUint16(e,r);r+=2}return 4===i||3===i&&0===t?null:a||{}}parse(e,{dnlScanLines:t=null}={}){let a,r,i=0,n=null,s=null,o=0;const c=[],l=[],h=[];let u=readUint16(e,i);i+=2;if(65496!==u)throw new JpegError("SOI not found");u=readUint16(e,i);i+=2;e:for(;65497!==u;){let d,f,g;switch(u){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:const{appData:p,newOffset:m}=readDataBlock(e,i);i=m;65504===u&&74===p[0]&&70===p[1]&&73===p[2]&&70===p[3]&&0===p[4]&&(n={version:{major:p[5],minor:p[6]},densityUnits:p[7],xDensity:p[8]<<8|p[9],yDensity:p[10]<<8|p[11],thumbWidth:p[12],thumbHeight:p[13],thumbData:p.subarray(14,14+3*p[12]*p[13])});65518===u&&65===p[0]&&100===p[1]&&111===p[2]&&98===p[3]&&101===p[4]&&(s={version:p[5]<<8|p[6],flags0:p[7]<<8|p[8],flags1:p[9]<<8|p[10],transformCode:p[11]});break;case 65499:const b=readUint16(e,i);i+=2;const y=b+i-2;let w;for(;i>4){if(t>>4!=1)throw new JpegError("DQT - invalid table spec");for(f=0;f<64;f++){w=Sa[f];a[w]=readUint16(e,i);i+=2}}else for(f=0;f<64;f++){w=Sa[f];a[w]=e[i++]}c[15&t]=a}break;case 65472:case 65473:case 65474:if(a)throw new JpegError("Only single frame JPEGs supported");i+=2;a={};a.extended=65473===u;a.progressive=65474===u;a.precision=e[i++];const x=readUint16(e,i);i+=2;a.scanLines=t||x;a.samplesPerLine=readUint16(e,i);i+=2;a.components=[];a.componentIds={};const S=e[i++];let k=0,C=0;for(d=0;d>4,n=15&e[i+1];k>4?l:h)[15&t]=buildHuffmanTable(a,n)}break;case 65501:i+=2;r=readUint16(e,i);i+=2;break;case 65498:const F=1===++o&&!t;i+=2;const T=e[i++],O=[];for(d=0;d>4];n.huffmanTableAC=l[15&s];O.push(n)}const M=e[i++],D=e[i++],R=e[i++];try{i+=decodeScan(e,i,a,O,r,M,D,R>>4,15&R,F)}catch(t){if(t instanceof DNLMarkerError){warn(`${t.message} -- attempting to re-parse the JPEG image.`);return this.parse(e,{dnlScanLines:t.scanLines})}if(t instanceof EOIMarkerError){warn(`${t.message} -- ignoring the rest of the image data.`);break e}throw t}break;case 65500:i+=4;break;case 65535:255!==e[i]&&i--;break;default:const N=findNextFileMarker(e,i-2,i-3);if(N?.invalid){warn("JpegImage.parse - unexpected data, current marker is: "+N.invalid);i=N.offset;break}if(!N||i>=e.length-1){warn("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break e}throw new JpegError("JpegImage.parse - unknown marker: "+u.toString(16))}u=readUint16(e,i);i+=2}if(!a)throw new JpegError("JpegImage.parse - no frame data found.");this.width=a.samplesPerLine;this.height=a.scanLines;this.jfif=n;this.adobe=s;this.components=[];for(const e of a.components){const t=c[e.quantizationId];t&&(e.quantizationTable=t);this.components.push({index:e.index,output:buildComponentData(0,e),scaleX:e.h/a.maxH,scaleY:e.v/a.maxV,blocksPerLine:e.blocksPerLine,blocksPerColumn:e.blocksPerColumn})}this.numComponents=this.components.length}_getLinearizedBlockData(e,t,a=!1){const r=this.width/e,i=this.height/t;let n,s,o,c,l,h,u,d,f,g,p,m=0;const b=this.components.length,y=e*t*b,w=new Uint8ClampedArray(y),x=new Uint32Array(e),S=4294967288;let k;for(u=0;u>8)+C[f+1];return w}get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform&&(82!==this.components[0].index||71!==this.components[1].index||66!==this.components[2].index):1===this._colorTransform}_convertYccToRgb(e){let t,a,r;for(let i=0,n=e.length;i4)throw new JpegError("Unsupported color mode");const n=this._getLinearizedBlockData(e,t,i);if(1===this.numComponents&&(a||r)){const e=n.length*(a?4:3),t=new Uint8ClampedArray(e);let r=0;if(a)!function grayToRGBA(e,t){if(FeatureTest.isLittleEndian)for(let a=0,r=e.length;a0&&(e=e.subarray(t));break}return e}decodeImage(e){if(this.eof)return this.buffer;e=this.#N(e||this.bytes);const t=new JpegImage(this.jpegOptions);t.parse(e);const a=t.getData({width:this.drawWidth,height:this.drawHeight,forceRGBA:this.forceRGBA,forceRGB:this.forceRGB,isSourcePDF:!0});this.buffer=a;this.bufferLength=a.length;this.eof=!0;return this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}async getTransferableImage(){if(!await JpegStream.canUseImageDecoder)return null;const e=this.jpegOptions;if(e.decodeTransform)return null;let t;try{const a=this.canAsyncDecodeImageFromBuffer&&await this.stream.asyncGetBytes()||this.bytes;if(!a)return null;let r=this.#N(a);const i=JpegImage.canUseImageDecoder(r,e.colorTransform);if(!i)return null;if(i.exifStart){r=r.slice();r.fill(0,i.exifStart,i.exifEnd)}t=new ImageDecoder({data:r,type:"image/jpeg",preferAnimation:!1});return(await t.decode()).image}catch(e){warn(`getTransferableImage - failed: "${e}".`);return null}finally{t?.close()}}}const Ma=async function OpenJPEG(e={}){var t=e,a="./this.program",quit_=(e,t)=>{throw t},r=import.meta.url;try{new URL(".",r).href}catch{}0;var i,n,s,o,c,l,h,u,d=console.log.bind(console),f=console.error.bind(console),g=!1,p=!1;function updateMemoryViews(){var e=o.buffer;c=new Int8Array(e);new Int16Array(e);l=new Uint8Array(e);new Uint16Array(e);h=new Int32Array(e);u=new Uint32Array(e);new Float32Array(e);new Float64Array(e);new BigInt64Array(e);new BigUint64Array(e)}class ExitStatus{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`;this.status=e}}var m,callRuntimeCallbacks=e=>{for(;e.length>0;)e.shift()(t)},b=[],addOnPostRun=e=>b.push(e),y=[],addOnPreRun=e=>y.push(e),w=!0,x=0,S={},handleException=e=>{if(e instanceof ExitStatus||"unwind"==e)return i;quit_(0,e)},keepRuntimeAlive=()=>w||x>0,_proc_exit=e=>{i=e;if(!keepRuntimeAlive()){t.onExit?.(e);g=!0}quit_(0,new ExitStatus(e))},_exit=(e,t)=>{i=e;_proc_exit(e)},callUserCallback=e=>{if(!g)try{e();(()=>{if(!keepRuntimeAlive())try{_exit(i)}catch(e){handleException(e)}})()}catch(e){handleException(e)}},alignMemory=(e,t)=>Math.ceil(e/t)*t,growMemory=e=>{var t=(e-o.buffer.byteLength+65535)/65536|0;try{o.grow(t);updateMemoryViews();return 1}catch(e){}},k={},getEnvStrings=()=>{if(!getEnvStrings.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.language||"C").replace("-","_")+".UTF-8",_:a||"./this.program"};for(var t in k)void 0===k[t]?delete e[t]:e[t]=k[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);getEnvStrings.strings=r}return getEnvStrings.strings},stringToUTF8=(e,t,a)=>((e,t,a,r)=>{if(!(r>0))return 0;for(var i=a,n=a+r-1,s=0;s=n)break;t[a++]=o}else if(o<=2047){if(a+1>=n)break;t[a++]=192|o>>6;t[a++]=128|63&o}else if(o<=65535){if(a+2>=n)break;t[a++]=224|o>>12;t[a++]=128|o>>6&63;t[a++]=128|63&o}else{if(a+3>=n)break;t[a++]=240|o>>18;t[a++]=128|o>>12&63;t[a++]=128|o>>6&63;t[a++]=128|63&o;s++}}t[a]=0;return a-i})(e,l,t,a),lengthBytesUTF8=e=>{for(var t=0,a=0;a=55296&&r<=57343){t+=4;++a}else t+=3}return t},C=[null,[],[]],v="undefined"!=typeof TextDecoder?new TextDecoder:void 0,UTF8ArrayToString=(e,t=0,a,r)=>{var i=((e,t,a,r)=>{var i=t+a;if(r)return i;for(;e[t]&&!(t>=i);)++t;return t})(e,t,a,r);if(i-t>16&&e.buffer&&v)return v.decode(e.subarray(t,i));for(var n="";t>10,56320|1023&l)}}else n+=String.fromCharCode((31&s)<<6|o)}else n+=String.fromCharCode(s)}return n},printChar=(e,t)=>{var a=C[e];if(0===t||10===t){(1===e?d:f)(UTF8ArrayToString(a));a.length=0}else a.push(t)},UTF8ToString=(e,t,a)=>e?UTF8ArrayToString(l,e,t,a):"";t.noExitRuntime&&(w=t.noExitRuntime);t.print&&(d=t.print);t.printErr&&(f=t.printErr);t.wasmBinary&&t.wasmBinary;t.arguments&&t.arguments;t.thisProgram&&(a=t.thisProgram);if(t.preInit){"function"==typeof t.preInit&&(t.preInit=[t.preInit]);for(;t.preInit.length>0;)t.preInit.shift()()}t.writeArrayToMemory=(e,t)=>{c.set(e,t)};var F,T={k:()=>function abort(e){t.onAbort?.(e);f(e="Aborted("+e+")");g=!0;e+=". Build with -sASSERTIONS for more info.";var a=new WebAssembly.RuntimeError(e);s?.(a);throw a}(""),j:()=>{w=!1;x=0},l:(e,t)=>{if(S[e]){clearTimeout(S[e].id);delete S[e]}if(!t)return 0;var a=setTimeout(()=>{delete S[e];callUserCallback(()=>m(e,performance.now()))},t);S[e]={id:a,timeout_ms:t};return 0},f:function _copy_pixels_1(e,a){e>>=2;const r=t.imageData=new Uint8ClampedArray(a),i=h.subarray(e,e+a);r.set(i)},e:function _copy_pixels_3(e,a,r,i){e>>=2;a>>=2;r>>=2;const n=t.imageData=new Uint8ClampedArray(3*i),s=h.subarray(e,e+i),o=h.subarray(a,a+i),c=h.subarray(r,r+i);for(let e=0;e>=2;a>>=2;r>>=2;i>>=2;const s=t.imageData=new Uint8ClampedArray(4*n),o=h.subarray(e,e+n),c=h.subarray(a,a+n),l=h.subarray(r,r+n),u=h.subarray(i,i+n);for(let e=0;e{var t=l.length,a=2147483648;if((e>>>=0)>a)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);i=Math.min(i,e+100663296);var n=Math.min(a,alignMemory(Math.max(e,i),65536));if(growMemory(n))return!0}return!1},o:(e,t)=>{var a=0,r=0;for(var i of getEnvStrings()){var n=t+a;u[e+r>>2]=n;a+=stringToUTF8(i,n,1/0)+1;r+=4}return 0},p:(e,t)=>{var a=getEnvStrings();u[e>>2]=a.length;var r=0;for(var i of a)r+=lengthBytesUTF8(i)+1;u[t>>2]=r;return 0},n:function _fd_seek(e,t,a,r){t=(i=t)<-9007199254740992||i>9007199254740992?NaN:Number(i);var i;return 70},b:(e,t,a,r)=>{for(var i=0,n=0;n>2],o=u[t+4>>2];t+=8;for(var c=0;c>2]=i;return 0},q:function _gray_to_rgba(e,a){e>>=2;const r=t.imageData=new Uint8ClampedArray(4*a),i=h.subarray(e,e+a);for(let e=0;e>=2;a>>=2;const i=t.imageData=new Uint8ClampedArray(4*r),n=h.subarray(e,e+r),s=h.subarray(a,a+r);for(let e=0;e>=2;a>>=2;r>>=2;const n=t.imageData=new Uint8ClampedArray(4*i),s=h.subarray(e,e+i),o=h.subarray(a,a+i),c=h.subarray(r,r+i);for(let e=0;e{t.instantiateWasm(e,(e,t)=>{a(receiveInstance(e))})})}();!function run(){!function preRun(){if(t.preRun){"function"==typeof t.preRun&&(t.preRun=[t.preRun]);for(;t.preRun.length;)addOnPreRun(t.preRun.shift())}callRuntimeCallbacks(y)}();function doRun(){t.calledRun=!0;if(!g){!function initRuntime(){p=!0;F.s()}();n?.(t);t.onRuntimeInitialized?.();!function postRun(){if(t.postRun){"function"==typeof t.postRun&&(t.postRun=[t.postRun]);for(;t.postRun.length;)addOnPostRun(t.postRun.shift())}callRuntimeCallbacks(b)}()}}if(t.setStatus){t.setStatus("Running...");setTimeout(()=>{setTimeout(()=>t.setStatus(""),1);doRun()},1)}else doRun()}();return p?t:new Promise((e,t)=>{n=e;s=t})};class JpxError extends Jt{constructor(e){super(e,"JpxError")}}class JpxImage{static#E=null;static#P=null;static#L=null;static#v=!0;static#_=!0;static#F=null;static setOptions({handler:e,useWasm:t,useWorkerFetch:a,wasmUrl:r}){this.#v=t;this.#_=a;this.#F=r;a||(this.#P=e)}static async#j(e){const t=`${this.#F}openjpeg_nowasm_fallback.js`;let a=null;try{a=(await import( /*webpackIgnore: true*/ /*@vite-ignore*/ t)).default()}catch(e){warn(`JpxImage#getJsModule: ${e}`)}e(a)}static async#U(e,t,a){const r="openjpeg.wasm";try{this.#E||(this.#_?this.#E=await fetchBinaryData(`${this.#F}${r}`):this.#E=await this.#P.sendWithPromise("FetchBinaryData",{type:"wasmFactory",filename:r}));return a((await WebAssembly.instantiate(this.#E,t)).instance)}catch(t){warn(`JpxImage#instantiateWasm: ${t}`);this.#j(e);return null}finally{this.#P=null}}static async decode(e,{numComponents:t=4,isIndexedColormap:a=!1,smaskInData:r=!1,reducePower:i=0}={}){if(!this.#L){const{promise:e,resolve:t}=Promise.withResolvers(),a=[e];this.#v?a.push(Ma({warn,instantiateWasm:this.#U.bind(this,t)})):this.#j(t);this.#L=Promise.race(a)}const n=await this.#L;if(!n)throw new JpxError("OpenJPEG failed to initialize");let s;try{const o=e.length;s=n._malloc(o);n.writeArrayToMemory(e,s);if(n._jp2_decode(s,o,t>0?t:0,!!a,!!r,i)){const{errorMessages:e}=n;if(e){delete n.errorMessages;throw new JpxError(e)}throw new JpxError("Unknown error")}const{imageData:c}=n;n.imageData=null;return c}finally{s&&n._free(s)}}static cleanup(){this.#L=null}static parseImageProperties(e){let t=e.getByte();for(;t>=0;){const a=t;t=e.getByte();if(65361===(a<<8|t)){e.skip(4);const t=e.getInt32()>>>0,a=e.getInt32()>>>0,r=e.getInt32()>>>0,i=e.getInt32()>>>0;e.skip(16);return{width:t-r,height:a-i,bitsPerComponent:8,componentsCount:e.getUint16()}}}throw new JpxError("No size marker found in JPX stream")}}function addState(e,t,a,r,i){let n=e;for(let e=0,a=t.length-1;e1e3){l=Math.max(l,d);f+=u+2;d=0;u=0}h.push({transform:t,x:d,y:f,w:a.width,h:a.height});d+=a.width+2;u=Math.max(u,a.height)}const g=Math.max(l,d)+1,p=f+u+1,m=new Uint8Array(g*p*4),b=g<<2;for(let e=0;e=0;){t[n-4]=t[n];t[n-3]=t[n+1];t[n-2]=t[n+2];t[n-1]=t[n+3];t[n+a]=t[n+a-4];t[n+a+1]=t[n+a-3];t[n+a+2]=t[n+a-2];t[n+a+3]=t[n+a-1];n-=b}}const y={width:g,height:p};if(e.isOffscreenCanvasSupported){const e=new OffscreenCanvas(g,p);e.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(m.buffer),g,p),0,0);y.bitmap=e.transferToImageBitmap();y.data=null}else{y.kind=v;y.data=m}a.splice(n,4*c,Et);r.splice(n,4*c,[y,h]);return n+1});addState(Da,[pe,be,Dt,me],null,function iterateImageMaskGroup(e,t){const a=e.fnArray,r=(t-(e.iCurr-3))%4;switch(r){case 0:return a[t]===pe;case 1:return a[t]===be;case 2:return a[t]===Dt;case 3:return a[t]===me}throw new Error(`iterateImageMaskGroup - invalid pos: ${r}`)},function foundImageMaskGroup(e,t){const a=e.fnArray,r=e.argsArray,i=e.iCurr,n=i-3,s=i-2,o=i-1;let c=Math.floor((t-n)/4);if(c<10)return t-(t-n)%4;let l,h,u=!1;const d=r[o][0],f=r[s][0],g=r[s][1],p=r[s][2],m=r[s][3];if(g===p){u=!0;l=s+4;let e=o+4;for(let t=1;t=4&&a[n-4]===a[s]&&a[n-3]===a[o]&&a[n-2]===a[c]&&a[n-1]===a[l]&&r[n-4][0]===h&&r[n-4][1]===u){d++;f-=5}let g=f+4;for(let e=1;e{const t=e.argsArray,a=t[e.iCurr-1][0];if(a!==ve&&a!==Fe&&a!==Oe&&a!==Me&&a!==De&&a!==Be)return!0;const r=t[e.iCurr-2];return 1===r[0]&&0===r[1]&&0===r[2]&&1===r[3]},()=>!1,(e,t)=>{const{fnArray:a,argsArray:r}=e,i=e.iCurr,n=i-3,s=i-2,o=r[i-1],c=r[s],[,[l],h]=o;if(h){Util.scaleMinMax(c,h);for(let e=0,t=l.length;e=a)break}r=(r||Da)[e[t]];if(r&&!Array.isArray(r)){n.iCurr=t;t++;if(!r.checkFn||(0,r.checkFn)(n)){i=r;r=null}else r=null}else t++}this.state=r;this.match=i;this.lastProcessed=t}flush(){for(;this.match;){const e=this.queue.fnArray.length;this.lastProcessed=(0,this.match.processFn)(this.context,e);this.match=null;this.state=null;this._optimize()}}reset(){this.state=null;this.match=null;this.lastProcessed=0}}class OperatorList{static CHUNK_SIZE=1e3;static CHUNK_SIZE_ABOUT=this.CHUNK_SIZE-5;static isOffscreenCanvasSupported=!1;constructor(e=0,t){this._streamSink=t;this.fnArray=[];this.argsArray=[];this.optimizer=!t||e&d?new NullOptimizer(this):new QueueOptimizer(this);this.dependencies=new Set;this._totalLength=0;this.weight=0;this._resolved=t?null:Promise.resolve()}static setOptions({isOffscreenCanvasSupported:e}){this.isOffscreenCanvasSupported=e}get length(){return this.argsArray.length}get ready(){return this._resolved||this._streamSink.ready}get totalLength(){return this._totalLength+this.length}addOp(e,t){this.optimizer.push(e,t);this.weight++;this._streamSink&&(this.weight>=OperatorList.CHUNK_SIZE||this.weight>=OperatorList.CHUNK_SIZE_ABOUT&&(e===me||e===Le))&&this.flush()}addImageOps(e,t,a,r=!1){if(r){this.addOp(pe);this.addOp(ge,[[["SMask",!1]]])}void 0!==a&&this.addOp(St,["OC",a]);this.addOp(e,t);void 0!==a&&this.addOp(At,[]);r&&this.addOp(me)}addDependency(e){if(!this.dependencies.has(e)){this.dependencies.add(e);this.addOp(se,[e])}}addDependencies(e){for(const t of e)this.addDependency(t)}addOpList(e){if(e instanceof OperatorList){for(const t of e.dependencies)this.dependencies.add(t);for(let t=0,a=e.length;t>>0}function hexToStr(e,t){return 1===t?String.fromCharCode(e[0],e[1]):3===t?String.fromCharCode(e[0],e[1],e[2],e[3]):String.fromCharCode(...e.subarray(0,t+1))}function addHex(e,t,a){let r=0;for(let i=a;i>=0;i--){r+=e[i]+t[i];e[i]=255&r;r>>=8}}function incHex(e,t){let a=1;for(let r=t;r>=0&&a>0;r--){a+=e[r];e[r]=255&a;a>>=8}}const Ba=16;class BinaryCMapStream{constructor(e){this.buffer=e;this.pos=0;this.end=e.length;this.tmpBuf=new Uint8Array(19)}readByte(){return this.pos>=this.end?-1:this.buffer[this.pos++]}readNumber(){let e,t=0;do{const a=this.readByte();if(a<0)throw new FormatError("unexpected EOF in bcmap");e=!(128&a);t=t<<7|127&a}while(!e);return t}readSigned(){const e=this.readNumber();return 1&e?~(e>>>1):e>>>1}readHex(e,t){e.set(this.buffer.subarray(this.pos,this.pos+t+1));this.pos+=t+1}readHexNumber(e,t){let a;const r=this.tmpBuf;let i=0;do{const e=this.readByte();if(e<0)throw new FormatError("unexpected EOF in bcmap");a=!(128&e);r[i++]=127&e}while(!a);let n=t,s=0,o=0;for(;n>=0;){for(;o<8&&r.length>0;){s|=r[--i]<>=8;o-=8}}readHexSigned(e,t){this.readHexNumber(e,t);const a=1&e[t]?255:0;let r=0;for(let i=0;i<=t;i++){r=(1&r)<<8|e[i];e[i]=r>>1^a}}readString(){const e=this.readNumber(),t=new Array(e);for(let a=0;a=0;){const e=d>>5;if(7===e){switch(31&d){case 0:r.readString();break;case 1:n=r.readString()}continue}const a=!!(16&d),i=15&d;if(i+1>Ba)throw new Error("BinaryCMapReader.process: Invalid dataSize.");const f=1,g=r.readNumber();switch(e){case 0:r.readHex(s,i);r.readHexNumber(o,i);addHex(o,s,i);t.addCodespaceRange(i+1,hexToInt(s,i),hexToInt(o,i));for(let e=1;e=0;--i){r[a+i]=255&s;s>>=8}}}}class AsciiHexStream extends DecodeStream{constructor(e,t){t&&(t*=.5);super(t);this.str=e;this.dict=e.dict;this.firstDigit=-1}readBlock(){const e=this.str.getBytes(8e3);if(!e.length){this.eof=!0;return}const t=e.length+1>>1,a=this.ensureBuffer(this.bufferLength+t);let r=this.bufferLength,i=this.firstDigit;for(const t of e){let e;if(t>=48&&t<=57)e=15&t;else{if(!(t>=65&&t<=70||t>=97&&t<=102)){if(62===t){this.eof=!0;break}continue}e=9+(15&t)}if(i<0)i=e;else{a[r++]=i<<4|e;i=-1}}if(i>=0&&this.eof){a[r++]=i<<4;i=-1}this.firstDigit=i;this.bufferLength=r}}const Ra=-1,Na=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]],Ea=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],Pa=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],La=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],_a=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],ja=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];class CCITTFaxDecoder{constructor(e,t={}){if("function"!=typeof e?.next)throw new Error('CCITTFaxDecoder - invalid "source" parameter.');this.source=e;this.eof=!1;this.encoding=t.K||0;this.eoline=t.EndOfLine||!1;this.byteAlign=t.EncodedByteAlign||!1;this.columns=t.Columns||1728;this.rows=t.Rows||0;this.eoblock=t.EndOfBlock??!0;this.black=t.BlackIs1||!1;this.codingLine=new Uint32Array(this.columns+1);this.refLine=new Uint32Array(this.columns+2);this.codingLine[0]=this.columns;this.codingPos=0;this.row=0;this.nextLine2D=this.encoding<0;this.inputBits=0;this.inputBuf=0;this.outputBits=0;this.rowsDone=!1;let a;for(;0===(a=this._lookBits(12));)this._eatBits(1);1===a&&this._eatBits(12);if(this.encoding>0){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}}readNextChar(){if(this.eof)return-1;const e=this.refLine,t=this.codingLine,a=this.columns;let r,i,n,s,o;if(0===this.outputBits){this.rowsDone&&(this.eof=!0);if(this.eof)return-1;this.err=!1;let n,o,c;if(this.nextLine2D){for(s=0;t[s]=64);do{o+=c=this._getWhiteCode()}while(c>=64)}else{do{n+=c=this._getWhiteCode()}while(c>=64);do{o+=c=this._getBlackCode()}while(c>=64)}this._addPixels(t[this.codingPos]+n,i);t[this.codingPos]0?--r:++r;for(;e[r]<=t[this.codingPos]&&e[r]0?--r:++r;for(;e[r]<=t[this.codingPos]&&e[r]0?--r:++r;for(;e[r]<=t[this.codingPos]&&e[r]=64);else do{n+=c=this._getWhiteCode()}while(c>=64);this._addPixels(t[this.codingPos]+n,i);i^=1}}let l=!1;this.byteAlign&&(this.inputBits&=-8);if(this.eoblock||this.row!==this.rows-1){n=this._lookBits(12);if(this.eoline)for(;n!==Ra&&1!==n;){this._eatBits(1);n=this._lookBits(12)}else for(;0===n;){this._eatBits(1);n=this._lookBits(12)}if(1===n){this._eatBits(12);l=!0}else n===Ra&&(this.eof=!0)}else this.rowsDone=!0;if(!this.eof&&this.encoding>0&&!this.rowsDone){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}if(this.eoblock&&l&&this.byteAlign){n=this._lookBits(12);if(1===n){this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}if(this.encoding>=0)for(s=0;s<4;++s){n=this._lookBits(12);1!==n&&info("bad rtc code: "+n);this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}}this.eof=!0}}else if(this.err&&this.eoline){for(;;){n=this._lookBits(13);if(n===Ra){this.eof=!0;return-1}if(n>>1==1)break;this._eatBits(1)}this._eatBits(12);if(this.encoding>0){this._eatBits(1);this.nextLine2D=!(1&n)}}this.outputBits=t[0]>0?t[this.codingPos=0]:t[this.codingPos=1];this.row++}if(this.outputBits>=8){o=1&this.codingPos?0:255;this.outputBits-=8;if(0===this.outputBits&&t[this.codingPos]n){o<<=n;1&this.codingPos||(o|=255>>8-n);this.outputBits-=n;n=0}else{o<<=this.outputBits;1&this.codingPos||(o|=255>>8-this.outputBits);n-=this.outputBits;this.outputBits=0;if(t[this.codingPos]0){o<<=n;n=0}}}while(n)}this.black&&(o^=255);return o}_addPixels(e,t){const a=this.codingLine;let r=this.codingPos;if(e>a[r]){if(e>this.columns){info("row is wrong length");this.err=!0;e=this.columns}1&r^t&&++r;a[r]=e}this.codingPos=r}_addPixelsNeg(e,t){const a=this.codingLine;let r=this.codingPos;if(e>a[r]){if(e>this.columns){info("row is wrong length");this.err=!0;e=this.columns}1&r^t&&++r;a[r]=e}else if(e0&&e=i){const t=a[e-i];if(t[0]===r){this._eatBits(r);return[!0,t[1],!0]}}}return[!1,0,!1]}_getTwoDimCode(){let e,t=0;if(this.eoblock){t=this._lookBits(7);e=Na[t];if(e?.[0]>0){this._eatBits(e[0]);return e[1]}}else{const e=this._findTableCode(1,7,Na);if(e[0]&&e[2])return e[1]}info("Bad two dim code");return Ra}_getWhiteCode(){let e,t=0;if(this.eoblock){t=this._lookBits(12);if(t===Ra)return 1;e=t>>5?Pa[t>>3]:Ea[t];if(e[0]>0){this._eatBits(e[0]);return e[1]}}else{let e=this._findTableCode(1,9,Pa);if(e[0])return e[1];e=this._findTableCode(11,12,Ea);if(e[0])return e[1]}info("bad white code");this._eatBits(1);return 1}_getBlackCode(){let e,t;if(this.eoblock){e=this._lookBits(13);if(e===Ra)return 1;t=e>>7?!(e>>9)&&e>>7?_a[(e>>1)-64]:ja[e>>7]:La[e];if(t[0]>0){this._eatBits(t[0]);return t[1]}}else{let e=this._findTableCode(2,6,ja);if(e[0])return e[1];e=this._findTableCode(7,12,_a,64);if(e[0])return e[1];e=this._findTableCode(10,13,La);if(e[0])return e[1]}info("bad black code");this._eatBits(1);return 1}_lookBits(e){let t;for(;this.inputBits>16-e;this.inputBuf=this.inputBuf<<8|t;this.inputBits+=8}return this.inputBuf>>this.inputBits-e&65535>>16-e}_eatBits(e){(this.inputBits-=e)<0&&(this.inputBits=0)}}class CCITTFaxStream extends DecodeStream{constructor(e,t,a){super(t);this.str=e;this.dict=e.dict;a instanceof Dict||(a=Dict.empty);const r={next:()=>e.getByte()};this.ccittFaxDecoder=new CCITTFaxDecoder(r,{K:a.get("K"),EndOfLine:a.get("EndOfLine"),EncodedByteAlign:a.get("EncodedByteAlign"),Columns:a.get("Columns"),Rows:a.get("Rows"),EndOfBlock:a.get("EndOfBlock"),BlackIs1:a.get("BlackIs1")})}readBlock(){for(;!this.eof;){const e=this.ccittFaxDecoder.readNextChar();if(-1===e){this.eof=!0;return}this.ensureBuffer(this.bufferLength+1);this.buffer[this.bufferLength++]=e}}}const Ua=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xa=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),qa=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Ha=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Wa=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];class FlateStream extends DecodeStream{constructor(e,t){super(t);this.str=e;this.dict=e.dict;const a=e.getByte(),r=e.getByte();if(-1===a||-1===r)throw new FormatError(`Invalid header in flate stream: ${a}, ${r}`);if(8!=(15&a))throw new FormatError(`Unknown compression method in flate stream: ${a}, ${r}`);if(((a<<8)+r)%31!=0)throw new FormatError(`Bad FCHECK in flate stream: ${a}, ${r}`);if(32&r)throw new FormatError(`FDICT bit set in flate stream: ${a}, ${r}`);this.codeSize=0;this.codeBuf=0}async getImageData(e,t){const a=await this.asyncGetBytes();return a?a.length<=e?a:a.subarray(0,e):this.getBytes(e)}async asyncGetBytes(){this.str.reset();const e=this.str.getBytes();try{const{readable:t,writable:a}=new DecompressionStream("deflate"),r=a.getWriter();await r.ready;r.write(e).then(async()=>{await r.ready;await r.close()}).catch(()=>{});const i=[];let n=0;for await(const e of t){i.push(e);n+=e.byteLength}const s=new Uint8Array(n);let o=0;for(const e of i){s.set(e,o);o+=e.byteLength}return s}catch{this.str=new Stream(e,2,e.length,this.str.dict);this.reset();return null}}get isAsync(){return!0}getBits(e){const t=this.str;let a,r=this.codeSize,i=this.codeBuf;for(;r>e;this.codeSize=r-=e;return a}getCode(e){const t=this.str,a=e[0],r=e[1];let i,n=this.codeSize,s=this.codeBuf;for(;n>16,l=65535&o;if(c<1||n>c;this.codeSize=n-c;return l}generateHuffmanTable(e){const t=e.length;let a,r=0;for(a=0;ar&&(r=e[a]);const i=1<>=1}for(a=e;a>=1;if(0===t){let t;if(-1===(t=r.getByte())){this.#X("Bad block header in flate stream");return}let a=t;if(-1===(t=r.getByte())){this.#X("Bad block header in flate stream");return}a|=t<<8;if(-1===(t=r.getByte())){this.#X("Bad block header in flate stream");return}let i=t;if(-1===(t=r.getByte())){this.#X("Bad block header in flate stream");return}i|=t<<8;if(i!==(65535&~a)&&(0!==a||0!==i))throw new FormatError("Bad uncompressed block length in flate stream");this.codeBuf=0;this.codeSize=0;const n=this.bufferLength,s=n+a;e=this.ensureBuffer(s);this.bufferLength=s;if(0===a)-1===r.peekByte()&&(this.eof=!0);else{const t=r.getBytes(a);e.set(t,n);t.length0;)h[o++]=f}i=this.generateHuffmanTable(h.subarray(0,e));n=this.generateHuffmanTable(h.subarray(e,l))}}e=this.buffer;let s=e?e.length:0,o=this.bufferLength;for(;;){let t=this.getCode(i);if(t<256){if(o+1>=s){e=this.ensureBuffer(o+1);s=e.length}e[o++]=t;continue}if(256===t){this.bufferLength=o;return}t-=257;t=Xa[t];let r=t>>16;r>0&&(r=this.getBits(r));a=(65535&t)+r;t=this.getCode(n);t=qa[t];r=t>>16;r>0&&(r=this.getBits(r));const c=(65535&t)+r;if(o+a>=s){e=this.ensureBuffer(o+a);s=e.length}for(let t=0;t>9&127;this.clow=this.clow<<7&65535;this.ct-=7;this.a=32768}byteIn(){const e=this.data;let t=this.bp;if(255===e[t])if(e[t+1]>143){this.clow+=65280;this.ct=8}else{t++;this.clow+=e[t]<<9;this.ct=7;this.bp=t}else{t++;this.clow+=t65535){this.chigh+=this.clow>>16;this.clow&=65535}}readBit(e,t){let a=e[t]>>1,r=1&e[t];const i=za[a],n=i.qe;let s,o=this.a-n;if(this.chigh>15&1;this.clow=this.clow<<1&65535;this.ct--}while(!(32768&o));this.a=o;e[t]=a<<1|r;return s}}class Jbig2Error extends Jt{constructor(e){super(e,"Jbig2Error")}}class ContextCache{getContexts(e){return e in this?this[e]:this[e]=new Int8Array(65536)}}class DecodingContext{constructor(e,t,a){this.data=e;this.start=t;this.end=a}get decoder(){return shadow(this,"decoder",new ArithmeticDecoder(this.data,this.start,this.end))}get contextCache(){return shadow(this,"contextCache",new ContextCache)}}function decodeInteger(e,t,a){const r=e.getContexts(t);let i=1;function readBits(e){let t=0;for(let n=0;n>>0}const n=readBits(1),s=readBits(1)?readBits(1)?readBits(1)?readBits(1)?readBits(1)?readBits(32)+4436:readBits(12)+340:readBits(8)+84:readBits(6)+20:readBits(4)+4:readBits(2);let o;0===n?o=s:s>0&&(o=-s);return o>=-2147483648&&o<=ca?o:null}function decodeIAID(e,t,a){const r=e.getContexts("IAID");let i=1;for(let e=0;ee.y-t.y||e.x-t.x);const h=l.length,u=new Int8Array(h),d=new Int8Array(h),f=[];let g,p,m=0,b=0,y=0,w=0;for(p=0;p=v&&E=F){q=q<<1&m;for(p=0;p=0&&_=0){j=D[L][_];j&&(q|=j<=e?l<<=1:l=l<<1|S[o][c]}for(f=0;f=w||c<0||c>=y?l<<=1:l=l<<1|r[o][c]}const g=k.readBit(C,l);t[s]=g}}return S}function decodeTextRegion(e,t,a,r,i,n,s,o,c,l,h,u,d,f,g,p,m,b,y){if(e&&t)throw new Jbig2Error("refinement with Huffman is not supported");const w=[];let x,S;for(x=0;x1&&(i=e?y.readBits(b):decodeInteger(C,"IAIT",k));const n=s*v+i,F=e?f.symbolIDTable.decode(y):decodeIAID(C,k,c),T=t&&(e?y.readBit():decodeInteger(C,"IARI",k));let O=o[F],M=O[0].length,D=O.length;if(T){const e=decodeInteger(C,"IARDW",k),t=decodeInteger(C,"IARDH",k);M+=e;D+=t;O=decodeRefinement(M,D,g,O,(e>>1)+decodeInteger(C,"IARDX",k),(t>>1)+decodeInteger(C,"IARDY",k),!1,p,m)}let R=0;l?1&u?R=D-1:r+=D-1:u>1?r+=M-1:R=M-1;const N=n-(1&u?0:D-1),E=r-(2&u?M-1:0);let L,_,j;if(l)for(L=0;L>5&7;const c=[31&s];let l=t+6;if(7===s){o=536870911&readUint32(e,l-1);l+=3;let t=o+7>>3;c[0]=e[l++];for(;--t>0;)c.push(e[l++])}else if(5===s||6===s)throw new Jbig2Error("invalid referred-to flags");a.retainBits=c;let h=4;a.number<=256?h=1:a.number<=65536&&(h=2);const u=[];let d,f;for(d=0;d>>24&255;n[3]=t.height>>16&255;n[4]=t.height>>8&255;n[5]=255&t.height;for(d=l,f=e.length;d>2&3;e.huffmanDWSelector=t>>4&3;e.bitmapSizeSelector=t>>6&1;e.aggregationInstancesSelector=t>>7&1;e.bitmapCodingContextUsed=!!(256&t);e.bitmapCodingContextRetained=!!(512&t);e.template=t>>10&3;e.refinementTemplate=t>>12&1;l+=2;if(!e.huffman){c=0===e.template?4:1;s=[];for(o=0;o>2&3;h.stripSize=1<>4&3;h.transposed=!!(64&u);h.combinationOperator=u>>7&3;h.defaultPixelValue=u>>9&1;h.dsOffset=u<<17>>27;h.refinementTemplate=u>>15&1;if(h.huffman){const e=readUint16(r,l);l+=2;h.huffmanFS=3&e;h.huffmanDS=e>>2&3;h.huffmanDT=e>>4&3;h.huffmanRefinementDW=e>>6&3;h.huffmanRefinementDH=e>>8&3;h.huffmanRefinementDX=e>>10&3;h.huffmanRefinementDY=e>>12&3;h.huffmanRefinementSizeSelector=!!(16384&e)}if(h.refinement&&!h.refinementTemplate){s=[];for(o=0;o<2;o++){s.push({x:readInt8(r,l),y:readInt8(r,l+1)});l+=2}h.refinementAt=s}h.numberOfSymbolInstances=readUint32(r,l);l+=4;n=[h,a.referredTo,r,l,i];break;case 16:const d={},f=r[l++];d.mmr=!!(1&f);d.template=f>>1&3;d.patternWidth=r[l++];d.patternHeight=r[l++];d.maxPatternIndex=readUint32(r,l);l+=4;n=[d,a.number,r,l,i];break;case 22:case 23:const g={};g.info=readRegionSegmentInformation(r,l);l+=Ya;const p=r[l++];g.mmr=!!(1&p);g.template=p>>1&3;g.enableSkip=!!(8&p);g.combinationOperator=p>>4&7;g.defaultPixelValue=p>>7&1;g.gridWidth=readUint32(r,l);l+=4;g.gridHeight=readUint32(r,l);l+=4;g.gridOffsetX=4294967295&readUint32(r,l);l+=4;g.gridOffsetY=4294967295&readUint32(r,l);l+=4;g.gridVectorX=readUint16(r,l);l+=2;g.gridVectorY=readUint16(r,l);l+=2;n=[g,a.referredTo,r,l,i];break;case 38:case 39:const m={};m.info=readRegionSegmentInformation(r,l);l+=Ya;const b=r[l++];m.mmr=!!(1&b);m.template=b>>1&3;m.prediction=!!(8&b);if(!m.mmr){c=0===m.template?4:1;s=[];for(o=0;o>2&1;y.combinationOperator=w>>3&3;y.requiresBuffer=!!(32&w);y.combinationOperatorOverride=!!(64&w);n=[y];break;case 49:case 50:case 51:case 62:break;case 53:n=[a.number,r,l,i];break;default:throw new Jbig2Error(`segment type ${a.typeName}(${a.type}) is not implemented`)}const h="on"+a.typeName;h in t&&t[h].apply(t,n)}function processSegments(e,t){for(let a=0,r=e.length;a>3,a=new Uint8ClampedArray(t*e.height);e.defaultPixelValue&&a.fill(255);this.buffer=a}drawBitmap(e,t){const a=this.currentPageInfo,r=e.width,i=e.height,n=a.width+7>>3,s=a.combinationOperatorOverride?e.combinationOperator:a.combinationOperator,o=this.buffer,c=128>>(7&e.x);let l,h,u,d,f=e.y*n+(e.x>>3);switch(s){case 0:for(l=0;l>=1;if(!u){u=128;d++}}f+=n}break;case 2:for(l=0;l>=1;if(!u){u=128;d++}}f+=n}break;default:throw new Jbig2Error(`operator ${s} is not supported`)}}onImmediateGenericRegion(e,t,a,r){const i=e.info,n=new DecodingContext(t,a,r),s=decodeBitmap(e.mmr,i.width,i.height,e.template,e.prediction,null,e.at,n);this.drawBitmap(i,s)}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments)}onSymbolDictionary(e,t,a,r,i,n){let s,o;if(e.huffman){s=function getSymbolDictionaryHuffmanTables(e,t,a){let r,i,n,s,o=0;switch(e.huffmanDHSelector){case 0:case 1:r=getStandardTable(e.huffmanDHSelector+4);break;case 3:r=getCustomHuffmanTable(o,t,a);o++;break;default:throw new Jbig2Error("invalid Huffman DH selector")}switch(e.huffmanDWSelector){case 0:case 1:i=getStandardTable(e.huffmanDWSelector+2);break;case 3:i=getCustomHuffmanTable(o,t,a);o++;break;default:throw new Jbig2Error("invalid Huffman DW selector")}if(e.bitmapSizeSelector){n=getCustomHuffmanTable(o,t,a);o++}else n=getStandardTable(1);s=e.aggregationInstancesSelector?getCustomHuffmanTable(o,t,a):getStandardTable(1);return{tableDeltaHeight:r,tableDeltaWidth:i,tableBitmapSize:n,tableAggregateInstances:s}}(e,a,this.customTables);o=new Reader(r,i,n)}let c=this.symbols;c||(this.symbols=c={});const l=[];for(const e of a){const t=c[e];t&&l.push(...t)}const h=new DecodingContext(r,i,n);c[t]=function decodeSymbolDictionary(e,t,a,r,i,n,s,o,c,l,h,u){if(e&&t)throw new Jbig2Error("symbol refinement with Huffman is not supported");const d=[];let f=0,g=log2(a.length+r);const p=h.decoder,m=h.contextCache;let b,y;if(e){b=getStandardTable(1);y=[];g=Math.max(g,1)}for(;d.length1)w=decodeTextRegion(e,t,r,f,0,i,1,a.concat(d),g,0,0,1,0,n,c,l,h,0,u);else{const e=decodeIAID(m,p,g),t=decodeInteger(m,"IARDX",p),i=decodeInteger(m,"IARDY",p);w=decodeRefinement(r,f,c,e=32){let a,r,s;switch(t){case 32:if(0===e)throw new Jbig2Error("no previous value in symbol ID table");r=i.readBits(2)+3;a=n[e-1].prefixLength;break;case 33:r=i.readBits(3)+3;a=0;break;case 34:r=i.readBits(7)+11;a=0;break;default:throw new Jbig2Error("invalid code length in symbol ID table")}for(s=0;s=0;m--){O=e?decodeMMRBitmap(T,c,l,!0):decodeBitmap(!1,c,l,a,!1,null,v,g);F[m]=O}for(M=0;M=0;b--){R^=F[b][M][D];N|=R<>8;_=u+M*d-D*f>>8;if(L>=0&&L+S<=r&&_>=0&&_+k<=i)for(m=0;m=i)){U=p[t];j=E[m];for(b=0;b=0&&e>1&7),c=1+(r>>4&7),l=[];let h,u,d=i;do{h=s.readBits(o);u=s.readBits(c);l.push(new HuffmanLine([d,h,u,0]));d+=1<>t&1;if(t<=0)this.children[a]=new HuffmanTreeNode(e);else{let r=this.children[a];r||(this.children[a]=r=new HuffmanTreeNode(null));r.buildTree(e,t-1)}}decodeNode(e){if(this.isLeaf){if(this.isOOB)return null;const t=e.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-t:t)}const t=this.children[e.readBit()];if(!t)throw new Jbig2Error("invalid Huffman data");return t.decodeNode(e)}}class HuffmanTable{constructor(e,t){t||this.assignPrefixCodes(e);this.rootNode=new HuffmanTreeNode(null);for(let t=0,a=e.length;t0&&this.rootNode.buildTree(a,a.prefixLength-1)}}decode(e){return this.rootNode.decodeNode(e)}assignPrefixCodes(e){const t=e.length;let a=0;for(let r=0;r=this.end)throw new Jbig2Error("end of data while reading bit");this.currentByte=this.data[this.position++];this.shift=7}const e=this.currentByte>>this.shift&1;this.shift--;return e}readBits(e){let t,a=0;for(t=e-1;t>=0;t--)a|=this.readBit()<=this.end?-1:this.data[this.position++]}}function getCustomHuffmanTable(e,t,a){let r=0;for(let i=0,n=t.length;i>a&1;a--}}if(r&&!o){const e=5;for(let t=0;t>>t&(1<0;if(e<256){d[0]=e;f=1}else{if(!(e>=258)){if(256===e){h=9;s=258;f=0;continue}this.eof=!0;delete this.lzwState;break}if(e=0;t--){d[t]=o[a];a=l[a]}}else d[f++]=d[0]}if(i){l[s]=u;c[s]=c[u]+1;o[s]=d[0];s++;h=s+n&s+n-1?h:0|Math.min(Math.log(s+n)/.6931471805599453+1,12)}u=e;g+=f;if(r15))throw new FormatError(`Unsupported predictor: ${r}`);this.readBlock=2===r?this.readBlockTiff:this.readBlockPng;this.str=e;this.dict=e.dict;const i=this.colors=a.get("Colors")||1,n=this.bits=a.get("BPC","BitsPerComponent")||8,s=this.columns=a.get("Columns")||1;this.pixBytes=i*n+7>>3;this.rowBytes=s*i*n+7>>3;return this}readBlockTiff(){const e=this.rowBytes,t=this.bufferLength,a=this.ensureBuffer(t+e),r=this.bits,i=this.colors,n=this.str.getBytes(e);this.eof=!n.length;if(this.eof)return;let s,o=0,c=0,l=0,h=0,u=t;if(1===r&&1===i)for(s=0;s>1;e^=e>>2;e^=e>>4;o=(1&e)<<7;a[u++]=e}else if(8===r){for(s=0;s>8&255;a[u++]=255&e}}else{const e=new Uint8Array(i+1),u=(1<>l-r)&u;l-=r;c=c<=8){a[f++]=c>>h-8&255;h-=8}}h>0&&(a[f++]=(c<<8-h)+(o&(1<<8-h)-1))}this.bufferLength+=e}readBlockPng(){const e=this.rowBytes,t=this.pixBytes,a=this.str.getByte(),r=this.str.getBytes(e);this.eof=!r.length;if(this.eof)return;const i=this.bufferLength,n=this.ensureBuffer(i+e);let s=n.subarray(i-e,i);0===s.length&&(s=new Uint8Array(e));let o,c,l,h=i;switch(a){case 0:for(o=0;o>1)+r[o];for(;o>1)+r[o]&255;h++}break;case 4:for(o=0;o0){const e=this.str.getBytes(r);t.set(e,a);a+=r}}else{r=257-r;t=this.ensureBuffer(a+r+1);t.fill(e[1],a,a+r);a+=r}this.bufferLength=a}}class Parser{constructor({lexer:e,xref:t,allowStreams:a=!1,recoveryMode:r=!1}){this.lexer=e;this.xref=t;this.allowStreams=a;this.recoveryMode=r;this.imageCache=Object.create(null);this._imageId=0;this.refill()}refill(){this.buf1=this.lexer.getObj();this.buf2=this.lexer.getObj()}shift(){if(this.buf2 instanceof Cmd&&"ID"===this.buf2.cmd){this.buf1=this.buf2;this.buf2=null}else{this.buf1=this.buf2;this.buf2=this.lexer.getObj()}}tryShift(){try{this.shift();return!0}catch(e){if(e instanceof MissingDataException)throw e;return!1}}getObj(e=null){const t=this.buf1;this.shift();if(t instanceof Cmd)switch(t.cmd){case"BI":return this.makeInlineImage(e);case"[":const a=[];for(;!isCmd(this.buf1,"]")&&this.buf1!==aa;)a.push(this.getObj(e));if(this.buf1===aa){if(this.recoveryMode)return a;throw new ParserEOFException("End of file inside array.")}this.shift();return a;case"<<":const r=new Dict(this.xref);for(;!isCmd(this.buf1,">>")&&this.buf1!==aa;){if(!(this.buf1 instanceof Name)){info("Malformed dictionary: key must be a name object");this.shift();continue}const t=this.buf1.name;this.shift();if(this.buf1===aa)break;r.set(t,this.getObj(e))}if(this.buf1===aa){if(this.recoveryMode)return r;throw new ParserEOFException("End of file inside dictionary.")}if(isCmd(this.buf2,"stream"))return this.allowStreams?this.makeStream(r,e):r;this.shift();return r;default:return t}if(Number.isInteger(t)){if(Number.isInteger(this.buf1)&&isCmd(this.buf2,"R")){const e=Ref.get(t,this.buf1);this.shift();this.shift();return e}return t}return"string"==typeof t&&e?e.decryptString(t):t}findDefaultInlineStreamEnd(e){const{knownCommands:t}=this.lexer,a=e.pos;let r,i,n=0;for(;-1!==(r=e.getByte());)if(0===n)n=69===r?1:0;else if(1===n)n=73===r?2:0;else if(32===r||10===r||13===r){i=e.pos;const a=e.peekBytes(15),s=a.length;if(0===s)break;for(let e=0;e127))){n=0;break}}if(2!==n)continue;if(!t){warn("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");continue}const o=new Lexer(new Stream(e.peekBytes(75)),t);o._hexStringWarn=()=>{};let c=0;for(;;){const e=o.getObj();if(e===aa){n=0;break}if(e instanceof Cmd){const a=t[e.cmd];if(!a){n=0;break}if(a.variableArgs?c<=a.numArgs:c===a.numArgs)break;c=0;continue}c++}if(2===n)break}else n=0;if(-1===r){warn("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker");if(i){warn('... trying to recover by using the last "EI" occurrence.');e.skip(-(e.pos-i))}}let s=4;e.skip(-s);r=e.peekByte();e.skip(s);isWhiteSpace(r)||s--;return e.pos-s-a}findDCTDecodeInlineStreamEnd(e){const t=e.pos;let a,r,i=!1;for(;-1!==(a=e.getByte());)if(255===a){switch(e.getByte()){case 0:break;case 255:e.skip(-1);break;case 217:i=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:r=e.getUint16();r>2?e.skip(r-2):e.skip(-2)}if(i)break}const n=e.pos-t;if(-1===a){warn("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead.");e.skip(-n);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return n}findASCII85DecodeInlineStreamEnd(e){const t=e.pos;let a;for(;-1!==(a=e.getByte());)if(126===a){const t=e.pos;a=e.peekByte();for(;isWhiteSpace(a);){e.skip();a=e.peekByte()}if(62===a){e.skip();break}if(e.pos>t){const t=e.peekBytes(2);if(69===t[0]&&73===t[1])break}}const r=e.pos-t;if(-1===a){warn("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead.");e.skip(-r);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return r}findASCIIHexDecodeInlineStreamEnd(e){const t=e.pos;let a;for(;-1!==(a=e.getByte())&&62!==a;);const r=e.pos-t;if(-1===a){warn("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead.");e.skip(-r);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return r}inlineStreamSkipEI(e){let t,a=0;for(;-1!==(t=e.getByte());)if(0===a)a=69===t?1:0;else if(1===a)a=73===t?2:0;else if(2===a)break}makeInlineImage(e){const t=this.lexer,a=t.stream,r=Object.create(null);let i;for(;!isCmd(this.buf1,"ID")&&this.buf1!==aa;){if(!(this.buf1 instanceof Name))throw new FormatError("Dictionary key must be a name object");const t=this.buf1.name;this.shift();if(this.buf1===aa)break;r[t]=this.getObj(e)}-1!==t.beginInlineImagePos&&(i=a.pos-t.beginInlineImagePos);const n=this.xref.fetchIfRef(r.F||r.Filter);let s;if(n instanceof Name)s=n.name;else if(Array.isArray(n)){const e=this.xref.fetchIfRef(n[0]);e instanceof Name&&(s=e.name)}const o=a.pos;let c,l;switch(s){case"DCT":case"DCTDecode":c=this.findDCTDecodeInlineStreamEnd(a);break;case"A85":case"ASCII85Decode":c=this.findASCII85DecodeInlineStreamEnd(a);break;case"AHx":case"ASCIIHexDecode":c=this.findASCIIHexDecodeInlineStreamEnd(a);break;default:c=this.findDefaultInlineStreamEnd(a)}if(c<1e3&&i>0){const e=a.pos;a.pos=t.beginInlineImagePos;l=function getInlineImageCacheKey(e){const t=[],a=e.length;let r=0;for(;r=r){let r=!1;for(const e of i){const t=e.length;let i=0;for(;i=n){r=!0;break}if(i>=t){if(isWhiteSpace(s[c+o+i])){info(`Found "${bytesToString([...a,...e])}" when searching for endstream command.`);r=!0}break}}if(r){t.pos+=c;return t.pos-e}}c++}t.pos+=o}return-1}makeStream(e,t){const a=this.lexer;let r=a.stream;a.skipToNextLine();const i=r.pos-1;let n=e.get("Length");if(!Number.isInteger(n)){info(`Bad length "${n&&n.toString()}" in stream.`);n=0}r.pos=i+n;a.nextChar();if(this.tryShift()&&isCmd(this.buf2,"endstream"))this.shift();else{n=this.#q(i);if(n<0)throw new FormatError("Missing endstream command.");a.nextChar();this.shift();this.shift()}this.shift();r=r.makeSubStream(i,n,e);t&&(r=t.createStream(r,n));r=this.filter(r,e,n);r.dict=e;return r}filter(e,t,a){let r=t.get("F","Filter"),i=t.get("DP","DecodeParms");if(r instanceof Name){Array.isArray(i)&&warn("/DecodeParms should not be an Array, when /Filter is a Name.");return this.makeFilter(e,r.name,a,i)}let n=a;if(Array.isArray(r)){const t=r,a=i;for(let s=0,o=t.length;s=48&&e<=57?15&e:e>=65&&e<=70||e>=97&&e<=102?9+(15&e):-1}class Lexer{constructor(e,t=null){this.stream=e;this.nextChar();this.strBuf=[];this.knownCommands=t;this._hexStringNumWarn=0;this.beginInlineImagePos=-1}nextChar(){return this.currentChar=this.stream.getByte()}peekChar(){return this.stream.peekByte()}getNumber(){let e=this.currentChar,t=!1,a=0,r=1;if(45===e){r=-1;e=this.nextChar();45===e&&(e=this.nextChar())}else 43===e&&(e=this.nextChar());if(10===e||13===e)do{e=this.nextChar()}while(10===e||13===e);if(46===e){a=10;e=this.nextChar()}if(e<48||e>57){const t=`Invalid number: ${String.fromCharCode(e)} (charCode ${e})`;if(isWhiteSpace(e)||40===e||60===e||-1===e){info(`Lexer.getNumber - "${t}".`);return 0}throw new FormatError(t)}let i=e-48,n=0,s=1;for(;(e=this.nextChar())>=0;)if(e>=48&&e<=57){const r=e-48;if(t)n=10*n+r;else{0!==a&&(a*=10);i=10*i+r}}else if(46===e){if(0!==a)break;a=1}else if(45===e)warn("Badly formatted number: minus sign in the middle");else{if(69!==e&&101!==e)break;e=this.peekChar();if(43===e||45===e){s=45===e?-1:1;this.nextChar()}else if(e<48||e>57)break;t=!0}0!==a&&(i/=a);t&&(i*=10**(s*n));return r*i}getString(){let e=1,t=!1;const a=this.strBuf;a.length=0;let r=this.nextChar();for(;;){let i=!1;switch(0|r){case-1:warn("Unterminated string");t=!0;break;case 40:++e;a.push("(");break;case 41:if(0===--e){this.nextChar();t=!0}else a.push(")");break;case 92:r=this.nextChar();switch(r){case-1:warn("Unterminated string");t=!0;break;case 110:a.push("\n");break;case 114:a.push("\r");break;case 116:a.push("\t");break;case 98:a.push("\b");break;case 102:a.push("\f");break;case 92:case 40:case 41:a.push(String.fromCharCode(r));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:let e=15&r;r=this.nextChar();i=!0;if(r>=48&&r<=55){e=(e<<3)+(15&r);r=this.nextChar();if(r>=48&&r<=55){i=!1;e=(e<<3)+(15&r)}}a.push(String.fromCharCode(e));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:a.push(String.fromCharCode(r))}break;default:a.push(String.fromCharCode(r))}if(t)break;i||(r=this.nextChar())}return a.join("")}getName(){let e,t;const a=this.strBuf;a.length=0;for(;(e=this.nextChar())>=0&&!Qa[e];)if(35===e){e=this.nextChar();if(Qa[e]){warn("Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number.");a.push("#");break}const r=toHexDigit(e);if(-1!==r){t=e;e=this.nextChar();const i=toHexDigit(e);if(-1===i){warn(`Lexer_getName: Illegal digit (${String.fromCharCode(e)}) in hexadecimal number.`);a.push("#",String.fromCharCode(t));if(Qa[e])break;a.push(String.fromCharCode(e));continue}a.push(String.fromCharCode(r<<4|i))}else a.push("#",String.fromCharCode(e))}else a.push(String.fromCharCode(e));a.length>127&&warn(`Name token is longer than allowed by the spec: ${a.length}`);return Name.get(a.join(""))}_hexStringWarn(e){5!==this._hexStringNumWarn++?this._hexStringNumWarn>5||warn(`getHexString - ignoring invalid character: ${e}`):warn("getHexString - ignoring additional invalid characters.")}getHexString(){const e=this.strBuf;e.length=0;let t=this.currentChar,a=-1,r=-1;this._hexStringNumWarn=0;for(;;){if(t<0){warn("Unterminated hex string");break}if(62===t){this.nextChar();break}if(1!==Qa[t]){r=toHexDigit(t);if(-1===r)this._hexStringWarn(t);else if(-1===a)a=r;else{e.push(String.fromCharCode(a<<4|r));a=-1}t=this.nextChar()}else t=this.nextChar()}-1!==a&&e.push(String.fromCharCode(a<<4));return e.join("")}getObj(){let e=!1,t=this.currentChar;for(;;){if(t<0)return aa;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(1!==Qa[t])break;t=this.nextChar()}switch(0|t){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:this.nextChar();return Cmd.get("[");case 93:this.nextChar();return Cmd.get("]");case 60:t=this.nextChar();if(60===t){this.nextChar();return Cmd.get("<<")}return this.getHexString();case 62:t=this.nextChar();if(62===t){this.nextChar();return Cmd.get(">>")}return Cmd.get(">");case 123:this.nextChar();return Cmd.get("{");case 125:this.nextChar();return Cmd.get("}");case 41:this.nextChar();throw new FormatError(`Illegal character: ${t}`)}let a=String.fromCharCode(t);if(t<32||t>127){const e=this.peekChar();if(e>=32&&e<=127){this.nextChar();return Cmd.get(a)}}const r=this.knownCommands;let i=void 0!==r?.[a];for(;(t=this.nextChar())>=0&&!Qa[t];){const e=a+String.fromCharCode(t);if(i&&void 0===r[e])break;if(128===a.length)throw new FormatError(`Command token too long: ${a.length}`);a=e;i=void 0!==r?.[a]}if("true"===a)return!0;if("false"===a)return!1;if("null"===a)return null;"BI"===a&&(this.beginInlineImagePos=this.stream.pos);return Cmd.get(a)}skipToNextLine(){let e=this.currentChar;for(;e>=0;){if(13===e){e=this.nextChar();10===e&&this.nextChar();break}if(10===e){this.nextChar();break}e=this.nextChar()}}}class Linearization{static create(e){function getInt(e,t,a=!1){const r=e.get(t);if(Number.isInteger(r)&&(a?r>=0:r>0))return r;throw new Error(`The "${t}" parameter in the linearization dictionary is invalid.`)}const t=new Parser({lexer:new Lexer(e),xref:null}),a=t.getObj(),r=t.getObj(),i=t.getObj(),n=t.getObj();let s,o;if(!(Number.isInteger(a)&&Number.isInteger(r)&&isCmd(i,"obj")&&n instanceof Dict&&"number"==typeof(s=n.get("Linearized"))&&s>0))return null;if((o=getInt(n,"L"))!==e.length)throw new Error('The "L" parameter in the linearization dictionary does not equal the stream length.');return{length:o,hints:function getHints(e){const t=e.get("H");let a;if(Array.isArray(t)&&(2===(a=t.length)||4===a)){for(let e=0;e0))throw new Error(`Hint (${e}) in the linearization dictionary is invalid.`)}return t}throw new Error("Hint array in the linearization dictionary is invalid.")}(n),objectNumberFirst:getInt(n,"O"),endFirst:getInt(n,"E"),numPages:getInt(n,"N"),mainXRefEntriesOffset:getInt(n,"T"),pageFirst:n.has("P")?getInt(n,"P",!0):0}}}const er=["Adobe-GB1-UCS2","Adobe-CNS1-UCS2","Adobe-Japan1-UCS2","Adobe-Korea1-UCS2","78-EUC-H","78-EUC-V","78-H","78-RKSJ-H","78-RKSJ-V","78-V","78ms-RKSJ-H","78ms-RKSJ-V","83pv-RKSJ-H","90ms-RKSJ-H","90ms-RKSJ-V","90msp-RKSJ-H","90msp-RKSJ-V","90pv-RKSJ-H","90pv-RKSJ-V","Add-H","Add-RKSJ-H","Add-RKSJ-V","Add-V","Adobe-CNS1-0","Adobe-CNS1-1","Adobe-CNS1-2","Adobe-CNS1-3","Adobe-CNS1-4","Adobe-CNS1-5","Adobe-CNS1-6","Adobe-GB1-0","Adobe-GB1-1","Adobe-GB1-2","Adobe-GB1-3","Adobe-GB1-4","Adobe-GB1-5","Adobe-Japan1-0","Adobe-Japan1-1","Adobe-Japan1-2","Adobe-Japan1-3","Adobe-Japan1-4","Adobe-Japan1-5","Adobe-Japan1-6","Adobe-Korea1-0","Adobe-Korea1-1","Adobe-Korea1-2","B5-H","B5-V","B5pc-H","B5pc-V","CNS-EUC-H","CNS-EUC-V","CNS1-H","CNS1-V","CNS2-H","CNS2-V","ETHK-B5-H","ETHK-B5-V","ETen-B5-H","ETen-B5-V","ETenms-B5-H","ETenms-B5-V","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"],tr=2**24-1;class CMap{constructor(e=!1){this.codespaceRanges=[[],[],[],[]];this.numCodespaceRanges=0;this._map=[];this.name="";this.vertical=!1;this.useCMap=null;this.builtInCMap=e}addCodespaceRange(e,t,a){this.codespaceRanges[e-1].push(t,a);this.numCodespaceRanges++}mapCidRange(e,t,a){if(t-e>tr)throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");for(;e<=t;)this._map[e++]=a++}mapBfRange(e,t,a){if(t-e>tr)throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");const r=a.length-1;for(;e<=t;){this._map[e++]=a;const t=a.charCodeAt(r)+1;t>255?a=a.substring(0,r-1)+String.fromCharCode(a.charCodeAt(r-1)+1)+"\0":a=a.substring(0,r)+String.fromCharCode(t)}}mapBfRangeToArray(e,t,a){if(t-e>tr)throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");const r=a.length;let i=0;for(;e<=t&&i>>0;const s=i[n];for(let e=0,t=s.length;e=t&&r<=i){a.charcode=r;a.length=n+1;return}}}a.charcode=0;a.length=1}getCharCodeLength(e){const t=this.codespaceRanges;for(let a=0,r=t.length;a=i&&e<=n)return a+1}}return 1}get length(){return this._map.length}get isIdentityCMap(){if("Identity-H"!==this.name&&"Identity-V"!==this.name)return!1;if(65536!==this._map.length)return!1;for(let e=0;e<65536;e++)if(this._map[e]!==e)return!1;return!0}}class IdentityCMap extends CMap{constructor(e,t){super();this.vertical=e;this.addCodespaceRange(t,0,65535)}mapCidRange(e,t,a){unreachable("should not call mapCidRange")}mapBfRange(e,t,a){unreachable("should not call mapBfRange")}mapBfRangeToArray(e,t,a){unreachable("should not call mapBfRangeToArray")}mapOne(e,t){unreachable("should not call mapCidOne")}lookup(e){return Number.isInteger(e)&&e<=65535?e:void 0}contains(e){return Number.isInteger(e)&&e<=65535}forEach(e){for(let t=0;t<=65535;t++)e(t,t)}charCodeOf(e){return Number.isInteger(e)&&e<=65535?e:-1}getMap(){const e=new Array(65536);for(let t=0;t<=65535;t++)e[t]=t;return e}get length(){return 65536}get isIdentityCMap(){unreachable("should not access .isIdentityCMap")}}function strToInt(e){let t=0;for(let a=0;a>>0}function expectString(e){if("string"!=typeof e)throw new FormatError("Malformed CMap: expected string.")}function expectInt(e){if(!Number.isInteger(e))throw new FormatError("Malformed CMap: expected int.")}function parseBfChar(e,t){for(;;){let a=t.getObj();if(a===aa)break;if(isCmd(a,"endbfchar"))return;expectString(a);const r=strToInt(a);a=t.getObj();expectString(a);const i=a;e.mapOne(r,i)}}function parseBfRange(e,t){for(;;){let a=t.getObj();if(a===aa)break;if(isCmd(a,"endbfrange"))return;expectString(a);const r=strToInt(a);a=t.getObj();expectString(a);const i=strToInt(a);a=t.getObj();if(Number.isInteger(a)||"string"==typeof a){const t=Number.isInteger(a)?String.fromCharCode(a):a;e.mapBfRange(r,i,t)}else{if(!isCmd(a,"["))break;{a=t.getObj();const n=[];for(;!isCmd(a,"]")&&a!==aa;){n.push(a);a=t.getObj()}e.mapBfRangeToArray(r,i,n)}}}throw new FormatError("Invalid bf range.")}function parseCidChar(e,t){for(;;){let a=t.getObj();if(a===aa)break;if(isCmd(a,"endcidchar"))return;expectString(a);const r=strToInt(a);a=t.getObj();expectInt(a);const i=a;e.mapOne(r,i)}}function parseCidRange(e,t){for(;;){let a=t.getObj();if(a===aa)break;if(isCmd(a,"endcidrange"))return;expectString(a);const r=strToInt(a);a=t.getObj();expectString(a);const i=strToInt(a);a=t.getObj();expectInt(a);const n=a;e.mapCidRange(r,i,n)}}function parseCodespaceRange(e,t){for(;;){let a=t.getObj();if(a===aa)break;if(isCmd(a,"endcodespacerange"))return;if("string"!=typeof a)break;const r=strToInt(a);a=t.getObj();if("string"!=typeof a)break;const i=strToInt(a);e.addCodespaceRange(a.length,r,i)}throw new FormatError("Invalid codespace range.")}function parseWMode(e,t){const a=t.getObj();Number.isInteger(a)&&(e.vertical=!!a)}function parseCMapName(e,t){const a=t.getObj();a instanceof Name&&(e.name=a.name)}async function parseCMap(e,t,a,r){let i,n;e:for(;;)try{const a=t.getObj();if(a===aa)break;if(a instanceof Name){"WMode"===a.name?parseWMode(e,t):"CMapName"===a.name&&parseCMapName(e,t);i=a}else if(a instanceof Cmd)switch(a.cmd){case"endcmap":break e;case"usecmap":i instanceof Name&&(n=i.name);break;case"begincodespacerange":parseCodespaceRange(e,t);break;case"beginbfchar":parseBfChar(e,t);break;case"begincidchar":parseCidChar(e,t);break;case"beginbfrange":parseBfRange(e,t);break;case"begincidrange":parseCidRange(e,t)}}catch(e){if(e instanceof MissingDataException)throw e;warn("Invalid cMap data: "+e);continue}!r&&n&&(r=n);return r?extendCMap(e,a,r):e}async function extendCMap(e,t,a){e.useCMap=await createBuiltInCMap(a,t);if(0===e.numCodespaceRanges){const t=e.useCMap.codespaceRanges;for(let a=0;aextendCMap(i,t,e));const n=new Lexer(new Stream(a));return parseCMap(i,n,t,null)}class CMapFactory{static async create({encoding:e,fetchBuiltInCMap:t,useCMap:a}){if(e instanceof Name)return createBuiltInCMap(e.name,t);if(e instanceof BaseStream){const r=await parseCMap(new CMap,new Lexer(e),t,a);return r.isIdentityCMap?createBuiltInCMap(r.name,t):r}throw new Error("Encoding required.")}}const ar=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],rr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","centoldstyle","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","","threequartersemdash","","questionsmall","","","","","Ethsmall","","","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","","","","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hypheninferior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","asuperior","centsuperior","","","","","Aacutesmall","Agravesmall","Acircumflexsmall","Adieresissmall","Atildesmall","Aringsmall","Ccedillasmall","Eacutesmall","Egravesmall","Ecircumflexsmall","Edieresissmall","Iacutesmall","Igravesmall","Icircumflexsmall","Idieresissmall","Ntildesmall","Oacutesmall","Ogravesmall","Ocircumflexsmall","Odieresissmall","Otildesmall","Uacutesmall","Ugravesmall","Ucircumflexsmall","Udieresissmall","","eightsuperior","fourinferior","threeinferior","sixinferior","eightinferior","seveninferior","Scaronsmall","","centinferior","twoinferior","","Dieresissmall","","Caronsmall","osuperior","fiveinferior","","commainferior","periodinferior","Yacutesmall","","dollarinferior","","","Thornsmall","","nineinferior","zeroinferior","Zcaronsmall","AEsmall","Oslashsmall","questiondownsmall","oneinferior","Lslashsmall","","","","","","","Cedillasmall","","","","","","OEsmall","figuredash","hyphensuperior","","","","","exclamdownsmall","","Ydieresissmall","","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","ninesuperior","zerosuperior","","esuperior","rsuperior","tsuperior","","","isuperior","ssuperior","dsuperior","","","","","","lsuperior","Ogoneksmall","Brevesmall","Macronsmall","bsuperior","nsuperior","msuperior","commasuperior","periodsuperior","Dotaccentsmall","Ringsmall","","","",""],ir=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","space","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron"],nr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls","","","",""],sr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","bullet","Euro","bullet","quotesinglbase","florin","quotedblbase","ellipsis","dagger","daggerdbl","circumflex","perthousand","Scaron","guilsinglleft","OE","bullet","Zcaron","bullet","bullet","quoteleft","quoteright","quotedblleft","quotedblright","bullet","endash","emdash","tilde","trademark","scaron","guilsinglright","oe","bullet","zcaron","Ydieresis","space","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis","copyright","ordfeminine","guillemotleft","logicalnot","hyphen","registered","macron","degree","plusminus","twosuperior","threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright","onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring","AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth","Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex","Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae","ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde","ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis","yacute","thorn","ydieresis"],or=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","universal","numbersign","existential","percent","ampersand","suchthat","parenleft","parenright","asteriskmath","plus","comma","minus","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","congruent","Alpha","Beta","Chi","Delta","Epsilon","Phi","Gamma","Eta","Iota","theta1","Kappa","Lambda","Mu","Nu","Omicron","Pi","Theta","Rho","Sigma","Tau","Upsilon","sigma1","Omega","Xi","Psi","Zeta","bracketleft","therefore","bracketright","perpendicular","underscore","radicalex","alpha","beta","chi","delta","epsilon","phi","gamma","eta","iota","phi1","kappa","lambda","mu","nu","omicron","pi","theta","rho","sigma","tau","upsilon","omega1","omega","xi","psi","zeta","braceleft","bar","braceright","similar","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Euro","Upsilon1","minute","lessequal","fraction","infinity","florin","club","diamond","heart","spade","arrowboth","arrowleft","arrowup","arrowright","arrowdown","degree","plusminus","second","greaterequal","multiply","proportional","partialdiff","bullet","divide","notequal","equivalence","approxequal","ellipsis","arrowvertex","arrowhorizex","carriagereturn","aleph","Ifraktur","Rfraktur","weierstrass","circlemultiply","circleplus","emptyset","intersection","union","propersuperset","reflexsuperset","notsubset","propersubset","reflexsubset","element","notelement","angle","gradient","registerserif","copyrightserif","trademarkserif","product","radical","dotmath","logicalnot","logicaland","logicalor","arrowdblboth","arrowdblleft","arrowdblup","arrowdblright","arrowdbldown","lozenge","angleleft","registersans","copyrightsans","trademarksans","summation","parenlefttp","parenleftex","parenleftbt","bracketlefttp","bracketleftex","bracketleftbt","bracelefttp","braceleftmid","braceleftbt","braceex","","angleright","integral","integraltp","integralex","integralbt","parenrighttp","parenrightex","parenrightbt","bracketrighttp","bracketrightex","bracketrightbt","bracerighttp","bracerightmid","bracerightbt",""],cr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","a1","a2","a202","a3","a4","a5","a119","a118","a117","a11","a12","a13","a14","a15","a16","a105","a17","a18","a19","a20","a21","a22","a23","a24","a25","a26","a27","a28","a6","a7","a8","a9","a10","a29","a30","a31","a32","a33","a34","a35","a36","a37","a38","a39","a40","a41","a42","a43","a44","a45","a46","a47","a48","a49","a50","a51","a52","a53","a54","a55","a56","a57","a58","a59","a60","a61","a62","a63","a64","a65","a66","a67","a68","a69","a70","a71","a72","a73","a74","a203","a75","a204","a76","a77","a78","a79","a81","a82","a83","a84","a97","a98","a99","a100","","a89","a90","a93","a94","a91","a92","a205","a85","a206","a86","a87","a88","a95","a96","","","","","","","","","","","","","","","","","","","","a101","a102","a103","a104","a106","a107","a108","a112","a111","a110","a109","a120","a121","a122","a123","a124","a125","a126","a127","a128","a129","a130","a131","a132","a133","a134","a135","a136","a137","a138","a139","a140","a141","a142","a143","a144","a145","a146","a147","a148","a149","a150","a151","a152","a153","a154","a155","a156","a157","a158","a159","a160","a161","a163","a164","a196","a165","a192","a166","a167","a168","a169","a170","a171","a172","a173","a162","a174","a175","a176","a177","a178","a179","a193","a180","a199","a181","a200","a182","","a201","a183","a184","a197","a185","a194","a198","a186","a195","a187","a188","a189","a190","a191",""];function getEncoding(e){switch(e){case"WinAnsiEncoding":return sr;case"StandardEncoding":return nr;case"MacRomanEncoding":return ir;case"SymbolSetEncoding":return or;case"ZapfDingbatsEncoding":return cr;case"ExpertEncoding":return ar;case"MacExpertEncoding":return rr;default:return null}}const lr=getLookupTableFactory(function(e){e.A=65;e.AE=198;e.AEacute=508;e.AEmacron=482;e.AEsmall=63462;e.Aacute=193;e.Aacutesmall=63457;e.Abreve=258;e.Abreveacute=7854;e.Abrevecyrillic=1232;e.Abrevedotbelow=7862;e.Abrevegrave=7856;e.Abrevehookabove=7858;e.Abrevetilde=7860;e.Acaron=461;e.Acircle=9398;e.Acircumflex=194;e.Acircumflexacute=7844;e.Acircumflexdotbelow=7852;e.Acircumflexgrave=7846;e.Acircumflexhookabove=7848;e.Acircumflexsmall=63458;e.Acircumflextilde=7850;e.Acute=63177;e.Acutesmall=63412;e.Acyrillic=1040;e.Adblgrave=512;e.Adieresis=196;e.Adieresiscyrillic=1234;e.Adieresismacron=478;e.Adieresissmall=63460;e.Adotbelow=7840;e.Adotmacron=480;e.Agrave=192;e.Agravesmall=63456;e.Ahookabove=7842;e.Aiecyrillic=1236;e.Ainvertedbreve=514;e.Alpha=913;e.Alphatonos=902;e.Amacron=256;e.Amonospace=65313;e.Aogonek=260;e.Aring=197;e.Aringacute=506;e.Aringbelow=7680;e.Aringsmall=63461;e.Asmall=63329;e.Atilde=195;e.Atildesmall=63459;e.Aybarmenian=1329;e.B=66;e.Bcircle=9399;e.Bdotaccent=7682;e.Bdotbelow=7684;e.Becyrillic=1041;e.Benarmenian=1330;e.Beta=914;e.Bhook=385;e.Blinebelow=7686;e.Bmonospace=65314;e.Brevesmall=63220;e.Bsmall=63330;e.Btopbar=386;e.C=67;e.Caarmenian=1342;e.Cacute=262;e.Caron=63178;e.Caronsmall=63221;e.Ccaron=268;e.Ccedilla=199;e.Ccedillaacute=7688;e.Ccedillasmall=63463;e.Ccircle=9400;e.Ccircumflex=264;e.Cdot=266;e.Cdotaccent=266;e.Cedillasmall=63416;e.Chaarmenian=1353;e.Cheabkhasiancyrillic=1212;e.Checyrillic=1063;e.Chedescenderabkhasiancyrillic=1214;e.Chedescendercyrillic=1206;e.Chedieresiscyrillic=1268;e.Cheharmenian=1347;e.Chekhakassiancyrillic=1227;e.Cheverticalstrokecyrillic=1208;e.Chi=935;e.Chook=391;e.Circumflexsmall=63222;e.Cmonospace=65315;e.Coarmenian=1361;e.Csmall=63331;e.D=68;e.DZ=497;e.DZcaron=452;e.Daarmenian=1332;e.Dafrican=393;e.Dcaron=270;e.Dcedilla=7696;e.Dcircle=9401;e.Dcircumflexbelow=7698;e.Dcroat=272;e.Ddotaccent=7690;e.Ddotbelow=7692;e.Decyrillic=1044;e.Deicoptic=1006;e.Delta=8710;e.Deltagreek=916;e.Dhook=394;e.Dieresis=63179;e.DieresisAcute=63180;e.DieresisGrave=63181;e.Dieresissmall=63400;e.Digammagreek=988;e.Djecyrillic=1026;e.Dlinebelow=7694;e.Dmonospace=65316;e.Dotaccentsmall=63223;e.Dslash=272;e.Dsmall=63332;e.Dtopbar=395;e.Dz=498;e.Dzcaron=453;e.Dzeabkhasiancyrillic=1248;e.Dzecyrillic=1029;e.Dzhecyrillic=1039;e.E=69;e.Eacute=201;e.Eacutesmall=63465;e.Ebreve=276;e.Ecaron=282;e.Ecedillabreve=7708;e.Echarmenian=1333;e.Ecircle=9402;e.Ecircumflex=202;e.Ecircumflexacute=7870;e.Ecircumflexbelow=7704;e.Ecircumflexdotbelow=7878;e.Ecircumflexgrave=7872;e.Ecircumflexhookabove=7874;e.Ecircumflexsmall=63466;e.Ecircumflextilde=7876;e.Ecyrillic=1028;e.Edblgrave=516;e.Edieresis=203;e.Edieresissmall=63467;e.Edot=278;e.Edotaccent=278;e.Edotbelow=7864;e.Efcyrillic=1060;e.Egrave=200;e.Egravesmall=63464;e.Eharmenian=1335;e.Ehookabove=7866;e.Eightroman=8551;e.Einvertedbreve=518;e.Eiotifiedcyrillic=1124;e.Elcyrillic=1051;e.Elevenroman=8554;e.Emacron=274;e.Emacronacute=7702;e.Emacrongrave=7700;e.Emcyrillic=1052;e.Emonospace=65317;e.Encyrillic=1053;e.Endescendercyrillic=1186;e.Eng=330;e.Enghecyrillic=1188;e.Enhookcyrillic=1223;e.Eogonek=280;e.Eopen=400;e.Epsilon=917;e.Epsilontonos=904;e.Ercyrillic=1056;e.Ereversed=398;e.Ereversedcyrillic=1069;e.Escyrillic=1057;e.Esdescendercyrillic=1194;e.Esh=425;e.Esmall=63333;e.Eta=919;e.Etarmenian=1336;e.Etatonos=905;e.Eth=208;e.Ethsmall=63472;e.Etilde=7868;e.Etildebelow=7706;e.Euro=8364;e.Ezh=439;e.Ezhcaron=494;e.Ezhreversed=440;e.F=70;e.Fcircle=9403;e.Fdotaccent=7710;e.Feharmenian=1366;e.Feicoptic=996;e.Fhook=401;e.Fitacyrillic=1138;e.Fiveroman=8548;e.Fmonospace=65318;e.Fourroman=8547;e.Fsmall=63334;e.G=71;e.GBsquare=13191;e.Gacute=500;e.Gamma=915;e.Gammaafrican=404;e.Gangiacoptic=1002;e.Gbreve=286;e.Gcaron=486;e.Gcedilla=290;e.Gcircle=9404;e.Gcircumflex=284;e.Gcommaaccent=290;e.Gdot=288;e.Gdotaccent=288;e.Gecyrillic=1043;e.Ghadarmenian=1346;e.Ghemiddlehookcyrillic=1172;e.Ghestrokecyrillic=1170;e.Gheupturncyrillic=1168;e.Ghook=403;e.Gimarmenian=1331;e.Gjecyrillic=1027;e.Gmacron=7712;e.Gmonospace=65319;e.Grave=63182;e.Gravesmall=63328;e.Gsmall=63335;e.Gsmallhook=667;e.Gstroke=484;e.H=72;e.H18533=9679;e.H18543=9642;e.H18551=9643;e.H22073=9633;e.HPsquare=13259;e.Haabkhasiancyrillic=1192;e.Hadescendercyrillic=1202;e.Hardsigncyrillic=1066;e.Hbar=294;e.Hbrevebelow=7722;e.Hcedilla=7720;e.Hcircle=9405;e.Hcircumflex=292;e.Hdieresis=7718;e.Hdotaccent=7714;e.Hdotbelow=7716;e.Hmonospace=65320;e.Hoarmenian=1344;e.Horicoptic=1e3;e.Hsmall=63336;e.Hungarumlaut=63183;e.Hungarumlautsmall=63224;e.Hzsquare=13200;e.I=73;e.IAcyrillic=1071;e.IJ=306;e.IUcyrillic=1070;e.Iacute=205;e.Iacutesmall=63469;e.Ibreve=300;e.Icaron=463;e.Icircle=9406;e.Icircumflex=206;e.Icircumflexsmall=63470;e.Icyrillic=1030;e.Idblgrave=520;e.Idieresis=207;e.Idieresisacute=7726;e.Idieresiscyrillic=1252;e.Idieresissmall=63471;e.Idot=304;e.Idotaccent=304;e.Idotbelow=7882;e.Iebrevecyrillic=1238;e.Iecyrillic=1045;e.Ifraktur=8465;e.Igrave=204;e.Igravesmall=63468;e.Ihookabove=7880;e.Iicyrillic=1048;e.Iinvertedbreve=522;e.Iishortcyrillic=1049;e.Imacron=298;e.Imacroncyrillic=1250;e.Imonospace=65321;e.Iniarmenian=1339;e.Iocyrillic=1025;e.Iogonek=302;e.Iota=921;e.Iotaafrican=406;e.Iotadieresis=938;e.Iotatonos=906;e.Ismall=63337;e.Istroke=407;e.Itilde=296;e.Itildebelow=7724;e.Izhitsacyrillic=1140;e.Izhitsadblgravecyrillic=1142;e.J=74;e.Jaarmenian=1345;e.Jcircle=9407;e.Jcircumflex=308;e.Jecyrillic=1032;e.Jheharmenian=1355;e.Jmonospace=65322;e.Jsmall=63338;e.K=75;e.KBsquare=13189;e.KKsquare=13261;e.Kabashkircyrillic=1184;e.Kacute=7728;e.Kacyrillic=1050;e.Kadescendercyrillic=1178;e.Kahookcyrillic=1219;e.Kappa=922;e.Kastrokecyrillic=1182;e.Kaverticalstrokecyrillic=1180;e.Kcaron=488;e.Kcedilla=310;e.Kcircle=9408;e.Kcommaaccent=310;e.Kdotbelow=7730;e.Keharmenian=1364;e.Kenarmenian=1343;e.Khacyrillic=1061;e.Kheicoptic=998;e.Khook=408;e.Kjecyrillic=1036;e.Klinebelow=7732;e.Kmonospace=65323;e.Koppacyrillic=1152;e.Koppagreek=990;e.Ksicyrillic=1134;e.Ksmall=63339;e.L=76;e.LJ=455;e.LL=63167;e.Lacute=313;e.Lambda=923;e.Lcaron=317;e.Lcedilla=315;e.Lcircle=9409;e.Lcircumflexbelow=7740;e.Lcommaaccent=315;e.Ldot=319;e.Ldotaccent=319;e.Ldotbelow=7734;e.Ldotbelowmacron=7736;e.Liwnarmenian=1340;e.Lj=456;e.Ljecyrillic=1033;e.Llinebelow=7738;e.Lmonospace=65324;e.Lslash=321;e.Lslashsmall=63225;e.Lsmall=63340;e.M=77;e.MBsquare=13190;e.Macron=63184;e.Macronsmall=63407;e.Macute=7742;e.Mcircle=9410;e.Mdotaccent=7744;e.Mdotbelow=7746;e.Menarmenian=1348;e.Mmonospace=65325;e.Msmall=63341;e.Mturned=412;e.Mu=924;e.N=78;e.NJ=458;e.Nacute=323;e.Ncaron=327;e.Ncedilla=325;e.Ncircle=9411;e.Ncircumflexbelow=7754;e.Ncommaaccent=325;e.Ndotaccent=7748;e.Ndotbelow=7750;e.Nhookleft=413;e.Nineroman=8552;e.Nj=459;e.Njecyrillic=1034;e.Nlinebelow=7752;e.Nmonospace=65326;e.Nowarmenian=1350;e.Nsmall=63342;e.Ntilde=209;e.Ntildesmall=63473;e.Nu=925;e.O=79;e.OE=338;e.OEsmall=63226;e.Oacute=211;e.Oacutesmall=63475;e.Obarredcyrillic=1256;e.Obarreddieresiscyrillic=1258;e.Obreve=334;e.Ocaron=465;e.Ocenteredtilde=415;e.Ocircle=9412;e.Ocircumflex=212;e.Ocircumflexacute=7888;e.Ocircumflexdotbelow=7896;e.Ocircumflexgrave=7890;e.Ocircumflexhookabove=7892;e.Ocircumflexsmall=63476;e.Ocircumflextilde=7894;e.Ocyrillic=1054;e.Odblacute=336;e.Odblgrave=524;e.Odieresis=214;e.Odieresiscyrillic=1254;e.Odieresissmall=63478;e.Odotbelow=7884;e.Ogoneksmall=63227;e.Ograve=210;e.Ogravesmall=63474;e.Oharmenian=1365;e.Ohm=8486;e.Ohookabove=7886;e.Ohorn=416;e.Ohornacute=7898;e.Ohorndotbelow=7906;e.Ohorngrave=7900;e.Ohornhookabove=7902;e.Ohorntilde=7904;e.Ohungarumlaut=336;e.Oi=418;e.Oinvertedbreve=526;e.Omacron=332;e.Omacronacute=7762;e.Omacrongrave=7760;e.Omega=8486;e.Omegacyrillic=1120;e.Omegagreek=937;e.Omegaroundcyrillic=1146;e.Omegatitlocyrillic=1148;e.Omegatonos=911;e.Omicron=927;e.Omicrontonos=908;e.Omonospace=65327;e.Oneroman=8544;e.Oogonek=490;e.Oogonekmacron=492;e.Oopen=390;e.Oslash=216;e.Oslashacute=510;e.Oslashsmall=63480;e.Osmall=63343;e.Ostrokeacute=510;e.Otcyrillic=1150;e.Otilde=213;e.Otildeacute=7756;e.Otildedieresis=7758;e.Otildesmall=63477;e.P=80;e.Pacute=7764;e.Pcircle=9413;e.Pdotaccent=7766;e.Pecyrillic=1055;e.Peharmenian=1354;e.Pemiddlehookcyrillic=1190;e.Phi=934;e.Phook=420;e.Pi=928;e.Piwrarmenian=1363;e.Pmonospace=65328;e.Psi=936;e.Psicyrillic=1136;e.Psmall=63344;e.Q=81;e.Qcircle=9414;e.Qmonospace=65329;e.Qsmall=63345;e.R=82;e.Raarmenian=1356;e.Racute=340;e.Rcaron=344;e.Rcedilla=342;e.Rcircle=9415;e.Rcommaaccent=342;e.Rdblgrave=528;e.Rdotaccent=7768;e.Rdotbelow=7770;e.Rdotbelowmacron=7772;e.Reharmenian=1360;e.Rfraktur=8476;e.Rho=929;e.Ringsmall=63228;e.Rinvertedbreve=530;e.Rlinebelow=7774;e.Rmonospace=65330;e.Rsmall=63346;e.Rsmallinverted=641;e.Rsmallinvertedsuperior=694;e.S=83;e.SF010000=9484;e.SF020000=9492;e.SF030000=9488;e.SF040000=9496;e.SF050000=9532;e.SF060000=9516;e.SF070000=9524;e.SF080000=9500;e.SF090000=9508;e.SF100000=9472;e.SF110000=9474;e.SF190000=9569;e.SF200000=9570;e.SF210000=9558;e.SF220000=9557;e.SF230000=9571;e.SF240000=9553;e.SF250000=9559;e.SF260000=9565;e.SF270000=9564;e.SF280000=9563;e.SF360000=9566;e.SF370000=9567;e.SF380000=9562;e.SF390000=9556;e.SF400000=9577;e.SF410000=9574;e.SF420000=9568;e.SF430000=9552;e.SF440000=9580;e.SF450000=9575;e.SF460000=9576;e.SF470000=9572;e.SF480000=9573;e.SF490000=9561;e.SF500000=9560;e.SF510000=9554;e.SF520000=9555;e.SF530000=9579;e.SF540000=9578;e.Sacute=346;e.Sacutedotaccent=7780;e.Sampigreek=992;e.Scaron=352;e.Scarondotaccent=7782;e.Scaronsmall=63229;e.Scedilla=350;e.Schwa=399;e.Schwacyrillic=1240;e.Schwadieresiscyrillic=1242;e.Scircle=9416;e.Scircumflex=348;e.Scommaaccent=536;e.Sdotaccent=7776;e.Sdotbelow=7778;e.Sdotbelowdotaccent=7784;e.Seharmenian=1357;e.Sevenroman=8550;e.Shaarmenian=1351;e.Shacyrillic=1064;e.Shchacyrillic=1065;e.Sheicoptic=994;e.Shhacyrillic=1210;e.Shimacoptic=1004;e.Sigma=931;e.Sixroman=8549;e.Smonospace=65331;e.Softsigncyrillic=1068;e.Ssmall=63347;e.Stigmagreek=986;e.T=84;e.Tau=932;e.Tbar=358;e.Tcaron=356;e.Tcedilla=354;e.Tcircle=9417;e.Tcircumflexbelow=7792;e.Tcommaaccent=354;e.Tdotaccent=7786;e.Tdotbelow=7788;e.Tecyrillic=1058;e.Tedescendercyrillic=1196;e.Tenroman=8553;e.Tetsecyrillic=1204;e.Theta=920;e.Thook=428;e.Thorn=222;e.Thornsmall=63486;e.Threeroman=8546;e.Tildesmall=63230;e.Tiwnarmenian=1359;e.Tlinebelow=7790;e.Tmonospace=65332;e.Toarmenian=1337;e.Tonefive=444;e.Tonesix=388;e.Tonetwo=423;e.Tretroflexhook=430;e.Tsecyrillic=1062;e.Tshecyrillic=1035;e.Tsmall=63348;e.Twelveroman=8555;e.Tworoman=8545;e.U=85;e.Uacute=218;e.Uacutesmall=63482;e.Ubreve=364;e.Ucaron=467;e.Ucircle=9418;e.Ucircumflex=219;e.Ucircumflexbelow=7798;e.Ucircumflexsmall=63483;e.Ucyrillic=1059;e.Udblacute=368;e.Udblgrave=532;e.Udieresis=220;e.Udieresisacute=471;e.Udieresisbelow=7794;e.Udieresiscaron=473;e.Udieresiscyrillic=1264;e.Udieresisgrave=475;e.Udieresismacron=469;e.Udieresissmall=63484;e.Udotbelow=7908;e.Ugrave=217;e.Ugravesmall=63481;e.Uhookabove=7910;e.Uhorn=431;e.Uhornacute=7912;e.Uhorndotbelow=7920;e.Uhorngrave=7914;e.Uhornhookabove=7916;e.Uhorntilde=7918;e.Uhungarumlaut=368;e.Uhungarumlautcyrillic=1266;e.Uinvertedbreve=534;e.Ukcyrillic=1144;e.Umacron=362;e.Umacroncyrillic=1262;e.Umacrondieresis=7802;e.Umonospace=65333;e.Uogonek=370;e.Upsilon=933;e.Upsilon1=978;e.Upsilonacutehooksymbolgreek=979;e.Upsilonafrican=433;e.Upsilondieresis=939;e.Upsilondieresishooksymbolgreek=980;e.Upsilonhooksymbol=978;e.Upsilontonos=910;e.Uring=366;e.Ushortcyrillic=1038;e.Usmall=63349;e.Ustraightcyrillic=1198;e.Ustraightstrokecyrillic=1200;e.Utilde=360;e.Utildeacute=7800;e.Utildebelow=7796;e.V=86;e.Vcircle=9419;e.Vdotbelow=7806;e.Vecyrillic=1042;e.Vewarmenian=1358;e.Vhook=434;e.Vmonospace=65334;e.Voarmenian=1352;e.Vsmall=63350;e.Vtilde=7804;e.W=87;e.Wacute=7810;e.Wcircle=9420;e.Wcircumflex=372;e.Wdieresis=7812;e.Wdotaccent=7814;e.Wdotbelow=7816;e.Wgrave=7808;e.Wmonospace=65335;e.Wsmall=63351;e.X=88;e.Xcircle=9421;e.Xdieresis=7820;e.Xdotaccent=7818;e.Xeharmenian=1341;e.Xi=926;e.Xmonospace=65336;e.Xsmall=63352;e.Y=89;e.Yacute=221;e.Yacutesmall=63485;e.Yatcyrillic=1122;e.Ycircle=9422;e.Ycircumflex=374;e.Ydieresis=376;e.Ydieresissmall=63487;e.Ydotaccent=7822;e.Ydotbelow=7924;e.Yericyrillic=1067;e.Yerudieresiscyrillic=1272;e.Ygrave=7922;e.Yhook=435;e.Yhookabove=7926;e.Yiarmenian=1349;e.Yicyrillic=1031;e.Yiwnarmenian=1362;e.Ymonospace=65337;e.Ysmall=63353;e.Ytilde=7928;e.Yusbigcyrillic=1130;e.Yusbigiotifiedcyrillic=1132;e.Yuslittlecyrillic=1126;e.Yuslittleiotifiedcyrillic=1128;e.Z=90;e.Zaarmenian=1334;e.Zacute=377;e.Zcaron=381;e.Zcaronsmall=63231;e.Zcircle=9423;e.Zcircumflex=7824;e.Zdot=379;e.Zdotaccent=379;e.Zdotbelow=7826;e.Zecyrillic=1047;e.Zedescendercyrillic=1176;e.Zedieresiscyrillic=1246;e.Zeta=918;e.Zhearmenian=1338;e.Zhebrevecyrillic=1217;e.Zhecyrillic=1046;e.Zhedescendercyrillic=1174;e.Zhedieresiscyrillic=1244;e.Zlinebelow=7828;e.Zmonospace=65338;e.Zsmall=63354;e.Zstroke=437;e.a=97;e.aabengali=2438;e.aacute=225;e.aadeva=2310;e.aagujarati=2694;e.aagurmukhi=2566;e.aamatragurmukhi=2622;e.aarusquare=13059;e.aavowelsignbengali=2494;e.aavowelsigndeva=2366;e.aavowelsigngujarati=2750;e.abbreviationmarkarmenian=1375;e.abbreviationsigndeva=2416;e.abengali=2437;e.abopomofo=12570;e.abreve=259;e.abreveacute=7855;e.abrevecyrillic=1233;e.abrevedotbelow=7863;e.abrevegrave=7857;e.abrevehookabove=7859;e.abrevetilde=7861;e.acaron=462;e.acircle=9424;e.acircumflex=226;e.acircumflexacute=7845;e.acircumflexdotbelow=7853;e.acircumflexgrave=7847;e.acircumflexhookabove=7849;e.acircumflextilde=7851;e.acute=180;e.acutebelowcmb=791;e.acutecmb=769;e.acutecomb=769;e.acutedeva=2388;e.acutelowmod=719;e.acutetonecmb=833;e.acyrillic=1072;e.adblgrave=513;e.addakgurmukhi=2673;e.adeva=2309;e.adieresis=228;e.adieresiscyrillic=1235;e.adieresismacron=479;e.adotbelow=7841;e.adotmacron=481;e.ae=230;e.aeacute=509;e.aekorean=12624;e.aemacron=483;e.afii00208=8213;e.afii08941=8356;e.afii10017=1040;e.afii10018=1041;e.afii10019=1042;e.afii10020=1043;e.afii10021=1044;e.afii10022=1045;e.afii10023=1025;e.afii10024=1046;e.afii10025=1047;e.afii10026=1048;e.afii10027=1049;e.afii10028=1050;e.afii10029=1051;e.afii10030=1052;e.afii10031=1053;e.afii10032=1054;e.afii10033=1055;e.afii10034=1056;e.afii10035=1057;e.afii10036=1058;e.afii10037=1059;e.afii10038=1060;e.afii10039=1061;e.afii10040=1062;e.afii10041=1063;e.afii10042=1064;e.afii10043=1065;e.afii10044=1066;e.afii10045=1067;e.afii10046=1068;e.afii10047=1069;e.afii10048=1070;e.afii10049=1071;e.afii10050=1168;e.afii10051=1026;e.afii10052=1027;e.afii10053=1028;e.afii10054=1029;e.afii10055=1030;e.afii10056=1031;e.afii10057=1032;e.afii10058=1033;e.afii10059=1034;e.afii10060=1035;e.afii10061=1036;e.afii10062=1038;e.afii10063=63172;e.afii10064=63173;e.afii10065=1072;e.afii10066=1073;e.afii10067=1074;e.afii10068=1075;e.afii10069=1076;e.afii10070=1077;e.afii10071=1105;e.afii10072=1078;e.afii10073=1079;e.afii10074=1080;e.afii10075=1081;e.afii10076=1082;e.afii10077=1083;e.afii10078=1084;e.afii10079=1085;e.afii10080=1086;e.afii10081=1087;e.afii10082=1088;e.afii10083=1089;e.afii10084=1090;e.afii10085=1091;e.afii10086=1092;e.afii10087=1093;e.afii10088=1094;e.afii10089=1095;e.afii10090=1096;e.afii10091=1097;e.afii10092=1098;e.afii10093=1099;e.afii10094=1100;e.afii10095=1101;e.afii10096=1102;e.afii10097=1103;e.afii10098=1169;e.afii10099=1106;e.afii10100=1107;e.afii10101=1108;e.afii10102=1109;e.afii10103=1110;e.afii10104=1111;e.afii10105=1112;e.afii10106=1113;e.afii10107=1114;e.afii10108=1115;e.afii10109=1116;e.afii10110=1118;e.afii10145=1039;e.afii10146=1122;e.afii10147=1138;e.afii10148=1140;e.afii10192=63174;e.afii10193=1119;e.afii10194=1123;e.afii10195=1139;e.afii10196=1141;e.afii10831=63175;e.afii10832=63176;e.afii10846=1241;e.afii299=8206;e.afii300=8207;e.afii301=8205;e.afii57381=1642;e.afii57388=1548;e.afii57392=1632;e.afii57393=1633;e.afii57394=1634;e.afii57395=1635;e.afii57396=1636;e.afii57397=1637;e.afii57398=1638;e.afii57399=1639;e.afii57400=1640;e.afii57401=1641;e.afii57403=1563;e.afii57407=1567;e.afii57409=1569;e.afii57410=1570;e.afii57411=1571;e.afii57412=1572;e.afii57413=1573;e.afii57414=1574;e.afii57415=1575;e.afii57416=1576;e.afii57417=1577;e.afii57418=1578;e.afii57419=1579;e.afii57420=1580;e.afii57421=1581;e.afii57422=1582;e.afii57423=1583;e.afii57424=1584;e.afii57425=1585;e.afii57426=1586;e.afii57427=1587;e.afii57428=1588;e.afii57429=1589;e.afii57430=1590;e.afii57431=1591;e.afii57432=1592;e.afii57433=1593;e.afii57434=1594;e.afii57440=1600;e.afii57441=1601;e.afii57442=1602;e.afii57443=1603;e.afii57444=1604;e.afii57445=1605;e.afii57446=1606;e.afii57448=1608;e.afii57449=1609;e.afii57450=1610;e.afii57451=1611;e.afii57452=1612;e.afii57453=1613;e.afii57454=1614;e.afii57455=1615;e.afii57456=1616;e.afii57457=1617;e.afii57458=1618;e.afii57470=1607;e.afii57505=1700;e.afii57506=1662;e.afii57507=1670;e.afii57508=1688;e.afii57509=1711;e.afii57511=1657;e.afii57512=1672;e.afii57513=1681;e.afii57514=1722;e.afii57519=1746;e.afii57534=1749;e.afii57636=8362;e.afii57645=1470;e.afii57658=1475;e.afii57664=1488;e.afii57665=1489;e.afii57666=1490;e.afii57667=1491;e.afii57668=1492;e.afii57669=1493;e.afii57670=1494;e.afii57671=1495;e.afii57672=1496;e.afii57673=1497;e.afii57674=1498;e.afii57675=1499;e.afii57676=1500;e.afii57677=1501;e.afii57678=1502;e.afii57679=1503;e.afii57680=1504;e.afii57681=1505;e.afii57682=1506;e.afii57683=1507;e.afii57684=1508;e.afii57685=1509;e.afii57686=1510;e.afii57687=1511;e.afii57688=1512;e.afii57689=1513;e.afii57690=1514;e.afii57694=64298;e.afii57695=64299;e.afii57700=64331;e.afii57705=64287;e.afii57716=1520;e.afii57717=1521;e.afii57718=1522;e.afii57723=64309;e.afii57793=1460;e.afii57794=1461;e.afii57795=1462;e.afii57796=1467;e.afii57797=1464;e.afii57798=1463;e.afii57799=1456;e.afii57800=1458;e.afii57801=1457;e.afii57802=1459;e.afii57803=1474;e.afii57804=1473;e.afii57806=1465;e.afii57807=1468;e.afii57839=1469;e.afii57841=1471;e.afii57842=1472;e.afii57929=700;e.afii61248=8453;e.afii61289=8467;e.afii61352=8470;e.afii61573=8236;e.afii61574=8237;e.afii61575=8238;e.afii61664=8204;e.afii63167=1645;e.afii64937=701;e.agrave=224;e.agujarati=2693;e.agurmukhi=2565;e.ahiragana=12354;e.ahookabove=7843;e.aibengali=2448;e.aibopomofo=12574;e.aideva=2320;e.aiecyrillic=1237;e.aigujarati=2704;e.aigurmukhi=2576;e.aimatragurmukhi=2632;e.ainarabic=1593;e.ainfinalarabic=65226;e.aininitialarabic=65227;e.ainmedialarabic=65228;e.ainvertedbreve=515;e.aivowelsignbengali=2504;e.aivowelsigndeva=2376;e.aivowelsigngujarati=2760;e.akatakana=12450;e.akatakanahalfwidth=65393;e.akorean=12623;e.alef=1488;e.alefarabic=1575;e.alefdageshhebrew=64304;e.aleffinalarabic=65166;e.alefhamzaabovearabic=1571;e.alefhamzaabovefinalarabic=65156;e.alefhamzabelowarabic=1573;e.alefhamzabelowfinalarabic=65160;e.alefhebrew=1488;e.aleflamedhebrew=64335;e.alefmaddaabovearabic=1570;e.alefmaddaabovefinalarabic=65154;e.alefmaksuraarabic=1609;e.alefmaksurafinalarabic=65264;e.alefmaksurainitialarabic=65267;e.alefmaksuramedialarabic=65268;e.alefpatahhebrew=64302;e.alefqamatshebrew=64303;e.aleph=8501;e.allequal=8780;e.alpha=945;e.alphatonos=940;e.amacron=257;e.amonospace=65345;e.ampersand=38;e.ampersandmonospace=65286;e.ampersandsmall=63270;e.amsquare=13250;e.anbopomofo=12578;e.angbopomofo=12580;e.angbracketleft=12296;e.angbracketright=12297;e.angkhankhuthai=3674;e.angle=8736;e.anglebracketleft=12296;e.anglebracketleftvertical=65087;e.anglebracketright=12297;e.anglebracketrightvertical=65088;e.angleleft=9001;e.angleright=9002;e.angstrom=8491;e.anoteleia=903;e.anudattadeva=2386;e.anusvarabengali=2434;e.anusvaradeva=2306;e.anusvaragujarati=2690;e.aogonek=261;e.apaatosquare=13056;e.aparen=9372;e.apostrophearmenian=1370;e.apostrophemod=700;e.apple=63743;e.approaches=8784;e.approxequal=8776;e.approxequalorimage=8786;e.approximatelyequal=8773;e.araeaekorean=12686;e.araeakorean=12685;e.arc=8978;e.arighthalfring=7834;e.aring=229;e.aringacute=507;e.aringbelow=7681;e.arrowboth=8596;e.arrowdashdown=8675;e.arrowdashleft=8672;e.arrowdashright=8674;e.arrowdashup=8673;e.arrowdblboth=8660;e.arrowdbldown=8659;e.arrowdblleft=8656;e.arrowdblright=8658;e.arrowdblup=8657;e.arrowdown=8595;e.arrowdownleft=8601;e.arrowdownright=8600;e.arrowdownwhite=8681;e.arrowheaddownmod=709;e.arrowheadleftmod=706;e.arrowheadrightmod=707;e.arrowheadupmod=708;e.arrowhorizex=63719;e.arrowleft=8592;e.arrowleftdbl=8656;e.arrowleftdblstroke=8653;e.arrowleftoverright=8646;e.arrowleftwhite=8678;e.arrowright=8594;e.arrowrightdblstroke=8655;e.arrowrightheavy=10142;e.arrowrightoverleft=8644;e.arrowrightwhite=8680;e.arrowtableft=8676;e.arrowtabright=8677;e.arrowup=8593;e.arrowupdn=8597;e.arrowupdnbse=8616;e.arrowupdownbase=8616;e.arrowupleft=8598;e.arrowupleftofdown=8645;e.arrowupright=8599;e.arrowupwhite=8679;e.arrowvertex=63718;e.asciicircum=94;e.asciicircummonospace=65342;e.asciitilde=126;e.asciitildemonospace=65374;e.ascript=593;e.ascriptturned=594;e.asmallhiragana=12353;e.asmallkatakana=12449;e.asmallkatakanahalfwidth=65383;e.asterisk=42;e.asteriskaltonearabic=1645;e.asteriskarabic=1645;e.asteriskmath=8727;e.asteriskmonospace=65290;e.asterisksmall=65121;e.asterism=8258;e.asuperior=63209;e.asymptoticallyequal=8771;e.at=64;e.atilde=227;e.atmonospace=65312;e.atsmall=65131;e.aturned=592;e.aubengali=2452;e.aubopomofo=12576;e.audeva=2324;e.augujarati=2708;e.augurmukhi=2580;e.aulengthmarkbengali=2519;e.aumatragurmukhi=2636;e.auvowelsignbengali=2508;e.auvowelsigndeva=2380;e.auvowelsigngujarati=2764;e.avagrahadeva=2365;e.aybarmenian=1377;e.ayin=1506;e.ayinaltonehebrew=64288;e.ayinhebrew=1506;e.b=98;e.babengali=2476;e.backslash=92;e.backslashmonospace=65340;e.badeva=2348;e.bagujarati=2732;e.bagurmukhi=2604;e.bahiragana=12400;e.bahtthai=3647;e.bakatakana=12496;e.bar=124;e.barmonospace=65372;e.bbopomofo=12549;e.bcircle=9425;e.bdotaccent=7683;e.bdotbelow=7685;e.beamedsixteenthnotes=9836;e.because=8757;e.becyrillic=1073;e.beharabic=1576;e.behfinalarabic=65168;e.behinitialarabic=65169;e.behiragana=12409;e.behmedialarabic=65170;e.behmeeminitialarabic=64671;e.behmeemisolatedarabic=64520;e.behnoonfinalarabic=64621;e.bekatakana=12505;e.benarmenian=1378;e.bet=1489;e.beta=946;e.betasymbolgreek=976;e.betdagesh=64305;e.betdageshhebrew=64305;e.bethebrew=1489;e.betrafehebrew=64332;e.bhabengali=2477;e.bhadeva=2349;e.bhagujarati=2733;e.bhagurmukhi=2605;e.bhook=595;e.bihiragana=12403;e.bikatakana=12499;e.bilabialclick=664;e.bindigurmukhi=2562;e.birusquare=13105;e.blackcircle=9679;e.blackdiamond=9670;e.blackdownpointingtriangle=9660;e.blackleftpointingpointer=9668;e.blackleftpointingtriangle=9664;e.blacklenticularbracketleft=12304;e.blacklenticularbracketleftvertical=65083;e.blacklenticularbracketright=12305;e.blacklenticularbracketrightvertical=65084;e.blacklowerlefttriangle=9699;e.blacklowerrighttriangle=9698;e.blackrectangle=9644;e.blackrightpointingpointer=9658;e.blackrightpointingtriangle=9654;e.blacksmallsquare=9642;e.blacksmilingface=9787;e.blacksquare=9632;e.blackstar=9733;e.blackupperlefttriangle=9700;e.blackupperrighttriangle=9701;e.blackuppointingsmalltriangle=9652;e.blackuppointingtriangle=9650;e.blank=9251;e.blinebelow=7687;e.block=9608;e.bmonospace=65346;e.bobaimaithai=3610;e.bohiragana=12412;e.bokatakana=12508;e.bparen=9373;e.bqsquare=13251;e.braceex=63732;e.braceleft=123;e.braceleftbt=63731;e.braceleftmid=63730;e.braceleftmonospace=65371;e.braceleftsmall=65115;e.bracelefttp=63729;e.braceleftvertical=65079;e.braceright=125;e.bracerightbt=63742;e.bracerightmid=63741;e.bracerightmonospace=65373;e.bracerightsmall=65116;e.bracerighttp=63740;e.bracerightvertical=65080;e.bracketleft=91;e.bracketleftbt=63728;e.bracketleftex=63727;e.bracketleftmonospace=65339;e.bracketlefttp=63726;e.bracketright=93;e.bracketrightbt=63739;e.bracketrightex=63738;e.bracketrightmonospace=65341;e.bracketrighttp=63737;e.breve=728;e.brevebelowcmb=814;e.brevecmb=774;e.breveinvertedbelowcmb=815;e.breveinvertedcmb=785;e.breveinverteddoublecmb=865;e.bridgebelowcmb=810;e.bridgeinvertedbelowcmb=826;e.brokenbar=166;e.bstroke=384;e.bsuperior=63210;e.btopbar=387;e.buhiragana=12406;e.bukatakana=12502;e.bullet=8226;e.bulletinverse=9688;e.bulletoperator=8729;e.bullseye=9678;e.c=99;e.caarmenian=1390;e.cabengali=2458;e.cacute=263;e.cadeva=2330;e.cagujarati=2714;e.cagurmukhi=2586;e.calsquare=13192;e.candrabindubengali=2433;e.candrabinducmb=784;e.candrabindudeva=2305;e.candrabindugujarati=2689;e.capslock=8682;e.careof=8453;e.caron=711;e.caronbelowcmb=812;e.caroncmb=780;e.carriagereturn=8629;e.cbopomofo=12568;e.ccaron=269;e.ccedilla=231;e.ccedillaacute=7689;e.ccircle=9426;e.ccircumflex=265;e.ccurl=597;e.cdot=267;e.cdotaccent=267;e.cdsquare=13253;e.cedilla=184;e.cedillacmb=807;e.cent=162;e.centigrade=8451;e.centinferior=63199;e.centmonospace=65504;e.centoldstyle=63394;e.centsuperior=63200;e.chaarmenian=1401;e.chabengali=2459;e.chadeva=2331;e.chagujarati=2715;e.chagurmukhi=2587;e.chbopomofo=12564;e.cheabkhasiancyrillic=1213;e.checkmark=10003;e.checyrillic=1095;e.chedescenderabkhasiancyrillic=1215;e.chedescendercyrillic=1207;e.chedieresiscyrillic=1269;e.cheharmenian=1395;e.chekhakassiancyrillic=1228;e.cheverticalstrokecyrillic=1209;e.chi=967;e.chieuchacirclekorean=12919;e.chieuchaparenkorean=12823;e.chieuchcirclekorean=12905;e.chieuchkorean=12618;e.chieuchparenkorean=12809;e.chochangthai=3594;e.chochanthai=3592;e.chochingthai=3593;e.chochoethai=3596;e.chook=392;e.cieucacirclekorean=12918;e.cieucaparenkorean=12822;e.cieuccirclekorean=12904;e.cieuckorean=12616;e.cieucparenkorean=12808;e.cieucuparenkorean=12828;e.circle=9675;e.circlecopyrt=169;e.circlemultiply=8855;e.circleot=8857;e.circleplus=8853;e.circlepostalmark=12342;e.circlewithlefthalfblack=9680;e.circlewithrighthalfblack=9681;e.circumflex=710;e.circumflexbelowcmb=813;e.circumflexcmb=770;e.clear=8999;e.clickalveolar=450;e.clickdental=448;e.clicklateral=449;e.clickretroflex=451;e.club=9827;e.clubsuitblack=9827;e.clubsuitwhite=9831;e.cmcubedsquare=13220;e.cmonospace=65347;e.cmsquaredsquare=13216;e.coarmenian=1409;e.colon=58;e.colonmonetary=8353;e.colonmonospace=65306;e.colonsign=8353;e.colonsmall=65109;e.colontriangularhalfmod=721;e.colontriangularmod=720;e.comma=44;e.commaabovecmb=787;e.commaaboverightcmb=789;e.commaaccent=63171;e.commaarabic=1548;e.commaarmenian=1373;e.commainferior=63201;e.commamonospace=65292;e.commareversedabovecmb=788;e.commareversedmod=701;e.commasmall=65104;e.commasuperior=63202;e.commaturnedabovecmb=786;e.commaturnedmod=699;e.compass=9788;e.congruent=8773;e.contourintegral=8750;e.control=8963;e.controlACK=6;e.controlBEL=7;e.controlBS=8;e.controlCAN=24;e.controlCR=13;e.controlDC1=17;e.controlDC2=18;e.controlDC3=19;e.controlDC4=20;e.controlDEL=127;e.controlDLE=16;e.controlEM=25;e.controlENQ=5;e.controlEOT=4;e.controlESC=27;e.controlETB=23;e.controlETX=3;e.controlFF=12;e.controlFS=28;e.controlGS=29;e.controlHT=9;e.controlLF=10;e.controlNAK=21;e.controlNULL=0;e.controlRS=30;e.controlSI=15;e.controlSO=14;e.controlSOT=2;e.controlSTX=1;e.controlSUB=26;e.controlSYN=22;e.controlUS=31;e.controlVT=11;e.copyright=169;e.copyrightsans=63721;e.copyrightserif=63193;e.cornerbracketleft=12300;e.cornerbracketlefthalfwidth=65378;e.cornerbracketleftvertical=65089;e.cornerbracketright=12301;e.cornerbracketrighthalfwidth=65379;e.cornerbracketrightvertical=65090;e.corporationsquare=13183;e.cosquare=13255;e.coverkgsquare=13254;e.cparen=9374;e.cruzeiro=8354;e.cstretched=663;e.curlyand=8911;e.curlyor=8910;e.currency=164;e.cyrBreve=63185;e.cyrFlex=63186;e.cyrbreve=63188;e.cyrflex=63189;e.d=100;e.daarmenian=1380;e.dabengali=2470;e.dadarabic=1590;e.dadeva=2342;e.dadfinalarabic=65214;e.dadinitialarabic=65215;e.dadmedialarabic=65216;e.dagesh=1468;e.dageshhebrew=1468;e.dagger=8224;e.daggerdbl=8225;e.dagujarati=2726;e.dagurmukhi=2598;e.dahiragana=12384;e.dakatakana=12480;e.dalarabic=1583;e.dalet=1491;e.daletdagesh=64307;e.daletdageshhebrew=64307;e.dalethebrew=1491;e.dalfinalarabic=65194;e.dammaarabic=1615;e.dammalowarabic=1615;e.dammatanaltonearabic=1612;e.dammatanarabic=1612;e.danda=2404;e.dargahebrew=1447;e.dargalefthebrew=1447;e.dasiapneumatacyrilliccmb=1157;e.dblGrave=63187;e.dblanglebracketleft=12298;e.dblanglebracketleftvertical=65085;e.dblanglebracketright=12299;e.dblanglebracketrightvertical=65086;e.dblarchinvertedbelowcmb=811;e.dblarrowleft=8660;e.dblarrowright=8658;e.dbldanda=2405;e.dblgrave=63190;e.dblgravecmb=783;e.dblintegral=8748;e.dbllowline=8215;e.dbllowlinecmb=819;e.dbloverlinecmb=831;e.dblprimemod=698;e.dblverticalbar=8214;e.dblverticallineabovecmb=782;e.dbopomofo=12553;e.dbsquare=13256;e.dcaron=271;e.dcedilla=7697;e.dcircle=9427;e.dcircumflexbelow=7699;e.dcroat=273;e.ddabengali=2465;e.ddadeva=2337;e.ddagujarati=2721;e.ddagurmukhi=2593;e.ddalarabic=1672;e.ddalfinalarabic=64393;e.dddhadeva=2396;e.ddhabengali=2466;e.ddhadeva=2338;e.ddhagujarati=2722;e.ddhagurmukhi=2594;e.ddotaccent=7691;e.ddotbelow=7693;e.decimalseparatorarabic=1643;e.decimalseparatorpersian=1643;e.decyrillic=1076;e.degree=176;e.dehihebrew=1453;e.dehiragana=12391;e.deicoptic=1007;e.dekatakana=12487;e.deleteleft=9003;e.deleteright=8998;e.delta=948;e.deltaturned=397;e.denominatorminusonenumeratorbengali=2552;e.dezh=676;e.dhabengali=2471;e.dhadeva=2343;e.dhagujarati=2727;e.dhagurmukhi=2599;e.dhook=599;e.dialytikatonos=901;e.dialytikatonoscmb=836;e.diamond=9830;e.diamondsuitwhite=9826;e.dieresis=168;e.dieresisacute=63191;e.dieresisbelowcmb=804;e.dieresiscmb=776;e.dieresisgrave=63192;e.dieresistonos=901;e.dihiragana=12386;e.dikatakana=12482;e.dittomark=12291;e.divide=247;e.divides=8739;e.divisionslash=8725;e.djecyrillic=1106;e.dkshade=9619;e.dlinebelow=7695;e.dlsquare=13207;e.dmacron=273;e.dmonospace=65348;e.dnblock=9604;e.dochadathai=3598;e.dodekthai=3604;e.dohiragana=12393;e.dokatakana=12489;e.dollar=36;e.dollarinferior=63203;e.dollarmonospace=65284;e.dollaroldstyle=63268;e.dollarsmall=65129;e.dollarsuperior=63204;e.dong=8363;e.dorusquare=13094;e.dotaccent=729;e.dotaccentcmb=775;e.dotbelowcmb=803;e.dotbelowcomb=803;e.dotkatakana=12539;e.dotlessi=305;e.dotlessj=63166;e.dotlessjstrokehook=644;e.dotmath=8901;e.dottedcircle=9676;e.doubleyodpatah=64287;e.doubleyodpatahhebrew=64287;e.downtackbelowcmb=798;e.downtackmod=725;e.dparen=9375;e.dsuperior=63211;e.dtail=598;e.dtopbar=396;e.duhiragana=12389;e.dukatakana=12485;e.dz=499;e.dzaltone=675;e.dzcaron=454;e.dzcurl=677;e.dzeabkhasiancyrillic=1249;e.dzecyrillic=1109;e.dzhecyrillic=1119;e.e=101;e.eacute=233;e.earth=9793;e.ebengali=2447;e.ebopomofo=12572;e.ebreve=277;e.ecandradeva=2317;e.ecandragujarati=2701;e.ecandravowelsigndeva=2373;e.ecandravowelsigngujarati=2757;e.ecaron=283;e.ecedillabreve=7709;e.echarmenian=1381;e.echyiwnarmenian=1415;e.ecircle=9428;e.ecircumflex=234;e.ecircumflexacute=7871;e.ecircumflexbelow=7705;e.ecircumflexdotbelow=7879;e.ecircumflexgrave=7873;e.ecircumflexhookabove=7875;e.ecircumflextilde=7877;e.ecyrillic=1108;e.edblgrave=517;e.edeva=2319;e.edieresis=235;e.edot=279;e.edotaccent=279;e.edotbelow=7865;e.eegurmukhi=2575;e.eematragurmukhi=2631;e.efcyrillic=1092;e.egrave=232;e.egujarati=2703;e.eharmenian=1383;e.ehbopomofo=12573;e.ehiragana=12360;e.ehookabove=7867;e.eibopomofo=12575;e.eight=56;e.eightarabic=1640;e.eightbengali=2542;e.eightcircle=9319;e.eightcircleinversesansserif=10129;e.eightdeva=2414;e.eighteencircle=9329;e.eighteenparen=9349;e.eighteenperiod=9369;e.eightgujarati=2798;e.eightgurmukhi=2670;e.eighthackarabic=1640;e.eighthangzhou=12328;e.eighthnotebeamed=9835;e.eightideographicparen=12839;e.eightinferior=8328;e.eightmonospace=65304;e.eightoldstyle=63288;e.eightparen=9339;e.eightperiod=9359;e.eightpersian=1784;e.eightroman=8567;e.eightsuperior=8312;e.eightthai=3672;e.einvertedbreve=519;e.eiotifiedcyrillic=1125;e.ekatakana=12456;e.ekatakanahalfwidth=65396;e.ekonkargurmukhi=2676;e.ekorean=12628;e.elcyrillic=1083;e.element=8712;e.elevencircle=9322;e.elevenparen=9342;e.elevenperiod=9362;e.elevenroman=8570;e.ellipsis=8230;e.ellipsisvertical=8942;e.emacron=275;e.emacronacute=7703;e.emacrongrave=7701;e.emcyrillic=1084;e.emdash=8212;e.emdashvertical=65073;e.emonospace=65349;e.emphasismarkarmenian=1371;e.emptyset=8709;e.enbopomofo=12579;e.encyrillic=1085;e.endash=8211;e.endashvertical=65074;e.endescendercyrillic=1187;e.eng=331;e.engbopomofo=12581;e.enghecyrillic=1189;e.enhookcyrillic=1224;e.enspace=8194;e.eogonek=281;e.eokorean=12627;e.eopen=603;e.eopenclosed=666;e.eopenreversed=604;e.eopenreversedclosed=606;e.eopenreversedhook=605;e.eparen=9376;e.epsilon=949;e.epsilontonos=941;e.equal=61;e.equalmonospace=65309;e.equalsmall=65126;e.equalsuperior=8316;e.equivalence=8801;e.erbopomofo=12582;e.ercyrillic=1088;e.ereversed=600;e.ereversedcyrillic=1101;e.escyrillic=1089;e.esdescendercyrillic=1195;e.esh=643;e.eshcurl=646;e.eshortdeva=2318;e.eshortvowelsigndeva=2374;e.eshreversedloop=426;e.eshsquatreversed=645;e.esmallhiragana=12359;e.esmallkatakana=12455;e.esmallkatakanahalfwidth=65386;e.estimated=8494;e.esuperior=63212;e.eta=951;e.etarmenian=1384;e.etatonos=942;e.eth=240;e.etilde=7869;e.etildebelow=7707;e.etnahtafoukhhebrew=1425;e.etnahtafoukhlefthebrew=1425;e.etnahtahebrew=1425;e.etnahtalefthebrew=1425;e.eturned=477;e.eukorean=12641;e.euro=8364;e.evowelsignbengali=2503;e.evowelsigndeva=2375;e.evowelsigngujarati=2759;e.exclam=33;e.exclamarmenian=1372;e.exclamdbl=8252;e.exclamdown=161;e.exclamdownsmall=63393;e.exclammonospace=65281;e.exclamsmall=63265;e.existential=8707;e.ezh=658;e.ezhcaron=495;e.ezhcurl=659;e.ezhreversed=441;e.ezhtail=442;e.f=102;e.fadeva=2398;e.fagurmukhi=2654;e.fahrenheit=8457;e.fathaarabic=1614;e.fathalowarabic=1614;e.fathatanarabic=1611;e.fbopomofo=12552;e.fcircle=9429;e.fdotaccent=7711;e.feharabic=1601;e.feharmenian=1414;e.fehfinalarabic=65234;e.fehinitialarabic=65235;e.fehmedialarabic=65236;e.feicoptic=997;e.female=9792;e.ff=64256;e.f_f=64256;e.ffi=64259;e.f_f_i=64259;e.ffl=64260;e.f_f_l=64260;e.fi=64257;e.f_i=64257;e.fifteencircle=9326;e.fifteenparen=9346;e.fifteenperiod=9366;e.figuredash=8210;e.filledbox=9632;e.filledrect=9644;e.finalkaf=1498;e.finalkafdagesh=64314;e.finalkafdageshhebrew=64314;e.finalkafhebrew=1498;e.finalmem=1501;e.finalmemhebrew=1501;e.finalnun=1503;e.finalnunhebrew=1503;e.finalpe=1507;e.finalpehebrew=1507;e.finaltsadi=1509;e.finaltsadihebrew=1509;e.firsttonechinese=713;e.fisheye=9673;e.fitacyrillic=1139;e.five=53;e.fivearabic=1637;e.fivebengali=2539;e.fivecircle=9316;e.fivecircleinversesansserif=10126;e.fivedeva=2411;e.fiveeighths=8541;e.fivegujarati=2795;e.fivegurmukhi=2667;e.fivehackarabic=1637;e.fivehangzhou=12325;e.fiveideographicparen=12836;e.fiveinferior=8325;e.fivemonospace=65301;e.fiveoldstyle=63285;e.fiveparen=9336;e.fiveperiod=9356;e.fivepersian=1781;e.fiveroman=8564;e.fivesuperior=8309;e.fivethai=3669;e.fl=64258;e.f_l=64258;e.florin=402;e.fmonospace=65350;e.fmsquare=13209;e.fofanthai=3615;e.fofathai=3613;e.fongmanthai=3663;e.forall=8704;e.four=52;e.fourarabic=1636;e.fourbengali=2538;e.fourcircle=9315;e.fourcircleinversesansserif=10125;e.fourdeva=2410;e.fourgujarati=2794;e.fourgurmukhi=2666;e.fourhackarabic=1636;e.fourhangzhou=12324;e.fourideographicparen=12835;e.fourinferior=8324;e.fourmonospace=65300;e.fournumeratorbengali=2551;e.fouroldstyle=63284;e.fourparen=9335;e.fourperiod=9355;e.fourpersian=1780;e.fourroman=8563;e.foursuperior=8308;e.fourteencircle=9325;e.fourteenparen=9345;e.fourteenperiod=9365;e.fourthai=3668;e.fourthtonechinese=715;e.fparen=9377;e.fraction=8260;e.franc=8355;e.g=103;e.gabengali=2455;e.gacute=501;e.gadeva=2327;e.gafarabic=1711;e.gaffinalarabic=64403;e.gafinitialarabic=64404;e.gafmedialarabic=64405;e.gagujarati=2711;e.gagurmukhi=2583;e.gahiragana=12364;e.gakatakana=12460;e.gamma=947;e.gammalatinsmall=611;e.gammasuperior=736;e.gangiacoptic=1003;e.gbopomofo=12557;e.gbreve=287;e.gcaron=487;e.gcedilla=291;e.gcircle=9430;e.gcircumflex=285;e.gcommaaccent=291;e.gdot=289;e.gdotaccent=289;e.gecyrillic=1075;e.gehiragana=12370;e.gekatakana=12466;e.geometricallyequal=8785;e.gereshaccenthebrew=1436;e.gereshhebrew=1523;e.gereshmuqdamhebrew=1437;e.germandbls=223;e.gershayimaccenthebrew=1438;e.gershayimhebrew=1524;e.getamark=12307;e.ghabengali=2456;e.ghadarmenian=1394;e.ghadeva=2328;e.ghagujarati=2712;e.ghagurmukhi=2584;e.ghainarabic=1594;e.ghainfinalarabic=65230;e.ghaininitialarabic=65231;e.ghainmedialarabic=65232;e.ghemiddlehookcyrillic=1173;e.ghestrokecyrillic=1171;e.gheupturncyrillic=1169;e.ghhadeva=2394;e.ghhagurmukhi=2650;e.ghook=608;e.ghzsquare=13203;e.gihiragana=12366;e.gikatakana=12462;e.gimarmenian=1379;e.gimel=1490;e.gimeldagesh=64306;e.gimeldageshhebrew=64306;e.gimelhebrew=1490;e.gjecyrillic=1107;e.glottalinvertedstroke=446;e.glottalstop=660;e.glottalstopinverted=662;e.glottalstopmod=704;e.glottalstopreversed=661;e.glottalstopreversedmod=705;e.glottalstopreversedsuperior=740;e.glottalstopstroke=673;e.glottalstopstrokereversed=674;e.gmacron=7713;e.gmonospace=65351;e.gohiragana=12372;e.gokatakana=12468;e.gparen=9378;e.gpasquare=13228;e.gradient=8711;e.grave=96;e.gravebelowcmb=790;e.gravecmb=768;e.gravecomb=768;e.gravedeva=2387;e.gravelowmod=718;e.gravemonospace=65344;e.gravetonecmb=832;e.greater=62;e.greaterequal=8805;e.greaterequalorless=8923;e.greatermonospace=65310;e.greaterorequivalent=8819;e.greaterorless=8823;e.greateroverequal=8807;e.greatersmall=65125;e.gscript=609;e.gstroke=485;e.guhiragana=12368;e.guillemotleft=171;e.guillemotright=187;e.guilsinglleft=8249;e.guilsinglright=8250;e.gukatakana=12464;e.guramusquare=13080;e.gysquare=13257;e.h=104;e.haabkhasiancyrillic=1193;e.haaltonearabic=1729;e.habengali=2489;e.hadescendercyrillic=1203;e.hadeva=2361;e.hagujarati=2745;e.hagurmukhi=2617;e.haharabic=1581;e.hahfinalarabic=65186;e.hahinitialarabic=65187;e.hahiragana=12399;e.hahmedialarabic=65188;e.haitusquare=13098;e.hakatakana=12495;e.hakatakanahalfwidth=65418;e.halantgurmukhi=2637;e.hamzaarabic=1569;e.hamzalowarabic=1569;e.hangulfiller=12644;e.hardsigncyrillic=1098;e.harpoonleftbarbup=8636;e.harpoonrightbarbup=8640;e.hasquare=13258;e.hatafpatah=1458;e.hatafpatah16=1458;e.hatafpatah23=1458;e.hatafpatah2f=1458;e.hatafpatahhebrew=1458;e.hatafpatahnarrowhebrew=1458;e.hatafpatahquarterhebrew=1458;e.hatafpatahwidehebrew=1458;e.hatafqamats=1459;e.hatafqamats1b=1459;e.hatafqamats28=1459;e.hatafqamats34=1459;e.hatafqamatshebrew=1459;e.hatafqamatsnarrowhebrew=1459;e.hatafqamatsquarterhebrew=1459;e.hatafqamatswidehebrew=1459;e.hatafsegol=1457;e.hatafsegol17=1457;e.hatafsegol24=1457;e.hatafsegol30=1457;e.hatafsegolhebrew=1457;e.hatafsegolnarrowhebrew=1457;e.hatafsegolquarterhebrew=1457;e.hatafsegolwidehebrew=1457;e.hbar=295;e.hbopomofo=12559;e.hbrevebelow=7723;e.hcedilla=7721;e.hcircle=9431;e.hcircumflex=293;e.hdieresis=7719;e.hdotaccent=7715;e.hdotbelow=7717;e.he=1492;e.heart=9829;e.heartsuitblack=9829;e.heartsuitwhite=9825;e.hedagesh=64308;e.hedageshhebrew=64308;e.hehaltonearabic=1729;e.heharabic=1607;e.hehebrew=1492;e.hehfinalaltonearabic=64423;e.hehfinalalttwoarabic=65258;e.hehfinalarabic=65258;e.hehhamzaabovefinalarabic=64421;e.hehhamzaaboveisolatedarabic=64420;e.hehinitialaltonearabic=64424;e.hehinitialarabic=65259;e.hehiragana=12408;e.hehmedialaltonearabic=64425;e.hehmedialarabic=65260;e.heiseierasquare=13179;e.hekatakana=12504;e.hekatakanahalfwidth=65421;e.hekutaarusquare=13110;e.henghook=615;e.herutusquare=13113;e.het=1495;e.hethebrew=1495;e.hhook=614;e.hhooksuperior=689;e.hieuhacirclekorean=12923;e.hieuhaparenkorean=12827;e.hieuhcirclekorean=12909;e.hieuhkorean=12622;e.hieuhparenkorean=12813;e.hihiragana=12402;e.hikatakana=12498;e.hikatakanahalfwidth=65419;e.hiriq=1460;e.hiriq14=1460;e.hiriq21=1460;e.hiriq2d=1460;e.hiriqhebrew=1460;e.hiriqnarrowhebrew=1460;e.hiriqquarterhebrew=1460;e.hiriqwidehebrew=1460;e.hlinebelow=7830;e.hmonospace=65352;e.hoarmenian=1392;e.hohipthai=3627;e.hohiragana=12411;e.hokatakana=12507;e.hokatakanahalfwidth=65422;e.holam=1465;e.holam19=1465;e.holam26=1465;e.holam32=1465;e.holamhebrew=1465;e.holamnarrowhebrew=1465;e.holamquarterhebrew=1465;e.holamwidehebrew=1465;e.honokhukthai=3630;e.hookabovecomb=777;e.hookcmb=777;e.hookpalatalizedbelowcmb=801;e.hookretroflexbelowcmb=802;e.hoonsquare=13122;e.horicoptic=1001;e.horizontalbar=8213;e.horncmb=795;e.hotsprings=9832;e.house=8962;e.hparen=9379;e.hsuperior=688;e.hturned=613;e.huhiragana=12405;e.huiitosquare=13107;e.hukatakana=12501;e.hukatakanahalfwidth=65420;e.hungarumlaut=733;e.hungarumlautcmb=779;e.hv=405;e.hyphen=45;e.hypheninferior=63205;e.hyphenmonospace=65293;e.hyphensmall=65123;e.hyphensuperior=63206;e.hyphentwo=8208;e.i=105;e.iacute=237;e.iacyrillic=1103;e.ibengali=2439;e.ibopomofo=12583;e.ibreve=301;e.icaron=464;e.icircle=9432;e.icircumflex=238;e.icyrillic=1110;e.idblgrave=521;e.ideographearthcircle=12943;e.ideographfirecircle=12939;e.ideographicallianceparen=12863;e.ideographiccallparen=12858;e.ideographiccentrecircle=12965;e.ideographicclose=12294;e.ideographiccomma=12289;e.ideographiccommaleft=65380;e.ideographiccongratulationparen=12855;e.ideographiccorrectcircle=12963;e.ideographicearthparen=12847;e.ideographicenterpriseparen=12861;e.ideographicexcellentcircle=12957;e.ideographicfestivalparen=12864;e.ideographicfinancialcircle=12950;e.ideographicfinancialparen=12854;e.ideographicfireparen=12843;e.ideographichaveparen=12850;e.ideographichighcircle=12964;e.ideographiciterationmark=12293;e.ideographiclaborcircle=12952;e.ideographiclaborparen=12856;e.ideographicleftcircle=12967;e.ideographiclowcircle=12966;e.ideographicmedicinecircle=12969;e.ideographicmetalparen=12846;e.ideographicmoonparen=12842;e.ideographicnameparen=12852;e.ideographicperiod=12290;e.ideographicprintcircle=12958;e.ideographicreachparen=12867;e.ideographicrepresentparen=12857;e.ideographicresourceparen=12862;e.ideographicrightcircle=12968;e.ideographicsecretcircle=12953;e.ideographicselfparen=12866;e.ideographicsocietyparen=12851;e.ideographicspace=12288;e.ideographicspecialparen=12853;e.ideographicstockparen=12849;e.ideographicstudyparen=12859;e.ideographicsunparen=12848;e.ideographicsuperviseparen=12860;e.ideographicwaterparen=12844;e.ideographicwoodparen=12845;e.ideographiczero=12295;e.ideographmetalcircle=12942;e.ideographmooncircle=12938;e.ideographnamecircle=12948;e.ideographsuncircle=12944;e.ideographwatercircle=12940;e.ideographwoodcircle=12941;e.ideva=2311;e.idieresis=239;e.idieresisacute=7727;e.idieresiscyrillic=1253;e.idotbelow=7883;e.iebrevecyrillic=1239;e.iecyrillic=1077;e.ieungacirclekorean=12917;e.ieungaparenkorean=12821;e.ieungcirclekorean=12903;e.ieungkorean=12615;e.ieungparenkorean=12807;e.igrave=236;e.igujarati=2695;e.igurmukhi=2567;e.ihiragana=12356;e.ihookabove=7881;e.iibengali=2440;e.iicyrillic=1080;e.iideva=2312;e.iigujarati=2696;e.iigurmukhi=2568;e.iimatragurmukhi=2624;e.iinvertedbreve=523;e.iishortcyrillic=1081;e.iivowelsignbengali=2496;e.iivowelsigndeva=2368;e.iivowelsigngujarati=2752;e.ij=307;e.ikatakana=12452;e.ikatakanahalfwidth=65394;e.ikorean=12643;e.ilde=732;e.iluyhebrew=1452;e.imacron=299;e.imacroncyrillic=1251;e.imageorapproximatelyequal=8787;e.imatragurmukhi=2623;e.imonospace=65353;e.increment=8710;e.infinity=8734;e.iniarmenian=1387;e.integral=8747;e.integralbottom=8993;e.integralbt=8993;e.integralex=63733;e.integraltop=8992;e.integraltp=8992;e.intersection=8745;e.intisquare=13061;e.invbullet=9688;e.invcircle=9689;e.invsmileface=9787;e.iocyrillic=1105;e.iogonek=303;e.iota=953;e.iotadieresis=970;e.iotadieresistonos=912;e.iotalatin=617;e.iotatonos=943;e.iparen=9380;e.irigurmukhi=2674;e.ismallhiragana=12355;e.ismallkatakana=12451;e.ismallkatakanahalfwidth=65384;e.issharbengali=2554;e.istroke=616;e.isuperior=63213;e.iterationhiragana=12445;e.iterationkatakana=12541;e.itilde=297;e.itildebelow=7725;e.iubopomofo=12585;e.iucyrillic=1102;e.ivowelsignbengali=2495;e.ivowelsigndeva=2367;e.ivowelsigngujarati=2751;e.izhitsacyrillic=1141;e.izhitsadblgravecyrillic=1143;e.j=106;e.jaarmenian=1393;e.jabengali=2460;e.jadeva=2332;e.jagujarati=2716;e.jagurmukhi=2588;e.jbopomofo=12560;e.jcaron=496;e.jcircle=9433;e.jcircumflex=309;e.jcrossedtail=669;e.jdotlessstroke=607;e.jecyrillic=1112;e.jeemarabic=1580;e.jeemfinalarabic=65182;e.jeeminitialarabic=65183;e.jeemmedialarabic=65184;e.jeharabic=1688;e.jehfinalarabic=64395;e.jhabengali=2461;e.jhadeva=2333;e.jhagujarati=2717;e.jhagurmukhi=2589;e.jheharmenian=1403;e.jis=12292;e.jmonospace=65354;e.jparen=9381;e.jsuperior=690;e.k=107;e.kabashkircyrillic=1185;e.kabengali=2453;e.kacute=7729;e.kacyrillic=1082;e.kadescendercyrillic=1179;e.kadeva=2325;e.kaf=1499;e.kafarabic=1603;e.kafdagesh=64315;e.kafdageshhebrew=64315;e.kaffinalarabic=65242;e.kafhebrew=1499;e.kafinitialarabic=65243;e.kafmedialarabic=65244;e.kafrafehebrew=64333;e.kagujarati=2709;e.kagurmukhi=2581;e.kahiragana=12363;e.kahookcyrillic=1220;e.kakatakana=12459;e.kakatakanahalfwidth=65398;e.kappa=954;e.kappasymbolgreek=1008;e.kapyeounmieumkorean=12657;e.kapyeounphieuphkorean=12676;e.kapyeounpieupkorean=12664;e.kapyeounssangpieupkorean=12665;e.karoriisquare=13069;e.kashidaautoarabic=1600;e.kashidaautonosidebearingarabic=1600;e.kasmallkatakana=12533;e.kasquare=13188;e.kasraarabic=1616;e.kasratanarabic=1613;e.kastrokecyrillic=1183;e.katahiraprolongmarkhalfwidth=65392;e.kaverticalstrokecyrillic=1181;e.kbopomofo=12558;e.kcalsquare=13193;e.kcaron=489;e.kcedilla=311;e.kcircle=9434;e.kcommaaccent=311;e.kdotbelow=7731;e.keharmenian=1412;e.kehiragana=12369;e.kekatakana=12465;e.kekatakanahalfwidth=65401;e.kenarmenian=1391;e.kesmallkatakana=12534;e.kgreenlandic=312;e.khabengali=2454;e.khacyrillic=1093;e.khadeva=2326;e.khagujarati=2710;e.khagurmukhi=2582;e.khaharabic=1582;e.khahfinalarabic=65190;e.khahinitialarabic=65191;e.khahmedialarabic=65192;e.kheicoptic=999;e.khhadeva=2393;e.khhagurmukhi=2649;e.khieukhacirclekorean=12920;e.khieukhaparenkorean=12824;e.khieukhcirclekorean=12906;e.khieukhkorean=12619;e.khieukhparenkorean=12810;e.khokhaithai=3586;e.khokhonthai=3589;e.khokhuatthai=3587;e.khokhwaithai=3588;e.khomutthai=3675;e.khook=409;e.khorakhangthai=3590;e.khzsquare=13201;e.kihiragana=12365;e.kikatakana=12461;e.kikatakanahalfwidth=65399;e.kiroguramusquare=13077;e.kiromeetorusquare=13078;e.kirosquare=13076;e.kiyeokacirclekorean=12910;e.kiyeokaparenkorean=12814;e.kiyeokcirclekorean=12896;e.kiyeokkorean=12593;e.kiyeokparenkorean=12800;e.kiyeoksioskorean=12595;e.kjecyrillic=1116;e.klinebelow=7733;e.klsquare=13208;e.kmcubedsquare=13222;e.kmonospace=65355;e.kmsquaredsquare=13218;e.kohiragana=12371;e.kohmsquare=13248;e.kokaithai=3585;e.kokatakana=12467;e.kokatakanahalfwidth=65402;e.kooposquare=13086;e.koppacyrillic=1153;e.koreanstandardsymbol=12927;e.koroniscmb=835;e.kparen=9382;e.kpasquare=13226;e.ksicyrillic=1135;e.ktsquare=13263;e.kturned=670;e.kuhiragana=12367;e.kukatakana=12463;e.kukatakanahalfwidth=65400;e.kvsquare=13240;e.kwsquare=13246;e.l=108;e.labengali=2482;e.lacute=314;e.ladeva=2354;e.lagujarati=2738;e.lagurmukhi=2610;e.lakkhangyaothai=3653;e.lamaleffinalarabic=65276;e.lamalefhamzaabovefinalarabic=65272;e.lamalefhamzaaboveisolatedarabic=65271;e.lamalefhamzabelowfinalarabic=65274;e.lamalefhamzabelowisolatedarabic=65273;e.lamalefisolatedarabic=65275;e.lamalefmaddaabovefinalarabic=65270;e.lamalefmaddaaboveisolatedarabic=65269;e.lamarabic=1604;e.lambda=955;e.lambdastroke=411;e.lamed=1500;e.lameddagesh=64316;e.lameddageshhebrew=64316;e.lamedhebrew=1500;e.lamfinalarabic=65246;e.lamhahinitialarabic=64714;e.laminitialarabic=65247;e.lamjeeminitialarabic=64713;e.lamkhahinitialarabic=64715;e.lamlamhehisolatedarabic=65010;e.lammedialarabic=65248;e.lammeemhahinitialarabic=64904;e.lammeeminitialarabic=64716;e.largecircle=9711;e.lbar=410;e.lbelt=620;e.lbopomofo=12556;e.lcaron=318;e.lcedilla=316;e.lcircle=9435;e.lcircumflexbelow=7741;e.lcommaaccent=316;e.ldot=320;e.ldotaccent=320;e.ldotbelow=7735;e.ldotbelowmacron=7737;e.leftangleabovecmb=794;e.lefttackbelowcmb=792;e.less=60;e.lessequal=8804;e.lessequalorgreater=8922;e.lessmonospace=65308;e.lessorequivalent=8818;e.lessorgreater=8822;e.lessoverequal=8806;e.lesssmall=65124;e.lezh=622;e.lfblock=9612;e.lhookretroflex=621;e.lira=8356;e.liwnarmenian=1388;e.lj=457;e.ljecyrillic=1113;e.ll=63168;e.lladeva=2355;e.llagujarati=2739;e.llinebelow=7739;e.llladeva=2356;e.llvocalicbengali=2529;e.llvocalicdeva=2401;e.llvocalicvowelsignbengali=2531;e.llvocalicvowelsigndeva=2403;e.lmiddletilde=619;e.lmonospace=65356;e.lmsquare=13264;e.lochulathai=3628;e.logicaland=8743;e.logicalnot=172;e.logicalnotreversed=8976;e.logicalor=8744;e.lolingthai=3621;e.longs=383;e.lowlinecenterline=65102;e.lowlinecmb=818;e.lowlinedashed=65101;e.lozenge=9674;e.lparen=9383;e.lslash=322;e.lsquare=8467;e.lsuperior=63214;e.ltshade=9617;e.luthai=3622;e.lvocalicbengali=2444;e.lvocalicdeva=2316;e.lvocalicvowelsignbengali=2530;e.lvocalicvowelsigndeva=2402;e.lxsquare=13267;e.m=109;e.mabengali=2478;e.macron=175;e.macronbelowcmb=817;e.macroncmb=772;e.macronlowmod=717;e.macronmonospace=65507;e.macute=7743;e.madeva=2350;e.magujarati=2734;e.magurmukhi=2606;e.mahapakhhebrew=1444;e.mahapakhlefthebrew=1444;e.mahiragana=12414;e.maichattawalowleftthai=63637;e.maichattawalowrightthai=63636;e.maichattawathai=3659;e.maichattawaupperleftthai=63635;e.maieklowleftthai=63628;e.maieklowrightthai=63627;e.maiekthai=3656;e.maiekupperleftthai=63626;e.maihanakatleftthai=63620;e.maihanakatthai=3633;e.maitaikhuleftthai=63625;e.maitaikhuthai=3655;e.maitholowleftthai=63631;e.maitholowrightthai=63630;e.maithothai=3657;e.maithoupperleftthai=63629;e.maitrilowleftthai=63634;e.maitrilowrightthai=63633;e.maitrithai=3658;e.maitriupperleftthai=63632;e.maiyamokthai=3654;e.makatakana=12510;e.makatakanahalfwidth=65423;e.male=9794;e.mansyonsquare=13127;e.maqafhebrew=1470;e.mars=9794;e.masoracirclehebrew=1455;e.masquare=13187;e.mbopomofo=12551;e.mbsquare=13268;e.mcircle=9436;e.mcubedsquare=13221;e.mdotaccent=7745;e.mdotbelow=7747;e.meemarabic=1605;e.meemfinalarabic=65250;e.meeminitialarabic=65251;e.meemmedialarabic=65252;e.meemmeeminitialarabic=64721;e.meemmeemisolatedarabic=64584;e.meetorusquare=13133;e.mehiragana=12417;e.meizierasquare=13182;e.mekatakana=12513;e.mekatakanahalfwidth=65426;e.mem=1502;e.memdagesh=64318;e.memdageshhebrew=64318;e.memhebrew=1502;e.menarmenian=1396;e.merkhahebrew=1445;e.merkhakefulahebrew=1446;e.merkhakefulalefthebrew=1446;e.merkhalefthebrew=1445;e.mhook=625;e.mhzsquare=13202;e.middledotkatakanahalfwidth=65381;e.middot=183;e.mieumacirclekorean=12914;e.mieumaparenkorean=12818;e.mieumcirclekorean=12900;e.mieumkorean=12609;e.mieumpansioskorean=12656;e.mieumparenkorean=12804;e.mieumpieupkorean=12654;e.mieumsioskorean=12655;e.mihiragana=12415;e.mikatakana=12511;e.mikatakanahalfwidth=65424;e.minus=8722;e.minusbelowcmb=800;e.minuscircle=8854;e.minusmod=727;e.minusplus=8723;e.minute=8242;e.miribaarusquare=13130;e.mirisquare=13129;e.mlonglegturned=624;e.mlsquare=13206;e.mmcubedsquare=13219;e.mmonospace=65357;e.mmsquaredsquare=13215;e.mohiragana=12418;e.mohmsquare=13249;e.mokatakana=12514;e.mokatakanahalfwidth=65427;e.molsquare=13270;e.momathai=3617;e.moverssquare=13223;e.moverssquaredsquare=13224;e.mparen=9384;e.mpasquare=13227;e.mssquare=13235;e.msuperior=63215;e.mturned=623;e.mu=181;e.mu1=181;e.muasquare=13186;e.muchgreater=8811;e.muchless=8810;e.mufsquare=13196;e.mugreek=956;e.mugsquare=13197;e.muhiragana=12416;e.mukatakana=12512;e.mukatakanahalfwidth=65425;e.mulsquare=13205;e.multiply=215;e.mumsquare=13211;e.munahhebrew=1443;e.munahlefthebrew=1443;e.musicalnote=9834;e.musicalnotedbl=9835;e.musicflatsign=9837;e.musicsharpsign=9839;e.mussquare=13234;e.muvsquare=13238;e.muwsquare=13244;e.mvmegasquare=13241;e.mvsquare=13239;e.mwmegasquare=13247;e.mwsquare=13245;e.n=110;e.nabengali=2472;e.nabla=8711;e.nacute=324;e.nadeva=2344;e.nagujarati=2728;e.nagurmukhi=2600;e.nahiragana=12394;e.nakatakana=12490;e.nakatakanahalfwidth=65413;e.napostrophe=329;e.nasquare=13185;e.nbopomofo=12555;e.nbspace=160;e.ncaron=328;e.ncedilla=326;e.ncircle=9437;e.ncircumflexbelow=7755;e.ncommaaccent=326;e.ndotaccent=7749;e.ndotbelow=7751;e.nehiragana=12397;e.nekatakana=12493;e.nekatakanahalfwidth=65416;e.newsheqelsign=8362;e.nfsquare=13195;e.ngabengali=2457;e.ngadeva=2329;e.ngagujarati=2713;e.ngagurmukhi=2585;e.ngonguthai=3591;e.nhiragana=12435;e.nhookleft=626;e.nhookretroflex=627;e.nieunacirclekorean=12911;e.nieunaparenkorean=12815;e.nieuncieuckorean=12597;e.nieuncirclekorean=12897;e.nieunhieuhkorean=12598;e.nieunkorean=12596;e.nieunpansioskorean=12648;e.nieunparenkorean=12801;e.nieunsioskorean=12647;e.nieuntikeutkorean=12646;e.nihiragana=12395;e.nikatakana=12491;e.nikatakanahalfwidth=65414;e.nikhahitleftthai=63641;e.nikhahitthai=3661;e.nine=57;e.ninearabic=1641;e.ninebengali=2543;e.ninecircle=9320;e.ninecircleinversesansserif=10130;e.ninedeva=2415;e.ninegujarati=2799;e.ninegurmukhi=2671;e.ninehackarabic=1641;e.ninehangzhou=12329;e.nineideographicparen=12840;e.nineinferior=8329;e.ninemonospace=65305;e.nineoldstyle=63289;e.nineparen=9340;e.nineperiod=9360;e.ninepersian=1785;e.nineroman=8568;e.ninesuperior=8313;e.nineteencircle=9330;e.nineteenparen=9350;e.nineteenperiod=9370;e.ninethai=3673;e.nj=460;e.njecyrillic=1114;e.nkatakana=12531;e.nkatakanahalfwidth=65437;e.nlegrightlong=414;e.nlinebelow=7753;e.nmonospace=65358;e.nmsquare=13210;e.nnabengali=2467;e.nnadeva=2339;e.nnagujarati=2723;e.nnagurmukhi=2595;e.nnnadeva=2345;e.nohiragana=12398;e.nokatakana=12494;e.nokatakanahalfwidth=65417;e.nonbreakingspace=160;e.nonenthai=3603;e.nonuthai=3609;e.noonarabic=1606;e.noonfinalarabic=65254;e.noonghunnaarabic=1722;e.noonghunnafinalarabic=64415;e.nooninitialarabic=65255;e.noonjeeminitialarabic=64722;e.noonjeemisolatedarabic=64587;e.noonmedialarabic=65256;e.noonmeeminitialarabic=64725;e.noonmeemisolatedarabic=64590;e.noonnoonfinalarabic=64653;e.notcontains=8716;e.notelement=8713;e.notelementof=8713;e.notequal=8800;e.notgreater=8815;e.notgreaternorequal=8817;e.notgreaternorless=8825;e.notidentical=8802;e.notless=8814;e.notlessnorequal=8816;e.notparallel=8742;e.notprecedes=8832;e.notsubset=8836;e.notsucceeds=8833;e.notsuperset=8837;e.nowarmenian=1398;e.nparen=9385;e.nssquare=13233;e.nsuperior=8319;e.ntilde=241;e.nu=957;e.nuhiragana=12396;e.nukatakana=12492;e.nukatakanahalfwidth=65415;e.nuktabengali=2492;e.nuktadeva=2364;e.nuktagujarati=2748;e.nuktagurmukhi=2620;e.numbersign=35;e.numbersignmonospace=65283;e.numbersignsmall=65119;e.numeralsigngreek=884;e.numeralsignlowergreek=885;e.numero=8470;e.nun=1504;e.nundagesh=64320;e.nundageshhebrew=64320;e.nunhebrew=1504;e.nvsquare=13237;e.nwsquare=13243;e.nyabengali=2462;e.nyadeva=2334;e.nyagujarati=2718;e.nyagurmukhi=2590;e.o=111;e.oacute=243;e.oangthai=3629;e.obarred=629;e.obarredcyrillic=1257;e.obarreddieresiscyrillic=1259;e.obengali=2451;e.obopomofo=12571;e.obreve=335;e.ocandradeva=2321;e.ocandragujarati=2705;e.ocandravowelsigndeva=2377;e.ocandravowelsigngujarati=2761;e.ocaron=466;e.ocircle=9438;e.ocircumflex=244;e.ocircumflexacute=7889;e.ocircumflexdotbelow=7897;e.ocircumflexgrave=7891;e.ocircumflexhookabove=7893;e.ocircumflextilde=7895;e.ocyrillic=1086;e.odblacute=337;e.odblgrave=525;e.odeva=2323;e.odieresis=246;e.odieresiscyrillic=1255;e.odotbelow=7885;e.oe=339;e.oekorean=12634;e.ogonek=731;e.ogonekcmb=808;e.ograve=242;e.ogujarati=2707;e.oharmenian=1413;e.ohiragana=12362;e.ohookabove=7887;e.ohorn=417;e.ohornacute=7899;e.ohorndotbelow=7907;e.ohorngrave=7901;e.ohornhookabove=7903;e.ohorntilde=7905;e.ohungarumlaut=337;e.oi=419;e.oinvertedbreve=527;e.okatakana=12458;e.okatakanahalfwidth=65397;e.okorean=12631;e.olehebrew=1451;e.omacron=333;e.omacronacute=7763;e.omacrongrave=7761;e.omdeva=2384;e.omega=969;e.omega1=982;e.omegacyrillic=1121;e.omegalatinclosed=631;e.omegaroundcyrillic=1147;e.omegatitlocyrillic=1149;e.omegatonos=974;e.omgujarati=2768;e.omicron=959;e.omicrontonos=972;e.omonospace=65359;e.one=49;e.onearabic=1633;e.onebengali=2535;e.onecircle=9312;e.onecircleinversesansserif=10122;e.onedeva=2407;e.onedotenleader=8228;e.oneeighth=8539;e.onefitted=63196;e.onegujarati=2791;e.onegurmukhi=2663;e.onehackarabic=1633;e.onehalf=189;e.onehangzhou=12321;e.oneideographicparen=12832;e.oneinferior=8321;e.onemonospace=65297;e.onenumeratorbengali=2548;e.oneoldstyle=63281;e.oneparen=9332;e.oneperiod=9352;e.onepersian=1777;e.onequarter=188;e.oneroman=8560;e.onesuperior=185;e.onethai=3665;e.onethird=8531;e.oogonek=491;e.oogonekmacron=493;e.oogurmukhi=2579;e.oomatragurmukhi=2635;e.oopen=596;e.oparen=9386;e.openbullet=9702;e.option=8997;e.ordfeminine=170;e.ordmasculine=186;e.orthogonal=8735;e.oshortdeva=2322;e.oshortvowelsigndeva=2378;e.oslash=248;e.oslashacute=511;e.osmallhiragana=12361;e.osmallkatakana=12457;e.osmallkatakanahalfwidth=65387;e.ostrokeacute=511;e.osuperior=63216;e.otcyrillic=1151;e.otilde=245;e.otildeacute=7757;e.otildedieresis=7759;e.oubopomofo=12577;e.overline=8254;e.overlinecenterline=65098;e.overlinecmb=773;e.overlinedashed=65097;e.overlinedblwavy=65100;e.overlinewavy=65099;e.overscore=175;e.ovowelsignbengali=2507;e.ovowelsigndeva=2379;e.ovowelsigngujarati=2763;e.p=112;e.paampssquare=13184;e.paasentosquare=13099;e.pabengali=2474;e.pacute=7765;e.padeva=2346;e.pagedown=8671;e.pageup=8670;e.pagujarati=2730;e.pagurmukhi=2602;e.pahiragana=12401;e.paiyannoithai=3631;e.pakatakana=12497;e.palatalizationcyrilliccmb=1156;e.palochkacyrillic=1216;e.pansioskorean=12671;e.paragraph=182;e.parallel=8741;e.parenleft=40;e.parenleftaltonearabic=64830;e.parenleftbt=63725;e.parenleftex=63724;e.parenleftinferior=8333;e.parenleftmonospace=65288;e.parenleftsmall=65113;e.parenleftsuperior=8317;e.parenlefttp=63723;e.parenleftvertical=65077;e.parenright=41;e.parenrightaltonearabic=64831;e.parenrightbt=63736;e.parenrightex=63735;e.parenrightinferior=8334;e.parenrightmonospace=65289;e.parenrightsmall=65114;e.parenrightsuperior=8318;e.parenrighttp=63734;e.parenrightvertical=65078;e.partialdiff=8706;e.paseqhebrew=1472;e.pashtahebrew=1433;e.pasquare=13225;e.patah=1463;e.patah11=1463;e.patah1d=1463;e.patah2a=1463;e.patahhebrew=1463;e.patahnarrowhebrew=1463;e.patahquarterhebrew=1463;e.patahwidehebrew=1463;e.pazerhebrew=1441;e.pbopomofo=12550;e.pcircle=9439;e.pdotaccent=7767;e.pe=1508;e.pecyrillic=1087;e.pedagesh=64324;e.pedageshhebrew=64324;e.peezisquare=13115;e.pefinaldageshhebrew=64323;e.peharabic=1662;e.peharmenian=1402;e.pehebrew=1508;e.pehfinalarabic=64343;e.pehinitialarabic=64344;e.pehiragana=12410;e.pehmedialarabic=64345;e.pekatakana=12506;e.pemiddlehookcyrillic=1191;e.perafehebrew=64334;e.percent=37;e.percentarabic=1642;e.percentmonospace=65285;e.percentsmall=65130;e.period=46;e.periodarmenian=1417;e.periodcentered=183;e.periodhalfwidth=65377;e.periodinferior=63207;e.periodmonospace=65294;e.periodsmall=65106;e.periodsuperior=63208;e.perispomenigreekcmb=834;e.perpendicular=8869;e.perthousand=8240;e.peseta=8359;e.pfsquare=13194;e.phabengali=2475;e.phadeva=2347;e.phagujarati=2731;e.phagurmukhi=2603;e.phi=966;e.phi1=981;e.phieuphacirclekorean=12922;e.phieuphaparenkorean=12826;e.phieuphcirclekorean=12908;e.phieuphkorean=12621;e.phieuphparenkorean=12812;e.philatin=632;e.phinthuthai=3642;e.phisymbolgreek=981;e.phook=421;e.phophanthai=3614;e.phophungthai=3612;e.phosamphaothai=3616;e.pi=960;e.pieupacirclekorean=12915;e.pieupaparenkorean=12819;e.pieupcieuckorean=12662;e.pieupcirclekorean=12901;e.pieupkiyeokkorean=12658;e.pieupkorean=12610;e.pieupparenkorean=12805;e.pieupsioskiyeokkorean=12660;e.pieupsioskorean=12612;e.pieupsiostikeutkorean=12661;e.pieupthieuthkorean=12663;e.pieuptikeutkorean=12659;e.pihiragana=12404;e.pikatakana=12500;e.pisymbolgreek=982;e.piwrarmenian=1411;e.planckover2pi=8463;e.planckover2pi1=8463;e.plus=43;e.plusbelowcmb=799;e.pluscircle=8853;e.plusminus=177;e.plusmod=726;e.plusmonospace=65291;e.plussmall=65122;e.plussuperior=8314;e.pmonospace=65360;e.pmsquare=13272;e.pohiragana=12413;e.pointingindexdownwhite=9759;e.pointingindexleftwhite=9756;e.pointingindexrightwhite=9758;e.pointingindexupwhite=9757;e.pokatakana=12509;e.poplathai=3611;e.postalmark=12306;e.postalmarkface=12320;e.pparen=9387;e.precedes=8826;e.prescription=8478;e.primemod=697;e.primereversed=8245;e.product=8719;e.projective=8965;e.prolongedkana=12540;e.propellor=8984;e.propersubset=8834;e.propersuperset=8835;e.proportion=8759;e.proportional=8733;e.psi=968;e.psicyrillic=1137;e.psilipneumatacyrilliccmb=1158;e.pssquare=13232;e.puhiragana=12407;e.pukatakana=12503;e.pvsquare=13236;e.pwsquare=13242;e.q=113;e.qadeva=2392;e.qadmahebrew=1448;e.qafarabic=1602;e.qaffinalarabic=65238;e.qafinitialarabic=65239;e.qafmedialarabic=65240;e.qamats=1464;e.qamats10=1464;e.qamats1a=1464;e.qamats1c=1464;e.qamats27=1464;e.qamats29=1464;e.qamats33=1464;e.qamatsde=1464;e.qamatshebrew=1464;e.qamatsnarrowhebrew=1464;e.qamatsqatanhebrew=1464;e.qamatsqatannarrowhebrew=1464;e.qamatsqatanquarterhebrew=1464;e.qamatsqatanwidehebrew=1464;e.qamatsquarterhebrew=1464;e.qamatswidehebrew=1464;e.qarneyparahebrew=1439;e.qbopomofo=12561;e.qcircle=9440;e.qhook=672;e.qmonospace=65361;e.qof=1511;e.qofdagesh=64327;e.qofdageshhebrew=64327;e.qofhebrew=1511;e.qparen=9388;e.quarternote=9833;e.qubuts=1467;e.qubuts18=1467;e.qubuts25=1467;e.qubuts31=1467;e.qubutshebrew=1467;e.qubutsnarrowhebrew=1467;e.qubutsquarterhebrew=1467;e.qubutswidehebrew=1467;e.question=63;e.questionarabic=1567;e.questionarmenian=1374;e.questiondown=191;e.questiondownsmall=63423;e.questiongreek=894;e.questionmonospace=65311;e.questionsmall=63295;e.quotedbl=34;e.quotedblbase=8222;e.quotedblleft=8220;e.quotedblmonospace=65282;e.quotedblprime=12318;e.quotedblprimereversed=12317;e.quotedblright=8221;e.quoteleft=8216;e.quoteleftreversed=8219;e.quotereversed=8219;e.quoteright=8217;e.quoterightn=329;e.quotesinglbase=8218;e.quotesingle=39;e.quotesinglemonospace=65287;e.r=114;e.raarmenian=1404;e.rabengali=2480;e.racute=341;e.radeva=2352;e.radical=8730;e.radicalex=63717;e.radoverssquare=13230;e.radoverssquaredsquare=13231;e.radsquare=13229;e.rafe=1471;e.rafehebrew=1471;e.ragujarati=2736;e.ragurmukhi=2608;e.rahiragana=12425;e.rakatakana=12521;e.rakatakanahalfwidth=65431;e.ralowerdiagonalbengali=2545;e.ramiddlediagonalbengali=2544;e.ramshorn=612;e.ratio=8758;e.rbopomofo=12566;e.rcaron=345;e.rcedilla=343;e.rcircle=9441;e.rcommaaccent=343;e.rdblgrave=529;e.rdotaccent=7769;e.rdotbelow=7771;e.rdotbelowmacron=7773;e.referencemark=8251;e.reflexsubset=8838;e.reflexsuperset=8839;e.registered=174;e.registersans=63720;e.registerserif=63194;e.reharabic=1585;e.reharmenian=1408;e.rehfinalarabic=65198;e.rehiragana=12428;e.rekatakana=12524;e.rekatakanahalfwidth=65434;e.resh=1512;e.reshdageshhebrew=64328;e.reshhebrew=1512;e.reversedtilde=8765;e.reviahebrew=1431;e.reviamugrashhebrew=1431;e.revlogicalnot=8976;e.rfishhook=638;e.rfishhookreversed=639;e.rhabengali=2525;e.rhadeva=2397;e.rho=961;e.rhook=637;e.rhookturned=635;e.rhookturnedsuperior=693;e.rhosymbolgreek=1009;e.rhotichookmod=734;e.rieulacirclekorean=12913;e.rieulaparenkorean=12817;e.rieulcirclekorean=12899;e.rieulhieuhkorean=12608;e.rieulkiyeokkorean=12602;e.rieulkiyeoksioskorean=12649;e.rieulkorean=12601;e.rieulmieumkorean=12603;e.rieulpansioskorean=12652;e.rieulparenkorean=12803;e.rieulphieuphkorean=12607;e.rieulpieupkorean=12604;e.rieulpieupsioskorean=12651;e.rieulsioskorean=12605;e.rieulthieuthkorean=12606;e.rieultikeutkorean=12650;e.rieulyeorinhieuhkorean=12653;e.rightangle=8735;e.righttackbelowcmb=793;e.righttriangle=8895;e.rihiragana=12426;e.rikatakana=12522;e.rikatakanahalfwidth=65432;e.ring=730;e.ringbelowcmb=805;e.ringcmb=778;e.ringhalfleft=703;e.ringhalfleftarmenian=1369;e.ringhalfleftbelowcmb=796;e.ringhalfleftcentered=723;e.ringhalfright=702;e.ringhalfrightbelowcmb=825;e.ringhalfrightcentered=722;e.rinvertedbreve=531;e.rittorusquare=13137;e.rlinebelow=7775;e.rlongleg=636;e.rlonglegturned=634;e.rmonospace=65362;e.rohiragana=12429;e.rokatakana=12525;e.rokatakanahalfwidth=65435;e.roruathai=3619;e.rparen=9389;e.rrabengali=2524;e.rradeva=2353;e.rragurmukhi=2652;e.rreharabic=1681;e.rrehfinalarabic=64397;e.rrvocalicbengali=2528;e.rrvocalicdeva=2400;e.rrvocalicgujarati=2784;e.rrvocalicvowelsignbengali=2500;e.rrvocalicvowelsigndeva=2372;e.rrvocalicvowelsigngujarati=2756;e.rsuperior=63217;e.rtblock=9616;e.rturned=633;e.rturnedsuperior=692;e.ruhiragana=12427;e.rukatakana=12523;e.rukatakanahalfwidth=65433;e.rupeemarkbengali=2546;e.rupeesignbengali=2547;e.rupiah=63197;e.ruthai=3620;e.rvocalicbengali=2443;e.rvocalicdeva=2315;e.rvocalicgujarati=2699;e.rvocalicvowelsignbengali=2499;e.rvocalicvowelsigndeva=2371;e.rvocalicvowelsigngujarati=2755;e.s=115;e.sabengali=2488;e.sacute=347;e.sacutedotaccent=7781;e.sadarabic=1589;e.sadeva=2360;e.sadfinalarabic=65210;e.sadinitialarabic=65211;e.sadmedialarabic=65212;e.sagujarati=2744;e.sagurmukhi=2616;e.sahiragana=12373;e.sakatakana=12469;e.sakatakanahalfwidth=65403;e.sallallahoualayhewasallamarabic=65018;e.samekh=1505;e.samekhdagesh=64321;e.samekhdageshhebrew=64321;e.samekhhebrew=1505;e.saraaathai=3634;e.saraaethai=3649;e.saraaimaimalaithai=3652;e.saraaimaimuanthai=3651;e.saraamthai=3635;e.saraathai=3632;e.saraethai=3648;e.saraiileftthai=63622;e.saraiithai=3637;e.saraileftthai=63621;e.saraithai=3636;e.saraothai=3650;e.saraueeleftthai=63624;e.saraueethai=3639;e.saraueleftthai=63623;e.sarauethai=3638;e.sarauthai=3640;e.sarauuthai=3641;e.sbopomofo=12569;e.scaron=353;e.scarondotaccent=7783;e.scedilla=351;e.schwa=601;e.schwacyrillic=1241;e.schwadieresiscyrillic=1243;e.schwahook=602;e.scircle=9442;e.scircumflex=349;e.scommaaccent=537;e.sdotaccent=7777;e.sdotbelow=7779;e.sdotbelowdotaccent=7785;e.seagullbelowcmb=828;e.second=8243;e.secondtonechinese=714;e.section=167;e.seenarabic=1587;e.seenfinalarabic=65202;e.seeninitialarabic=65203;e.seenmedialarabic=65204;e.segol=1462;e.segol13=1462;e.segol1f=1462;e.segol2c=1462;e.segolhebrew=1462;e.segolnarrowhebrew=1462;e.segolquarterhebrew=1462;e.segoltahebrew=1426;e.segolwidehebrew=1462;e.seharmenian=1405;e.sehiragana=12379;e.sekatakana=12475;e.sekatakanahalfwidth=65406;e.semicolon=59;e.semicolonarabic=1563;e.semicolonmonospace=65307;e.semicolonsmall=65108;e.semivoicedmarkkana=12444;e.semivoicedmarkkanahalfwidth=65439;e.sentisquare=13090;e.sentosquare=13091;e.seven=55;e.sevenarabic=1639;e.sevenbengali=2541;e.sevencircle=9318;e.sevencircleinversesansserif=10128;e.sevendeva=2413;e.seveneighths=8542;e.sevengujarati=2797;e.sevengurmukhi=2669;e.sevenhackarabic=1639;e.sevenhangzhou=12327;e.sevenideographicparen=12838;e.seveninferior=8327;e.sevenmonospace=65303;e.sevenoldstyle=63287;e.sevenparen=9338;e.sevenperiod=9358;e.sevenpersian=1783;e.sevenroman=8566;e.sevensuperior=8311;e.seventeencircle=9328;e.seventeenparen=9348;e.seventeenperiod=9368;e.seventhai=3671;e.sfthyphen=173;e.shaarmenian=1399;e.shabengali=2486;e.shacyrillic=1096;e.shaddaarabic=1617;e.shaddadammaarabic=64609;e.shaddadammatanarabic=64606;e.shaddafathaarabic=64608;e.shaddakasraarabic=64610;e.shaddakasratanarabic=64607;e.shade=9618;e.shadedark=9619;e.shadelight=9617;e.shademedium=9618;e.shadeva=2358;e.shagujarati=2742;e.shagurmukhi=2614;e.shalshelethebrew=1427;e.shbopomofo=12565;e.shchacyrillic=1097;e.sheenarabic=1588;e.sheenfinalarabic=65206;e.sheeninitialarabic=65207;e.sheenmedialarabic=65208;e.sheicoptic=995;e.sheqel=8362;e.sheqelhebrew=8362;e.sheva=1456;e.sheva115=1456;e.sheva15=1456;e.sheva22=1456;e.sheva2e=1456;e.shevahebrew=1456;e.shevanarrowhebrew=1456;e.shevaquarterhebrew=1456;e.shevawidehebrew=1456;e.shhacyrillic=1211;e.shimacoptic=1005;e.shin=1513;e.shindagesh=64329;e.shindageshhebrew=64329;e.shindageshshindot=64300;e.shindageshshindothebrew=64300;e.shindageshsindot=64301;e.shindageshsindothebrew=64301;e.shindothebrew=1473;e.shinhebrew=1513;e.shinshindot=64298;e.shinshindothebrew=64298;e.shinsindot=64299;e.shinsindothebrew=64299;e.shook=642;e.sigma=963;e.sigma1=962;e.sigmafinal=962;e.sigmalunatesymbolgreek=1010;e.sihiragana=12375;e.sikatakana=12471;e.sikatakanahalfwidth=65404;e.siluqhebrew=1469;e.siluqlefthebrew=1469;e.similar=8764;e.sindothebrew=1474;e.siosacirclekorean=12916;e.siosaparenkorean=12820;e.sioscieuckorean=12670;e.sioscirclekorean=12902;e.sioskiyeokkorean=12666;e.sioskorean=12613;e.siosnieunkorean=12667;e.siosparenkorean=12806;e.siospieupkorean=12669;e.siostikeutkorean=12668;e.six=54;e.sixarabic=1638;e.sixbengali=2540;e.sixcircle=9317;e.sixcircleinversesansserif=10127;e.sixdeva=2412;e.sixgujarati=2796;e.sixgurmukhi=2668;e.sixhackarabic=1638;e.sixhangzhou=12326;e.sixideographicparen=12837;e.sixinferior=8326;e.sixmonospace=65302;e.sixoldstyle=63286;e.sixparen=9337;e.sixperiod=9357;e.sixpersian=1782;e.sixroman=8565;e.sixsuperior=8310;e.sixteencircle=9327;e.sixteencurrencydenominatorbengali=2553;e.sixteenparen=9347;e.sixteenperiod=9367;e.sixthai=3670;e.slash=47;e.slashmonospace=65295;e.slong=383;e.slongdotaccent=7835;e.smileface=9786;e.smonospace=65363;e.sofpasuqhebrew=1475;e.softhyphen=173;e.softsigncyrillic=1100;e.sohiragana=12381;e.sokatakana=12477;e.sokatakanahalfwidth=65407;e.soliduslongoverlaycmb=824;e.solidusshortoverlaycmb=823;e.sorusithai=3625;e.sosalathai=3624;e.sosothai=3595;e.sosuathai=3626;e.space=32;e.spacehackarabic=32;e.spade=9824;e.spadesuitblack=9824;e.spadesuitwhite=9828;e.sparen=9390;e.squarebelowcmb=827;e.squarecc=13252;e.squarecm=13213;e.squarediagonalcrosshatchfill=9641;e.squarehorizontalfill=9636;e.squarekg=13199;e.squarekm=13214;e.squarekmcapital=13262;e.squareln=13265;e.squarelog=13266;e.squaremg=13198;e.squaremil=13269;e.squaremm=13212;e.squaremsquared=13217;e.squareorthogonalcrosshatchfill=9638;e.squareupperlefttolowerrightfill=9639;e.squareupperrighttolowerleftfill=9640;e.squareverticalfill=9637;e.squarewhitewithsmallblack=9635;e.srsquare=13275;e.ssabengali=2487;e.ssadeva=2359;e.ssagujarati=2743;e.ssangcieuckorean=12617;e.ssanghieuhkorean=12677;e.ssangieungkorean=12672;e.ssangkiyeokkorean=12594;e.ssangnieunkorean=12645;e.ssangpieupkorean=12611;e.ssangsioskorean=12614;e.ssangtikeutkorean=12600;e.ssuperior=63218;e.sterling=163;e.sterlingmonospace=65505;e.strokelongoverlaycmb=822;e.strokeshortoverlaycmb=821;e.subset=8834;e.subsetnotequal=8842;e.subsetorequal=8838;e.succeeds=8827;e.suchthat=8715;e.suhiragana=12377;e.sukatakana=12473;e.sukatakanahalfwidth=65405;e.sukunarabic=1618;e.summation=8721;e.sun=9788;e.superset=8835;e.supersetnotequal=8843;e.supersetorequal=8839;e.svsquare=13276;e.syouwaerasquare=13180;e.t=116;e.tabengali=2468;e.tackdown=8868;e.tackleft=8867;e.tadeva=2340;e.tagujarati=2724;e.tagurmukhi=2596;e.taharabic=1591;e.tahfinalarabic=65218;e.tahinitialarabic=65219;e.tahiragana=12383;e.tahmedialarabic=65220;e.taisyouerasquare=13181;e.takatakana=12479;e.takatakanahalfwidth=65408;e.tatweelarabic=1600;e.tau=964;e.tav=1514;e.tavdages=64330;e.tavdagesh=64330;e.tavdageshhebrew=64330;e.tavhebrew=1514;e.tbar=359;e.tbopomofo=12554;e.tcaron=357;e.tccurl=680;e.tcedilla=355;e.tcheharabic=1670;e.tchehfinalarabic=64379;e.tchehinitialarabic=64380;e.tchehmedialarabic=64381;e.tcircle=9443;e.tcircumflexbelow=7793;e.tcommaaccent=355;e.tdieresis=7831;e.tdotaccent=7787;e.tdotbelow=7789;e.tecyrillic=1090;e.tedescendercyrillic=1197;e.teharabic=1578;e.tehfinalarabic=65174;e.tehhahinitialarabic=64674;e.tehhahisolatedarabic=64524;e.tehinitialarabic=65175;e.tehiragana=12390;e.tehjeeminitialarabic=64673;e.tehjeemisolatedarabic=64523;e.tehmarbutaarabic=1577;e.tehmarbutafinalarabic=65172;e.tehmedialarabic=65176;e.tehmeeminitialarabic=64676;e.tehmeemisolatedarabic=64526;e.tehnoonfinalarabic=64627;e.tekatakana=12486;e.tekatakanahalfwidth=65411;e.telephone=8481;e.telephoneblack=9742;e.telishagedolahebrew=1440;e.telishaqetanahebrew=1449;e.tencircle=9321;e.tenideographicparen=12841;e.tenparen=9341;e.tenperiod=9361;e.tenroman=8569;e.tesh=679;e.tet=1496;e.tetdagesh=64312;e.tetdageshhebrew=64312;e.tethebrew=1496;e.tetsecyrillic=1205;e.tevirhebrew=1435;e.tevirlefthebrew=1435;e.thabengali=2469;e.thadeva=2341;e.thagujarati=2725;e.thagurmukhi=2597;e.thalarabic=1584;e.thalfinalarabic=65196;e.thanthakhatlowleftthai=63640;e.thanthakhatlowrightthai=63639;e.thanthakhatthai=3660;e.thanthakhatupperleftthai=63638;e.theharabic=1579;e.thehfinalarabic=65178;e.thehinitialarabic=65179;e.thehmedialarabic=65180;e.thereexists=8707;e.therefore=8756;e.theta=952;e.theta1=977;e.thetasymbolgreek=977;e.thieuthacirclekorean=12921;e.thieuthaparenkorean=12825;e.thieuthcirclekorean=12907;e.thieuthkorean=12620;e.thieuthparenkorean=12811;e.thirteencircle=9324;e.thirteenparen=9344;e.thirteenperiod=9364;e.thonangmonthothai=3601;e.thook=429;e.thophuthaothai=3602;e.thorn=254;e.thothahanthai=3607;e.thothanthai=3600;e.thothongthai=3608;e.thothungthai=3606;e.thousandcyrillic=1154;e.thousandsseparatorarabic=1644;e.thousandsseparatorpersian=1644;e.three=51;e.threearabic=1635;e.threebengali=2537;e.threecircle=9314;e.threecircleinversesansserif=10124;e.threedeva=2409;e.threeeighths=8540;e.threegujarati=2793;e.threegurmukhi=2665;e.threehackarabic=1635;e.threehangzhou=12323;e.threeideographicparen=12834;e.threeinferior=8323;e.threemonospace=65299;e.threenumeratorbengali=2550;e.threeoldstyle=63283;e.threeparen=9334;e.threeperiod=9354;e.threepersian=1779;e.threequarters=190;e.threequartersemdash=63198;e.threeroman=8562;e.threesuperior=179;e.threethai=3667;e.thzsquare=13204;e.tihiragana=12385;e.tikatakana=12481;e.tikatakanahalfwidth=65409;e.tikeutacirclekorean=12912;e.tikeutaparenkorean=12816;e.tikeutcirclekorean=12898;e.tikeutkorean=12599;e.tikeutparenkorean=12802;e.tilde=732;e.tildebelowcmb=816;e.tildecmb=771;e.tildecomb=771;e.tildedoublecmb=864;e.tildeoperator=8764;e.tildeoverlaycmb=820;e.tildeverticalcmb=830;e.timescircle=8855;e.tipehahebrew=1430;e.tipehalefthebrew=1430;e.tippigurmukhi=2672;e.titlocyrilliccmb=1155;e.tiwnarmenian=1407;e.tlinebelow=7791;e.tmonospace=65364;e.toarmenian=1385;e.tohiragana=12392;e.tokatakana=12488;e.tokatakanahalfwidth=65412;e.tonebarextrahighmod=741;e.tonebarextralowmod=745;e.tonebarhighmod=742;e.tonebarlowmod=744;e.tonebarmidmod=743;e.tonefive=445;e.tonesix=389;e.tonetwo=424;e.tonos=900;e.tonsquare=13095;e.topatakthai=3599;e.tortoiseshellbracketleft=12308;e.tortoiseshellbracketleftsmall=65117;e.tortoiseshellbracketleftvertical=65081;e.tortoiseshellbracketright=12309;e.tortoiseshellbracketrightsmall=65118;e.tortoiseshellbracketrightvertical=65082;e.totaothai=3605;e.tpalatalhook=427;e.tparen=9391;e.trademark=8482;e.trademarksans=63722;e.trademarkserif=63195;e.tretroflexhook=648;e.triagdn=9660;e.triaglf=9668;e.triagrt=9658;e.triagup=9650;e.ts=678;e.tsadi=1510;e.tsadidagesh=64326;e.tsadidageshhebrew=64326;e.tsadihebrew=1510;e.tsecyrillic=1094;e.tsere=1461;e.tsere12=1461;e.tsere1e=1461;e.tsere2b=1461;e.tserehebrew=1461;e.tserenarrowhebrew=1461;e.tserequarterhebrew=1461;e.tserewidehebrew=1461;e.tshecyrillic=1115;e.tsuperior=63219;e.ttabengali=2463;e.ttadeva=2335;e.ttagujarati=2719;e.ttagurmukhi=2591;e.tteharabic=1657;e.ttehfinalarabic=64359;e.ttehinitialarabic=64360;e.ttehmedialarabic=64361;e.tthabengali=2464;e.tthadeva=2336;e.tthagujarati=2720;e.tthagurmukhi=2592;e.tturned=647;e.tuhiragana=12388;e.tukatakana=12484;e.tukatakanahalfwidth=65410;e.tusmallhiragana=12387;e.tusmallkatakana=12483;e.tusmallkatakanahalfwidth=65391;e.twelvecircle=9323;e.twelveparen=9343;e.twelveperiod=9363;e.twelveroman=8571;e.twentycircle=9331;e.twentyhangzhou=21316;e.twentyparen=9351;e.twentyperiod=9371;e.two=50;e.twoarabic=1634;e.twobengali=2536;e.twocircle=9313;e.twocircleinversesansserif=10123;e.twodeva=2408;e.twodotenleader=8229;e.twodotleader=8229;e.twodotleadervertical=65072;e.twogujarati=2792;e.twogurmukhi=2664;e.twohackarabic=1634;e.twohangzhou=12322;e.twoideographicparen=12833;e.twoinferior=8322;e.twomonospace=65298;e.twonumeratorbengali=2549;e.twooldstyle=63282;e.twoparen=9333;e.twoperiod=9353;e.twopersian=1778;e.tworoman=8561;e.twostroke=443;e.twosuperior=178;e.twothai=3666;e.twothirds=8532;e.u=117;e.uacute=250;e.ubar=649;e.ubengali=2441;e.ubopomofo=12584;e.ubreve=365;e.ucaron=468;e.ucircle=9444;e.ucircumflex=251;e.ucircumflexbelow=7799;e.ucyrillic=1091;e.udattadeva=2385;e.udblacute=369;e.udblgrave=533;e.udeva=2313;e.udieresis=252;e.udieresisacute=472;e.udieresisbelow=7795;e.udieresiscaron=474;e.udieresiscyrillic=1265;e.udieresisgrave=476;e.udieresismacron=470;e.udotbelow=7909;e.ugrave=249;e.ugujarati=2697;e.ugurmukhi=2569;e.uhiragana=12358;e.uhookabove=7911;e.uhorn=432;e.uhornacute=7913;e.uhorndotbelow=7921;e.uhorngrave=7915;e.uhornhookabove=7917;e.uhorntilde=7919;e.uhungarumlaut=369;e.uhungarumlautcyrillic=1267;e.uinvertedbreve=535;e.ukatakana=12454;e.ukatakanahalfwidth=65395;e.ukcyrillic=1145;e.ukorean=12636;e.umacron=363;e.umacroncyrillic=1263;e.umacrondieresis=7803;e.umatragurmukhi=2625;e.umonospace=65365;e.underscore=95;e.underscoredbl=8215;e.underscoremonospace=65343;e.underscorevertical=65075;e.underscorewavy=65103;e.union=8746;e.universal=8704;e.uogonek=371;e.uparen=9392;e.upblock=9600;e.upperdothebrew=1476;e.upsilon=965;e.upsilondieresis=971;e.upsilondieresistonos=944;e.upsilonlatin=650;e.upsilontonos=973;e.uptackbelowcmb=797;e.uptackmod=724;e.uragurmukhi=2675;e.uring=367;e.ushortcyrillic=1118;e.usmallhiragana=12357;e.usmallkatakana=12453;e.usmallkatakanahalfwidth=65385;e.ustraightcyrillic=1199;e.ustraightstrokecyrillic=1201;e.utilde=361;e.utildeacute=7801;e.utildebelow=7797;e.uubengali=2442;e.uudeva=2314;e.uugujarati=2698;e.uugurmukhi=2570;e.uumatragurmukhi=2626;e.uuvowelsignbengali=2498;e.uuvowelsigndeva=2370;e.uuvowelsigngujarati=2754;e.uvowelsignbengali=2497;e.uvowelsigndeva=2369;e.uvowelsigngujarati=2753;e.v=118;e.vadeva=2357;e.vagujarati=2741;e.vagurmukhi=2613;e.vakatakana=12535;e.vav=1493;e.vavdagesh=64309;e.vavdagesh65=64309;e.vavdageshhebrew=64309;e.vavhebrew=1493;e.vavholam=64331;e.vavholamhebrew=64331;e.vavvavhebrew=1520;e.vavyodhebrew=1521;e.vcircle=9445;e.vdotbelow=7807;e.vecyrillic=1074;e.veharabic=1700;e.vehfinalarabic=64363;e.vehinitialarabic=64364;e.vehmedialarabic=64365;e.vekatakana=12537;e.venus=9792;e.verticalbar=124;e.verticallineabovecmb=781;e.verticallinebelowcmb=809;e.verticallinelowmod=716;e.verticallinemod=712;e.vewarmenian=1406;e.vhook=651;e.vikatakana=12536;e.viramabengali=2509;e.viramadeva=2381;e.viramagujarati=2765;e.visargabengali=2435;e.visargadeva=2307;e.visargagujarati=2691;e.vmonospace=65366;e.voarmenian=1400;e.voicediterationhiragana=12446;e.voicediterationkatakana=12542;e.voicedmarkkana=12443;e.voicedmarkkanahalfwidth=65438;e.vokatakana=12538;e.vparen=9393;e.vtilde=7805;e.vturned=652;e.vuhiragana=12436;e.vukatakana=12532;e.w=119;e.wacute=7811;e.waekorean=12633;e.wahiragana=12431;e.wakatakana=12527;e.wakatakanahalfwidth=65436;e.wakorean=12632;e.wasmallhiragana=12430;e.wasmallkatakana=12526;e.wattosquare=13143;e.wavedash=12316;e.wavyunderscorevertical=65076;e.wawarabic=1608;e.wawfinalarabic=65262;e.wawhamzaabovearabic=1572;e.wawhamzaabovefinalarabic=65158;e.wbsquare=13277;e.wcircle=9446;e.wcircumflex=373;e.wdieresis=7813;e.wdotaccent=7815;e.wdotbelow=7817;e.wehiragana=12433;e.weierstrass=8472;e.wekatakana=12529;e.wekorean=12638;e.weokorean=12637;e.wgrave=7809;e.whitebullet=9702;e.whitecircle=9675;e.whitecircleinverse=9689;e.whitecornerbracketleft=12302;e.whitecornerbracketleftvertical=65091;e.whitecornerbracketright=12303;e.whitecornerbracketrightvertical=65092;e.whitediamond=9671;e.whitediamondcontainingblacksmalldiamond=9672;e.whitedownpointingsmalltriangle=9663;e.whitedownpointingtriangle=9661;e.whiteleftpointingsmalltriangle=9667;e.whiteleftpointingtriangle=9665;e.whitelenticularbracketleft=12310;e.whitelenticularbracketright=12311;e.whiterightpointingsmalltriangle=9657;e.whiterightpointingtriangle=9655;e.whitesmallsquare=9643;e.whitesmilingface=9786;e.whitesquare=9633;e.whitestar=9734;e.whitetelephone=9743;e.whitetortoiseshellbracketleft=12312;e.whitetortoiseshellbracketright=12313;e.whiteuppointingsmalltriangle=9653;e.whiteuppointingtriangle=9651;e.wihiragana=12432;e.wikatakana=12528;e.wikorean=12639;e.wmonospace=65367;e.wohiragana=12434;e.wokatakana=12530;e.wokatakanahalfwidth=65382;e.won=8361;e.wonmonospace=65510;e.wowaenthai=3623;e.wparen=9394;e.wring=7832;e.wsuperior=695;e.wturned=653;e.wynn=447;e.x=120;e.xabovecmb=829;e.xbopomofo=12562;e.xcircle=9447;e.xdieresis=7821;e.xdotaccent=7819;e.xeharmenian=1389;e.xi=958;e.xmonospace=65368;e.xparen=9395;e.xsuperior=739;e.y=121;e.yaadosquare=13134;e.yabengali=2479;e.yacute=253;e.yadeva=2351;e.yaekorean=12626;e.yagujarati=2735;e.yagurmukhi=2607;e.yahiragana=12420;e.yakatakana=12516;e.yakatakanahalfwidth=65428;e.yakorean=12625;e.yamakkanthai=3662;e.yasmallhiragana=12419;e.yasmallkatakana=12515;e.yasmallkatakanahalfwidth=65388;e.yatcyrillic=1123;e.ycircle=9448;e.ycircumflex=375;e.ydieresis=255;e.ydotaccent=7823;e.ydotbelow=7925;e.yeharabic=1610;e.yehbarreearabic=1746;e.yehbarreefinalarabic=64431;e.yehfinalarabic=65266;e.yehhamzaabovearabic=1574;e.yehhamzaabovefinalarabic=65162;e.yehhamzaaboveinitialarabic=65163;e.yehhamzaabovemedialarabic=65164;e.yehinitialarabic=65267;e.yehmedialarabic=65268;e.yehmeeminitialarabic=64733;e.yehmeemisolatedarabic=64600;e.yehnoonfinalarabic=64660;e.yehthreedotsbelowarabic=1745;e.yekorean=12630;e.yen=165;e.yenmonospace=65509;e.yeokorean=12629;e.yeorinhieuhkorean=12678;e.yerahbenyomohebrew=1450;e.yerahbenyomolefthebrew=1450;e.yericyrillic=1099;e.yerudieresiscyrillic=1273;e.yesieungkorean=12673;e.yesieungpansioskorean=12675;e.yesieungsioskorean=12674;e.yetivhebrew=1434;e.ygrave=7923;e.yhook=436;e.yhookabove=7927;e.yiarmenian=1397;e.yicyrillic=1111;e.yikorean=12642;e.yinyang=9775;e.yiwnarmenian=1410;e.ymonospace=65369;e.yod=1497;e.yoddagesh=64313;e.yoddageshhebrew=64313;e.yodhebrew=1497;e.yodyodhebrew=1522;e.yodyodpatahhebrew=64287;e.yohiragana=12424;e.yoikorean=12681;e.yokatakana=12520;e.yokatakanahalfwidth=65430;e.yokorean=12635;e.yosmallhiragana=12423;e.yosmallkatakana=12519;e.yosmallkatakanahalfwidth=65390;e.yotgreek=1011;e.yoyaekorean=12680;e.yoyakorean=12679;e.yoyakthai=3618;e.yoyingthai=3597;e.yparen=9396;e.ypogegrammeni=890;e.ypogegrammenigreekcmb=837;e.yr=422;e.yring=7833;e.ysuperior=696;e.ytilde=7929;e.yturned=654;e.yuhiragana=12422;e.yuikorean=12684;e.yukatakana=12518;e.yukatakanahalfwidth=65429;e.yukorean=12640;e.yusbigcyrillic=1131;e.yusbigiotifiedcyrillic=1133;e.yuslittlecyrillic=1127;e.yuslittleiotifiedcyrillic=1129;e.yusmallhiragana=12421;e.yusmallkatakana=12517;e.yusmallkatakanahalfwidth=65389;e.yuyekorean=12683;e.yuyeokorean=12682;e.yyabengali=2527;e.yyadeva=2399;e.z=122;e.zaarmenian=1382;e.zacute=378;e.zadeva=2395;e.zagurmukhi=2651;e.zaharabic=1592;e.zahfinalarabic=65222;e.zahinitialarabic=65223;e.zahiragana=12374;e.zahmedialarabic=65224;e.zainarabic=1586;e.zainfinalarabic=65200;e.zakatakana=12470;e.zaqefgadolhebrew=1429;e.zaqefqatanhebrew=1428;e.zarqahebrew=1432;e.zayin=1494;e.zayindagesh=64310;e.zayindageshhebrew=64310;e.zayinhebrew=1494;e.zbopomofo=12567;e.zcaron=382;e.zcircle=9449;e.zcircumflex=7825;e.zcurl=657;e.zdot=380;e.zdotaccent=380;e.zdotbelow=7827;e.zecyrillic=1079;e.zedescendercyrillic=1177;e.zedieresiscyrillic=1247;e.zehiragana=12380;e.zekatakana=12476;e.zero=48;e.zeroarabic=1632;e.zerobengali=2534;e.zerodeva=2406;e.zerogujarati=2790;e.zerogurmukhi=2662;e.zerohackarabic=1632;e.zeroinferior=8320;e.zeromonospace=65296;e.zerooldstyle=63280;e.zeropersian=1776;e.zerosuperior=8304;e.zerothai=3664;e.zerowidthjoiner=65279;e.zerowidthnonjoiner=8204;e.zerowidthspace=8203;e.zeta=950;e.zhbopomofo=12563;e.zhearmenian=1386;e.zhebrevecyrillic=1218;e.zhecyrillic=1078;e.zhedescendercyrillic=1175;e.zhedieresiscyrillic=1245;e.zihiragana=12376;e.zikatakana=12472;e.zinorhebrew=1454;e.zlinebelow=7829;e.zmonospace=65370;e.zohiragana=12382;e.zokatakana=12478;e.zparen=9397;e.zretroflexhook=656;e.zstroke=438;e.zuhiragana=12378;e.zukatakana=12474;e[".notdef"]=0;e.angbracketleftbig=9001;e.angbracketleftBig=9001;e.angbracketleftbigg=9001;e.angbracketleftBigg=9001;e.angbracketrightBig=9002;e.angbracketrightbig=9002;e.angbracketrightBigg=9002;e.angbracketrightbigg=9002;e.arrowhookleft=8618;e.arrowhookright=8617;e.arrowlefttophalf=8636;e.arrowleftbothalf=8637;e.arrownortheast=8599;e.arrownorthwest=8598;e.arrowrighttophalf=8640;e.arrowrightbothalf=8641;e.arrowsoutheast=8600;e.arrowsouthwest=8601;e.backslashbig=8726;e.backslashBig=8726;e.backslashBigg=8726;e.backslashbigg=8726;e.bardbl=8214;e.bracehtipdownleft=65079;e.bracehtipdownright=65079;e.bracehtipupleft=65080;e.bracehtipupright=65080;e.braceleftBig=123;e.braceleftbig=123;e.braceleftbigg=123;e.braceleftBigg=123;e.bracerightBig=125;e.bracerightbig=125;e.bracerightbigg=125;e.bracerightBigg=125;e.bracketleftbig=91;e.bracketleftBig=91;e.bracketleftbigg=91;e.bracketleftBigg=91;e.bracketrightBig=93;e.bracketrightbig=93;e.bracketrightbigg=93;e.bracketrightBigg=93;e.ceilingleftbig=8968;e.ceilingleftBig=8968;e.ceilingleftBigg=8968;e.ceilingleftbigg=8968;e.ceilingrightbig=8969;e.ceilingrightBig=8969;e.ceilingrightbigg=8969;e.ceilingrightBigg=8969;e.circledotdisplay=8857;e.circledottext=8857;e.circlemultiplydisplay=8855;e.circlemultiplytext=8855;e.circleplusdisplay=8853;e.circleplustext=8853;e.contintegraldisplay=8750;e.contintegraltext=8750;e.coproductdisplay=8720;e.coproducttext=8720;e.floorleftBig=8970;e.floorleftbig=8970;e.floorleftbigg=8970;e.floorleftBigg=8970;e.floorrightbig=8971;e.floorrightBig=8971;e.floorrightBigg=8971;e.floorrightbigg=8971;e.hatwide=770;e.hatwider=770;e.hatwidest=770;e.intercal=7488;e.integraldisplay=8747;e.integraltext=8747;e.intersectiondisplay=8898;e.intersectiontext=8898;e.logicalanddisplay=8743;e.logicalandtext=8743;e.logicalordisplay=8744;e.logicalortext=8744;e.parenleftBig=40;e.parenleftbig=40;e.parenleftBigg=40;e.parenleftbigg=40;e.parenrightBig=41;e.parenrightbig=41;e.parenrightBigg=41;e.parenrightbigg=41;e.prime=8242;e.productdisplay=8719;e.producttext=8719;e.radicalbig=8730;e.radicalBig=8730;e.radicalBigg=8730;e.radicalbigg=8730;e.radicalbt=8730;e.radicaltp=8730;e.radicalvertex=8730;e.slashbig=47;e.slashBig=47;e.slashBigg=47;e.slashbigg=47;e.summationdisplay=8721;e.summationtext=8721;e.tildewide=732;e.tildewider=732;e.tildewidest=732;e.uniondisplay=8899;e.unionmultidisplay=8846;e.unionmultitext=8846;e.unionsqdisplay=8852;e.unionsqtext=8852;e.uniontext=8899;e.vextenddouble=8741;e.vextendsingle=8739}),hr=getLookupTableFactory(function(e){e.space=32;e.a1=9985;e.a2=9986;e.a202=9987;e.a3=9988;e.a4=9742;e.a5=9990;e.a119=9991;e.a118=9992;e.a117=9993;e.a11=9755;e.a12=9758;e.a13=9996;e.a14=9997;e.a15=9998;e.a16=9999;e.a105=1e4;e.a17=10001;e.a18=10002;e.a19=10003;e.a20=10004;e.a21=10005;e.a22=10006;e.a23=10007;e.a24=10008;e.a25=10009;e.a26=10010;e.a27=10011;e.a28=10012;e.a6=10013;e.a7=10014;e.a8=10015;e.a9=10016;e.a10=10017;e.a29=10018;e.a30=10019;e.a31=10020;e.a32=10021;e.a33=10022;e.a34=10023;e.a35=9733;e.a36=10025;e.a37=10026;e.a38=10027;e.a39=10028;e.a40=10029;e.a41=10030;e.a42=10031;e.a43=10032;e.a44=10033;e.a45=10034;e.a46=10035;e.a47=10036;e.a48=10037;e.a49=10038;e.a50=10039;e.a51=10040;e.a52=10041;e.a53=10042;e.a54=10043;e.a55=10044;e.a56=10045;e.a57=10046;e.a58=10047;e.a59=10048;e.a60=10049;e.a61=10050;e.a62=10051;e.a63=10052;e.a64=10053;e.a65=10054;e.a66=10055;e.a67=10056;e.a68=10057;e.a69=10058;e.a70=10059;e.a71=9679;e.a72=10061;e.a73=9632;e.a74=10063;e.a203=10064;e.a75=10065;e.a204=10066;e.a76=9650;e.a77=9660;e.a78=9670;e.a79=10070;e.a81=9687;e.a82=10072;e.a83=10073;e.a84=10074;e.a97=10075;e.a98=10076;e.a99=10077;e.a100=10078;e.a101=10081;e.a102=10082;e.a103=10083;e.a104=10084;e.a106=10085;e.a107=10086;e.a108=10087;e.a112=9827;e.a111=9830;e.a110=9829;e.a109=9824;e.a120=9312;e.a121=9313;e.a122=9314;e.a123=9315;e.a124=9316;e.a125=9317;e.a126=9318;e.a127=9319;e.a128=9320;e.a129=9321;e.a130=10102;e.a131=10103;e.a132=10104;e.a133=10105;e.a134=10106;e.a135=10107;e.a136=10108;e.a137=10109;e.a138=10110;e.a139=10111;e.a140=10112;e.a141=10113;e.a142=10114;e.a143=10115;e.a144=10116;e.a145=10117;e.a146=10118;e.a147=10119;e.a148=10120;e.a149=10121;e.a150=10122;e.a151=10123;e.a152=10124;e.a153=10125;e.a154=10126;e.a155=10127;e.a156=10128;e.a157=10129;e.a158=10130;e.a159=10131;e.a160=10132;e.a161=8594;e.a163=8596;e.a164=8597;e.a196=10136;e.a165=10137;e.a192=10138;e.a166=10139;e.a167=10140;e.a168=10141;e.a169=10142;e.a170=10143;e.a171=10144;e.a172=10145;e.a173=10146;e.a162=10147;e.a174=10148;e.a175=10149;e.a176=10150;e.a177=10151;e.a178=10152;e.a179=10153;e.a193=10154;e.a180=10155;e.a199=10156;e.a181=10157;e.a200=10158;e.a182=10159;e.a201=10161;e.a183=10162;e.a184=10163;e.a197=10164;e.a185=10165;e.a194=10166;e.a198=10167;e.a186=10168;e.a195=10169;e.a187=10170;e.a188=10171;e.a189=10172;e.a190=10173;e.a191=10174;e.a89=10088;e.a90=10089;e.a93=10090;e.a94=10091;e.a91=10092;e.a92=10093;e.a205=10094;e.a85=10095;e.a206=10096;e.a86=10097;e.a87=10098;e.a88=10099;e.a95=10100;e.a96=10101;e[".notdef"]=0}),ur=getLookupTableFactory(function(e){e[63721]=169;e[63193]=169;e[63720]=174;e[63194]=174;e[63722]=8482;e[63195]=8482;e[63729]=9127;e[63730]=9128;e[63731]=9129;e[63740]=9131;e[63741]=9132;e[63742]=9133;e[63726]=9121;e[63727]=9122;e[63728]=9123;e[63737]=9124;e[63738]=9125;e[63739]=9126;e[63723]=9115;e[63724]=9116;e[63725]=9117;e[63734]=9118;e[63735]=9119;e[63736]=9120});function getUnicodeForGlyph(e,t){let a=t[e];if(void 0!==a)return a;if(!e)return-1;if("u"===e[0]){const t=e.length;let r;if(7===t&&"n"===e[1]&&"i"===e[2])r=e.substring(3);else{if(!(t>=5&&t<=7))return-1;r=e.substring(1)}if(r===r.toUpperCase()){a=parseInt(r,16);if(a>=0)return a}}return-1}const dr=[[0,127],[128,255],[256,383],[384,591],[592,687,7424,7551,7552,7615],[688,767,42752,42783],[768,879,7616,7679],[880,1023],[11392,11519],[1024,1279,1280,1327,11744,11775,42560,42655],[1328,1423],[1424,1535],[42240,42559],[1536,1791,1872,1919],[1984,2047],[2304,2431],[2432,2559],[2560,2687],[2688,2815],[2816,2943],[2944,3071],[3072,3199],[3200,3327],[3328,3455],[3584,3711],[3712,3839],[4256,4351,11520,11567],[6912,7039],[4352,4607],[7680,7935,11360,11391,42784,43007],[7936,8191],[8192,8303,11776,11903],[8304,8351],[8352,8399],[8400,8447],[8448,8527],[8528,8591],[8592,8703,10224,10239,10496,10623,11008,11263],[8704,8959,10752,11007,10176,10223,10624,10751],[8960,9215],[9216,9279],[9280,9311],[9312,9471],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175],[12288,12351],[12352,12447],[12448,12543,12784,12799],[12544,12591,12704,12735],[12592,12687],[43072,43135],[12800,13055],[13056,13311],[44032,55215],[55296,57343],[67840,67871],[19968,40959,11904,12031,12032,12255,12272,12287,13312,19903,131072,173791,12688,12703],[57344,63743],[12736,12783,63744,64255,194560,195103],[64256,64335],[64336,65023],[65056,65071],[65040,65055],[65104,65135],[65136,65279],[65280,65519],[65520,65535],[3840,4095],[1792,1871],[1920,1983],[3456,3583],[4096,4255],[4608,4991,4992,5023,11648,11743],[5024,5119],[5120,5759],[5760,5791],[5792,5887],[6016,6143],[6144,6319],[10240,10495],[40960,42127],[5888,5919,5920,5951,5952,5983,5984,6015],[66304,66351],[66352,66383],[66560,66639],[118784,119039,119040,119295,119296,119375],[119808,120831],[1044480,1048573],[65024,65039,917760,917999],[917504,917631],[6400,6479],[6480,6527],[6528,6623],[6656,6687],[11264,11359],[11568,11647],[19904,19967],[43008,43055],[65536,65663,65664,65791,65792,65855],[65856,65935],[66432,66463],[66464,66527],[66640,66687],[66688,66735],[67584,67647],[68096,68191],[119552,119647],[73728,74751,74752,74879],[119648,119679],[7040,7103],[7168,7247],[7248,7295],[43136,43231],[43264,43311],[43312,43359],[43520,43615],[65936,65999],[66e3,66047],[66208,66271,66176,66207,67872,67903],[127024,127135,126976,127023]];function getUnicodeRangeFor(e,t=-1){if(-1!==t){const a=dr[t];for(let r=0,i=a.length;r=a[r]&&e<=a[r+1])return t}for(let t=0,a=dr.length;t=a[r]&&e<=a[r+1])return t}return-1}const fr=new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$","u"),gr=new Map;const pr=!0,mr=1,br=2,yr=4,wr=32,xr=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function recoverGlyphName(e,t){if(void 0!==t[e])return e;const a=getUnicodeForGlyph(e,t);if(-1!==a)for(const e in t)if(t[e]===a)return e;info("Unable to recover a standard glyph name for: "+e);return e}function type1FontGlyphMapping(e,t,a){const r=Object.create(null);let i,n,s;const o=!!(e.flags&yr);if(e.isInternalFont){s=t;for(n=0;n=0?i:0}}else if(e.baseEncodingName){s=getEncoding(e.baseEncodingName);for(n=0;n=0?i:0}}else if(o)for(n in t)r[n]=t[n];else{s=nr;for(n=0;n=0?i:0}}const c=e.differences;let l;if(c)for(n in c){const e=c[n];i=a.indexOf(e);if(-1===i){l||(l=lr());const t=recoverGlyphName(e,l);t!==e&&(i=a.indexOf(t))}r[n]=i>=0?i:0}return r}function normalizeFontName(e){return e.replaceAll(/[,_]/g,"-").replaceAll(/\s/g,"")}const Sr=getLookupTableFactory(e=>{e[8211]=65074;e[8212]=65073;e[8229]=65072;e[8230]=65049;e[12289]=65041;e[12290]=65042;e[12296]=65087;e[12297]=65088;e[12298]=65085;e[12299]=65086;e[12300]=65089;e[12301]=65090;e[12302]=65091;e[12303]=65092;e[12304]=65083;e[12305]=65084;e[12308]=65081;e[12309]=65082;e[12310]=65047;e[12311]=65048;e[65103]=65076;e[65281]=65045;e[65288]=65077;e[65289]=65078;e[65292]=65040;e[65306]=65043;e[65307]=65044;e[65311]=65046;e[65339]=65095;e[65341]=65096;e[65343]=65075;e[65371]=65079;e[65373]=65080});const Ar=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],kr=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Cr=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],vr=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Fr=391,Ir=[null,{id:"hstem",min:2,stackClearing:!0,stem:!0},null,{id:"vstem",min:2,stackClearing:!0,stem:!0},{id:"vmoveto",min:1,stackClearing:!0},{id:"rlineto",min:2,resetStack:!0},{id:"hlineto",min:1,resetStack:!0},{id:"vlineto",min:1,resetStack:!0},{id:"rrcurveto",min:6,resetStack:!0},null,{id:"callsubr",min:1,undefStack:!0},{id:"return",min:0,undefStack:!0},null,null,{id:"endchar",min:0,stackClearing:!0},null,null,null,{id:"hstemhm",min:2,stackClearing:!0,stem:!0},{id:"hintmask",min:0,stackClearing:!0},{id:"cntrmask",min:0,stackClearing:!0},{id:"rmoveto",min:2,stackClearing:!0},{id:"hmoveto",min:1,stackClearing:!0},{id:"vstemhm",min:2,stackClearing:!0,stem:!0},{id:"rcurveline",min:8,resetStack:!0},{id:"rlinecurve",min:8,resetStack:!0},{id:"vvcurveto",min:4,resetStack:!0},{id:"hhcurveto",min:4,resetStack:!0},null,{id:"callgsubr",min:1,undefStack:!0},{id:"vhcurveto",min:4,resetStack:!0},{id:"hvcurveto",min:4,resetStack:!0}],Tr=[null,null,null,{id:"and",min:2,stackDelta:-1},{id:"or",min:2,stackDelta:-1},{id:"not",min:1,stackDelta:0},null,null,null,{id:"abs",min:1,stackDelta:0},{id:"add",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]+e[t-1]}},{id:"sub",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]-e[t-1]}},{id:"div",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]/e[t-1]}},null,{id:"neg",min:1,stackDelta:0,stackFn(e,t){e[t-1]=-e[t-1]}},{id:"eq",min:2,stackDelta:-1},null,null,{id:"drop",min:1,stackDelta:-1},null,{id:"put",min:2,stackDelta:-2},{id:"get",min:1,stackDelta:0},{id:"ifelse",min:4,stackDelta:-3},{id:"random",min:0,stackDelta:1},{id:"mul",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]*e[t-1]}},null,{id:"sqrt",min:1,stackDelta:0},{id:"dup",min:1,stackDelta:1},{id:"exch",min:2,stackDelta:0},{id:"index",min:2,stackDelta:0},{id:"roll",min:3,stackDelta:-2},null,null,null,{id:"hflex",min:7,resetStack:!0},{id:"flex",min:13,resetStack:!0},{id:"hflex1",min:9,resetStack:!0},{id:"flex1",min:11,resetStack:!0}];class CFFParser{constructor(e,t,a){this.bytes=e.getBytes();this.properties=t;this.seacAnalysisEnabled=!!a}parse(){const e=this.properties,t=new CFF;this.cff=t;const a=this.parseHeader(),r=this.parseIndex(a.endPos),i=this.parseIndex(r.endPos),n=this.parseIndex(i.endPos),s=this.parseIndex(n.endPos),o=this.parseDict(i.obj.get(0)),c=this.createDict(CFFTopDict,o,t.strings);t.header=a.obj;t.names=this.parseNameIndex(r.obj);t.strings=this.parseStringIndex(n.obj);t.topDict=c;t.globalSubrIndex=s.obj;this.parsePrivateDict(t.topDict);t.isCIDFont=c.hasName("ROS");const l=c.getByName("CharStrings"),h=this.parseIndex(l).obj,u=c.getByName("FontMatrix");u&&(e.fontMatrix=u);const d=c.getByName("FontBBox");if(d){e.ascent=Math.max(d[3],d[1]);e.descent=Math.min(d[1],d[3]);e.ascentScaled=!0}let f,g;if(t.isCIDFont){const e=this.parseIndex(c.getByName("FDArray")).obj;for(let a=0,r=e.count;a=t)throw new FormatError("Invalid CFF header");if(0!==a){info("cff data is shifted");e=e.subarray(a);this.bytes=e}const r=e[0],i=e[1],n=e[2],s=e[3];return{obj:new CFFHeader(r,i,n,s),endPos:n}}parseDict(e){let t=0;function parseOperand(){let a=e[t++];if(30===a)return function parseFloatOperand(){let a="";const r=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"],n=e.length;for(;t>4,o=15&n;if(s===r)break;a+=i[s];if(o===r)break;a+=i[o]}return parseFloat(a)}();if(28===a){a=readInt16(e,t);t+=2;return a}if(29===a){a=e[t++];a=a<<8|e[t++];a=a<<8|e[t++];a=a<<8|e[t++];return a}if(a>=32&&a<=246)return a-139;if(a>=247&&a<=250)return 256*(a-247)+e[t++]+108;if(a>=251&&a<=254)return-256*(a-251)-e[t++]-108;warn('CFFParser_parseDict: "'+a+'" is a reserved command.');return NaN}let a=[];const r=[];t=0;const i=e.length;for(;t10)return!1;let i=e.stackSize;const n=e.stack;let s=t.length;for(let o=0;o=4){i-=4;if(this.seacAnalysisEnabled){e.seac=n.slice(i,i+4);return!1}}l=Ir[c]}else if(c>=32&&c<=246){n[i]=c-139;i++}else if(c>=247&&c<=254){n[i]=c<251?(c-247<<8)+t[o]+108:-(c-251<<8)-t[o]-108;o++;i++}else if(255===c){n[i]=(t[o]<<24|t[o+1]<<16|t[o+2]<<8|t[o+3])/65536;o+=4;i++}else if(19===c||20===c){e.hints+=i>>1;if(0===e.hints){t.copyWithin(o-1,o,-1);o-=1;s-=1;continue}o+=e.hints+7>>3;i%=2;l=Ir[c]}else{if(10===c||29===c){const t=10===c?a:r;if(!t){l=Ir[c];warn("Missing subrsIndex for "+l.id);return!1}let s=32768;t.count<1240?s=107:t.count<33900&&(s=1131);const o=n[--i]+s;if(o<0||o>=t.count||isNaN(o)){l=Ir[c];warn("Out of bounds subrIndex for "+l.id);return!1}e.stackSize=i;e.callDepth++;if(!this.parseCharString(e,t.get(o),a,r))return!1;e.callDepth--;i=e.stackSize;continue}if(11===c){e.stackSize=i;return!0}if(0===c&&o===t.length){t[o-1]=14;l=Ir[14]}else{if(9===c){t.copyWithin(o-1,o,-1);o-=1;s-=1;continue}l=Ir[c]}}if(l){if(l.stem){e.hints+=i>>1;if(3===c||23===c)e.hasVStems=!0;else if(e.hasVStems&&(1===c||18===c)){warn("CFF stem hints are in wrong order");t[o-1]=1===c?3:23}}if("min"in l&&!e.undefStack&&i=2&&l.stem?i%=2:i>1&&warn("Found too many parameters for stack-clearing command");i>0&&(e.width=n[i-1])}if("stackDelta"in l){"stackFn"in l&&l.stackFn(n,i);i+=l.stackDelta}else if(l.stackClearing)i=0;else if(l.resetStack){i=0;e.undefStack=!1}else if(l.undefStack){i=0;e.undefStack=!0;e.firstStackClearing=!1}}}s=i.length){warn("Invalid fd index for glyph index.");u=!1}if(u){f=i[e].privateDict;d=f.subrsIndex}}else t&&(d=t);u&&(u=this.parseCharString(h,c,d,a));if(null!==h.width){const e=f.getByName("nominalWidthX");o[l]=e+h.width}else{const e=f.getByName("defaultWidthX");o[l]=e}null!==h.seac&&(s[l]=h.seac);u||e.set(l,new Uint8Array([14]))}return{charStrings:e,seacs:s,widths:o}}emptyPrivateDictionary(e){const t=this.createDict(CFFPrivateDict,[],e.strings);e.setByKey(18,[0,0]);e.privateDict=t}parsePrivateDict(e){if(!e.hasName("Private")){this.emptyPrivateDictionary(e);return}const t=e.getByName("Private");if(!Array.isArray(t)||2!==t.length){e.removeByName("Private");return}const a=t[0],r=t[1];if(0===a||r>=this.bytes.length){this.emptyPrivateDictionary(e);return}const i=r+a,n=this.bytes.subarray(r,i),s=this.parseDict(n),o=this.createDict(CFFPrivateDict,s,e.strings);e.privateDict=o;0===o.getByName("ExpansionFactor")&&o.setByName("ExpansionFactor",.06);if(!o.getByName("Subrs"))return;const c=o.getByName("Subrs"),l=r+c;if(0===c||l>=this.bytes.length){this.emptyPrivateDictionary(e);return}const h=this.parseIndex(l);o.subrsIndex=h.obj}parseCharsets(e,t,a,r){if(0===e)return new CFFCharset(!0,Dr.ISO_ADOBE,Ar);if(1===e)return new CFFCharset(!0,Dr.EXPERT,kr);if(2===e)return new CFFCharset(!0,Dr.EXPERT_SUBSET,Cr);const i=this.bytes,n=e,s=i[e++],o=[r?0:".notdef"];let c,l,h;t-=1;switch(s){case 0:for(h=0;h=65535){warn("Not enough space in charstrings to duplicate first glyph.");return}const e=this.charStrings.get(0);this.charStrings.add(e);this.isCIDFont&&this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0])}hasGlyphId(e){if(e<0||e>=this.charStrings.count)return!1;return this.charStrings.get(e).length>0}}class CFFHeader{constructor(e,t,a,r){this.major=e;this.minor=t;this.hdrSize=a;this.offSize=r}}class CFFStrings{constructor(){this.strings=[]}get(e){return e>=0&&e<=390?vr[e]:e-Fr<=this.strings.length?this.strings[e-Fr]:vr[0]}getSID(e){let t=vr.indexOf(e);if(-1!==t)return t;t=this.strings.indexOf(e);return-1!==t?t+Fr:-1}add(e){this.strings.push(e)}get count(){return this.strings.length}}class CFFIndex{constructor(){this.objects=[];this.length=0}add(e){this.length+=e.length;this.objects.push(e)}set(e,t){this.length+=t.length-this.objects[e].length;this.objects[e]=t}get(e){return this.objects[e]}get count(){return this.objects.length}}class CFFDict{constructor(e,t){this.keyToNameMap=e.keyToNameMap;this.nameToKeyMap=e.nameToKeyMap;this.defaults=e.defaults;this.types=e.types;this.opcodes=e.opcodes;this.order=e.order;this.strings=t;this.values=Object.create(null)}setByKey(e,t){if(!(e in this.keyToNameMap))return!1;if(0===t.length)return!0;for(const a of t)if(isNaN(a)){warn(`Invalid CFFDict value: "${t}" for key "${e}".`);return!0}const a=this.types[e];"num"!==a&&"sid"!==a&&"offset"!==a||(t=t[0]);this.values[e]=t;return!0}setByName(e,t){if(!(e in this.nameToKeyMap))throw new FormatError(`Invalid dictionary name "${e}"`);this.values[this.nameToKeyMap[e]]=t}hasName(e){return this.nameToKeyMap[e]in this.values}getByName(e){if(!(e in this.nameToKeyMap))throw new FormatError(`Invalid dictionary name ${e}"`);const t=this.nameToKeyMap[e];return t in this.values?this.values[t]:this.defaults[t]}removeByName(e){delete this.values[this.nameToKeyMap[e]]}static createTables(e){const t={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]};for(const a of e){const e=Array.isArray(a[0])?(a[0][0]<<8)+a[0][1]:a[0];t.keyToNameMap[e]=a[1];t.nameToKeyMap[a[1]]=e;t.types[e]=a[2];t.defaults[e]=a[3];t.opcodes[e]=Array.isArray(a[0])?a[0]:[a[0]];t.order.push(e)}return t}}const Or=[[[12,30],"ROS",["sid","sid","num"],null],[[12,20],"SyntheticBase","num",null],[0,"version","sid",null],[1,"Notice","sid",null],[[12,0],"Copyright","sid",null],[2,"FullName","sid",null],[3,"FamilyName","sid",null],[4,"Weight","sid",null],[[12,1],"isFixedPitch","num",0],[[12,2],"ItalicAngle","num",0],[[12,3],"UnderlinePosition","num",-100],[[12,4],"UnderlineThickness","num",50],[[12,5],"PaintType","num",0],[[12,6],"CharstringType","num",2],[[12,7],"FontMatrix",["num","num","num","num","num","num"],[.001,0,0,.001,0,0]],[13,"UniqueID","num",null],[5,"FontBBox",["num","num","num","num"],[0,0,0,0]],[[12,8],"StrokeWidth","num",0],[14,"XUID","array",null],[15,"charset","offset",0],[16,"Encoding","offset",0],[17,"CharStrings","offset",0],[18,"Private",["offset","offset"],null],[[12,21],"PostScript","sid",null],[[12,22],"BaseFontName","sid",null],[[12,23],"BaseFontBlend","delta",null],[[12,31],"CIDFontVersion","num",0],[[12,32],"CIDFontRevision","num",0],[[12,33],"CIDFontType","num",0],[[12,34],"CIDCount","num",8720],[[12,35],"UIDBase","num",null],[[12,37],"FDSelect","offset",null],[[12,36],"FDArray","offset",null],[[12,38],"FontName","sid",null]];class CFFTopDict extends CFFDict{static get tables(){return shadow(this,"tables",this.createTables(Or))}constructor(e){super(CFFTopDict.tables,e);this.privateDict=null}}const Mr=[[6,"BlueValues","delta",null],[7,"OtherBlues","delta",null],[8,"FamilyBlues","delta",null],[9,"FamilyOtherBlues","delta",null],[[12,9],"BlueScale","num",.039625],[[12,10],"BlueShift","num",7],[[12,11],"BlueFuzz","num",1],[10,"StdHW","num",null],[11,"StdVW","num",null],[[12,12],"StemSnapH","delta",null],[[12,13],"StemSnapV","delta",null],[[12,14],"ForceBold","num",0],[[12,17],"LanguageGroup","num",0],[[12,18],"ExpansionFactor","num",.06],[[12,19],"initialRandomSeed","num",0],[20,"defaultWidthX","num",0],[21,"nominalWidthX","num",0],[19,"Subrs","offset",null]];class CFFPrivateDict extends CFFDict{static get tables(){return shadow(this,"tables",this.createTables(Mr))}constructor(e){super(CFFPrivateDict.tables,e);this.subrsIndex=null}}const Dr={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2};class CFFCharset{constructor(e,t,a,r){this.predefined=e;this.format=t;this.charset=a;this.raw=r}}class CFFEncoding{constructor(e,t,a,r){this.predefined=e;this.format=t;this.encoding=a;this.raw=r}}class CFFFDSelect{constructor(e,t){this.format=e;this.fdSelect=t}getFDIndex(e){return e<0||e>=this.fdSelect.length?-1:this.fdSelect[e]}}class CFFOffsetTracker{constructor(){this.offsets=Object.create(null)}isTracking(e){return e in this.offsets}track(e,t){if(e in this.offsets)throw new FormatError(`Already tracking location of ${e}`);this.offsets[e]=t}offset(e){for(const t in this.offsets)this.offsets[t]+=e}setEntryLocation(e,t,a){if(!(e in this.offsets))throw new FormatError(`Not tracking location of ${e}`);const r=a.data,i=this.offsets[e];for(let e=0,a=t.length;e>24&255;r[s]=l>>16&255;r[o]=l>>8&255;r[c]=255&l}}}class CFFCompiler{constructor(e){this.cff=e}compile(){const e=this.cff,t={data:[],length:0,add(e){try{this.data.push(...e)}catch{this.data=this.data.concat(e)}this.length=this.data.length}},a=this.compileHeader(e.header);t.add(a);const r=this.compileNameIndex(e.names);t.add(r);if(e.isCIDFont&&e.topDict.hasName("FontMatrix")){const t=e.topDict.getByName("FontMatrix");e.topDict.removeByName("FontMatrix");for(const a of e.fdArray){let e=t.slice(0);a.hasName("FontMatrix")&&(e=Util.transform(e,a.getByName("FontMatrix")));a.setByName("FontMatrix",e)}}const i=e.topDict.getByName("XUID");i?.length>16&&e.topDict.removeByName("XUID");e.topDict.setByName("charset",0);let n=this.compileTopDicts([e.topDict],t.length,e.isCIDFont);t.add(n.output);const s=n.trackers[0],o=this.compileStringIndex(e.strings.strings);t.add(o);const c=this.compileIndex(e.globalSubrIndex);t.add(c);if(e.encoding&&e.topDict.hasName("Encoding"))if(e.encoding.predefined)s.setEntryLocation("Encoding",[e.encoding.format],t);else{const a=this.compileEncoding(e.encoding);s.setEntryLocation("Encoding",[t.length],t);t.add(a)}const l=this.compileCharset(e.charset,e.charStrings.count,e.strings,e.isCIDFont);s.setEntryLocation("charset",[t.length],t);t.add(l);const h=this.compileCharStrings(e.charStrings);s.setEntryLocation("CharStrings",[t.length],t);t.add(h);if(e.isCIDFont){s.setEntryLocation("FDSelect",[t.length],t);const a=this.compileFDSelect(e.fdSelect);t.add(a);n=this.compileTopDicts(e.fdArray,t.length,!0);s.setEntryLocation("FDArray",[t.length],t);t.add(n.output);const r=n.trackers;this.compilePrivateDicts(e.fdArray,r,t)}this.compilePrivateDicts([e.topDict],[s],t);t.add([0]);return t.data}encodeNumber(e){return Number.isInteger(e)?this.encodeInteger(e):this.encodeFloat(e)}static get EncodeFloatRegExp(){return shadow(this,"EncodeFloatRegExp",/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/)}encodeFloat(e){let t=e.toString();const a=CFFCompiler.EncodeFloatRegExp.exec(t);if(a){const r=parseFloat("1e"+((a[2]?+a[2]:0)+a[1].length));t=(Math.round(e*r)/r).toString()}let r,i,n="";for(r=0,i=t.length;r=-107&&e<=107?[e+139]:e>=108&&e<=1131?[247+((e-=108)>>8),255&e]:e>=-1131&&e<=-108?[251+((e=-e-108)>>8),255&e]:e>=-32768&&e<=32767?[28,e>>8&255,255&e]:[29,e>>24&255,e>>16&255,e>>8&255,255&e];return t}compileHeader(e){return[e.major,e.minor,4,e.offSize]}compileNameIndex(e){const t=new CFFIndex;for(const a of e){const e=Math.min(a.length,127);let r=new Array(e);for(let t=0;t"~"||"["===e||"]"===e||"("===e||")"===e||"{"===e||"}"===e||"<"===e||">"===e||"/"===e||"%"===e)&&(e="_");r[t]=e}r=r.join("");""===r&&(r="Bad_Font_Name");t.add(stringToBytes(r))}return this.compileIndex(t)}compileTopDicts(e,t,a){const r=[];let i=new CFFIndex;for(const n of e){if(a){n.removeByName("CIDFontVersion");n.removeByName("CIDFontRevision");n.removeByName("CIDFontType");n.removeByName("CIDCount");n.removeByName("UIDBase")}const e=new CFFOffsetTracker,s=this.compileDict(n,e);r.push(e);i.add(s);e.offset(t)}i=this.compileIndex(i,r);return{trackers:r,output:i}}compilePrivateDicts(e,t,a){for(let r=0,i=e.length;r>8&255,255&e])}else{i=new Uint8Array(1+2*n);i[0]=0;let t=0;const r=e.charset.length;let s=!1;for(let n=1;n>8&255;i[n+1]=255&o}}return this.compileTypedArray(i)}compileEncoding(e){return this.compileTypedArray(e.raw)}compileFDSelect(e){const t=e.format;let a,r;switch(t){case 0:a=new Uint8Array(1+e.fdSelect.length);a[0]=t;for(r=0;r>8&255,255&i,n];for(r=1;r>8&255,255&r,t);n=t}}const o=(s.length-3)/3;s[1]=o>>8&255;s[2]=255&o;s.push(r>>8&255,255&r);a=new Uint8Array(s)}return this.compileTypedArray(a)}compileTypedArray(e){return Array.from(e)}compileIndex(e,t=[]){const a=e.objects,r=a.length;if(0===r)return[0,0];const i=[r>>8&255,255&r];let n,s,o=1;for(n=0;n>8&255,255&c):3===s?i.push(c>>16&255,c>>8&255,255&c):i.push(c>>>24&255,c>>16&255,c>>8&255,255&c);a[n]&&(c+=a[n].length)}for(n=0;n=this.firstChar&&e<=this.lastChar?e:-1}amend(e){unreachable("Should not call amend()")}}class CFFFont{constructor(e,t){this.properties=t;const a=new CFFParser(e,t,pr);this.cff=a.parse();this.cff.duplicateFirstGlyph();const r=new CFFCompiler(this.cff);this.seacs=this.cff.seacs;try{this.data=r.compile()}catch{warn("Failed to compile font "+t.loadedName);this.data=e}this._createBuiltInEncoding()}get numGlyphs(){return this.cff.charStrings.count}getCharset(){return this.cff.charset.charset}getGlyphMapping(){const e=this.cff,t=this.properties,{cidToGidMap:a,cMap:r}=t,i=e.charset.charset;let n,s;if(t.composite){let t,o;if(a?.length>0){t=Object.create(null);for(let e=0,r=a.length;e=0){const r=a[t];r&&(i[e]=r)}}i.length>0&&(this.properties.builtInEncoding=i)}}function getFloat214(e,t){return readInt16(e,t)/16384}function getSubroutineBias(e){const t=e.length;let a=32768;t<1240?a=107:t<33900&&(a=1131);return a}function parseCmap(e,t,a){const r=1===readUint16(e,t+2)?readUint32(e,t+8):readUint32(e,t+16),i=readUint16(e,t+r);let n,s,o;if(4===i){readUint16(e,t+r+2);const a=readUint16(e,t+r+6)>>1;s=t+r+14;n=[];for(o=0;o>1;a0;)h.push({flags:n})}for(a=0;a>1;y=!0;break;case 4:s+=i.pop();moveTo(n,s);y=!0;break;case 5:for(;i.length>0;){n+=i.shift();s+=i.shift();lineTo(n,s)}break;case 6:for(;i.length>0;){n+=i.shift();lineTo(n,s);if(0===i.length)break;s+=i.shift();lineTo(n,s)}break;case 7:for(;i.length>0;){s+=i.shift();lineTo(n,s);if(0===i.length)break;n+=i.shift();lineTo(n,s)}break;case 8:for(;i.length>0;){l=n+i.shift();u=s+i.shift();h=l+i.shift();d=u+i.shift();n=h+i.shift();s=d+i.shift();bezierCurveTo(l,u,h,d,n,s)}break;case 10:m=i.pop();b=null;if(a.isCFFCIDFont){const e=a.fdSelect.getFDIndex(r);if(e>=0&&eMath.abs(s-t)?n+=i.shift():s+=i.shift();bezierCurveTo(l,u,h,d,n,s);break;default:throw new FormatError(`unknown operator: 12 ${w}`)}break;case 14:if(i.length>=4){const e=i.pop(),r=i.pop();s=i.pop();n=i.pop();t.save();t.translate(n,s);let o=lookupCmap(a.cmap,String.fromCharCode(a.glyphNameMap[nr[e]]));compileCharString(a.glyphs[o.glyphId],t,a,o.glyphId);t.restore();o=lookupCmap(a.cmap,String.fromCharCode(a.glyphNameMap[nr[r]]));compileCharString(a.glyphs[o.glyphId],t,a,o.glyphId)}return;case 19:case 20:o+=i.length>>1;c+=o+7>>3;y=!0;break;case 21:s+=i.pop();n+=i.pop();moveTo(n,s);y=!0;break;case 22:n+=i.pop();moveTo(n,s);y=!0;break;case 24:for(;i.length>2;){l=n+i.shift();u=s+i.shift();h=l+i.shift();d=u+i.shift();n=h+i.shift();s=d+i.shift();bezierCurveTo(l,u,h,d,n,s)}n+=i.shift();s+=i.shift();lineTo(n,s);break;case 25:for(;i.length>6;){n+=i.shift();s+=i.shift();lineTo(n,s)}l=n+i.shift();u=s+i.shift();h=l+i.shift();d=u+i.shift();n=h+i.shift();s=d+i.shift();bezierCurveTo(l,u,h,d,n,s);break;case 26:i.length%2&&(n+=i.shift());for(;i.length>0;){l=n;u=s+i.shift();h=l+i.shift();d=u+i.shift();n=h;s=d+i.shift();bezierCurveTo(l,u,h,d,n,s)}break;case 27:i.length%2&&(s+=i.shift());for(;i.length>0;){l=n+i.shift();u=s;h=l+i.shift();d=u+i.shift();n=h+i.shift();s=d;bezierCurveTo(l,u,h,d,n,s)}break;case 28:i.push(readInt16(e,c));c+=2;break;case 29:m=i.pop()+a.gsubrsBias;b=a.gsubrs[m];b&&parse(b);break;case 30:for(;i.length>0;){l=n;u=s+i.shift();h=l+i.shift();d=u+i.shift();n=h+i.shift();s=d+(1===i.length?i.shift():0);bezierCurveTo(l,u,h,d,n,s);if(0===i.length)break;l=n+i.shift();u=s;h=l+i.shift();d=u+i.shift();s=d+i.shift();n=h+(1===i.length?i.shift():0);bezierCurveTo(l,u,h,d,n,s)}break;case 31:for(;i.length>0;){l=n+i.shift();u=s;h=l+i.shift();d=u+i.shift();s=d+i.shift();n=h+(1===i.length?i.shift():0);bezierCurveTo(l,u,h,d,n,s);if(0===i.length)break;l=n;u=s+i.shift();h=l+i.shift();d=u+i.shift();n=h+i.shift();s=d+(1===i.length?i.shift():0);bezierCurveTo(l,u,h,d,n,s)}break;default:if(w<32)throw new FormatError(`unknown operator: ${w}`);if(w<247)i.push(w-139);else if(w<251)i.push(256*(w-247)+e[c++]+108);else if(w<255)i.push(256*-(w-251)-e[c++]-108);else{i.push((e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3])/65536);c+=4}}y&&(i.length=0)}}(e)}class Commands{cmds=[];transformStack=[];currentTransform=[1,0,0,1,0,0];add(e,t){if(t){const{currentTransform:a}=this;for(let e=0,r=t.length;e=0&&e2*readUint16(e,t)}const n=[];let s=i(t,0);for(let a=r;ae.getSize()+3&-4))}write(){const e=this.getSize(),t=new DataView(new ArrayBuffer(e)),a=e>131070,r=a?4:2,i=new DataView(new ArrayBuffer((this.glyphs.length+1)*r));a?i.setUint32(0,0):i.setUint16(0,0);let n=0,s=0;for(const e of this.glyphs){n+=e.write(n,t);n=n+3&-4;s+=r;a?i.setUint32(s,n):i.setUint16(s,n>>1)}return{isLocationLong:a,loca:new Uint8Array(i.buffer),glyf:new Uint8Array(t.buffer)}}scale(e){for(let t=0,a=this.glyphs.length;te.getSize()));return this.header.getSize()+e}write(e,t){if(!this.header)return 0;const a=e;e+=this.header.write(e,t);if(this.simple)e+=this.simple.write(e,t);else for(const a of this.composites)e+=a.write(e,t);return e-a}scale(e){if(!this.header)return;const t=(this.header.xMin+this.header.xMax)/2;this.header.scale(t,e);if(this.simple)this.simple.scale(t,e);else for(const a of this.composites)a.scale(t,e)}}class GlyphHeader{constructor({numberOfContours:e,xMin:t,yMin:a,xMax:r,yMax:i}){this.numberOfContours=e;this.xMin=t;this.yMin=a;this.xMax=r;this.yMax=i}static parse(e,t){return[10,new GlyphHeader({numberOfContours:t.getInt16(e),xMin:t.getInt16(e+2),yMin:t.getInt16(e+4),xMax:t.getInt16(e+6),yMax:t.getInt16(e+8)})]}getSize(){return 10}write(e,t){t.setInt16(e,this.numberOfContours);t.setInt16(e+2,this.xMin);t.setInt16(e+4,this.yMin);t.setInt16(e+6,this.xMax);t.setInt16(e+8,this.yMax);return 10}scale(e,t){this.xMin=Math.round(e+(this.xMin-e)*t);this.xMax=Math.round(e+(this.xMax-e)*t)}}class Contour{constructor({flags:e,xCoordinates:t,yCoordinates:a}){this.xCoordinates=t;this.yCoordinates=a;this.flags=e}}class SimpleGlyph{constructor({contours:e,instructions:t}){this.contours=e;this.instructions=t}static parse(e,t,a){const r=[];for(let i=0;i255?e+=2:o>0&&(e+=1);t=n;o=Math.abs(s-a);o>255?e+=2:o>0&&(e+=1);a=s}}return e}write(e,t){const a=e,r=[],i=[],n=[];let s=0,o=0;for(const a of this.contours){for(let e=0,t=a.xCoordinates.length;e=0?18:2;r.push(e)}else r.push(l)}s=c;const h=a.yCoordinates[e];l=h-o;if(0===l){t|=32;i.push(0)}else{const e=Math.abs(l);if(e<=255){t|=l>=0?36:4;i.push(e)}else i.push(l)}o=h;n.push(t)}t.setUint16(e,r.length-1);e+=2}t.setUint16(e,this.instructions.length);e+=2;if(this.instructions.length){new Uint8Array(t.buffer,0,t.buffer.byteLength).set(this.instructions,e);e+=this.instructions.length}for(const a of n)t.setUint8(e++,a);for(let a=0,i=r.length;a=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(e+=2):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(e+=2);return e}write(e,t){const a=e;2&this.flags?this.argument1>=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(this.flags|=1):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(this.flags|=1);t.setUint16(e,this.flags);t.setUint16(e+2,this.glyphIndex);e+=4;if(1&this.flags){if(2&this.flags){t.setInt16(e,this.argument1);t.setInt16(e+2,this.argument2)}else{t.setUint16(e,this.argument1);t.setUint16(e+2,this.argument2)}e+=4}else{t.setUint8(e,this.argument1);t.setUint8(e+1,this.argument2);e+=2}if(256&this.flags){t.setUint16(e,this.instructions.length);e+=2;if(this.instructions.length){new Uint8Array(t.buffer,0,t.buffer.byteLength).set(this.instructions,e);e+=this.instructions.length}}return e-a}scale(e,t){}}function writeInt16(e,t,a){e[t]=a>>8&255;e[t+1]=255&a}function writeInt32(e,t,a){e[t]=a>>24&255;e[t+1]=a>>16&255;e[t+2]=a>>8&255;e[t+3]=255&a}function writeData(e,t,a){if(a instanceof Uint8Array)e.set(a,t);else if("string"==typeof a)for(let r=0,i=a.length;ra;){a<<=1;r++}const i=a*t;return{range:i,entry:r,rangeShift:t*e-i}}toArray(){let e=this.sfnt;const t=this.tables,a=Object.keys(t);a.sort();const r=a.length;let i,n,s,o,c,l=12+16*r;const h=[l];for(i=0;i>>0;h.push(l)}const u=new Uint8Array(l);for(i=0;i>>0}writeInt32(u,l+4,e);writeInt32(u,l+8,h[i]);writeInt32(u,l+12,t[c].length);l+=16}return u}addTable(e,t){if(e in this.tables)throw new Error("Table "+e+" already exists");this.tables[e]=t}}const Hr=[4],Wr=[5],zr=[6],$r=[7],Gr=[8],Vr=[12,35],Kr=[14],Jr=[21],Yr=[22],Zr=[30],Qr=[31];class Type1CharString{constructor(){this.width=0;this.lsb=0;this.flexing=!1;this.output=[];this.stack=[]}convert(e,t,a){const r=e.length;let i,n,s,o=!1;for(let c=0;cr)return!0;const i=r-e;for(let e=i;e>8&255,255&t);else{t=65536*t|0;this.output.push(255,t>>24&255,t>>16&255,t>>8&255,255&t)}}this.output.push(...t);a?this.stack.splice(i,e):this.stack.length=0;return!1}}function isHexDigit(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function decrypt(e,t,a){if(a>=e.length)return new Uint8Array(0);let r,i,n=0|t;for(r=0;r>8;n=52845*(t+n)+22719&65535}return o}function isSpecial(e){return 47===e||91===e||93===e||123===e||125===e||40===e||41===e}class Type1Parser{constructor(e,t,a){if(t){const t=e.getBytes(),a=!((isHexDigit(t[0])||isWhiteSpace(t[0]))&&isHexDigit(t[1])&&isHexDigit(t[2])&&isHexDigit(t[3])&&isHexDigit(t[4])&&isHexDigit(t[5])&&isHexDigit(t[6])&&isHexDigit(t[7]));e=new Stream(a?decrypt(t,55665,4):function decryptAscii(e,t,a){let r=0|t;const i=e.length,n=new Uint8Array(i>>>1);let s,o;for(s=0,o=0;s>8;r=52845*(e+r)+22719&65535}}return n.slice(a,o)}(t,55665,4))}this.seacAnalysisEnabled=!!a;this.stream=e;this.nextChar()}readNumberArray(){this.getToken();const e=[];for(;;){const t=this.getToken();if(null===t||"]"===t||"}"===t)break;e.push(parseFloat(t||0))}return e}readNumber(){const e=this.getToken();return parseFloat(e||0)}readInt(){const e=this.getToken();return 0|parseInt(e||0,10)}readBoolean(){return"true"===this.getToken()?1:0}nextChar(){return this.currentChar=this.stream.getByte()}prevChar(){this.stream.skip(-2);return this.currentChar=this.stream.getByte()}getToken(){let e=!1,t=this.currentChar;for(;;){if(-1===t)return null;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(!isWhiteSpace(t))break;t=this.nextChar()}if(isSpecial(t)){this.nextChar();return String.fromCharCode(t)}let a="";do{a+=String.fromCharCode(t);t=this.nextChar()}while(t>=0&&!isWhiteSpace(t)&&!isSpecial(t));return a}readCharStrings(e,t){return-1===t?e:decrypt(e,4330,t)}extractFontProgram(e){const t=this.stream,a=[],r=[],i=Object.create(null);i.lenIV=4;const n={subrs:[],charstrings:[],properties:{privateData:i}};let s,o,c,l;for(;null!==(s=this.getToken());)if("/"===s){s=this.getToken();switch(s){case"CharStrings":this.getToken();this.getToken();this.getToken();this.getToken();for(;;){s=this.getToken();if(null===s||"end"===s)break;if("/"!==s)continue;const e=this.getToken();o=this.readInt();this.getToken();c=o>0?t.getBytes(o):new Uint8Array(0);l=n.properties.privateData.lenIV;const a=this.readCharStrings(c,l);this.nextChar();s=this.getToken();"noaccess"===s?this.getToken():"/"===s&&this.prevChar();r.push({glyph:e,encoded:a})}break;case"Subrs":this.readInt();this.getToken();for(;"dup"===this.getToken();){const e=this.readInt();o=this.readInt();this.getToken();c=o>0?t.getBytes(o):new Uint8Array(0);l=n.properties.privateData.lenIV;const r=this.readCharStrings(c,l);this.nextChar();s=this.getToken();"noaccess"===s&&this.getToken();a[e]=r}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":const e=this.readNumberArray();e.length>0&&e.length,0;break;case"StemSnapH":case"StemSnapV":n.properties.privateData[s]=this.readNumberArray();break;case"StdHW":case"StdVW":n.properties.privateData[s]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":n.properties.privateData[s]=this.readNumber();break;case"ExpansionFactor":n.properties.privateData[s]=this.readNumber()||.06;break;case"ForceBold":n.properties.privateData[s]=this.readBoolean()}}for(const{encoded:t,glyph:i}of r){const r=new Type1CharString,s=r.convert(t,a,this.seacAnalysisEnabled);let o=r.output;s&&(o=[14]);const c={glyphName:i,charstring:o,width:r.width,lsb:r.lsb,seac:r.seac};".notdef"===i?n.charstrings.unshift(c):n.charstrings.push(c);if(e.builtInEncoding){const t=e.builtInEncoding.indexOf(i);t>-1&&void 0===e.widths[t]&&t>=e.firstChar&&t<=e.lastChar&&(e.widths[t]=r.width)}}return n}extractFontHeader(e){let t;for(;null!==(t=this.getToken());)if("/"===t){t=this.getToken();switch(t){case"FontMatrix":const a=this.readNumberArray();e.fontMatrix=a;break;case"Encoding":const r=this.getToken();let i;if(/^\d+$/.test(r)){i=[];const e=0|parseInt(r,10);this.getToken();for(let a=0;a=i){s+=a;for(;s=0&&(r[e]=i)}}return type1FontGlyphMapping(e,r,a)}hasGlyphId(e){if(e<0||e>=this.numGlyphs)return!1;if(0===e)return!0;return this.charstrings[e-1].charstring.length>0}getSeacs(e){const t=[];for(let a=0,r=e.length;a0;e--)t[e]-=t[e-1];f.setByName(e,t)}n.topDict.privateDict=f;const p=new CFFIndex;for(h=0,u=r.length;h0&&e.toUnicode.amend(t)}class fonts_Glyph{constructor(e,t,a,r,i,n,s,o,c){this.originalCharCode=e;this.fontChar=t;this.unicode=a;this.accent=r;this.width=i;this.vmetric=n;this.operatorListId=s;this.isSpace=o;this.isInFont=c}get category(){return shadow(this,"category",function getCharUnicodeCategory(e){const t=gr.get(e);if(t)return t;const a=e.match(fr),r={isWhitespace:!!a?.[1],isZeroWidthDiacritic:!!a?.[2],isInvisibleFormatMark:!!a?.[3]};gr.set(e,r);return r}(this.unicode),!0)}}function int16(e,t){return(e<<8)+t}function writeSignedInt16(e,t,a){e[t+1]=a;e[t]=a>>>8}function signedInt16(e,t){const a=(e<<8)+t;return 32768&a?a-65536:a}function string16(e){return String.fromCharCode(e>>8&255,255&e)}function safeString16(e){e>32767?e=32767:e<-32768&&(e=-32768);return String.fromCharCode(e>>8&255,255&e)}function isTrueTypeCollectionFile(e){return"ttcf"===bytesToString(e.peekBytes(4))}function getFontFileType(e,{type:t,subtype:a,composite:r}){let i,n;if(function isTrueTypeFile(e){const t=e.peekBytes(4);return 65536===readUint32(t,0)||"true"===bytesToString(t)}(e)||isTrueTypeCollectionFile(e))i=r?"CIDFontType2":"TrueType";else if(function isOpenTypeFile(e){return"OTTO"===bytesToString(e.peekBytes(4))}(e))i=r?"CIDFontType2":"OpenType";else if(function isType1File(e){const t=e.peekBytes(2);return 37===t[0]&&33===t[1]||128===t[0]&&1===t[1]}(e))i=r?"CIDFontType0":"MMType1"===t?"MMType1":"Type1";else if(function isCFFFile(e){const t=e.peekBytes(4);return t[0]>=1&&t[3]>=1&&t[3]<=4}(e))if(r){i="CIDFontType0";n="CIDFontType0C"}else{i="MMType1"===t?"MMType1":"Type1";n="Type1C"}else{warn("getFontFileType: Unable to detect correct font file Type/Subtype.");i=t;n=a}return[i,n]}function applyStandardFontGlyphMap(e,t){for(const a in t)e[+a]=t[a]}function buildToFontChar(e,t,a){const r=[];let i;for(let a=0,n=e.length;aei[0][0]<=e&&e<=ei[0][1]||ei[1][0]<=e&&e<=ei[1][1];let u=null;for(const d in e){let f=e[d];if(!t(f))continue;if(l>h){c++;if(c>=ei.length){warn("Ran out of space in font private use area.");break}l=ei[c][0];h=ei[c][1]}const g=l++;0===f&&(f=a);let p=r.get(d);if("string"==typeof p)if(1===p.length)p=p.codePointAt(0);else{if(!u){u=new Map;for(let e=64256;e<=64335;e++){const t=String.fromCharCode(e).normalize("NFKD");t.length>1&&u.set(t,e)}}p=u.get(p)||p.codePointAt(0)}if(p&&!isInPrivateArea(p)&&!o.has(f)){n.set(p,f);o.add(f)}i[g]=f;s[d]=g}return{toFontChar:s,charCodeToGlyphId:i,toUnicodeExtraMap:n,nextAvailableFontCharCode:l}}function createCmapTable(e,t,a){const r=function getRanges(e,t,a){const r=[];for(const t in e)e[t]>=a||r.push({fontCharCode:0|t,glyphId:e[t]});if(t)for(const[e,i]of t)i>=a||r.push({fontCharCode:e,glyphId:i});0===r.length&&r.push({fontCharCode:0,glyphId:0});r.sort((e,t)=>e.fontCharCode-t.fontCharCode);const i=[],n=r.length;for(let e=0;e65535?2:1;let n,s,o,c,l="\0\0"+string16(i)+"\0\0"+string32(4+8*i);for(n=r.length-1;n>=0&&!(r[n][0]<=65535);--n);const h=n+1;r[n][0]<65535&&65535===r[n][1]&&(r[n][1]=65534);const u=r[n][1]<65535?1:0,d=h+u,f=OpenTypeFileBuilder.getSearchParams(d,2);let g,p,m,b,y="",w="",x="",S="",k="",C=0;for(n=0,s=h;n0){w+="ÿÿ";y+="ÿÿ";x+="\0";S+="\0\0"}const v="\0\0"+string16(2*d)+string16(f.range)+string16(f.entry)+string16(f.rangeShift)+w+"\0\0"+y+x+S+k;let F="",T="";if(i>1){l+="\0\0\n"+string32(4+8*i+4+v.length);F="";for(n=0,s=r.length;ne||!o)&&(o=e);c 123 are reserved for internal usage");s|=1<65535&&(c=65535)}else{o=0;c=255}const h=e.bbox||[0,0,0,0],u=a.unitsPerEm||(e.fontMatrix?1/Math.max(...e.fontMatrix.slice(0,4).map(Math.abs)):1e3),d=e.ascentScaled?1:u/ti,f=a.ascent||Math.round(d*(e.ascent||h[3]));let g=a.descent||Math.round(d*(e.descent||h[1]));g>0&&e.descent>0&&h[1]<0&&(g=-g);const p=a.yMax||f,m=-a.yMin||-g;return"\0$ô\0\0\0Š»\0\0\0ŒŠ»\0\0ß\x001\0\0\0\0"+String.fromCharCode(e.fixedPitch?9:0)+"\0\0\0\0\0\0"+string32(r)+string32(i)+string32(n)+string32(s)+"*21*"+string16(e.italicAngle?1:0)+string16(o||e.firstChar)+string16(c||e.lastChar)+string16(f)+string16(g)+"\0d"+string16(p)+string16(m)+"\0\0\0\0\0\0\0\0"+string16(e.xHeight)+string16(e.capHeight)+string16(0)+string16(o||e.firstChar)+"\0"}function createPostTable(e){return"\0\0\0"+string32(Math.floor(65536*e.italicAngle))+"\0\0\0\0"+string32(e.fixedPitch?1:0)+"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}function createPostscriptName(e){return e.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g,"").slice(0,63)}function createNameTable(e,t){t||(t=[[],[]]);const a=[t[0][0]||"Original licence",t[0][1]||e,t[0][2]||"Unknown",t[0][3]||"uniqueID",t[0][4]||e,t[0][5]||"Version 0.11",t[0][6]||createPostscriptName(e),t[0][7]||"Unknown",t[0][8]||"Unknown",t[0][9]||"Unknown"],r=[];let i,n,s,o,c;for(i=0,n=a.length;i0;if((s||o)&&"CIDFontType2"===a&&this.cidEncoding.startsWith("Identity-")){const a=e.cidToGidMap,r=[];applyStandardFontGlyphMap(r,_r());/Arial-?Black/i.test(t)?applyStandardFontGlyphMap(r,jr()):/Calibri/i.test(t)&&applyStandardFontGlyphMap(r,Ur());if(a){for(const e in r){const t=r[e];void 0!==a[t]&&(r[+e]=a[t])}a.length!==this.toUnicode.length&&e.hasIncludedToUnicodeMap&&this.toUnicode instanceof IdentityToUnicodeMap&&this.toUnicode.forEach(function(e,t){const i=r[e];void 0===a[i]&&(r[+e]=t)})}this.toUnicode instanceof IdentityToUnicodeMap||this.toUnicode.forEach(function(e,t){r[+e]=t});this.toFontChar=r;this.toUnicode=new ToUnicodeMap(r)}else if(/Symbol/i.test(r))this.toFontChar=buildToFontChar(or,lr(),this.differences);else if(/Dingbats/i.test(r))this.toFontChar=buildToFontChar(cr,hr(),this.differences);else if(s||o){const e=buildToFontChar(this.defaultEncoding,lr(),this.differences);"CIDFontType2"!==a||this.cidEncoding.startsWith("Identity-")||this.toUnicode instanceof IdentityToUnicodeMap||this.toUnicode.forEach(function(t,a){e[+t]=a});this.toFontChar=e}else{const e=lr(),a=[];this.toUnicode.forEach((t,r)=>{if(!this.composite){const a=getUnicodeForGlyph(this.differences[t]||this.defaultEncoding[t],e);-1!==a&&(r=a)}a[+t]=r});this.composite&&this.toUnicode instanceof IdentityToUnicodeMap&&/Tahoma|Verdana/i.test(t)&&applyStandardFontGlyphMap(a,_r());this.toFontChar=a}amendFallbackToUnicode(e);this.loadedName=r.split("-",1)[0]}checkAndRepair(e,t,a){const r=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "];function readTables(e,t){const a=Object.create(null);a["OS/2"]=null;a.cmap=null;a.head=null;a.hhea=null;a.hmtx=null;a.maxp=null;a.name=null;a.post=null;for(let i=0;i>>0,r=e.getInt32()>>>0,i=e.getInt32()>>>0,n=e.pos;e.pos=e.start||0;e.skip(r);const s=e.getBytes(i);e.pos=n;if("head"===t){s[8]=s[9]=s[10]=s[11]=0;s[17]|=32}return{tag:t,checksum:a,length:i,offset:r,data:s}}function readOpenTypeHeader(e){return{version:e.getString(4),numTables:e.getUint16(),searchRange:e.getUint16(),entrySelector:e.getUint16(),rangeShift:e.getUint16()}}function sanitizeGlyph(e,t,a,r,i,n){const s={length:0,sizeOfInstructions:0};if(t<0||t>=e.length||a>e.length||a-t<=12)return s;const o=e.subarray(t,a),c=signedInt16(o[2],o[3]),l=signedInt16(o[4],o[5]),h=signedInt16(o[6],o[7]),u=signedInt16(o[8],o[9]);if(c>h){writeSignedInt16(o,2,h);writeSignedInt16(o,6,c)}if(l>u){writeSignedInt16(o,4,u);writeSignedInt16(o,8,l)}const d=signedInt16(o[0],o[1]);if(d<0){if(d<-1)return s;r.set(o,i);s.length=o.length;return s}let f,g=10,p=0;for(f=0;fo.length)return s;if(!n&&b>0){r.set(o.subarray(0,m),i);r.set([0,0],i+m);r.set(o.subarray(y,x),i+m+2);x-=b;o.length-x>3&&(x=x+3&-4);s.length=x;return s}if(o.length-x>3){x=x+3&-4;r.set(o.subarray(0,x),i);s.length=x;return s}r.set(o,i);s.length=o.length;return s}function readNameTable(e){const a=(t.start||0)+e.offset;t.pos=a;const r=[[],[]],i=[],n=e.length,s=a+n;if(0!==t.getUint16()||n<6)return[r,i];const o=t.getUint16(),c=t.getUint16();let l,h;for(l=0;ls)continue;t.pos=n;const o=e.name;if(e.encoding){let a="";for(let r=0,i=e.length;r0&&(l+=e-1)}}else{if(m||y){warn("TT: nested FDEFs not allowed");p=!0}m=!0;u=l;s=d.pop();t.functionsDefined[s]={data:c,i:l}}else if(!m&&!y){s=d.at(-1);if(isNaN(s))info("TT: CALL empty stack (or invalid entry).");else{t.functionsUsed[s]=!0;if(s in t.functionsStackDeltas){const e=d.length+t.functionsStackDeltas[s];if(e<0){warn("TT: CALL invalid functions stack delta.");t.hintsValid=!1;return}d.length=e}else if(s in t.functionsDefined&&!g.includes(s)){f.push({data:c,i:l,stackTop:d.length-1});g.push(s);o=t.functionsDefined[s];if(!o){warn("TT: CALL non-existent function");t.hintsValid=!1;return}c=o.data;l=o.i}}}if(!m&&!y){let t=0;e<=142?t=i[e]:e>=192&&e<=223?t=-1:e>=224&&(t=-2);if(e>=113&&e<=117){r=d.pop();isNaN(r)||(t=2*-r)}for(;t<0&&d.length>0;){d.pop();t++}for(;t>0;){d.push(NaN);t--}}}t.tooComplexToFollowFunctions=p;const w=[c];l>c.length&&w.push(new Uint8Array(l-c.length));if(u>h){warn("TT: complementing a missing function tail");w.push(new Uint8Array([34,45]))}!function foldTTTable(e,t){if(t.length>1){let a,r,i=0;for(a=0,r=t.length;a>>0,n=[];for(let t=0;t>>0);const s={ttcTag:t,majorVersion:a,minorVersion:r,numFonts:i,offsetTable:n};switch(a){case 1:return s;case 2:s.dsigTag=e.getInt32()>>>0;s.dsigLength=e.getInt32()>>>0;s.dsigOffset=e.getInt32()>>>0;return s}throw new FormatError(`Invalid TrueType Collection majorVersion: ${a}.`)}(e),i=t.split("+");let n;for(let s=0;s0||!(a.cMap instanceof IdentityCMap));if("OTTO"===n.version&&!t||!s.head||!s.hhea||!s.maxp||!s.post){c=new Stream(s["CFF "].data);o=new CFFFont(c,a);return this.convert(e,o,a)}delete s.glyf;delete s.loca;delete s.fpgm;delete s.prep;delete s["cvt "];this.isOpenType=!0}if(!s.maxp)throw new FormatError('Required "maxp" table is not found');t.pos=(t.start||0)+s.maxp.offset;let h=t.getInt32();const u=t.getUint16();if(65536!==h&&20480!==h){if(6===s.maxp.length)h=20480;else{if(!(s.maxp.length>=32))throw new FormatError('"maxp" table has a wrong version number');h=65536}!function writeUint32(e,t,a){e[t+3]=255&a;e[t+2]=a>>>8;e[t+1]=a>>>16;e[t]=a>>>24}(s.maxp.data,0,h)}if(a.scaleFactors?.length===u&&l){const{scaleFactors:e}=a,t=int16(s.head.data[50],s.head.data[51]),r=new GlyfTable({glyfTable:s.glyf.data,isGlyphLocationsLong:t,locaTable:s.loca.data,numGlyphs:u});r.scale(e);const{glyf:i,loca:n,isLocationLong:o}=r.write();s.glyf.data=i;s.loca.data=n;if(o!==!!t){s.head.data[50]=0;s.head.data[51]=o?1:0}const c=s.hmtx.data;for(let t=0;t>8&255;c[a+1]=255&r;writeSignedInt16(c,a+2,Math.round(e[t]*signedInt16(c[a+2],c[a+3])))}}let d=u+1,f=!0;if(d>65535){f=!1;d=u;warn("Not enough space in glyfs to duplicate first glyph.")}let g=0,p=0;if(h>=65536&&s.maxp.length>=32){t.pos+=8;if(t.getUint16()>2){s.maxp.data[14]=0;s.maxp.data[15]=2}t.pos+=4;g=t.getUint16();t.pos+=4;p=t.getUint16()}s.maxp.data[4]=d>>8;s.maxp.data[5]=255&d;const m=function sanitizeTTPrograms(e,t,a,r){const i={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};e&&sanitizeTTProgram(e,i);t&&sanitizeTTProgram(t,i);e&&function checkInvalidFunctions(e,t){if(!e.tooComplexToFollowFunctions)if(e.functionsDefined.length>t){warn("TT: more functions defined than expected");e.hintsValid=!1}else for(let a=0,r=e.functionsUsed.length;at){warn("TT: invalid function id: "+a);e.hintsValid=!1;return}if(e.functionsUsed[a]&&!e.functionsDefined[a]){warn("TT: undefined function: "+a);e.hintsValid=!1;return}}}(i,r);if(a&&1&a.length){const e=new Uint8Array(a.length+1);e.set(a.data);a.data=e}return i.hintsValid}(s.fpgm,s.prep,s["cvt "],g);if(!m){delete s.fpgm;delete s.prep;delete s["cvt "]}!function sanitizeMetrics(e,t,a,r,i,n){if(!t){a&&(a.data=null);return}e.pos=(e.start||0)+t.offset;e.pos+=4;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;const s=e.getUint16();e.pos+=8;e.pos+=2;let o=e.getUint16();if(0!==s){if(!(2&int16(r.data[44],r.data[45]))){t.data[22]=0;t.data[23]=0}}if(o>i){info(`The numOfMetrics (${o}) should not be greater than the numGlyphs (${i}).`);o=i;t.data[34]=(65280&o)>>8;t.data[35]=255&o}const c=i-o-(a.length-4*o>>1);if(c>0){const e=new Uint8Array(a.length+2*c);e.set(a.data);if(n){e[a.length]=a.data[2];e[a.length+1]=a.data[3]}a.data=e}}(t,s.hhea,s.hmtx,s.head,d,f);if(!s.head)throw new FormatError('Required "head" table is not found');!function sanitizeHead(e,t,a){const r=e.data,i=function int32(e,t,a,r){return(e<<24)+(t<<16)+(a<<8)+r}(r[0],r[1],r[2],r[3]);if(i>>16!=1){info("Attempting to fix invalid version in head table: "+i);r[0]=0;r[1]=1;r[2]=0;r[3]=0}const n=int16(r[50],r[51]);if(n<0||n>1){info("Attempting to fix invalid indexToLocFormat in head table: "+n);const e=t+1;if(a===e<<1){r[50]=0;r[51]=0}else{if(a!==e<<2)throw new FormatError("Could not fix indexToLocFormat: "+n);r[50]=0;r[51]=1}}}(s.head,u,l?s.loca.length:0);let b=Object.create(null);if(l){const e=int16(s.head.data[50],s.head.data[51]),t=function sanitizeGlyphLocations(e,t,a,r,i,n,s){let o,c,l;if(r){o=4;c=function fontItemDecodeLong(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};l=function fontItemEncodeLong(e,t,a){e[t]=a>>>24&255;e[t+1]=a>>16&255;e[t+2]=a>>8&255;e[t+3]=255&a}}else{o=2;c=function fontItemDecode(e,t){return e[t]<<9|e[t+1]<<1};l=function fontItemEncode(e,t,a){e[t]=a>>9&255;e[t+1]=a>>1&255}}const h=n?a+1:a,u=o*(1+h),d=new Uint8Array(u);d.set(e.data.subarray(0,u));e.data=d;const f=t.data,g=f.length,p=new Uint8Array(g);let m,b;const y=[];for(m=0,b=0;mg&&(e=g);y.push({index:m,offset:e,endOffset:0})}y.sort((e,t)=>e.offset-t.offset);for(m=0;me.index-t.index);for(m=0;ms&&(s=e.sizeOfInstructions);S+=t;l(d,b,S)}if(0===S){const e=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(m=0,b=o;ma+S)t.data=p.subarray(0,a+S);else{t.data=new Uint8Array(a+S);t.data.set(p.subarray(0,S))}t.data.set(p.subarray(0,a),S);l(e.data,d.length-o,S+a)}else t.data=p.subarray(0,S);return{missingGlyphs:x,maxSizeOfInstructions:s}}(s.loca,s.glyf,u,e,m,f,p);b=t.missingGlyphs;if(h>=65536&&s.maxp.length>=32){s.maxp.data[26]=t.maxSizeOfInstructions>>8;s.maxp.data[27]=255&t.maxSizeOfInstructions}}if(!s.hhea)throw new FormatError('Required "hhea" table is not found');if(0===s.hhea.data[10]&&0===s.hhea.data[11]){s.hhea.data[10]=255;s.hhea.data[11]=255}const y={unitsPerEm:int16(s.head.data[18],s.head.data[19]),yMax:signedInt16(s.head.data[42],s.head.data[43]),yMin:signedInt16(s.head.data[38],s.head.data[39]),ascent:signedInt16(s.hhea.data[4],s.hhea.data[5]),descent:signedInt16(s.hhea.data[6],s.hhea.data[7]),lineGap:signedInt16(s.hhea.data[8],s.hhea.data[9])};this.ascent=y.ascent/y.unitsPerEm;this.descent=y.descent/y.unitsPerEm;this.lineGap=y.lineGap/y.unitsPerEm;if(this.cssFontInfo?.lineHeight){this.lineHeight=this.cssFontInfo.metrics.lineHeight;this.lineGap=this.cssFontInfo.metrics.lineGap}else this.lineHeight=this.ascent-this.descent+this.lineGap;s.post&&function readPostScriptTable(e,a,r){const i=(t.start||0)+e.offset;t.pos=i;const n=i+e.length,s=t.getInt32();t.skip(28);let o,c,l=!0;switch(s){case 65536:o=xr;break;case 131072:const e=t.getUint16();if(e!==r){l=!1;break}const i=[];for(c=0;c=32768){l=!1;break}i.push(e)}if(!l)break;const h=[],u=[];for(;t.pos65535)throw new FormatError("Max size of CID is 65,535");let i=-1;t?i=r:void 0!==e[r]&&(i=e[r]);i>=0&&i>>0;let h=!1;if(o?.platformId!==i||o?.encodingId!==n){if(0!==i||0!==n&&1!==n&&3!==n)if(1===i&&0===n)h=!0;else if(3!==i||1!==n||!r&&o){if(a&&3===i&&0===n){h=!0;let a=!0;if(e>3;e.push(r);a=Math.max(r,a)}const r=[];for(let e=0;e<=a;e++)r.push({firstCode:t.getUint16(),entryCount:t.getUint16(),idDelta:signedInt16(t.getByte(),t.getByte()),idRangePos:t.pos+t.getUint16()});for(let a=0;a<256;a++)if(0===e[a]){t.pos=r[0].idRangePos+2*a;f=t.getUint16();u.push({charCode:a,glyphId:f})}else{const i=r[e[a]];for(d=0;d>1;t.skip(6);const a=[];let r;for(r=0;r>1)-(e-r);i.offsetIndex=s;o=Math.max(o,s+i.end-i.start+1)}else i.offsetIndex=-1}const c=[];for(d=0;d>>0;for(d=0;d>>0,a=t.getInt32()>>>0;let r=t.getInt32()>>>0;for(let t=e;t<=a;t++)u.push({charCode:t,glyphId:r++})}}}u.sort((e,t)=>e.charCode-t.charCode);const g=[],p=new Set;for(const e of u){const{charCode:t}=e;if(!p.has(t)){p.add(t);g.push(e)}}return{platformId:o.platformId,encodingId:o.encodingId,mappings:g,hasShortCmap:h}}(s.cmap,t,this.isSymbolicFont,a.hasEncoding),r=e.platformId,i=e.encodingId,n=e.mappings;let o=[],c=!1;!a.hasEncoding||"MacRomanEncoding"!==a.baseEncodingName&&"WinAnsiEncoding"!==a.baseEncodingName||(o=getEncoding(a.baseEncodingName));if(a.hasEncoding&&!this.isSymbolicFont&&(3===r&&1===i||1===r&&0===i)){const e=lr();for(let t=0;t<256;t++){let s;s=void 0!==this.differences[t]?this.differences[t]:o.length&&""!==o[t]?o[t]:nr[t];if(!s)continue;const c=recoverGlyphName(s,e);let l;3===r&&1===i?l=e[c]:1===r&&0===i&&(l=ir.indexOf(c));if(void 0===l){if(!a.glyphNames&&a.hasIncludedToUnicodeMap&&!(this.toUnicode instanceof IdentityToUnicodeMap)){const e=this.toUnicode.get(t);e&&(l=e.codePointAt(0))}if(void 0===l)continue}for(const e of n)if(e.charCode===l){w[t]=e.glyphId;break}}}else if(0===r){for(const e of n)w[e.charCode]=e.glyphId;c=!0}else if(3===r&&0===i)for(const e of n){let t=e.charCode;t>=61440&&t<=61695&&(t&=255);w[t]=e.glyphId}else for(const e of n)w[e.charCode]=e.glyphId;if(a.glyphNames&&(o.length||this.differences.length))for(let e=0;e<256;++e){if(!c&&void 0!==w[e])continue;const t=this.differences[e]||o[e];if(!t)continue;const r=a.glyphNames.indexOf(t);r>0&&hasGlyph(r)&&(w[e]=r)}}0===w.length&&(w[0]=0);let x=d-1;f||(x=0);if(!a.cssFontInfo){const e=adjustMapping(w,hasGlyph,x,this.toUnicode);this.toFontChar=e.toFontChar;s.cmap={tag:"cmap",data:createCmapTable(e.charCodeToGlyphId,e.toUnicodeExtraMap,d)};s["OS/2"]&&function validateOS2Table(e,t){t.pos=(t.start||0)+e.offset;const a=t.getUint16();t.skip(60);const r=t.getUint16();if(a<4&&768&r)return!1;if(t.getUint16()>t.getUint16())return!1;t.skip(6);if(0===t.getUint16())return!1;e.data[8]=e.data[9]=0;return!0}(s["OS/2"],t)||(s["OS/2"]={tag:"OS/2",data:createOS2Table(a,e.charCodeToGlyphId,y)})}if(!l)try{c=new Stream(s["CFF "].data);o=new CFFParser(c,a,pr).parse();o.duplicateFirstGlyph();const e=new CFFCompiler(o);s["CFF "].data=e.compile()}catch{warn("Failed to compile font "+a.loadedName)}if(s.name){const[t,r]=readNameTable(s.name);s.name.data=createNameTable(e,t);this.psName=t[0][6]||null;a.composite||function adjustTrueTypeToUnicode(e,t,a){if(e.isInternalFont)return;if(e.hasIncludedToUnicodeMap)return;if(e.hasEncoding)return;if(e.toUnicode instanceof IdentityToUnicodeMap)return;if(!t)return;if(0===a.length)return;if(e.defaultEncoding===sr)return;for(const e of a)if(!isWinNameRecord(e))return;const r=sr,i=[],n=lr();for(const e in r){const t=r[e];if(""===t)continue;const a=n[t];void 0!==a&&(i[e]=String.fromCharCode(a))}i.length>0&&e.toUnicode.amend(i)}(a,this.isSymbolicFont,r)}else s.name={tag:"name",data:createNameTable(this.name)};const S=new OpenTypeFileBuilder(n.version);for(const e in s)S.addTable(e,s[e].data);return S.toArray()}convert(e,a,r){r.fixedPitch=!1;r.builtInEncoding&&function adjustType1ToUnicode(e,t){if(e.isInternalFont)return;if(e.hasIncludedToUnicodeMap)return;if(t===e.defaultEncoding)return;if(e.toUnicode instanceof IdentityToUnicodeMap)return;const a=[],r=lr();for(const i in t){if(e.hasEncoding&&(e.baseEncodingName||void 0!==e.differences[i]))continue;const n=getUnicodeForGlyph(t[i],r);-1!==n&&(a[i]=String.fromCharCode(n))}a.length>0&&e.toUnicode.amend(a)}(r,r.builtInEncoding);let i=1;a instanceof CFFFont&&(i=a.numGlyphs-1);const n=a.getGlyphMapping(r);let s=null,o=n,c=null;if(!r.cssFontInfo){s=adjustMapping(n,a.hasGlyphId.bind(a),i,this.toUnicode);this.toFontChar=s.toFontChar;o=s.charCodeToGlyphId;c=s.toUnicodeExtraMap}const l=a.numGlyphs;function getCharCodes(e,t){let a=null;for(const r in e)t===e[r]&&(a||=[]).push(0|r);return a}function createCharCode(e,t){for(const a in e)if(t===e[a])return 0|a;s.charCodeToGlyphId[s.nextAvailableFontCharCode]=t;return s.nextAvailableFontCharCode++}const h=a.seacs;if(s&&h?.length){const e=r.fontMatrix||t,i=a.getCharset(),o=Object.create(null);for(let t in h){t|=0;const a=h[t],r=nr[a[2]],c=nr[a[3]],l=i.indexOf(r),u=i.indexOf(c);if(l<0||u<0)continue;const d={x:a[0]*e[0]+a[1]*e[2]+e[4],y:a[0]*e[1]+a[1]*e[3]+e[5]},f=getCharCodes(n,t);if(f)for(const e of f){const t=s.charCodeToGlyphId,a=createCharCode(t,l),r=createCharCode(t,u);o[e]={baseFontCharCode:a,accentFontCharCode:r,accentOffset:d}}}r.seacMap=o}const u=r.fontMatrix?1/Math.max(...r.fontMatrix.slice(0,4).map(Math.abs)):1e3,d=new OpenTypeFileBuilder("OTTO");d.addTable("CFF ",a.data);d.addTable("OS/2",createOS2Table(r,o));d.addTable("cmap",createCmapTable(o,c,l));d.addTable("head","\0\0\0\0\0\0\0\0\0\0_<õ\0\0"+safeString16(u)+"\0\0\0\0ž\v~'\0\0\0\0ž\v~'\0\0"+safeString16(r.descent)+"ÿ"+safeString16(r.ascent)+string16(r.italicAngle?2:0)+"\0\0\0\0\0\0\0");d.addTable("hhea","\0\0\0"+safeString16(r.ascent)+safeString16(r.descent)+"\0\0ÿÿ\0\0\0\0\0\0"+safeString16(r.capHeight)+safeString16(Math.tan(r.italicAngle)*r.xHeight)+"\0\0\0\0\0\0\0\0\0\0\0\0"+string16(l));d.addTable("hmtx",function fontFieldsHmtx(){const e=a.charstrings,t=a.cff?a.cff.widths:null;let r="\0\0\0\0";for(let a=1,i=l;a=65520&&e<=65535?0:e>=62976&&e<=63743?ur()[e]||e:173===e?45:e}(a)}this.isType3Font&&(i=a);let h=null;if(this.seacMap?.[e]){l=!0;const t=this.seacMap[e];a=t.baseFontCharCode;h={fontChar:String.fromCodePoint(t.accentFontCharCode),offset:t.accentOffset}}let u="";"number"==typeof a&&(a<=1114111?u=String.fromCodePoint(a):warn(`charToGlyph - invalid fontCharCode: ${a}`));if(this.missingFile&&this.vertical&&1===u.length){const e=Sr()[u.charCodeAt(0)];e&&(u=c=String.fromCharCode(e))}n=new fonts_Glyph(e,u,c,h,r,o,i,t,l);return this._glyphCache[e]=n}charsToGlyphs(e){let t=this._charsCache[e];if(t)return t;t=[];if(this.cMap){const a=Object.create(null),r=e.length;let i=0;for(;it.length%2==1,r=this.toUnicode instanceof IdentityToUnicodeMap?e=>this.toUnicode.charCodeOf(e):e=>this.toUnicode.charCodeOf(String.fromCodePoint(e));for(let i=0,n=e.length;i55295&&(n<57344||n>65533)&&i++;if(this.toUnicode){const e=r(n);if(-1!==e){if(hasCurrentBufErrors()){t.push(a.join(""));a.length=0}for(let t=(this.cMap?this.cMap.getCharCodeLength(e):1)-1;t>=0;t--)a.push(String.fromCharCode(e>>8*t&255));continue}}if(!hasCurrentBufErrors()){t.push(a.join(""));a.length=0}a.push(String.fromCodePoint(n))}t.push(a.join(""));return t}}class ErrorFont{constructor(e){this.error=e;this.loadedName="g_font_error";this.missingFile=!0}charsToGlyphs(){return[]}encodeString(e){return[e]}exportData(){return{error:this.error}}}const ii=2,ni=3,si=4,oi=5,ci=6,li=7;class Pattern{constructor(){unreachable("Cannot initialize Pattern.")}static parseShading(e,t,a,r,i,n){const s=e instanceof BaseStream?e.dict:e,o=s.get("ShadingType");try{switch(o){case ii:case ni:return new RadialAxialShading(s,t,a,r,i,n);case si:case oi:case ci:case li:return new MeshShading(e,t,a,r,i,n);default:throw new FormatError("Unsupported ShadingType: "+o)}}catch(e){if(e instanceof MissingDataException)throw e;warn(e);return new DummyShading}}}class BaseShading{static SMALL_NUMBER=1e-6;getIR(){unreachable("Abstract method `getIR` called.")}}class RadialAxialShading extends BaseShading{constructor(e,t,a,r,i,n){super();this.shadingType=e.get("ShadingType");let s=0;this.shadingType===ii?s=4:this.shadingType===ni&&(s=6);this.coordsArr=e.getArray("Coords");if(!isNumberArray(this.coordsArr,s))throw new FormatError("RadialAxialShading: Invalid /Coords array.");const o=ColorSpaceUtils.parse({cs:e.getRaw("CS")||e.getRaw("ColorSpace"),xref:t,resources:a,pdfFunctionFactory:r,globalColorSpaceCache:i,localColorSpaceCache:n});this.bbox=lookupNormalRect(e.getArray("BBox"),null);let c=0,l=1;const h=e.getArray("Domain");isNumberArray(h,2)&&([c,l]=h);let u=!1,d=!1;const f=e.getArray("Extend");(function isBooleanArray(e,t){return Array.isArray(e)&&(null===t||e.length===t)&&e.every(e=>"boolean"==typeof e)})(f,2)&&([u,d]=f);if(!(this.shadingType!==ni||u&&d)){const[e,t,a,r,i,n]=this.coordsArr,s=Math.hypot(e-r,t-i);a<=n+s&&n<=a+s&&warn("Unsupported radial gradient.")}this.extendStart=u;this.extendEnd=d;const g=e.getRaw("Function"),p=r.create(g,!0),m=(l-c)/840,b=this.colorStops=[];if(c>=l||m<=0){info("Bad shading domain.");return}const y=new Float32Array(o.numComps),w=new Float32Array(1);let x=0;w[0]=c;p(w,0,y,0);const S=new Uint8ClampedArray(3);o.getRgb(y,0,S);let[k,C,v]=S;b.push([0,Util.makeHexColor(k,C,v)]);let F=1;w[0]=c+m;p(w,0,y,0);o.getRgb(y,0,S);let[T,O,M]=S,D=T-k+1,R=O-C+1,N=M-v+1,E=T-k-1,L=O-C-1,_=M-v-1;for(let e=2;e<840;e++){w[0]=c+e*m;p(w,0,y,0);o.getRgb(y,0,S);const[t,a,r]=S,i=e-x;D=Math.min(D,(t-k+1)/i);R=Math.min(R,(a-C+1)/i);N=Math.min(N,(r-v+1)/i);E=Math.max(E,(t-k-1)/i);L=Math.max(L,(a-C-1)/i);_=Math.max(_,(r-v-1)/i);if(!(E<=D&&L<=R&&_<=N)){const e=Util.makeHexColor(T,O,M);b.push([F/840,e]);D=t-T+1;R=a-O+1;N=r-M+1;E=t-T-1;L=a-O-1;_=r-M-1;x=F;k=T;C=O;v=M}F=e;T=t;O=a;M=r}b.push([1,Util.makeHexColor(T,O,M)]);let j="transparent";e.has("Background")&&(j=o.getRgbHex(e.get("Background"),0));if(!u){b.unshift([0,j]);b[1][0]+=BaseShading.SMALL_NUMBER}if(!d){b.at(-1)[0]-=BaseShading.SMALL_NUMBER;b.push([1,j])}this.colorStops=b}getIR(){const{coordsArr:e,shadingType:t}=this;let a,r,i,n,s;if(t===ii){r=[e[0],e[1]];i=[e[2],e[3]];n=null;s=null;a="axial"}else if(t===ni){r=[e[0],e[1]];i=[e[3],e[4]];n=e[2];s=e[5];a="radial"}else unreachable(`getPattern type unknown: ${t}`);return["RadialAxial",a,this.bbox,this.colorStops,r,i,n,s]}}class MeshStreamReader{constructor(e,t){this.stream=e;this.context=t;this.buffer=0;this.bufferLength=0;const a=t.numComps;this.tmpCompsBuf=new Float32Array(a);const r=t.colorSpace.numComps;this.tmpCsCompsBuf=t.colorFn?new Float32Array(r):this.tmpCompsBuf}get hasData(){if(this.stream.end)return this.stream.pos0)return!0;const e=this.stream.getByte();if(e<0)return!1;this.buffer=e;this.bufferLength=8;return!0}readBits(e){const{stream:t}=this;let{buffer:a,bufferLength:r}=this;if(32===e){if(0===r)return t.getInt32()>>>0;a=a<<24|t.getByte()<<16|t.getByte()<<8|t.getByte();const e=t.getByte();this.buffer=e&(1<>r)>>>0}if(8===e&&0===r)return t.getByte();for(;r>r}align(){this.buffer=0;this.bufferLength=0}readFlag(){return this.readBits(this.context.bitsPerFlag)}readCoordinate(){const{bitsPerCoordinate:e,decode:t}=this.context,a=this.readBits(e),r=this.readBits(e),i=e<32?1/((1<n?n:e;t=t>s?s:t;a=ae*i[t]):a;let s,o=-2;const c=[];for(const[e,t]of r.map((e,t)=>[e,t]).sort(([e],[t])=>e-t))if(-1!==e)if(e===o+1){s.push(n[t]);o+=1}else{o=e;s=[n[t]];c.push(e,s)}return c}(e),a=new Dict(null);a.set("BaseFont",Name.get(e));a.set("Type",Name.get("Font"));a.set("Subtype",Name.get("CIDFontType2"));a.set("Encoding",Name.get("Identity-H"));a.set("CIDToGIDMap",Name.get("Identity"));a.set("W",t);a.set("FirstChar",t[0]);a.set("LastChar",t.at(-2)+t.at(-1).length-1);const r=new Dict(null);a.set("FontDescriptor",r);const i=new Dict(null);i.set("Ordering","Identity");i.set("Registry","Adobe");i.set("Supplement",0);a.set("CIDSystemInfo",i);return a}class PostScriptParser{constructor(e){this.lexer=e;this.operators=[];this.token=null;this.prev=null}nextToken(){this.prev=this.token;this.token=this.lexer.getToken()}accept(e){if(this.token.type===e){this.nextToken();return!0}return!1}expect(e){if(this.accept(e))return!0;throw new FormatError(`Unexpected symbol: found ${this.token.type} expected ${e}.`)}parse(){this.nextToken();this.expect(en.LBRACE);this.parseBlock();this.expect(en.RBRACE);return this.operators}parseBlock(){for(;;)if(this.accept(en.NUMBER))this.operators.push(this.prev.value);else if(this.accept(en.OPERATOR))this.operators.push(this.prev.value);else{if(!this.accept(en.LBRACE))return;this.parseCondition()}}parseCondition(){const e=this.operators.length;this.operators.push(null,null);this.parseBlock();this.expect(en.RBRACE);if(this.accept(en.IF)){this.operators[e]=this.operators.length;this.operators[e+1]="jz"}else{if(!this.accept(en.LBRACE))throw new FormatError("PS Function: error parsing conditional.");{const t=this.operators.length;this.operators.push(null,null);const a=this.operators.length;this.parseBlock();this.expect(en.RBRACE);this.expect(en.IFELSE);this.operators[t]=this.operators.length;this.operators[t+1]="j";this.operators[e]=a;this.operators[e+1]="jz"}}}}const en={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5};class PostScriptToken{static get opCache(){return shadow(this,"opCache",Object.create(null))}constructor(e,t){this.type=e;this.value=t}static getOperator(e){return PostScriptToken.opCache[e]||=new PostScriptToken(en.OPERATOR,e)}static get LBRACE(){return shadow(this,"LBRACE",new PostScriptToken(en.LBRACE,"{"))}static get RBRACE(){return shadow(this,"RBRACE",new PostScriptToken(en.RBRACE,"}"))}static get IF(){return shadow(this,"IF",new PostScriptToken(en.IF,"IF"))}static get IFELSE(){return shadow(this,"IFELSE",new PostScriptToken(en.IFELSE,"IFELSE"))}}class PostScriptLexer{constructor(e){this.stream=e;this.nextChar();this.strBuf=[]}nextChar(){return this.currentChar=this.stream.getByte()}getToken(){let e=!1,t=this.currentChar;for(;;){if(t<0)return aa;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(!isWhiteSpace(t))break;t=this.nextChar()}switch(0|t){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return new PostScriptToken(en.NUMBER,this.getNumber());case 123:this.nextChar();return PostScriptToken.LBRACE;case 125:this.nextChar();return PostScriptToken.RBRACE}const a=this.strBuf;a.length=0;a[0]=String.fromCharCode(t);for(;(t=this.nextChar())>=0&&(t>=65&&t<=90||t>=97&&t<=122);)a.push(String.fromCharCode(t));const r=a.join("");switch(r.toLowerCase()){case"if":return PostScriptToken.IF;case"ifelse":return PostScriptToken.IFELSE;default:return PostScriptToken.getOperator(r)}}getNumber(){let e=this.currentChar;const t=this.strBuf;t.length=0;t[0]=String.fromCharCode(e);for(;(e=this.nextChar())>=0&&(e>=48&&e<=57||45===e||46===e);)t.push(String.fromCharCode(e));const a=parseFloat(t.join(""));if(isNaN(a))throw new FormatError(`Invalid floating point number: ${a}`);return a}}class BaseLocalCache{constructor(e){this._onlyRefs=!0===e?.onlyRefs;if(!this._onlyRefs){this._nameRefMap=new Map;this._imageMap=new Map}this._imageCache=new RefSetCache}getByName(e){this._onlyRefs&&unreachable("Should not call `getByName` method.");const t=this._nameRefMap.get(e);return t?this.getByRef(t):this._imageMap.get(e)||null}getByRef(e){return this._imageCache.get(e)||null}set(e,t,a){unreachable("Abstract method `set` called.")}}class LocalImageCache extends BaseLocalCache{set(e,t=null,a){if("string"!=typeof e)throw new Error('LocalImageCache.set - expected "name" argument.');if(t){if(this._imageCache.has(t))return;this._nameRefMap.set(e,t);this._imageCache.put(t,a)}else this._imageMap.has(e)||this._imageMap.set(e,a)}}class LocalColorSpaceCache extends BaseLocalCache{set(e=null,t=null,a){if("string"!=typeof e&&!t)throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');if(t){if(this._imageCache.has(t))return;null!==e&&this._nameRefMap.set(e,t);this._imageCache.put(t,a)}else this._imageMap.has(e)||this._imageMap.set(e,a)}}class LocalFunctionCache extends BaseLocalCache{constructor(e){super({onlyRefs:!0})}set(e=null,t,a){if(!t)throw new Error('LocalFunctionCache.set - expected "ref" argument.');this._imageCache.has(t)||this._imageCache.put(t,a)}}class LocalGStateCache extends BaseLocalCache{set(e,t=null,a){if("string"!=typeof e)throw new Error('LocalGStateCache.set - expected "name" argument.');if(t){if(this._imageCache.has(t))return;this._nameRefMap.set(e,t);this._imageCache.put(t,a)}else this._imageMap.has(e)||this._imageMap.set(e,a)}}class LocalTilingPatternCache extends BaseLocalCache{constructor(e){super({onlyRefs:!0})}set(e=null,t,a){if(!t)throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');this._imageCache.has(t)||this._imageCache.put(t,a)}}class RegionalImageCache extends BaseLocalCache{constructor(e){super({onlyRefs:!0})}set(e=null,t,a){if(!t)throw new Error('RegionalImageCache.set - expected "ref" argument.');this._imageCache.has(t)||this._imageCache.put(t,a)}}class GlobalColorSpaceCache extends BaseLocalCache{constructor(e){super({onlyRefs:!0})}set(e=null,t,a){if(!t)throw new Error('GlobalColorSpaceCache.set - expected "ref" argument.');this._imageCache.has(t)||this._imageCache.put(t,a)}clear(){this._imageCache.clear()}}class GlobalImageCache{static NUM_PAGES_THRESHOLD=2;static MIN_IMAGES_TO_CACHE=10;static MAX_BYTE_SIZE=5e7;#H=new RefSet;constructor(){this._refCache=new RefSetCache;this._imageCache=new RefSetCache}get#W(){let e=0;for(const t of this._imageCache)e+=t.byteSize;return e}get#z(){return!(this._imageCache.size+e):null}class PDFFunction{static getSampleArray(e,t,a,r){let i,n,s=1;for(i=0,n=e.length;i>c)*h;l&=(1<0&&(d=n[u-1]);let f=a[1];u>1,c=r.length>>1,l=new PostScriptEvaluator(s),h=Object.create(null);let u=8192;const d=new Float32Array(c);return function constructPostScriptFn(e,t,a,r){let n,s,f="";const g=d;for(n=0;ne&&(s=e)}m[n]=s}if(u>0){u--;h[f]=m}a.set(m,r)}}}function isPDFFunction(e){let t;if(e instanceof Dict)t=e;else{if(!(e instanceof BaseStream))return!1;t=e.dict}return t.has("FunctionType")}class PostScriptStack{static MAX_STACK_SIZE=100;constructor(e){this.stack=e?Array.from(e):[]}push(e){if(this.stack.length>=PostScriptStack.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");this.stack.push(e)}pop(){if(this.stack.length<=0)throw new Error("PostScript function stack underflow.");return this.stack.pop()}copy(e){if(this.stack.length+e>=PostScriptStack.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");const t=this.stack;for(let a=t.length-e,r=e-1;r>=0;r--,a++)t.push(t[a])}index(e){this.push(this.stack[this.stack.length-e-1])}roll(e,t){const a=this.stack,r=a.length-e,i=a.length-1,n=r+(t-Math.floor(t/e)*e);for(let e=r,t=i;e0?t.push(s<>o);break;case"ceiling":s=t.pop();t.push(Math.ceil(s));break;case"copy":s=t.pop();t.copy(s);break;case"cos":s=t.pop();t.push(Math.cos(s%360/180*Math.PI));break;case"cvi":s=0|t.pop();t.push(s);break;case"cvr":break;case"div":o=t.pop();s=t.pop();t.push(s/o);break;case"dup":t.copy(1);break;case"eq":o=t.pop();s=t.pop();t.push(s===o);break;case"exch":t.roll(2,1);break;case"exp":o=t.pop();s=t.pop();t.push(s**o);break;case"false":t.push(!1);break;case"floor":s=t.pop();t.push(Math.floor(s));break;case"ge":o=t.pop();s=t.pop();t.push(s>=o);break;case"gt":o=t.pop();s=t.pop();t.push(s>o);break;case"idiv":o=t.pop();s=t.pop();t.push(s/o|0);break;case"index":s=t.pop();t.index(s);break;case"le":o=t.pop();s=t.pop();t.push(s<=o);break;case"ln":s=t.pop();t.push(Math.log(s));break;case"log":s=t.pop();t.push(Math.log10(s));break;case"lt":o=t.pop();s=t.pop();t.push(s=t?new AstLiteral(t):e.max<=t?e:new AstMin(e,t)}class PostScriptCompiler{compile(e,t,a){const r=[],i=[],n=t.length>>1,s=a.length>>1;let o,c,l,h,u,d,f,g,p=0;for(let e=0;et.min){o.unshift("Math.max(",n,", ");o.push(")")}if(s4){r=!0;t=0}else{r=!1;t=1}const c=[];for(n=0;n=0&&"ET"===nn[e];--e)nn[e]="EN";for(let e=n+1;e0&&(t=nn[n-1]);let a=u;e+1g&&isOdd(g)&&(m=g)}for(g=p;g>=m;--g){let e=-1;for(n=0,s=c.length;n=0){reverseValues(rn,e,n);e=-1}}else e<0&&(e=n);e>=0&&reverseValues(rn,e,c.length)}for(n=0,s=rn.length;n"!==e||(rn[n]="")}return createBidiText(rn.join(""),r)}class CssFontInfo{#E;#$;#G;static strings=["fontFamily","fontWeight","italicAngle"];static write(e){const t=new TextEncoder,a={};let r=0;for(const i of CssFontInfo.strings){const n=t.encode(e[i]);a[i]=n;r+=4+n.length}const i=new ArrayBuffer(r),n=new Uint8Array(i),s=new DataView(i);let o=0;for(const e of CssFontInfo.strings){const t=a[e],r=t.length;s.setUint32(o,r);n.set(t,o+4);o+=4+r}assert(o===i.byteLength,"CssFontInfo.write: Buffer overflow");return i}constructor(e){this.#E=e;this.#$=new DataView(this.#E);this.#G=new TextDecoder}#V(e){assert(e>a&3;return 0===r?void 0:2===r}get black(){return this.#ee(0)}get bold(){return this.#ee(1)}get disableFontFace(){return this.#ee(2)}get fontExtraProperties(){return this.#ee(3)}get isInvalidPDFjsFont(){return this.#ee(4)}get isType3Font(){return this.#ee(5)}get italic(){return this.#ee(6)}get missingFile(){return this.#ee(7)}get remeasure(){return this.#ee(8)}get vertical(){return this.#ee(9)}#te(e){assert(e!t.has(e.toLowerCase())).join(" ")}function generateFont({alias:e,local:t,path:a,fallback:r,style:i,ultimate:n},s,o,c=!0,l=!0,h=""){const u={style:null,ultimate:null};if(t){const e=h?` ${h}`:"";for(const a of t)s.push(`local(${a}${e})`)}if(e){const t=hn.get(e),n=h||function getStyleToAppend(e){switch(e){case on:return"Bold";case cn:return"Italic";case ln:return"Bold Italic";default:if("bold"===e?.weight)return"Bold";if("italic"===e?.style)return"Italic"}return""}(i);Object.assign(u,generateFont(t,s,o,c&&!r,l&&!a,n))}i&&(u.style=i);n&&(u.ultimate=n);if(c&&r){const e=hn.get(r),{ultimate:t}=generateFont(e,s,o,c,l&&!a,h);u.ultimate||=t}l&&a&&o&&s.push(`url(${o}${a})`);return u}function getFontSubstitution(e,t,a,r,i,n){if(r.startsWith("InvalidPDFjsFont_"))return null;"TrueType"!==n&&"Type1"!==n||!/^[A-Z]{6}\+/.test(r)||(r=r.slice(7));const s=r=normalizeFontName(r);let o=e.get(s);if(o)return o;let c=hn.get(r);if(!c)for(const[e,t]of un)if(r.startsWith(e)){r=`${t}${r.substring(e.length)}`;c=hn.get(r);break}let l=!1;if(!c){c=hn.get(i);l=!0}const h=`${t.getDocId()}_s${t.createFontId()}`;if(!c){if(!validateFontName(r)){warn(`Cannot substitute the font because of its name: ${r}`);e.set(s,null);return null}const t=/bold/gi.test(r),a=/oblique|italic/gi.test(r),i=t&&a&&ln||t&&on||a&&cn||sn;o={css:`"${getFamilyName(r)}",${h}`,guessFallback:!0,loadedName:h,baseFontName:r,src:`local(${r})`,style:i};e.set(s,o);return o}const u=[];l&&validateFontName(r)&&u.push(`local(${r})`);const{style:d,ultimate:f}=generateFont(c,u,a),g=null===f,p=g?"":`,${f}`;o={css:`"${getFamilyName(r)}",${h}${p}`,guessFallback:g,loadedName:h,baseFontName:r,src:u.join(","),style:d};e.set(s,o);return o}const dn=3285377520,fn=4294901760,gn=65535;class MurmurHash3_64{constructor(e){this.h1=e?4294967295&e:dn;this.h2=e?4294967295&e:dn}update(e){let t,a;if("string"==typeof e){t=new Uint8Array(2*e.length);a=0;for(let r=0,i=e.length;r>>8;t[a++]=255&i}}}else{if(!ArrayBuffer.isView(e))throw new Error("Invalid data format, must be a string or TypedArray.");t=e.slice();a=t.byteLength}const r=a>>2,i=a-4*r,n=new Uint32Array(t.buffer,0,r);let s=0,o=0,c=this.h1,l=this.h2;const h=3432918353,u=461845907,d=11601,f=13715;for(let e=0;e>>17;s=s*u&fn|s*f&gn;c^=s;c=c<<13|c>>>19;c=5*c+3864292196}else{o=n[e];o=o*h&fn|o*d&gn;o=o<<15|o>>>17;o=o*u&fn|o*f&gn;l^=o;l=l<<13|l>>>19;l=5*l+3864292196}s=0;switch(i){case 3:s^=t[4*r+2]<<16;case 2:s^=t[4*r+1]<<8;case 1:s^=t[4*r];s=s*h&fn|s*d&gn;s=s<<15|s>>>17;s=s*u&fn|s*f&gn;1&r?c^=s:l^=s}this.h1=c;this.h2=l}hexdigest(){let e=this.h1,t=this.h2;e^=t>>>1;e=3981806797*e&fn|36045*e&gn;t=4283543511*t&fn|(2950163797*(t<<16|e>>>16)&fn)>>>16;e^=t>>>1;e=444984403*e&fn|60499*e&gn;t=3301882366*t&fn|(3120437893*(t<<16|e>>>16)&fn)>>>16;e^=t>>>1;return(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}function resizeImageMask(e,t,a,r,i,n){const s=i*n;let o;o=t<=8?new Uint8Array(s):t<=16?new Uint16Array(s):new Uint32Array(s);const c=a/i,l=r/n;let h,u,d,f,g=0;const p=new Uint16Array(i),m=a;for(h=0;h0&&Number.isInteger(a.height)&&a.height>0&&(a.width!==f||a.height!==g)){warn("PDFImage - using the Width/Height of the image data, rather than the image dictionary.");f=a.width;g=a.height}else{const e="number"==typeof f&&f>0,t="number"==typeof g&&g>0;if(!e||!t){if(!a.fallbackDims)throw new FormatError(`Invalid image width: ${f} or height: ${g}`);warn("PDFImage - using the Width/Height of the parent image, for SMask/Mask data.");e||(f=a.fallbackDims.width);t||(g=a.fallbackDims.height)}}this.width=f;this.height=g;this.interpolate=h.get("I","Interpolate");this.imageMask=h.get("IM","ImageMask")||!1;this.matte=h.get("Matte")||!1;let p=a.bitsPerComponent;if(!p){p=h.get("BPC","BitsPerComponent");if(!p){if(!this.imageMask)throw new FormatError(`Bits per component missing in image: ${this.imageMask}`);p=1}}this.bpc=p;if(!this.imageMask){let i=h.getRaw("CS")||h.getRaw("ColorSpace");const n=!!i;if(n)this.jpxDecoderOptions?.smaskInData&&(i=Name.get("DeviceRGBA"));else if(this.jpxDecoderOptions)i=Name.get("DeviceRGBA");else switch(a.numComps){case 1:i=Name.get("DeviceGray");break;case 3:i=Name.get("DeviceRGB");break;case 4:i=Name.get("DeviceCMYK");break;default:throw new Error(`Images with ${a.numComps} color components not supported.`)}this.colorSpace=ColorSpaceUtils.parse({cs:i,xref:e,resources:r?t:null,pdfFunctionFactory:o,globalColorSpaceCache:c,localColorSpaceCache:l});this.numComps=this.colorSpace.numComps;if(this.jpxDecoderOptions){this.jpxDecoderOptions.numComponents=n?this.numComps:0;this.jpxDecoderOptions.isIndexedColormap="Indexed"===this.colorSpace.name}}this.decode=h.getArray("D","Decode");this.needsDecode=!1;if(this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode,p)||s&&!ColorSpace.isDefaultDecode(this.decode,1))){this.needsDecode=!0;const e=(1<0,c=(r+7>>3)*i,l=e.getBytes(c),h=1===r&&1===i&&o===(0===l.length||!!(128&l[0]));if(h)return{isSingleOpaquePixel:h};if(t){if(ImageResizer.needsToBeResized(r,i)){const e=new Uint8ClampedArray(r*i*4);convertBlackAndWhiteToRGBA({src:l,dest:e,width:r,height:i,nonBlackColor:0,inverseDecode:o});return ImageResizer.createImage({kind:v,data:e,width:r,height:i,interpolate:n})}const e=new OffscreenCanvas(r,i),t=e.getContext("2d"),a=t.createImageData(r,i);convertBlackAndWhiteToRGBA({src:l,dest:a.data,width:r,height:i,nonBlackColor:0,inverseDecode:o});t.putImageData(a,0,0);return{data:null,width:r,height:i,interpolate:n,bitmap:e.transferToImageBitmap()}}const u=l.byteLength;let d;if(e instanceof DecodeStream&&(!o||c===u))d=l;else if(o){d=new Uint8Array(c);d.set(l);d.fill(255,u)}else d=new Uint8Array(l);if(o)for(let e=0;e>7&1;s[d+1]=u>>6&1;s[d+2]=u>>5&1;s[d+3]=u>>4&1;s[d+4]=u>>3&1;s[d+5]=u>>2&1;s[d+6]=u>>1&1;s[d+7]=1&u;d+=8}if(d>=1}}}}else{let a=0;u=0;for(d=0,h=n;d>r;i<0?i=0:i>l&&(i=l);s[d]=i;u&=(1<s[r+1]){t=255;break}}o[h]=t}}}if(o)for(h=0,d=3,u=t*r;h>3,h=t&&ImageResizer.needsToBeResized(a,r);if(!this.smask&&!this.mask&&"DeviceRGBA"===this.colorSpace.name){i.kind=v;const e=i.data=await this.getImageBytes(o*s*4,{});return t?h?ImageResizer.createImage(i,!1):this.createBitmap(v,a,r,e):i}if(!e){let e;"DeviceGray"===this.colorSpace.name&&1===c?e=k:"DeviceRGB"!==this.colorSpace.name||8!==c||this.needsDecode||(e=C);if(e&&!this.smask&&!this.mask&&a===s&&r===o){const n=await this.#ae(s,o);if(n)return n;const c=await this.getImageBytes(o*l,{});if(t)return h?ImageResizer.createImage({data:c,kind:e,width:a,height:r,interpolate:this.interpolate},this.needsDecode):this.createBitmap(e,s,o,c);i.kind=e;i.data=c;if(this.needsDecode){assert(e===k,"PDFImage.createImageData: The image must be grayscale.");const t=i.data;for(let e=0,a=t.length;e>3,s=await this.getImageBytes(r*n,{internal:!0}),o=this.getComponents(s);let c,l;if(1===i){l=a*r;if(this.needsDecode)for(c=0;c0&&r[0].count++}class TimeSlotManager{static TIME_SLOT_DURATION_MS=20;static CHECK_TIME_EVERY=100;constructor(){this.reset()}check(){if(++this.checkedo){const e="Image exceeded maximum allowed size and was removed.";if(!c)throw new Error(e);warn(e);return}let g;h.has("OC")&&(g=await this.parseMarkedContentProps(h.get("OC"),e));let p,m,b;if(h.get("IM","ImageMask")||!1){p=await PDFImage.createMask({image:t,isOffscreenCanvasSupported:l&&!this.parsingType3Font});if(p.isSingleOpaquePixel){m=_t;b=[];r.addImageOps(m,b,g);if(i){const e={fn:m,args:b,optionalContent:g};n.set(i,u,e);u&&this._regionalImageCache.set(null,u,e)}return}if(this.parsingType3Font){b=function compileType3Glyph({data:e,width:t,height:a}){if(t>1e3||a>1e3)return null;const r=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),i=t+1,n=new Uint8Array(i*(a+1));let s,o,c;const l=t+7&-8,h=new Uint8Array(l*a);let u=0;for(const t of e){let e=128;for(;e>0;){h[u++]=t&e?0:255;e>>=1}}let d=0;u=0;if(0!==h[u]){n[0]=1;++d}for(o=1;o>2)+(h[u+1]?4:0)+(h[u-l+1]?8:0);if(r[e]){n[c+o]=r[e];++d}u++}if(h[u-l]!==h[u]){n[c+o]=h[u]?2:4;++d}if(d>1e3)return null}u=l*(a-1);c=s*i;if(0!==h[u]){n[c]=8;++d}for(o=1;o1e3)return null;const f=new Int32Array([0,i,-1,0,-i,0,0,0,1]),g=[],{a:p,b:m,c:b,d:y,e:w,f:x}=(new DOMMatrix).scaleSelf(1/t,-1/a).translateSelf(0,-a);for(s=0;d&&s<=a;s++){let e=s*i;const a=e+t;for(;e>4;n[e]&=l>>2|l<<2}r=e%i;o=e/i|0;g.push(Wt,p*r+b*o+w,m*r+y*o+x);n[e]||--d}while(c!==e);--s}return[qt,[new Float32Array(g)],new Float32Array([0,0,t,a])]}(p);if(b){r.addImageOps(jt,b,g);return}warn("Cannot compile Type3 glyph.");r.addImageOps(Dt,[p],g);return}const e=`mask_${this.idFactory.createObjId()}`;r.addDependency(e);p.dataLen=p.bitmap?p.width*p.height*4:p.data.length;this._sendImgData(e,p);m=Dt;b=[{data:e,width:p.width,height:p.height,interpolate:p.interpolate,count:1}];r.addImageOps(m,b,g);if(i){const t={objId:e,fn:m,args:b,optionalContent:g};n.set(i,u,t);u&&this._regionalImageCache.set(null,u,t)}return}const y=h.has("SMask")||h.has("Mask");if(a&&d+f<200&&!y){try{const i=new PDFImage({xref:this.xref,res:e,image:t,isInline:a,pdfFunctionFactory:this._pdfFunctionFactory,globalColorSpaceCache:this.globalColorSpaceCache,localColorSpaceCache:s});p=await i.createImageData(!0,!1);r.addImageOps(Nt,[p],g)}catch(e){const t=`Unable to decode inline image: "${e}".`;if(!c)throw new Error(t);warn(t)}return}let w=`img_${this.idFactory.createObjId()}`,x=!1,S=null;if(this.parsingType3Font)w=`${this.idFactory.getDocId()}_type3_${w}`;else if(i&&u){x=this.globalImageCache.shouldCache(u,this.pageIndex);if(x){assert(!a,"Cannot cache an inline image globally.");w=`${this.idFactory.getDocId()}_${w}`}}r.addDependency(w);m=Rt;b=[w,d,f];r.addImageOps(m,b,g,y);if(x){S={objId:w,fn:m,args:b,optionalContent:g,hasMask:y,byteSize:0};if(this.globalImageCache.hasDecodeFailed(u)){this.globalImageCache.setData(u,S);this._sendImgData(w,null,x);return}if(d*f>25e4||y){const e=await this.handler.sendWithPromise("commonobj",[w,"CopyLocalImage",{imageRef:u}]);if(e){this.globalImageCache.setData(u,S);this.globalImageCache.addByteSize(u,e);return}}}PDFImage.buildImage({xref:this.xref,res:e,image:t,isInline:a,pdfFunctionFactory:this._pdfFunctionFactory,globalColorSpaceCache:this.globalColorSpaceCache,localColorSpaceCache:s}).then(async e=>{p=await e.createImageData(!1,l);p.dataLen=p.bitmap?p.width*p.height*4:p.data.length;p.ref=u;x&&this.globalImageCache.addByteSize(u,p.dataLen);return this._sendImgData(w,p,x)}).catch(e=>{warn(`Unable to decode image "${w}": "${e}".`);u&&this.globalImageCache.addDecodeFailed(u);return this._sendImgData(w,null,x)});if(i){const e={objId:w,fn:m,args:b,optionalContent:g,hasMask:y};n.set(i,u,e);if(u){this._regionalImageCache.set(null,u,e);if(x){assert(S,"The global cache-data must be available.");this.globalImageCache.setData(u,S)}}}}handleSMask(e,t,a,r,i,n,s){const o=e.get("G"),c={subtype:e.get("S").name,backdrop:e.get("BC")},l=e.get("TR");if(isPDFFunction(l)){const e=this._pdfFunctionFactory.create(l),t=new Uint8Array(256),a=new Float32Array(1);for(let r=0;r<256;r++){a[0]=r/255;e(a,0,a,0);t[r]=255*a[0]|0}c.transferMap=t}return this.buildFormXObject(t,o,c,a,r,i.state.clone({newPath:!0}),n,s)}handleTransferFunction(e){let t;if(Array.isArray(e))t=e;else{if(!isPDFFunction(e))return null;t=[e]}const a=[];let r=0,i=0;for(const e of t){const t=this.xref.fetchIfRef(e);r++;if(isName(t,"Identity")){a.push(null);continue}if(!isPDFFunction(t))return null;const n=this._pdfFunctionFactory.create(t),s=new Uint8Array(256),o=new Float32Array(1);for(let e=0;e<256;e++){o[0]=e/255;n(o,0,o,0);s[e]=255*o[0]|0}a.push(s);i++}return 1!==r&&4!==r||0===i?null:a}handleTilingType(e,t,a,r,i,n,s,o){const c=new OperatorList,l=Dict.merge({xref:this.xref,dictArray:[i.get("Resources"),a]});return this.getOperatorList({stream:r,task:s,resources:l,operatorList:c}).then(function(){const a=c.getIR(),r=getTilingPatternIR(a,i,t);n.addDependencies(c.dependencies);n.addOp(e,r);i.objId&&o.set(null,i.objId,{operatorListIR:a,dict:i})}).catch(e=>{if(!(e instanceof AbortException)){if(!this.options.ignoreErrors)throw e;warn(`handleTilingType - ignoring pattern: "${e}".`)}})}async handleSetFont(e,t,a,r,i,n,s=null,o=null){const c=t?.[0]instanceof Name?t[0].name:null,l=await this.loadFont(c,a,e,i,s,o);l.font.isType3Font&&r.addDependencies(l.type3Dependencies);n.font=l.font;l.send(this.handler);return l.loadedName}handleText(e,t){const a=t.font,r=a.charsToGlyphs(e);if(a.data){(!!(t.textRenderingMode&S)||"Pattern"===t.fillColorSpace.name||a.disableFontFace)&&PartialEvaluator.buildFontPaths(a,r,this.handler,this.options)}return r}ensureStateFont(e){if(e.font)return;const t=new FormatError("Missing setFont (Tf) operator before text rendering operator.");if(!this.options.ignoreErrors)throw t;warn(`ensureStateFont: "${t}".`)}async setGState({resources:e,gState:t,operatorList:a,cacheKey:r,task:i,stateManager:n,localGStateCache:s,localColorSpaceCache:o,seenRefs:c}){const l=t.objId;let h=!0;const u=[];let d=Promise.resolve();for(const[r,s]of t)switch(r){case"Type":break;case"LW":if("number"!=typeof s){warn(`Invalid LW (line width): ${s}`);break}u.push([r,Math.abs(s)]);break;case"LC":case"LJ":case"ML":case"D":case"RI":case"FL":case"CA":case"ca":u.push([r,s]);break;case"Font":h=!1;d=d.then(()=>this.handleSetFont(e,null,s[0],a,i,n.state).then(function(e){a.addDependency(e);u.push([r,[e,s[1]]])}));break;case"BM":u.push([r,normalizeBlendMode(s)]);break;case"SMask":if(isName(s,"None")){u.push([r,!1]);break}if(s instanceof Dict){h=!1;d=d.then(()=>this.handleSMask(s,e,a,i,n,o,c));u.push([r,!0])}else warn("Unsupported SMask type");break;case"TR":const t=this.handleTransferFunction(s);u.push([r,t]);break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":info("graphic state operator "+r);break;default:info("Unknown graphic state operator "+r)}await d;u.length>0&&a.addOp(ge,[u]);h&&s.set(r,l,u)}loadFont(e,t,a,r,i=null,n=null){const errorFont=async()=>new TranslatedFont({loadedName:"g_font_error",font:new ErrorFont(`Font "${e}" is not available.`),dict:t});let s;if(t)t instanceof Ref&&(s=t);else{const t=a.get("Font");t&&(s=t.getRaw(e))}if(s){if(this.type3FontRefs?.has(s))return errorFont();if(this.fontCache.has(s))return this.fontCache.get(s);try{t=this.xref.fetchIfRef(s)}catch(e){warn(`loadFont - lookup failed: "${e}".`)}}if(!(t instanceof Dict)){if(!this.options.ignoreErrors&&!this.parsingType3Font){warn(`Font "${e}" is not available.`);return errorFont()}warn(`Font "${e}" is not available -- attempting to fallback to a default font.`);t=i||PartialEvaluator.fallbackFontDict}if(t.cacheKey&&this.fontCache.has(t.cacheKey))return this.fontCache.get(t.cacheKey);const{promise:o,resolve:c}=Promise.withResolvers();let l;try{l=this.preEvaluateFont(t);l.cssFontInfo=n}catch(e){warn(`loadFont - preEvaluateFont failed: "${e}".`);return errorFont()}const{descriptor:h,hash:u}=l,d=s instanceof Ref;let f;if(u&&h instanceof Dict){const e=h.fontAliases||=Object.create(null);if(e[u]){const t=e[u].aliasRef;if(d&&t&&this.fontCache.has(t)){this.fontCache.putAlias(s,t);return this.fontCache.get(s)}}else e[u]={fontID:this.idFactory.createFontId()};d&&(e[u].aliasRef=s);f=e[u].fontID}else f=this.idFactory.createFontId();assert(f?.startsWith("f"),'The "fontID" must be (correctly) defined.');if(d)this.fontCache.put(s,o);else{t.cacheKey=`cacheKey_${f}`;this.fontCache.put(t.cacheKey,o)}t.loadedName=`${this.idFactory.getDocId()}_${f}`;this.translateFont(l).then(async e=>{const i=new TranslatedFont({loadedName:t.loadedName,font:e,dict:t});if(e.isType3Font)try{await i.loadType3Data(this,a,r)}catch(e){throw new Error(`Type3 font load error: ${e}`)}c(i)}).catch(e=>{warn(`loadFont - translateFont failed: "${e}".`);c(new TranslatedFont({loadedName:t.loadedName,font:new ErrorFont(e?.message),dict:t}))});return o}buildPath(e,t,a){const{pathMinMax:r,pathBuffer:i}=a;switch(0|e){case Ce:{const e=a.currentPointX=t[0],n=a.currentPointY=t[1],s=t[2],o=t[3],c=e+s,l=n+o;0===s||0===o?i.push(Ht,e,n,Wt,c,l,$t):i.push(Ht,e,n,Wt,c,n,Wt,c,l,Wt,e,l,$t);Util.rectBoundingBox(e,n,c,l,r);break}case ye:{const e=a.currentPointX=t[0],n=a.currentPointY=t[1];i.push(Ht,e,n);Util.pointBoundingBox(e,n,r);break}case we:{const e=a.currentPointX=t[0],n=a.currentPointY=t[1];i.push(Wt,e,n);Util.pointBoundingBox(e,n,r);break}case xe:{const e=a.currentPointX,n=a.currentPointY,[s,o,c,l,h,u]=t;a.currentPointX=h;a.currentPointY=u;i.push(zt,s,o,c,l,h,u);Util.bezierBoundingBox(e,n,s,o,c,l,h,u,r);break}case Se:{const e=a.currentPointX,n=a.currentPointY,[s,o,c,l]=t;a.currentPointX=c;a.currentPointY=l;i.push(zt,e,n,s,o,c,l);Util.bezierBoundingBox(e,n,e,n,s,o,c,l,r);break}case Ae:{const e=a.currentPointX,n=a.currentPointY,[s,o,c,l]=t;a.currentPointX=c;a.currentPointY=l;i.push(zt,s,o,c,l,c,l);Util.bezierBoundingBox(e,n,s,o,c,l,c,l,r);break}case ke:i.push($t)}}_getColorSpace(e,t,a){return ColorSpaceUtils.parse({cs:e,xref:this.xref,resources:t,pdfFunctionFactory:this._pdfFunctionFactory,globalColorSpaceCache:this.globalColorSpaceCache,localColorSpaceCache:a,asyncIfNotCached:!0})}async _handleColorSpace(e){try{return await e}catch(e){if(e instanceof AbortException)return null;if(this.options.ignoreErrors){warn(`_handleColorSpace - ignoring ColorSpace: "${e}".`);return null}throw e}}parseShading({shading:e,resources:t,localColorSpaceCache:a,localShadingPatternCache:r}){let i,n=r.get(e);if(n)return n;try{i=Pattern.parseShading(e,this.xref,t,this._pdfFunctionFactory,this.globalColorSpaceCache,a).getIR()}catch(t){if(t instanceof AbortException)return null;if(this.options.ignoreErrors){warn(`parseShading - ignoring shading: "${t}".`);r.set(e,null);return null}throw t}n=`pattern_${this.idFactory.createObjId()}`;this.parsingType3Font&&(n=`${this.idFactory.getDocId()}_type3_${n}`);r.set(e,n);this.parsingType3Font?this.handler.send("commonobj",[n,"Pattern",i]):this.handler.send("obj",[n,this.pageIndex,"Pattern",i]);return n}handleColorN(e,t,a,r,i,n,s,o,c,l){const h=a.pop();if(h instanceof Name){const u=i.getRaw(h.name),d=u instanceof Ref&&c.getByRef(u);if(d)try{const i=r.base?r.base.getRgbHex(a,0):null,n=getTilingPatternIR(d.operatorListIR,d.dict,i);e.addOp(t,n);return}catch{}const f=this.xref.fetchIfRef(u);if(f){const i=f instanceof BaseStream?f.dict:f,h=i.get("PatternType");if(h===mn){const o=r.base?r.base.getRgbHex(a,0):null;return this.handleTilingType(t,o,n,f,i,e,s,c)}if(h===bn){const a=i.get("Shading"),r=this.parseShading({shading:a,resources:n,localColorSpaceCache:o,localShadingPatternCache:l});if(r){const a=lookupMatrix(i.getArray("Matrix"),null);e.addOp(t,["Shading",r,a])}return}throw new FormatError(`Unknown PatternType: ${h}`)}}throw new FormatError(`Unknown PatternName: ${h}`)}_parseVisibilityExpression(e,t,a){if(++t>10){warn("Visibility expression is too deeply nested");return}const r=e.length,i=this.xref.fetchIfRef(e[0]);if(!(r<2)&&i instanceof Name){switch(i.name){case"And":case"Or":case"Not":a.push(i.name);break;default:warn(`Invalid operator ${i.name} in visibility expression`);return}for(let i=1;i0)return{type:"OCMD",expression:t}}const t=a.get("OCGs");if(Array.isArray(t)||t instanceof Dict){const e=[];if(Array.isArray(t))for(const a of t)e.push(a.toString());else e.push(t.objId);return{type:r,ids:e,policy:a.get("P")instanceof Name?a.get("P").name:null,expression:null}}if(t instanceof Ref)return{type:r,id:t.toString()}}return null}getOperatorList({stream:e,task:t,resources:a,operatorList:r,initialState:i=null,fallbackFontDict:n=null,prevRefs:s=null}){const o=e.dict?.objId,c=new RefSet(s);if(o){if(s?.has(o))throw new Error(`getOperatorList - ignoring circular reference: ${o}`);c.put(o)}a||=Dict.empty;i||=new EvalState;if(!r)throw new Error('getOperatorList: missing "operatorList" parameter');const l=this,h=this.xref,u=new LocalImageCache,d=new LocalColorSpaceCache,f=new LocalGStateCache,g=new LocalTilingPatternCache,p=new Map,m=a.get("XObject")||Dict.empty,b=a.get("Pattern")||Dict.empty,y=new StateManager(i),w=new EvaluatorPreprocessor(e,h,y),x=new TimeSlotManager;function closePendingRestoreOPS(e){for(let e=0,t=w.savedStatesDepth;e{y.state.fillColorSpace=e||ColorSpaceUtils.gray}));return}case tt:{const t=l._getColorSpace(e[0],a,d);if(t instanceof ColorSpace){y.state.strokeColorSpace=t;continue}next(l._handleColorSpace(t).then(e=>{y.state.strokeColorSpace=e||ColorSpaceUtils.gray}));return}case nt:C=y.state.fillColorSpace;e=[C.getRgbHex(e,0)];i=ht;break;case rt:C=y.state.strokeColorSpace;e=[C.getRgbHex(e,0)];i=lt;break;case ct:y.state.fillColorSpace=ColorSpaceUtils.gray;e=[ColorSpaceUtils.gray.getRgbHex(e,0)];i=ht;break;case ot:y.state.strokeColorSpace=ColorSpaceUtils.gray;e=[ColorSpaceUtils.gray.getRgbHex(e,0)];i=lt;break;case dt:y.state.fillColorSpace=ColorSpaceUtils.cmyk;e=[ColorSpaceUtils.cmyk.getRgbHex(e,0)];i=ht;break;case ut:y.state.strokeColorSpace=ColorSpaceUtils.cmyk;e=[ColorSpaceUtils.cmyk.getRgbHex(e,0)];i=lt;break;case ht:y.state.fillColorSpace=ColorSpaceUtils.rgb;e=[ColorSpaceUtils.rgb.getRgbHex(e,0)];break;case lt:y.state.strokeColorSpace=ColorSpaceUtils.rgb;e=[ColorSpaceUtils.rgb.getRgbHex(e,0)];break;case st:C=y.state.patternFillColorSpace;if(!C){if(isNumberArray(e,null)){e=[ColorSpaceUtils.gray.getRgbHex(e,0)];i=ht;break}e=[];i=Xt;break}if("Pattern"===C.name){next(l.handleColorN(r,st,e,C,b,a,t,d,g,p));return}e=[C.getRgbHex(e,0)];i=ht;break;case it:C=y.state.patternStrokeColorSpace;if(!C){if(isNumberArray(e,null)){e=[ColorSpaceUtils.gray.getRgbHex(e,0)];i=lt;break}e=[];i=Ut;break}if("Pattern"===C.name){next(l.handleColorN(r,it,e,C,b,a,t,d,g,p));return}e=[C.getRgbHex(e,0)];i=lt;break;case ft:let T;try{const t=a.get("Shading");if(!t)throw new FormatError("No shading resource found");T=t.get(e[0].name);if(!T)throw new FormatError("No shading object found")}catch(e){if(e instanceof AbortException)continue;if(l.options.ignoreErrors){warn(`getOperatorList - ignoring Shading: "${e}".`);continue}throw e}const O=l.parseShading({shading:T,resources:a,localColorSpaceCache:d,localShadingPatternCache:p});if(!O)continue;e=[O];i=ft;break;case ge:F=e[0]instanceof Name;v=e[0].name;if(F){const t=f.getByName(v);if(t){t.length>0&&r.addOp(ge,[t]);e=null;continue}}next(new Promise(function(e,i){if(!F)throw new FormatError("GState must be referred to by name.");const n=a.get("ExtGState");if(!(n instanceof Dict))throw new FormatError("ExtGState should be a dictionary.");const s=n.get(v);if(!(s instanceof Dict))throw new FormatError("GState should be a dictionary.");l.setGState({resources:a,gState:s,operatorList:r,cacheKey:v,task:t,stateManager:y,localGStateCache:f,localColorSpaceCache:d,seenRefs:c}).then(e,i)}).catch(function(e){if(!(e instanceof AbortException)){if(!l.options.ignoreErrors)throw e;warn(`getOperatorList - ignoring ExtGState: "${e}".`)}}));return;case oe:{const[t]=e;if("number"!=typeof t){warn(`Invalid setLineWidth: ${t}`);continue}e[0]=Math.abs(t);break}case ue:{const t=e[1];if("number"!=typeof t){warn(`Invalid setDash: ${t}`);continue}const a=e[0];if(!Array.isArray(a)){warn(`Invalid setDash: ${a}`);continue}a.some(e=>"number"!=typeof e)&&(e[0]=a.filter(e=>"number"==typeof e));break}case ye:case we:case xe:case Se:case Ae:case ke:case Ce:l.buildPath(i,e,y.state);continue;case ve:case Fe:case Ie:case Te:case Oe:case Me:case De:case Be:case Re:{const{state:{pathBuffer:e,pathMinMax:t}}=y;i!==Fe&&i!==De&&i!==Be||e.push($t);if(0===e.length)r.addOp(jt,[i,[null],null]);else{r.addOp(jt,[i,[new Float32Array(e)],t.slice()]);e.length=0;t.set([1/0,1/0,-1/0,-1/0],0)}continue}case Ge:r.addOp(i,[new Float32Array(e)]);continue;case yt:case wt:case kt:case Ct:continue;case St:if(!(e[0]instanceof Name)){warn(`Expected name for beginMarkedContentProps arg0=${e[0]}`);r.addOp(St,["OC",null]);continue}if("OC"===e[0].name){next(l.parseMarkedContentProps(e[1],a).then(e=>{r.addOp(St,["OC",e])}).catch(e=>{if(!(e instanceof AbortException)){if(!l.options.ignoreErrors)throw e;warn(`getOperatorList - ignoring beginMarkedContentProps: "${e}".`);r.addOp(St,["OC",null])}}));return}e=[e[0].name,e[1]instanceof Dict?e[1].get("MCID"):null];break;default:if(null!==e){for(S=0,k=e.length;S{if(!(e instanceof AbortException)){if(!this.options.ignoreErrors)throw e;warn(`getOperatorList - ignoring errors during "${t.name}" task: "${e}".`);closePendingRestoreOPS()}})}getTextContent({stream:e,task:a,resources:r,stateManager:i=null,includeMarkedContent:n=!1,sink:s,seenStyles:o=new Set,viewBox:c,lang:l=null,markedContentData:h=null,disableNormalization:u=!1,keepWhiteSpace:d=!1,prevRefs:f=null,intersector:g=null}){const p=e.dict?.objId,m=new RefSet(f);if(p){if(f?.has(p))throw new Error(`getTextContent - ignoring circular reference: ${p}`);m.put(p)}r||=Dict.empty;i||=new StateManager(new TextState);n&&(h||={level:0});const b={items:[],styles:Object.create(null),lang:l},y={initialized:!1,str:[],totalWidth:0,totalHeight:0,width:0,height:0,vertical:!1,prevTransform:null,textAdvanceScale:0,spaceInFlowMin:0,spaceInFlowMax:0,trackingSpaceMin:1/0,negativeSpaceMax:-1/0,notASpace:-1/0,transform:null,fontName:null,hasEOL:!1},w=[" "," "];let x=0;function saveLastChar(e){const t=(x+1)%2,a=" "!==w[x]&&" "===w[t];w[x]=e;x=t;return!d&&a}function shouldAddWhitepsace(){return!d&&" "!==w[x]&&" "===w[(x+1)%2]}function resetLastChars(){w[0]=w[1]=" ";x=0}const S=this,k=this.xref,C=[];let v=null;const F=new LocalImageCache,T=new LocalGStateCache,O=new EvaluatorPreprocessor(e,k,i);let M;function pushWhitespace({width:e=0,height:t=0,transform:a=y.prevTransform,fontName:r=y.fontName}){g?.addExtraChar(" ");b.items.push({str:" ",dir:"ltr",width:e,height:t,transform:a,fontName:r,hasEOL:!1})}function getCurrentTextTransform(){const e=M.font,a=[M.fontSize*M.textHScale,0,0,M.fontSize,0,M.textRise];if(e.isType3Font&&(M.fontSize<=1||e.isCharBBox)&&!isArrayEqual(M.fontMatrix,t)){const t=e.bbox[3]-e.bbox[1];t>0&&(a[3]*=t*M.fontMatrix[3])}return Util.transform(M.ctm,Util.transform(M.textMatrix,a))}function ensureTextContentItem(){if(y.initialized)return y;const{font:e,loadedName:t}=M;if(!o.has(t)){o.add(t);b.styles[t]={fontFamily:e.fallbackName,ascent:e.ascent,descent:e.descent,vertical:e.vertical};if(S.options.fontExtraProperties&&e.systemFontInfo){const a=b.styles[t];a.fontSubstitution=e.systemFontInfo.css;a.fontSubstitutionLoadedName=e.systemFontInfo.loadedName}}y.fontName=t;const a=y.transform=getCurrentTextTransform();if(e.vertical){y.width=y.totalWidth=Math.hypot(a[0],a[1]);y.height=y.totalHeight=0;y.vertical=!0}else{y.width=y.totalWidth=0;y.height=y.totalHeight=Math.hypot(a[2],a[3]);y.vertical=!1}const r=Math.hypot(M.textLineMatrix[0],M.textLineMatrix[1]),i=Math.hypot(M.ctm[0],M.ctm[1]);y.textAdvanceScale=i*r;const{fontSize:n}=M;y.trackingSpaceMin=.102*n;y.notASpace=.03*n;y.negativeSpaceMax=-.2*n;y.spaceInFlowMin=.102*n;y.spaceInFlowMax=.6*n;y.hasEOL=!1;y.initialized=!0;return y}function updateAdvanceScale(){if(!y.initialized)return;const e=Math.hypot(M.textLineMatrix[0],M.textLineMatrix[1]),t=Math.hypot(M.ctm[0],M.ctm[1])*e;if(t!==y.textAdvanceScale){if(y.vertical){y.totalHeight+=y.height*y.textAdvanceScale;y.height=0}else{y.totalWidth+=y.width*y.textAdvanceScale;y.width=0}y.textAdvanceScale=t}}function runBidiTransform(e){let t=e.str.join("");u||(t=function normalizeUnicode(e){if(!Qt){Qt=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;ea=new Map([["ſt","ſt"]])}return e.replaceAll(Qt,(e,t,a)=>t?t.normalize("NFKC"):ea.get(a))}(t));const a=bidi(t,-1,e.vertical);return{str:a.str,dir:a.dir,width:Math.abs(e.totalWidth),height:Math.abs(e.totalHeight),transform:e.transform,fontName:e.fontName,hasEOL:e.hasEOL}}async function handleSetFont(e,i){const n=await S.loadFont(e,i,r,a);M.loadedName=n.loadedName;M.font=n.font;M.fontMatrix=n.font.fontMatrix||t}function applyInverseRotation(e,t,a){const r=Math.hypot(a[0],a[1]);return[(a[0]*e+a[1]*t)/r,(a[2]*e+a[3]*t)/r]}function compareWithLastPosition(e){const t=getCurrentTextTransform();let a=t[4],r=t[5];if(M.font?.vertical){if(ac[2]||r+ec[3])return!1}else if(a+ec[2]||rc[3])return!1;if(!M.font||!y.prevTransform)return!0;let i=y.prevTransform[4],n=y.prevTransform[5];if(i===a&&n===r)return!0;let s=-1;t[0]&&0===t[1]&&0===t[2]?s=t[0]>0?0:180:t[1]&&0===t[0]&&0===t[3]&&(s=t[1]>0?90:270);switch(s){case 0:break;case 90:[a,r]=[r,a];[i,n]=[n,i];break;case 180:[a,r,i,n]=[-a,-r,-i,-n];break;case 270:[a,r]=[-r,-a];[i,n]=[-n,-i];break;default:[a,r]=applyInverseRotation(a,r,t);[i,n]=applyInverseRotation(i,n,y.prevTransform)}if(M.font.vertical){const e=(n-r)/y.textAdvanceScale,t=a-i,s=Math.sign(y.height);if(e.5*y.width){appendEOL();return!0}resetLastChars();flushTextContentItem();return!0}if(Math.abs(t)>y.width){appendEOL();return!0}e<=s*y.notASpace&&resetLastChars();if(e<=s*y.trackingSpaceMin)if(shouldAddWhitepsace()){resetLastChars();flushTextContentItem();pushWhitespace({height:Math.abs(e)})}else y.height+=e;else if(!addFakeSpaces(e,y.prevTransform,s))if(0===y.str.length){resetLastChars();pushWhitespace({height:Math.abs(e)})}else y.height+=e;Math.abs(t)>.25*y.width&&flushTextContentItem();return!0}const o=(a-i)/y.textAdvanceScale,l=r-n,h=Math.sign(y.width);if(o.5*y.height){appendEOL();return!0}resetLastChars();flushTextContentItem();return!0}if(Math.abs(l)>y.height){appendEOL();return!0}o<=h*y.notASpace&&resetLastChars();if(o<=h*y.trackingSpaceMin)if(shouldAddWhitepsace()){resetLastChars();flushTextContentItem();pushWhitespace({width:Math.abs(o)})}else y.width+=o;else if(!addFakeSpaces(o,y.prevTransform,h))if(0===y.str.length){resetLastChars();pushWhitespace({width:Math.abs(o)})}else y.width+=o;Math.abs(l)>.25*y.height&&flushTextContentItem();return!0}function buildTextContentItem({chars:e,extraSpacing:t}){const a=M.font;if(!e){const e=M.charSpacing+t;e&&(a.vertical?M.translateTextMatrix(0,-e):M.translateTextMatrix(e*M.textHScale,0));d&&compareWithLastPosition(0);return}const r=a.charsToGlyphs(e),i=M.fontMatrix[0]*M.fontSize;for(let e=0,n=r.length;e0){const e=C.join("");C.length=0;buildTextContentItem({chars:e,extraSpacing:0})}break;case Ke:if(!i.state.font){S.ensureStateFont(i.state);continue}buildTextContentItem({chars:w[0],extraSpacing:0});break;case Ye:if(!i.state.font){S.ensureStateFont(i.state);continue}M.carriageReturn();buildTextContentItem({chars:w[0],extraSpacing:0});break;case Ze:if(!i.state.font){S.ensureStateFont(i.state);continue}M.wordSpacing=w[0];M.charSpacing=w[1];M.carriageReturn();buildTextContentItem({chars:w[2],extraSpacing:0});break;case bt:flushTextContentItem();v??=r.get("XObject")||Dict.empty;y=w[0]instanceof Name;p=w[0].name;if(y&&F.getByName(p))break;next(new Promise(function(e,t){if(!y)throw new FormatError("XObject must be referred to by name.");let f=v.getRaw(p);if(f instanceof Ref){if(F.getByRef(f)){e();return}if(S.globalImageCache.getData(f,S.pageIndex)){e();return}f=k.fetch(f)}if(!(f instanceof BaseStream))throw new FormatError("XObject should be a stream");const{dict:g}=f,b=g.get("Subtype");if(!(b instanceof Name))throw new FormatError("XObject should have a Name subtype");if("Form"!==b.name){F.set(p,g.objId,!0);e();return}const w=i.state.clone(),x=new StateManager(w),C=lookupMatrix(g.getArray("Matrix"),null);C&&x.transform(C);const T=g.get("Resources");enqueueChunk();const O={enqueueInvoked:!1,enqueue(e,t){this.enqueueInvoked=!0;s.enqueue(e,t)},get desiredSize(){return s.desiredSize??0},get ready(){return s.ready}};S.getTextContent({stream:f,task:a,resources:T instanceof Dict?T:r,stateManager:x,includeMarkedContent:n,sink:s&&O,seenStyles:o,viewBox:c,lang:l,markedContentData:h,disableNormalization:u,keepWhiteSpace:d,prevRefs:m}).then(function(){O.enqueueInvoked||F.set(p,g.objId,!0);e()},t)}).catch(function(e){if(!(e instanceof AbortException)){if(!S.options.ignoreErrors)throw e;warn(`getTextContent - ignoring XObject: "${e}".`)}}));return;case ge:y=w[0]instanceof Name;p=w[0].name;if(y&&T.getByName(p))break;next(new Promise(function(e,t){if(!y)throw new FormatError("GState must be referred to by name.");const a=r.get("ExtGState");if(!(a instanceof Dict))throw new FormatError("ExtGState should be a dictionary.");const i=a.get(p);if(!(i instanceof Dict))throw new FormatError("GState should be a dictionary.");const n=i.get("Font");if(n){flushTextContentItem();M.fontName=null;M.fontSize=n[1];handleSetFont(null,n[0]).then(e,t)}else{T.set(p,i.objId,!0);e()}}).catch(function(e){if(!(e instanceof AbortException)){if(!S.options.ignoreErrors)throw e;warn(`getTextContent - ignoring ExtGState: "${e}".`)}}));return;case xt:flushTextContentItem();if(n){h.level++;b.items.push({type:"beginMarkedContent",tag:w[0]instanceof Name?w[0].name:null})}break;case St:flushTextContentItem();if(n){h.level++;let e=null;w[1]instanceof Dict&&(e=w[1].get("MCID"));b.items.push({type:"beginMarkedContentProps",id:Number.isInteger(e)?`${S.idFactory.getPageObjId()}_mc${e}`:null,tag:w[0]instanceof Name?w[0].name:null})}break;case At:flushTextContentItem();if(n){if(0===h.level)break;h.level--;b.items.push({type:"endMarkedContent"})}break;case me:!e||e.font===M.font&&e.fontSize===M.fontSize&&e.fontName===M.fontName||flushTextContentItem()}if(b.items.length>=(s?.desiredSize??1)){g=!0;break}}if(g)next(yn);else{flushTextContentItem();enqueueChunk();e()}}).catch(e=>{if(!(e instanceof AbortException)){if(!this.options.ignoreErrors)throw e;warn(`getTextContent - ignoring errors during "${a.name}" task: "${e}".`);flushTextContentItem();enqueueChunk()}})}async extractDataStructures(e,t){const a=this.xref;let r;const i=this.readToUnicode(t.toUnicode);if(t.composite){const a=e.get("CIDSystemInfo");a instanceof Dict&&(t.cidSystemInfo={registry:stringToPDFString(a.get("Registry")),ordering:stringToPDFString(a.get("Ordering")),supplement:a.get("Supplement")});try{const t=e.get("CIDToGIDMap");t instanceof BaseStream&&(r=t.getBytes())}catch(e){if(!this.options.ignoreErrors)throw e;warn(`extractDataStructures - ignoring CIDToGIDMap data: "${e}".`)}}const n=[];let s,o=null;if(e.has("Encoding")){s=e.get("Encoding");if(s instanceof Dict){o=s.get("BaseEncoding");o=o instanceof Name?o.name:null;if(s.has("Differences")){const e=s.get("Differences");let t=0;for(const r of e){const e=a.fetchIfRef(r);if("number"==typeof e)t=e;else{if(!(e instanceof Name))throw new FormatError(`Invalid entry in 'Differences' array: ${e}`);n[t++]=e.name}}}}else if(s instanceof Name)o=s.name;else{const e="Encoding is not a Name nor a Dict";if(!this.options.ignoreErrors)throw new FormatError(e);warn(e)}"MacRomanEncoding"!==o&&"MacExpertEncoding"!==o&&"WinAnsiEncoding"!==o&&(o=null)}const c=!t.file||t.isInternalFont,l=Lr()[t.name];o&&c&&l&&(o=null);if(o)t.defaultEncoding=getEncoding(o);else{let e=!!(t.flags&yr);const a=!!(t.flags&wr);if("TrueType"===t.type&&e&&a&&0!==n.length){t.flags&=~yr;e=!1}s=nr;"TrueType"!==t.type||a||(s=sr);if(e||l){s=ir;c&&(/Symbol/i.test(t.name)?s=or:/Dingbats/i.test(t.name)?s=cr:/Wingdings/i.test(t.name)&&(s=sr))}t.defaultEncoding=s}t.differences=n;t.baseEncodingName=o;t.hasEncoding=!!o||n.length>0;t.dict=e;t.toUnicode=await i;const h=await this.buildToUnicode(t);t.toUnicode=h;r&&(t.cidToGidMap=this.readCidToGidMap(r,h));return t}_simpleFontToUnicode(e,t=!1){assert(!e.composite,"Must be a simple font.");const a=[],r=e.defaultEncoding.slice(),i=e.baseEncodingName,n=e.differences;for(const e in n){const t=n[e];".notdef"!==t&&(r[e]=t)}const s=lr();for(const n in r){let o=r[n];if(""===o)continue;let c=s[o];if(void 0!==c){a[n]=String.fromCharCode(c);continue}let l=0;switch(o[0]){case"G":3===o.length&&(l=parseInt(o.substring(1),16));break;case"g":5===o.length&&(l=parseInt(o.substring(1),16));break;case"C":case"c":if(o.length>=3&&o.length<=4){const a=o.substring(1);if(t){l=parseInt(a,16);break}l=+a;if(Number.isNaN(l)&&Number.isInteger(parseInt(a,16)))return this._simpleFontToUnicode(e,!0)}break;case"u":c=getUnicodeForGlyph(o,s);-1!==c&&(l=c);break;default:switch(o){case"f_h":case"f_t":case"T_h":a[n]=o.replaceAll("_","");continue}}if(l>0&&l<=1114111&&Number.isInteger(l)){if(i&&l===+n){const e=getEncoding(i);if(e&&(o=e[n])){a[n]=String.fromCharCode(s[o]);continue}}a[n]=String.fromCodePoint(l)}}return a}async buildToUnicode(e){e.hasIncludedToUnicodeMap=e.toUnicode?.length>0;if(e.hasIncludedToUnicodeMap){!e.composite&&e.hasEncoding&&(e.fallbackToUnicode=this._simpleFontToUnicode(e));return e.toUnicode}if(!e.composite)return new ToUnicodeMap(this._simpleFontToUnicode(e));if(e.composite&&(e.cMap.builtInCMap&&!(e.cMap instanceof IdentityCMap)||"Adobe"===e.cidSystemInfo?.registry&&("GB1"===e.cidSystemInfo.ordering||"CNS1"===e.cidSystemInfo.ordering||"Japan1"===e.cidSystemInfo.ordering||"Korea1"===e.cidSystemInfo.ordering))){const{registry:t,ordering:a}=e.cidSystemInfo,r=Name.get(`${t}-${a}-UCS2`),i=await CMapFactory.create({encoding:r,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null}),n=[],s=[];e.cMap.forEach(function(e,t){if(t>65535)throw new FormatError("Max size of CID is 65,535");const a=i.lookup(t);if(a){s.length=0;for(let e=0,t=a.length;e>1;(0!==i||t.has(n))&&(a[n]=i)}return a}extractWidths(e,t,a){const r=this.xref;let i=[],n=0;const s=[];let o;if(a.composite){const t=e.get("DW");n="number"==typeof t?Math.ceil(t):1e3;const c=e.get("W");if(Array.isArray(c))for(let e=0,t=c.length;e{const t=c.get(e),r=new OperatorList;return n.getOperatorList({stream:t,task:a,resources:l,operatorList:r}).then(()=>{switch(r.fnArray[0]){case et:this.#ne(r,b);break;case Qe:b||this.#se(r)}h[e]=r.getIR();for(const e of r.dependencies)i.add(e)}).catch(function(t){warn(`Type3 font resource "${e}" is not available.`);const a=new OperatorList;h[e]=a.getIR()})});this.#ie=o.then(()=>{r.charProcOperatorList=h;if(this._bbox){r.isCharBBox=!0;r.bbox=this._bbox}});return this.#ie}#ne(e,t=NaN){const a=Util.normalizeRect(e.argsArray[0].slice(2)),r=a[2]-a[0],i=a[3]-a[1],n=Math.hypot(r,i);if(0===r||0===i){e.fnArray.splice(0,1);e.argsArray.splice(0,1)}else if(0===t||Math.round(n/t)>=10){this._bbox??=[1/0,1/0,-1/0,-1/0];Util.rectBoundingBox(...a,this._bbox)}let s=0,o=e.length;for(;s=ye&&n<=Re;if(i.variableArgs)o>s&&info(`Command ${r}: expected [0, ${s}] args, but received ${o} args.`);else{if(o!==s){const e=this.nonProcessedArgs;for(;o>s;){e.push(t.shift());o--}for(;oEvaluatorPreprocessor.MAX_INVALID_PATH_OPS)throw new FormatError(`Invalid ${e}`);warn(`Skipping ${e}`);null!==t&&(t.length=0);continue}}this.preprocessCommand(n,t);e.fn=n;e.args=t;return!0}if(a===aa)return!1;if(null!==a){null===t&&(t=[]);t.push(a);if(t.length>33)throw new FormatError("Too many arguments")}}}preprocessCommand(e,t){switch(0|e){case pe:this.stateManager.save();break;case me:this.stateManager.restore();break;case be:this.stateManager.transform(t)}}}class DefaultAppearanceEvaluator extends EvaluatorPreprocessor{constructor(e){super(new StringStream(e))}parse(){const e={fn:0,args:[]},t={fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3)};try{for(;;){e.args.length=0;if(!this.read(e))break;if(0!==this.savedStatesDepth)continue;const{fn:a,args:r}=e;switch(0|a){case qe:const[e,a]=r;e instanceof Name&&(t.fontName=e.name);"number"==typeof a&&a>0&&(t.fontSize=a);break;case ht:ColorSpaceUtils.rgb.getRgbItem(r,0,t.fontColor,0);break;case ct:ColorSpaceUtils.gray.getRgbItem(r,0,t.fontColor,0);break;case dt:ColorSpaceUtils.cmyk.getRgbItem(r,0,t.fontColor,0)}}}catch(e){warn(`parseDefaultAppearance - ignoring errors: "${e}".`)}return t}}function parseDefaultAppearance(e){return new DefaultAppearanceEvaluator(e).parse()}class AppearanceStreamEvaluator extends EvaluatorPreprocessor{constructor(e,t,a,r){super(e);this.stream=e;this.evaluatorOptions=t;this.xref=a;this.globalColorSpaceCache=r;this.resources=e.dict?.get("Resources")}parse(){const e={fn:0,args:[]};let t={scaleFactor:1,fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3),fillColorSpace:ColorSpaceUtils.gray},a=!1;const r=[];try{for(;;){e.args.length=0;if(a||!this.read(e))break;const{fn:i,args:n}=e;switch(0|i){case pe:r.push({scaleFactor:t.scaleFactor,fontSize:t.fontSize,fontName:t.fontName,fontColor:t.fontColor.slice(),fillColorSpace:t.fillColorSpace});break;case me:t=r.pop()||t;break;case Ge:t.scaleFactor*=Math.hypot(n[0],n[1]);break;case qe:const[e,i]=n;e instanceof Name&&(t.fontName=e.name);"number"==typeof i&&i>0&&(t.fontSize=i*t.scaleFactor);break;case at:t.fillColorSpace=ColorSpaceUtils.parse({cs:n[0],xref:this.xref,resources:this.resources,pdfFunctionFactory:this._pdfFunctionFactory,globalColorSpaceCache:this.globalColorSpaceCache,localColorSpaceCache:this._localColorSpaceCache});break;case nt:t.fillColorSpace.getRgbItem(n,0,t.fontColor,0);break;case ht:ColorSpaceUtils.rgb.getRgbItem(n,0,t.fontColor,0);break;case ct:ColorSpaceUtils.gray.getRgbItem(n,0,t.fontColor,0);break;case dt:ColorSpaceUtils.cmyk.getRgbItem(n,0,t.fontColor,0);break;case Ke:case Je:case Ye:case Ze:a=!0}}}catch(e){warn(`parseAppearanceStream - ignoring errors: "${e}".`)}this.stream.reset();delete t.scaleFactor;delete t.fillColorSpace;return t}get _localColorSpaceCache(){return shadow(this,"_localColorSpaceCache",new LocalColorSpaceCache)}get _pdfFunctionFactory(){return shadow(this,"_pdfFunctionFactory",new PDFFunctionFactory({xref:this.xref,isEvalSupported:this.evaluatorOptions.isEvalSupported}))}}function getPdfColor(e,t){if(e[0]===e[1]&&e[1]===e[2]){return`${numberToString(e[0]/255)} ${t?"g":"G"}`}return Array.from(e,e=>numberToString(e/255)).join(" ")+" "+(t?"rg":"RG")}class FakeUnicodeFont{constructor(e,t){this.xref=e;this.widths=null;this.firstChar=1/0;this.lastChar=-1/0;this.fontFamily=t;const a=new OffscreenCanvas(1,1);this.ctxMeasure=a.getContext("2d",{willReadFrequently:!0});FakeUnicodeFont._fontNameId||(FakeUnicodeFont._fontNameId=1);this.fontName=Name.get(`InvalidPDFjsFont_${t}_${FakeUnicodeFont._fontNameId++}`)}get fontDescriptorRef(){if(!FakeUnicodeFont._fontDescriptorRef){const e=new Dict(this.xref);e.setIfName("Type","FontDescriptor");e.set("FontName",this.fontName);e.set("FontFamily","MyriadPro Regular");e.set("FontBBox",[0,0,0,0]);e.setIfName("FontStretch","Normal");e.set("FontWeight",400);e.set("ItalicAngle",0);FakeUnicodeFont._fontDescriptorRef=this.xref.getNewPersistentRef(e)}return FakeUnicodeFont._fontDescriptorRef}get descendantFontRef(){const e=new Dict(this.xref);e.set("BaseFont",this.fontName);e.setIfName("Type","Font");e.setIfName("Subtype","CIDFontType0");e.setIfName("CIDToGIDMap","Identity");e.set("FirstChar",this.firstChar);e.set("LastChar",this.lastChar);e.set("FontDescriptor",this.fontDescriptorRef);e.set("DW",1e3);const t=[],a=[...this.widths.entries()].sort();let r=null,i=null;for(const[e,n]of a)if(r)if(e===r+i.length)i.push(n);else{t.push(r,i);r=e;i=[n]}else{r=e;i=[n]}r&&t.push(r,i);e.set("W",t);const n=new Dict(this.xref);n.set("Ordering","Identity");n.set("Registry","Adobe");n.set("Supplement",0);e.set("CIDSystemInfo",n);return this.xref.getNewPersistentRef(e)}get baseFontRef(){const e=new Dict(this.xref);e.set("BaseFont",this.fontName);e.setIfName("Type","Font");e.setIfName("Subtype","Type0");e.setIfName("Encoding","Identity-H");e.set("DescendantFonts",[this.descendantFontRef]);e.setIfName("ToUnicode","Identity-H");return this.xref.getNewPersistentRef(e)}get resources(){const e=new Dict(this.xref),t=new Dict(this.xref);t.set(this.fontName.name,this.baseFontRef);e.set("Font",t);return e}_createContext(){this.widths=new Map;this.ctxMeasure.font=`1000px ${this.fontFamily}`;return this.ctxMeasure}createFontResources(e){const t=this._createContext();for(const a of e.split(/\r\n?|\n/))for(const e of a.split("")){const a=e.charCodeAt(0);if(this.widths.has(a))continue;const r=t.measureText(e),i=Math.ceil(r.width);this.widths.set(a,i);this.firstChar=Math.min(a,this.firstChar);this.lastChar=Math.max(a,this.lastChar)}return this.resources}static getFirstPositionInfo(e,t,i){const[n,s,o,c]=e;let l=o-n,h=c-s;t%180!=0&&([l,h]=[h,l]);const u=a*i;return{coords:[0,h+r*i-u],bbox:[0,0,l,h],matrix:0!==t?getRotationMatrix(t,h,u):void 0}}createAppearance(e,t,i,n,s,o){const c=this._createContext(),l=[];let h=-1/0;for(const t of e.split(/\r\n?|\n/)){l.push(t);const e=c.measureText(t).width;h=Math.max(h,e);for(const e of codePointIter(t)){const t=String.fromCodePoint(e);let a=this.widths.get(e);if(void 0===a){const r=c.measureText(t);a=Math.ceil(r.width);this.widths.set(e,a);this.firstChar=Math.min(e,this.firstChar);this.lastChar=Math.max(e,this.lastChar)}}}h*=n/1e3;const[u,d,f,g]=t;let p=f-u,m=g-d;i%180!=0&&([p,m]=[m,p]);let b=1;h>p&&(b=p/h);let y=1;const w=a*n,x=r*n,S=w*l.length;S>m&&(y=m/S);const k=n*Math.min(b,y),C=["q",`0 0 ${numberToString(p)} ${numberToString(m)} re W n`,"BT",`1 0 0 1 0 ${numberToString(m+x)} Tm 0 Tc ${getPdfColor(s,!0)}`,`/${this.fontName.name} ${numberToString(k)} Tf`],{resources:v}=this;if(1!==(o="number"==typeof o&&o>=0&&o<=1?o:1)){C.push("/R0 gs");const e=new Dict(this.xref),t=new Dict(this.xref);t.set("ca",o);t.set("CA",o);t.setIfName("Type","ExtGState");e.set("R0",t);v.set("ExtGState",e)}const F=numberToString(w);for(const e of l)C.push(`0 -${F} Td <${stringToUTF16HexString(e)}> Tj`);C.push("ET","Q");const T=C.join("\n"),O=new Dict(this.xref);O.setIfName("Subtype","Form");O.setIfName("Type","XObject");O.set("BBox",[0,0,p,m]);O.set("Length",T.length);O.set("Resources",v);if(i){const e=getRotationMatrix(i,p,m);O.set("Matrix",e)}const M=new StringStream(T);M.dict=O;return M}}const wn=["m/d","m/d/yy","mm/dd/yy","mm/yy","d-mmm","d-mmm-yy","dd-mmm-yy","yy-mm-dd","mmm-yy","mmmm-yy","mmm d, yyyy","mmmm d, yyyy","m/d/yy h:MM tt","m/d/yy HH:MM"],xn=["HH:MM","h:MM tt","HH:MM:ss","h:MM:ss tt"];class NameOrNumberTree{constructor(e,t,a){this.root=e;this.xref=t;this._type=a}getAll(){const e=new Map;if(!this.root)return e;const t=this.xref,a=new RefSet;a.put(this.root);const r=[this.root];for(;r.length>0;){const i=t.fetchIfRef(r.shift());if(!(i instanceof Dict))continue;if(i.has("Kids")){const e=i.get("Kids");if(!Array.isArray(e))continue;for(const t of e){if(a.has(t))throw new FormatError(`Duplicate entry in "${this._type}" tree.`);r.push(t);a.put(t)}continue}const n=i.get(this._type);if(Array.isArray(n))for(let a=0,r=n.length;a10){warn(`Search depth limit reached for "${this._type}" tree.`);return null}const i=a.get("Kids");if(!Array.isArray(i))return null;let n=0,s=i.length-1;for(;n<=s;){const r=n+s>>1,o=t.fetchIfRef(i[r]),c=o.get("Limits");if(et.fetchIfRef(c[1]))){a=o;break}n=r+1}}if(n>s)return null}const i=a.get(this._type);if(Array.isArray(i)){let a=0,r=i.length-2;for(;a<=r;){const n=a+r>>1,s=n+(1&n),o=t.fetchIfRef(i[s]);if(eo))return i[s+1];a=s+2}}}return null}get(e){return this.xref.fetchIfRef(this.getRaw(e))}}class NameTree extends NameOrNumberTree{constructor(e,t){super(e,t,"Names")}}class NumberTree extends NameOrNumberTree{constructor(e,t){super(e,t,"Nums")}}function clearGlobalCaches(){!function clearPatternCaches(){hi=Object.create(null)}();!function clearPrimitiveCaches(){ra=Object.create(null);ia=Object.create(null);na=Object.create(null)}();!function clearUnicodeCaches(){gr.clear()}();JpxImage.cleanup()}function pickPlatformItem(e){return e instanceof Dict?e.has("UF")?e.get("UF"):e.has("F")?e.get("F"):e.has("Unix")?e.get("Unix"):e.has("Mac")?e.get("Mac"):e.has("DOS")?e.get("DOS"):null:null}class FileSpec{#oe=!1;constructor(e,t,a=!1){if(e instanceof Dict){this.xref=t;this.root=e;e.has("FS")&&(this.fs=e.get("FS"));e.has("RF")&&warn("Related file specifications are not supported");a||(e.has("EF")?this.#oe=!0:warn("Non-embedded file specifications are not supported"))}}get filename(){let e="";const t=pickPlatformItem(this.root);t&&"string"==typeof t&&(e=stringToPDFString(t,!0).replaceAll("\\\\","\\").replaceAll("\\/","/").replaceAll("\\","/"));return shadow(this,"filename",e||"unnamed")}get content(){if(!this.#oe)return null;this._contentRef||=pickPlatformItem(this.root?.get("EF"));let e=null;if(this._contentRef){const t=this.xref.fetchIfRef(this._contentRef);t instanceof BaseStream?e=t.getBytes():warn("Embedded file specification points to non-existing/invalid content")}else warn("Embedded file specification does not have any content");return e}get description(){let e="";const t=this.root?.get("Desc");t&&"string"==typeof t&&(e=stringToPDFString(t));return shadow(this,"description",e)}get serializable(){return{rawFilename:this.filename,filename:(e=this.filename,e.substring(e.lastIndexOf("/")+1)),content:this.content,description:this.description};var e}}const Sn=0,An=-2,kn=-3,Cn=-4,vn=-5,Fn=-6,In=-9;function isWhitespace(e,t){const a=e[t];return" "===a||"\n"===a||"\r"===a||"\t"===a}class XMLParserBase{_resolveEntities(e){return e.replaceAll(/&([^;]+);/g,(e,t)=>{if("#x"===t.substring(0,2))return String.fromCodePoint(parseInt(t.substring(2),16));if("#"===t.substring(0,1))return String.fromCodePoint(parseInt(t.substring(1),10));switch(t){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"';case"apos":return"'"}return this.onResolveEntity(t)})}_parseContent(e,t){const a=[];let r=t;function skipWs(){for(;r"!==e[r]&&"/"!==e[r];)++r;const i=e.substring(t,r);skipWs();for(;r"!==e[r]&&"/"!==e[r]&&"?"!==e[r];){skipWs();let t="",i="";for(;r"!==e[a]&&"?"!==e[a]&&"/"!==e[a];)++a;const r=e.substring(t,a);!function skipWs(){for(;a"!==e[a+1]);)++a;return{name:r,value:e.substring(i,a),parsed:a-t}}parseXml(e){let t=0;for(;t",a);if(t<0){this.onError(In);return}this.onEndElement(e.substring(a,t));a=t+1;break;case"?":++a;const r=this._parseProcessingInstruction(e,a);if("?>"!==e.substring(a+r.parsed,a+r.parsed+2)){this.onError(kn);return}this.onPi(r.name,r.value);a+=r.parsed+2;break;case"!":if("--"===e.substring(a+1,a+3)){t=e.indexOf("--\x3e",a+3);if(t<0){this.onError(vn);return}this.onComment(e.substring(a+3,t));a=t+3}else if("[CDATA["===e.substring(a+1,a+8)){t=e.indexOf("]]>",a+8);if(t<0){this.onError(An);return}this.onCdata(e.substring(a+8,t));a=t+3}else{if("DOCTYPE"!==e.substring(a+1,a+8)){this.onError(Fn);return}{const r=e.indexOf("[",a+8);let i=!1;t=e.indexOf(">",a+8);if(t<0){this.onError(Cn);return}if(r>0&&t>r){t=e.indexOf("]>",a+8);if(t<0){this.onError(Cn);return}i=!0}const n=e.substring(a+8,t+(i?1:0));this.onDoctype(n);a=t+(i?2:1)}}break;default:const i=this._parseContent(e,a);if(null===i){this.onError(Fn);return}let n=!1;if("/>"===e.substring(a+i.parsed,a+i.parsed+2))n=!0;else if(">"!==e.substring(a+i.parsed,a+i.parsed+1)){this.onError(In);return}this.onBeginElement(i.name,i.attributes,n);a+=i.parsed+(n?2:1)}}else{for(;ae.textContent).join(""):this.nodeValue||""}get children(){return this.childNodes||[]}hasChildNodes(){return this.childNodes?.length>0}searchNode(e,t){if(t>=e.length)return this;const a=e[t];if(a.name.startsWith("#")&&t0){r.push([i,0]);i=i.childNodes[0]}else{if(0===r.length)return null;for(;0!==r.length;){const[e,t]=r.pop(),a=t+1;if(a");for(const t of this.childNodes)t.dump(e);e.push(``)}else this.nodeValue?e.push(`>${encodeToXmlString(this.nodeValue)}`):e.push("/>")}else e.push(encodeToXmlString(this.nodeValue))}}class SimpleXMLParser extends XMLParserBase{constructor({hasAttributes:e=!1,lowerCaseName:t=!1}){super();this._currentFragment=null;this._stack=null;this._errorCode=Sn;this._hasAttributes=e;this._lowerCaseName=t}parseFromString(e){this._currentFragment=[];this._stack=[];this._errorCode=Sn;this.parseXml(e);if(this._errorCode!==Sn)return;const[t]=this._currentFragment;return t?{documentElement:t}:void 0}onText(e){if(function isWhitespaceString(e){for(let t=0,a=e.length;t\\376\\377([^<]+)/g,function(e,t){const a=t.replaceAll(/\\([0-3])([0-7])([0-7])/g,function(e,t,a,r){return String.fromCharCode(64*t+8*a+1*r)}).replaceAll(/&(amp|apos|gt|lt|quot);/g,function(e,t){switch(t){case"amp":return"&";case"apos":return"'";case"gt":return">";case"lt":return"<";case"quot":return'"'}throw new Error(`_repair: ${t} isn't defined.`)}),r=[">"];for(let e=0,t=a.length;e=32&&t<127&&60!==t&&62!==t&&38!==t?r.push(String.fromCharCode(t)):r.push("&#x"+(65536+t).toString(16).substring(1)+";")}return r.join("")})}_getSequence(e){const t=e.nodeName;return"rdf:bag"!==t&&"rdf:seq"!==t&&"rdf:alt"!==t?null:e.childNodes.filter(e=>"rdf:li"===e.nodeName)}_parseArray(e){if(!e.hasChildNodes())return;const[t]=e.childNodes,a=this._getSequence(t)||[];this._metadataMap.set(e.nodeName,a.map(e=>e.textContent.trim()))}_parse(e){let t=e.documentElement;if("rdf:rdf"!==t.nodeName){t=t.firstChild;for(;t&&"rdf:rdf"!==t.nodeName;)t=t.nextSibling}if(t&&"rdf:rdf"===t.nodeName&&t.hasChildNodes())for(const e of t.childNodes)if("rdf:description"===e.nodeName)for(const t of e.childNodes){const e=t.nodeName;switch(e){case"#text":continue;case"dc:creator":case"dc:subject":this._parseArray(t);continue}this._metadataMap.set(e,t.textContent.trim())}}get serializable(){return{parsedData:this._metadataMap,rawData:this._data}}}const Tn=1,On=2,Mn=3,Dn=4,Bn=5;class StructTreeRoot{constructor(e,t,a){this.xref=e;this.dict=t;this.ref=a instanceof Ref?a:null;this.roleMap=new Map;this.structParentIds=null}init(){this.readRoleMap()}#ce(e,t,a){if(!(e instanceof Ref)||t<0)return;this.structParentIds||=new RefSetCache;let r=this.structParentIds.get(e);if(!r){r=[];this.structParentIds.put(e,r)}r.push([t,a])}addAnnotationIdToPage(e,t){this.#ce(e,t,Dn)}readRoleMap(){const e=this.dict.get("RoleMap");if(e instanceof Dict)for(const[t,a]of e)a instanceof Name&&this.roleMap.set(t,a.name)}static async canCreateStructureTree({catalogRef:e,pdfManager:t,newAnnotationsByPage:a}){if(!(e instanceof Ref)){warn("Cannot save the struct tree: no catalog reference.");return!1}let r=0,i=!0;for(const[e,n]of a){const{ref:a}=await t.getPage(e);if(!(a instanceof Ref)){warn(`Cannot save the struct tree: page ${e} has no ref.`);i=!0;break}for(const e of n)if(e.accessibilityData?.type){e.parentTreeId=r++;i=!1}}if(i){for(const e of a.values())for(const t of e)delete t.parentTreeId;return!1}return!0}static async createStructureTree({newAnnotationsByPage:e,xref:t,catalogRef:a,pdfManager:r,changes:i}){const n=await r.ensureCatalog("cloneDict"),s=new RefSetCache;s.put(a,n);const o=t.getNewTemporaryRef();n.set("StructTreeRoot",o);const c=new Dict(t);c.set("Type",Name.get("StructTreeRoot"));const l=t.getNewTemporaryRef();c.set("ParentTree",l);const h=[];c.set("K",h);s.put(o,c);const u=new Dict(t),d=[];u.set("Nums",d);const f=await this.#le({newAnnotationsByPage:e,structTreeRootRef:o,structTreeRoot:null,kids:h,nums:d,xref:t,pdfManager:r,changes:i,cache:s});c.set("ParentTreeNextKey",f);s.put(l,u);for(const[e,t]of s.items())i.put(e,{data:t})}async canUpdateStructTree({pdfManager:e,newAnnotationsByPage:t}){if(!this.ref){warn("Cannot update the struct tree: no root reference.");return!1}let a=this.dict.get("ParentTreeNextKey");if(!Number.isInteger(a)||a<0){warn("Cannot update the struct tree: invalid next key.");return!1}const r=this.dict.get("ParentTree");if(!(r instanceof Dict)){warn("Cannot update the struct tree: ParentTree isn't a dict.");return!1}const i=r.get("Nums");if(!Array.isArray(i)){warn("Cannot update the struct tree: nums isn't an array.");return!1}const n=new NumberTree(r,this.xref);for(const a of t.keys()){const{pageDict:t}=await e.getPage(a);if(!t.has("StructParents"))continue;const r=t.get("StructParents");if(!Number.isInteger(r)||!Array.isArray(n.get(r))){warn(`Cannot save the struct tree: page ${a} has a wrong id.`);return!1}}let s=!0;for(const[r,i]of t){const{pageDict:t}=await e.getPage(r);StructTreeRoot.#he({elements:i,xref:this.xref,pageDict:t,numberTree:n});for(const e of i)if(e.accessibilityData?.type){e.accessibilityData.structParent>=0||(e.parentTreeId=a++);s=!1}}if(s){for(const e of t.values())for(const t of e){delete t.parentTreeId;delete t.structTreeParent}return!1}return!0}async updateStructureTree({newAnnotationsByPage:e,pdfManager:t,changes:a}){const{ref:r,xref:i}=this,n=this.dict.clone(),s=new RefSetCache;s.put(r,n);let o,c=n.getRaw("ParentTree");if(c instanceof Ref)o=i.fetch(c);else{o=c;c=i.getNewTemporaryRef();n.set("ParentTree",c)}o=o.clone();s.put(c,o);let l=o.getRaw("Nums"),h=null;if(l instanceof Ref){h=l;l=i.fetch(h)}l=l.slice();h||o.set("Nums",l);const u=await StructTreeRoot.#le({newAnnotationsByPage:e,structTreeRootRef:r,structTreeRoot:this,kids:null,nums:l,xref:i,pdfManager:t,changes:a,cache:s});if(-1!==u){n.set("ParentTreeNextKey",u);h&&s.put(h,l);for(const[e,t]of s.items())a.put(e,{data:t})}}static async#le({newAnnotationsByPage:e,structTreeRootRef:t,structTreeRoot:a,kids:r,nums:i,xref:n,pdfManager:s,changes:o,cache:c}){const l=Name.get("OBJR");let h,u=-1;for(const[d,f]of e){const e=await s.getPage(d),{ref:g}=e,p=g instanceof Ref;for(const{accessibilityData:s,ref:m,parentTreeId:b,structTreeParent:y}of f){if(!s?.type)continue;const{structParent:f}=s;if(a&&Number.isInteger(f)&&f>=0){let t=(h||=new Map).get(d);if(void 0===t){t=new StructTreePage(a,e.pageDict).collectObjects(g);h.set(d,t)}const r=t?.get(f);if(r){const e=n.fetch(r).clone();StructTreeRoot.#ue(e,s);o.put(r,{data:e});continue}}u=Math.max(u,b);const w=n.getNewTemporaryRef(),x=new Dict(n);StructTreeRoot.#ue(x,s);await this.#de({structTreeParent:y,tagDict:x,newTagRef:w,structTreeRootRef:t,fallbackKids:r,xref:n,cache:c});const S=new Dict(n);x.set("K",S);S.set("Type",l);p&&S.set("Pg",g);S.set("Obj",m);c.put(w,x);i.push(b,w)}}return u+1}static#ue(e,{type:t,title:a,lang:r,alt:i,expanded:n,actualText:s}){e.set("S",Name.get(t));a&&e.set("T",stringToAsciiOrUTF16BE(a));r&&e.set("Lang",stringToAsciiOrUTF16BE(r));i&&e.set("Alt",stringToAsciiOrUTF16BE(i));n&&e.set("E",stringToAsciiOrUTF16BE(n));s&&e.set("ActualText",stringToAsciiOrUTF16BE(s))}static#he({elements:e,xref:t,pageDict:a,numberTree:r}){const i=new Map;for(const t of e)if(t.structTreeParentId){const e=parseInt(t.structTreeParentId.split("_mc")[1],10);let a=i.get(e);if(!a){a=[];i.set(e,a)}a.push(t)}const n=a.get("StructParents");if(!Number.isInteger(n))return;const s=r.get(n),updateElement=(e,a,r)=>{const n=i.get(e);if(n){const e=a.getRaw("P"),i=t.fetchIfRef(e);if(e instanceof Ref&&i instanceof Dict){const e={ref:r,dict:a};for(const t of n)t.structTreeParent=e}return!0}return!1};for(const e of s){if(!(e instanceof Ref))continue;const a=t.fetch(e),r=a.get("K");if(Number.isInteger(r))updateElement(r,a,e);else if(Array.isArray(r))for(let i of r){i=t.fetchIfRef(i);if(Number.isInteger(i)&&updateElement(i,a,e))break;if(!(i instanceof Dict))continue;if(!isName(i.get("Type"),"MCR"))break;const r=i.get("MCID");if(Number.isInteger(r)&&updateElement(r,a,e))break}}}static async#de({structTreeParent:e,tagDict:t,newTagRef:a,structTreeRootRef:r,fallbackKids:i,xref:n,cache:s}){let o,c=null;if(e){({ref:c}=e);o=e.dict.getRaw("P")||r}else o=r;t.set("P",o);const l=n.fetchIfRef(o);if(!l){i.push(a);return}let h=s.get(o);if(!h){h=l.clone();s.put(o,h)}const u=h.getRaw("K");let d=u instanceof Ref?s.get(u):null;if(!d){d=n.fetchIfRef(u);d=Array.isArray(d)?d.slice():[u];const e=n.getNewTemporaryRef();h.set("K",e);s.put(e,d)}const f=d.indexOf(c);d.splice(f>=0?f+1:d.length,0,a)}}class StructElementNode{constructor(e,t){this.tree=e;this.xref=e.xref;this.dict=t;this.kids=[];this.parseKids()}get role(){const e=this.dict.get("S"),t=e instanceof Name?e.name:"",{root:a}=this.tree;return a.roleMap.get(t)??t}parseKids(){let e=null;const t=this.dict.getRaw("Pg");t instanceof Ref&&(e=t.toString());const a=this.dict.get("K");if(Array.isArray(a))for(const t of a){const a=this.parseKid(e,this.xref.fetchIfRef(t));a&&this.kids.push(a)}else{const t=this.parseKid(e,a);t&&this.kids.push(t)}}parseKid(e,t){if(Number.isInteger(t))return this.tree.pageDict.objId!==e?null:new StructElement({type:Tn,mcid:t,pageObjId:e});if(!(t instanceof Dict))return null;const a=t.getRaw("Pg");a instanceof Ref&&(e=a.toString());const r=t.get("Type")instanceof Name?t.get("Type").name:null;if("MCR"===r){if(this.tree.pageDict.objId!==e)return null;const a=t.getRaw("Stm");return new StructElement({type:On,refObjId:a instanceof Ref?a.toString():null,pageObjId:e,mcid:t.get("MCID")})}if("OBJR"===r){if(this.tree.pageDict.objId!==e)return null;const a=t.getRaw("Obj");return new StructElement({type:Mn,refObjId:a instanceof Ref?a.toString():null,pageObjId:e})}return new StructElement({type:Bn,dict:t})}}class StructElement{constructor({type:e,dict:t=null,mcid:a=null,pageObjId:r=null,refObjId:i=null}){this.type=e;this.dict=t;this.mcid=a;this.pageObjId=r;this.refObjId=i;this.parentNode=null}}class StructTreePage{constructor(e,t){this.root=e;this.xref=e?.xref??null;this.rootDict=e?.dict??null;this.pageDict=t;this.nodes=[]}collectObjects(e){if(!(this.root&&this.rootDict&&e instanceof Ref))return null;const t=this.rootDict.get("ParentTree");if(!t)return null;const a=this.root.structParentIds?.get(e);if(!a)return null;const r=new Map,i=new NumberTree(t,this.xref);for(const[e]of a){const t=i.getRaw(e);t instanceof Ref&&r.set(e,t)}return r}parse(e){if(!(this.root&&this.rootDict&&e instanceof Ref))return;const t=this.rootDict.get("ParentTree");if(!t)return;const a=this.pageDict.get("StructParents"),r=this.root.structParentIds?.get(e);if(!Number.isInteger(a)&&!r)return;const i=new Map,n=new NumberTree(t,this.xref);if(Number.isInteger(a)){const e=n.get(a);if(Array.isArray(e))for(const t of e)t instanceof Ref&&this.addNode(this.xref.fetch(t),i)}if(r)for(const[e,t]of r){const a=n.get(e);if(a){const e=this.addNode(this.xref.fetchIfRef(a),i);1===e?.kids?.length&&e.kids[0].type===Mn&&(e.kids[0].type=t)}}}addNode(e,t,a=0){if(a>40){warn("StructTree MAX_DEPTH reached.");return null}if(!(e instanceof Dict))return null;if(t.has(e))return t.get(e);const r=new StructElementNode(this,e);t.set(e,r);const i=e.get("P");if(!(i instanceof Dict)||isName(i.get("Type"),"StructTreeRoot")){this.addTopLevelNode(e,r)||t.delete(e);return r}const n=this.addNode(i,t,a+1);if(!n)return r;let s=!1;for(const t of n.kids)if(t.type===Bn&&t.dict===e){t.parentNode=r;s=!0}s||t.delete(e);return r}addTopLevelNode(e,t){const a=this.rootDict.get("K");if(!a)return!1;if(a instanceof Dict){if(a.objId!==e.objId)return!1;this.nodes[0]=t;return!0}if(!Array.isArray(a))return!0;let r=!1;for(let i=0;i40){warn("StructTree too deep to be fully serialized.");return}const r=Object.create(null);r.role=e.role;r.children=[];t.children.push(r);let i=e.dict.get("Alt");"string"!=typeof i&&(i=e.dict.get("ActualText"));"string"==typeof i&&(r.alt=stringToPDFString(i));const n=e.dict.get("A");if(n instanceof Dict){const e=lookupNormalRect(n.getArray("BBox"),null);if(e)r.bbox=e;else{const e=n.get("Width"),t=n.get("Height");"number"==typeof e&&e>0&&"number"==typeof t&&t>0&&(r.bbox=[0,0,e,t])}}const s=e.dict.get("Lang");"string"==typeof s&&(r.lang=stringToPDFString(s));for(const t of e.kids){const e=t.type===Bn?t.parentNode:null;e?nodeToSerializable(e,r,a+1):t.type===Tn||t.type===On?r.children.push({type:"content",id:`p${t.pageObjId}_mc${t.mcid}`}):t.type===Mn?r.children.push({type:"object",id:t.refObjId}):t.type===Dn&&r.children.push({type:"annotation",id:`pdfjs_internal_id_${t.refObjId}`})}}const e=Object.create(null);e.children=[];e.role="Root";for(const t of this.nodes)t&&nodeToSerializable(t,e);return e}}const Rn=function _isValidExplicitDest(e,t,a){if(!Array.isArray(a)||a.length<2)return!1;const[r,i,...n]=a;if(!e(r)&&!Number.isInteger(r))return!1;if(!t(i))return!1;const s=n.length;let o=!0;switch(i.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return 0===s;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(4!==s)return!1;o=!1;break;default:return!1}for(const e of n)if(!("number"==typeof e||o&&null===e))return!1;return!0}.bind(null,e=>e instanceof Ref,isName);function fetchDest(e){e instanceof Dict&&(e=e.get("D"));return Rn(e)?e:null}function fetchRemoteDest(e){let t=e.get("D");if(t){t instanceof Name&&(t=t.name);if("string"==typeof t)return stringToPDFString(t,!0);if(Rn(t))return JSON.stringify(t)}return null}class Catalog{#fe=null;#ge=null;builtInCMapCache=new Map;fontCache=new RefSetCache;globalColorSpaceCache=new GlobalColorSpaceCache;globalImageCache=new GlobalImageCache;nonBlendModesSet=new RefSet;pageDictCache=new RefSetCache;pageIndexCache=new RefSetCache;pageKidsCountCache=new RefSetCache;standardFontDataCache=new Map;systemFontCache=new Map;constructor(e,t){this.pdfManager=e;this.xref=t;this.#ge=t.getCatalogObj();if(!(this.#ge instanceof Dict))throw new FormatError("Catalog object is not a dictionary.");this.toplevelPagesDict}cloneDict(){return this.#ge.clone()}get version(){const e=this.#ge.get("Version");if(e instanceof Name){if(oa.test(e.name))return shadow(this,"version",e.name);warn(`Invalid PDF catalog version: ${e.name}`)}return shadow(this,"version",null)}get lang(){const e=this.#ge.get("Lang");return shadow(this,"lang",e&&"string"==typeof e?stringToPDFString(e):null)}get needsRendering(){const e=this.#ge.get("NeedsRendering");return shadow(this,"needsRendering","boolean"==typeof e&&e)}get collection(){let e=null;try{const t=this.#ge.get("Collection");t instanceof Dict&&t.size>0&&(e=t)}catch(e){if(e instanceof MissingDataException)throw e;info("Cannot fetch Collection entry; assuming no collection is present.")}return shadow(this,"collection",e)}get acroForm(){let e=null;try{const t=this.#ge.get("AcroForm");t instanceof Dict&&t.size>0&&(e=t)}catch(e){if(e instanceof MissingDataException)throw e;info("Cannot fetch AcroForm entry; assuming no forms are present.")}return shadow(this,"acroForm",e)}get acroFormRef(){const e=this.#ge.getRaw("AcroForm");return shadow(this,"acroFormRef",e instanceof Ref?e:null)}get metadata(){const e=this.#ge.getRaw("Metadata");if(!(e instanceof Ref))return shadow(this,"metadata",null);let t=null;try{const a=this.xref.fetch(e,!this.xref.encrypt?.encryptMetadata);if(a instanceof BaseStream&&a.dict instanceof Dict){const e=a.dict.get("Type"),r=a.dict.get("Subtype");if(isName(e,"Metadata")&&isName(r,"XML")){const e=stringToUTF8String(a.getString());e&&(t=new MetadataParser(e).serializable)}}}catch(e){if(e instanceof MissingDataException)throw e;info(`Skipping invalid Metadata: "${e}".`)}return shadow(this,"metadata",t)}get markInfo(){let e=null;try{e=this.#pe()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read mark info.")}return shadow(this,"markInfo",e)}#pe(){const e=this.#ge.get("MarkInfo");if(!(e instanceof Dict))return null;const t={Marked:!1,UserProperties:!1,Suspects:!1};for(const a in t){const r=e.get(a);"boolean"==typeof r&&(t[a]=r)}return t}get structTreeRoot(){let e=null;try{e=this.#me()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable read to structTreeRoot info.")}return shadow(this,"structTreeRoot",e)}#me(){const e=this.#ge.getRaw("StructTreeRoot"),t=this.xref.fetchIfRef(e);if(!(t instanceof Dict))return null;const a=new StructTreeRoot(this.xref,t,e);a.init();return a}get toplevelPagesDict(){const e=this.#ge.get("Pages");if(!(e instanceof Dict))throw new FormatError("Invalid top-level pages dictionary.");return shadow(this,"toplevelPagesDict",e)}get documentOutline(){let e=null;try{e=this.#be()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read document outline.")}return shadow(this,"documentOutline",e)}#be(){let e=this.#ge.get("Outlines");if(!(e instanceof Dict))return null;e=e.getRaw("First");if(!(e instanceof Ref))return null;const t={items:[]},a=[{obj:e,parent:t}],r=new RefSet;r.put(e);const i=this.xref,n=new Uint8ClampedArray(3);for(;a.length>0;){const t=a.shift(),s=i.fetchIfRef(t.obj);if(null===s)continue;s.has("Title")||warn("Invalid outline item encountered.");const o={url:null,dest:null,action:null};Catalog.parseDestDictionary({destDict:s,resultObj:o,docBaseUrl:this.baseUrl,docAttachments:this.attachments});const c=s.get("Title"),l=s.get("F")||0,h=s.getArray("C"),u=s.get("Count");let d=n;!isNumberArray(h,3)||0===h[0]&&0===h[1]&&0===h[2]||(d=ColorSpaceUtils.rgb.getRgb(h,0));const f={action:o.action,attachment:o.attachment,dest:o.dest,url:o.url,unsafeUrl:o.unsafeUrl,newWindow:o.newWindow,setOCGState:o.setOCGState,title:"string"==typeof c?stringToPDFString(c):"",color:d,count:Number.isInteger(u)?u:void 0,bold:!!(2&l),italic:!!(1&l),items:[]};t.parent.items.push(f);e=s.getRaw("First");if(e instanceof Ref&&!r.has(e)){a.push({obj:e,parent:f});r.put(e)}e=s.getRaw("Next");if(e instanceof Ref&&!r.has(e)){a.push({obj:e,parent:t.parent});r.put(e)}}return t.items.length>0?t.items:null}get permissions(){let e=null;try{e=this.#ye()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read permissions.")}return shadow(this,"permissions",e)}#ye(){const e=this.xref.trailer.get("Encrypt");if(!(e instanceof Dict))return null;let t=e.get("P");if("number"!=typeof t)return null;t+=2**32;const a=[];for(const e in w){const r=w[e];t&r&&a.push(r)}return a}get optionalContentConfig(){let e=null;try{const t=this.#ge.get("OCProperties");if(!t)return shadow(this,"optionalContentConfig",null);const a=t.get("D");if(!a)return shadow(this,"optionalContentConfig",null);const r=t.get("OCGs");if(!Array.isArray(r))return shadow(this,"optionalContentConfig",null);const i=new RefSetCache;for(const e of r)e instanceof Ref&&!i.has(e)&&i.put(e,this.#we(e));e=this.#xe(a,i)}catch(e){if(e instanceof MissingDataException)throw e;warn(`Unable to read optional content config: ${e}`)}return shadow(this,"optionalContentConfig",e)}#we(e){const t=this.xref.fetch(e),a={id:e.toString(),name:null,intent:null,usage:{print:null,view:null},rbGroups:[]},r=t.get("Name");"string"==typeof r&&(a.name=stringToPDFString(r));let i=t.getArray("Intent");Array.isArray(i)||(i=[i]);i.every(e=>e instanceof Name)&&(a.intent=i.map(e=>e.name));const n=t.get("Usage");if(!(n instanceof Dict))return a;const s=a.usage,o=n.get("Print");if(o instanceof Dict){const e=o.get("PrintState");if(e instanceof Name)switch(e.name){case"ON":case"OFF":s.print={printState:e.name}}}const c=n.get("View");if(c instanceof Dict){const e=c.get("ViewState");if(e instanceof Name)switch(e.name){case"ON":case"OFF":s.view={viewState:e.name}}}return a}#xe(e,t){function parseOnOff(e){const a=[];if(Array.isArray(e))for(const r of e)r instanceof Ref&&t.has(r)&&a.push(r.toString());return a}function parseOrder(e,a=0){if(!Array.isArray(e))return null;const i=[];for(const n of e){if(n instanceof Ref&&t.has(n)){r.put(n);i.push(n.toString());continue}const e=parseNestedOrder(n,a);e&&i.push(e)}if(a>0)return i;const n=[];for(const[e]of t.items())r.has(e)||n.push(e.toString());n.length&&i.push({name:null,order:n});return i}function parseNestedOrder(e,t){if(++t>i){warn("parseNestedOrder - reached MAX_NESTED_LEVELS.");return null}const r=a.fetchIfRef(e);if(!Array.isArray(r))return null;const n=a.fetchIfRef(r[0]);if("string"!=typeof n)return null;const s=parseOrder(r.slice(1),t);return s?.length?{name:stringToPDFString(n),order:s}:null}const a=this.xref,r=new RefSet,i=10;!function parseRBGroups(e){if(Array.isArray(e))for(const r of e){const e=a.fetchIfRef(r);if(!Array.isArray(e)||!e.length)continue;const i=new Set;for(const a of e)if(a instanceof Ref&&t.has(a)&&!i.has(a.toString())){i.add(a.toString());t.get(a).rbGroups.push(i)}}}(e.get("RBGroups"));return{name:"string"==typeof e.get("Name")?stringToPDFString(e.get("Name")):null,creator:"string"==typeof e.get("Creator")?stringToPDFString(e.get("Creator")):null,baseState:e.get("BaseState")instanceof Name?e.get("BaseState").name:null,on:parseOnOff(e.get("ON")),off:parseOnOff(e.get("OFF")),order:parseOrder(e.get("Order")),groups:[...t]}}setActualNumPages(e=null){this.#fe=e}get hasActualNumPages(){return null!==this.#fe}get _pagesCount(){const e=this.toplevelPagesDict.get("Count");if(!Number.isInteger(e))throw new FormatError("Page count in top-level pages dictionary is not an integer.");return shadow(this,"_pagesCount",e)}get numPages(){return this.#fe??this._pagesCount}get destinations(){const e=this.#Se(),t=Object.create(null);for(const a of e)if(a instanceof NameTree)for(const[e,r]of a.getAll()){const a=fetchDest(r);a&&(t[stringToPDFString(e,!0)]=a)}else if(a instanceof Dict)for(const[e,r]of a){const a=fetchDest(r);a&&(t[stringToPDFString(e,!0)]||=a)}return shadow(this,"destinations",t)}getDestination(e){if(this.hasOwnProperty("destinations"))return this.destinations[e]??null;const t=this.#Se();for(const a of t)if(a instanceof NameTree||a instanceof Dict){const t=fetchDest(a.get(e));if(t)return t}if(t.length){const t=this.destinations[e];if(t)return t}return null}#Se(){const e=this.#ge.get("Names"),t=[];e?.has("Dests")&&t.push(new NameTree(e.getRaw("Dests"),this.xref));this.#ge.has("Dests")&&t.push(this.#ge.get("Dests"));return t}get pageLabels(){let e=null;try{e=this.#Ae()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read page labels.")}return shadow(this,"pageLabels",e)}#Ae(){const e=this.#ge.getRaw("PageLabels");if(!e)return null;const t=new Array(this.numPages);let a=null,r="";const i=new NumberTree(e,this.xref).getAll();let n="",s=1;for(let e=0,o=this.numPages;e=1))throw new FormatError("Invalid start in PageLabel dictionary.");s=e}else s=1}switch(a){case"D":n=s;break;case"R":case"r":n=toRomanNumerals(s,"r"===a);break;case"A":case"a":const e=26,t="a"===a?97:65,r=s-1;n=String.fromCharCode(t+r%e).repeat(Math.floor(r/e)+1);break;default:if(a)throw new FormatError(`Invalid style "${a}" in PageLabel dictionary.`);n=""}t[e]=r+n;s++}return t}get pageLayout(){const e=this.#ge.get("PageLayout");let t="";if(e instanceof Name)switch(e.name){case"SinglePage":case"OneColumn":case"TwoColumnLeft":case"TwoColumnRight":case"TwoPageLeft":case"TwoPageRight":t=e.name}return shadow(this,"pageLayout",t)}get pageMode(){const e=this.#ge.get("PageMode");let t="UseNone";if(e instanceof Name)switch(e.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"FullScreen":case"UseOC":case"UseAttachments":t=e.name}return shadow(this,"pageMode",t)}get viewerPreferences(){const e=this.#ge.get("ViewerPreferences");if(!(e instanceof Dict))return shadow(this,"viewerPreferences",null);let t=null;for(const[a,r]of e){let e;switch(a){case"HideToolbar":case"HideMenubar":case"HideWindowUI":case"FitWindow":case"CenterWindow":case"DisplayDocTitle":case"PickTrayByPDFSize":"boolean"==typeof r&&(e=r);break;case"NonFullScreenPageMode":if(r instanceof Name)switch(r.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"UseOC":e=r.name;break;default:e="UseNone"}break;case"Direction":if(r instanceof Name)switch(r.name){case"L2R":case"R2L":e=r.name;break;default:e="L2R"}break;case"ViewArea":case"ViewClip":case"PrintArea":case"PrintClip":if(r instanceof Name)switch(r.name){case"MediaBox":case"CropBox":case"BleedBox":case"TrimBox":case"ArtBox":e=r.name;break;default:e="CropBox"}break;case"PrintScaling":if(r instanceof Name)switch(r.name){case"None":case"AppDefault":e=r.name;break;default:e="AppDefault"}break;case"Duplex":if(r instanceof Name)switch(r.name){case"Simplex":case"DuplexFlipShortEdge":case"DuplexFlipLongEdge":e=r.name;break;default:e="None"}break;case"PrintPageRange":if(Array.isArray(r)&&r.length%2==0){r.every((e,t,a)=>Number.isInteger(e)&&e>0&&(0===t||e>=a[t-1])&&e<=this.numPages)&&(e=r)}break;case"NumCopies":Number.isInteger(r)&&r>0&&(e=r);break;default:warn(`Ignoring non-standard key in ViewerPreferences: ${a}.`);continue}if(void 0!==e){t??=Object.create(null);t[a]=e}else warn(`Bad value, for key "${a}", in ViewerPreferences: ${r}.`)}return shadow(this,"viewerPreferences",t)}get openAction(){const e=this.#ge.get("OpenAction"),t=Object.create(null);if(e instanceof Dict){const a=new Dict(this.xref);a.set("A",e);const r={url:null,dest:null,action:null};Catalog.parseDestDictionary({destDict:a,resultObj:r});Array.isArray(r.dest)?t.dest=r.dest:r.action&&(t.action=r.action)}else Rn(e)&&(t.dest=e);return shadow(this,"openAction",objectSize(t)>0?t:null)}get attachments(){const e=this.#ge.get("Names");let t=null;if(e instanceof Dict&&e.has("EmbeddedFiles")){const a=new NameTree(e.getRaw("EmbeddedFiles"),this.xref);for(const[e,r]of a.getAll()){const a=new FileSpec(r,this.xref);t??=Object.create(null);t[stringToPDFString(e,!0)]=a.serializable}}return shadow(this,"attachments",t)}get xfaImages(){const e=this.#ge.get("Names");let t=null;if(e instanceof Dict&&e.has("XFAImages")){const a=new NameTree(e.getRaw("XFAImages"),this.xref);for(const[e,r]of a.getAll())if(r instanceof BaseStream){t??=new Map;t.set(stringToPDFString(e,!0),r.getBytes())}}return shadow(this,"xfaImages",t)}#ke(){const e=this.#ge.get("Names");let t=null;function appendIfJavaScriptDict(e,a){if(!(a instanceof Dict))return;if(!isName(a.get("S"),"JavaScript"))return;let r=a.get("JS");if(r instanceof BaseStream)r=r.getString();else if("string"!=typeof r)return;r=stringToPDFString(r,!0).replaceAll("\0","");r&&(t||=new Map).set(e,r)}if(e instanceof Dict&&e.has("JavaScript")){const t=new NameTree(e.getRaw("JavaScript"),this.xref);for(const[e,a]of t.getAll())appendIfJavaScriptDict(stringToPDFString(e,!0),a)}const a=this.#ge.get("OpenAction");a&&appendIfJavaScriptDict("OpenAction",a);return t}get jsActions(){const e=this.#ke();let t=collectActions(this.xref,this.#ge,ae);if(e){t||=Object.create(null);for(const[a,r]of e)a in t?t[a].push(r):t[a]=[r]}return shadow(this,"jsActions",t)}async cleanup(e=!1){clearGlobalCaches();this.globalColorSpaceCache.clear();this.globalImageCache.clear(e);this.pageKidsCountCache.clear();this.pageIndexCache.clear();this.pageDictCache.clear();this.nonBlendModesSet.clear();for(const{dict:e}of await Promise.all(this.fontCache))delete e.cacheKey;this.fontCache.clear();this.builtInCMapCache.clear();this.standardFontDataCache.clear();this.systemFontCache.clear()}async getPageDict(e){const t=[this.toplevelPagesDict],a=new RefSet,r=this.#ge.getRaw("Pages");r instanceof Ref&&a.put(r);const i=this.xref,n=this.pageKidsCountCache,s=this.pageIndexCache,o=this.pageDictCache;let c=0;for(;t.length;){const r=t.pop();if(r instanceof Ref){const l=n.get(r);if(l>=0&&c+l<=e){c+=l;continue}if(a.has(r))throw new FormatError("Pages tree contains circular reference.");a.put(r);const h=await(o.get(r)||i.fetchAsync(r));if(h instanceof Dict){let t=h.getRaw("Type");t instanceof Ref&&(t=await i.fetchAsync(t));if(isName(t,"Page")||!h.has("Kids")){n.has(r)||n.put(r,1);s.has(r)||s.put(r,c);if(c===e)return[h,r];c++;continue}}t.push(h);continue}if(!(r instanceof Dict))throw new FormatError("Page dictionary kid reference points to wrong type of object.");const{objId:l}=r;let h=r.getRaw("Count");h instanceof Ref&&(h=await i.fetchAsync(h));if(Number.isInteger(h)&&h>=0){l&&!n.has(l)&&n.put(l,h);if(c+h<=e){c+=h;continue}}let u=r.getRaw("Kids");u instanceof Ref&&(u=await i.fetchAsync(u));if(!Array.isArray(u)){let t=r.getRaw("Type");t instanceof Ref&&(t=await i.fetchAsync(t));if(isName(t,"Page")||!r.has("Kids")){if(c===e)return[r,null];c++;continue}throw new FormatError("Page dictionary kids object is not an array.")}for(let e=u.length-1;e>=0;e--){const a=u[e];t.push(a);r===this.toplevelPagesDict&&a instanceof Ref&&!o.has(a)&&o.put(a,i.fetchAsync(a))}}throw new Error(`Page index ${e} not found.`)}async getAllPageDicts(e=!1){const{ignoreErrors:t}=this.pdfManager.evaluatorOptions,a=[{currentNode:this.toplevelPagesDict,posInKids:0}],r=new RefSet,i=this.#ge.getRaw("Pages");i instanceof Ref&&r.put(i);const n=new Map,s=this.xref,o=this.pageIndexCache;let c=0;function addPageDict(e,t){t&&!o.has(t)&&o.put(t,c);n.set(c++,[e,t])}function addPageError(a){if(a instanceof XRefEntryException&&!e)throw a;if(e&&t&&0===c){warn(`getAllPageDicts - Skipping invalid first page: "${a}".`);a=Dict.empty}n.set(c++,[a,null])}for(;a.length>0;){const e=a.at(-1),{currentNode:t,posInKids:i}=e;let n=t.getRaw("Kids");if(n instanceof Ref)try{n=await s.fetchAsync(n)}catch(e){addPageError(e);break}if(!Array.isArray(n)){addPageError(new FormatError("Page dictionary kids object is not an array."));break}if(i>=n.length){a.pop();continue}const o=n[i];let c;if(o instanceof Ref){if(r.has(o)){addPageError(new FormatError("Pages tree contains circular reference."));break}r.put(o);try{c=await s.fetchAsync(o)}catch(e){addPageError(e);break}}else c=o;if(!(c instanceof Dict)){addPageError(new FormatError("Page dictionary kid reference points to wrong type of object."));break}let l=c.getRaw("Type");if(l instanceof Ref)try{l=await s.fetchAsync(l)}catch(e){addPageError(e);break}isName(l,"Page")||!c.has("Kids")?addPageDict(c,o instanceof Ref?o:null):a.push({currentNode:c,posInKids:0});e.posInKids++}return n}getPageIndex(e){const t=this.pageIndexCache.get(e);if(void 0!==t)return Promise.resolve(t);const a=this.xref;let r=0;const next=t=>function pagesBeforeRef(t){let r,i=0;return a.fetchAsync(t).then(function(a){if(isRefsEqual(t,e)&&!isDict(a,"Page")&&!(a instanceof Dict&&!a.has("Type")&&a.has("Contents")))throw new FormatError("The reference does not point to a /Page dictionary.");if(!a)return null;if(!(a instanceof Dict))throw new FormatError("Node must be a dictionary.");r=a.getRaw("Parent");return a.getAsync("Parent")}).then(function(e){if(!e)return null;if(!(e instanceof Dict))throw new FormatError("Parent must be a dictionary.");return e.getAsync("Kids")}).then(function(e){if(!e)return null;const n=[];let s=!1;for(const r of e){if(!(r instanceof Ref))throw new FormatError("Kid must be a reference.");if(isRefsEqual(r,t)){s=!0;break}n.push(a.fetchAsync(r).then(function(e){if(!(e instanceof Dict))throw new FormatError("Kid node must be a dictionary.");e.has("Count")?i+=e.get("Count"):i++}))}if(!s)throw new FormatError("Kid reference not found in parent's kids.");return Promise.all(n).then(()=>[i,r])})}(t).then(t=>{if(!t){this.pageIndexCache.put(e,r);return r}const[a,i]=t;r+=a;return next(i)});return next(e)}get baseUrl(){const e=this.#ge.get("URI");if(e instanceof Dict){const t=e.get("Base");if("string"==typeof t){const e=createValidAbsoluteUrl(t,null,{tryConvertEncoding:!0});if(e)return shadow(this,"baseUrl",e.href)}}return shadow(this,"baseUrl",this.pdfManager.docBaseUrl)}static parseDestDictionary({destDict:e,resultObj:t,docBaseUrl:a=null,docAttachments:r=null}){if(!(e instanceof Dict)){warn("parseDestDictionary: `destDict` must be a dictionary.");return}let i,n,s=e.get("A");if(!(s instanceof Dict))if(e.has("Dest"))s=e.get("Dest");else{s=e.get("AA");s instanceof Dict&&(s.has("D")?s=s.get("D"):s.has("U")&&(s=s.get("U")))}if(s instanceof Dict){const e=s.get("S");if(!(e instanceof Name)){warn("parseDestDictionary: Invalid type in Action dictionary.");return}const a=e.name;switch(a){case"ResetForm":const e=s.get("Flags"),o=!(1&("number"==typeof e?e:0)),c=[],l=[];for(const e of s.get("Fields")||[])e instanceof Ref?l.push(e.toString()):"string"==typeof e&&c.push(stringToPDFString(e));t.resetForm={fields:c,refs:l,include:o};break;case"URI":i=s.get("URI");i instanceof Name&&(i="/"+i.name);break;case"GoTo":n=s.get("D");break;case"Launch":case"GoToR":const h=s.get("F");if(h instanceof Dict){const e=new FileSpec(h,null,!0),{rawFilename:t}=e.serializable;i=t}else"string"==typeof h&&(i=h);const u=fetchRemoteDest(s);u&&"string"==typeof i&&(i=i.split("#",1)[0]+"#"+u);const d=s.get("NewWindow");"boolean"==typeof d&&(t.newWindow=d);break;case"GoToE":const f=s.get("T");let g;if(r&&f instanceof Dict){const e=f.get("R"),t=f.get("N");isName(e,"C")&&"string"==typeof t&&(g=r[stringToPDFString(t,!0)])}if(g){t.attachment=g;const e=fetchRemoteDest(s);e&&(t.attachmentDest=e)}else warn('parseDestDictionary - unimplemented "GoToE" action.');break;case"Named":const p=s.get("N");p instanceof Name&&(t.action=p.name);break;case"SetOCGState":const m=s.get("State"),b=s.get("PreserveRB");if(!Array.isArray(m)||0===m.length)break;const y=[];for(const e of m)if(e instanceof Name)switch(e.name){case"ON":case"OFF":case"Toggle":y.push(e.name)}else e instanceof Ref&&y.push(e.toString());if(y.length!==m.length)break;t.setOCGState={state:y,preserveRB:"boolean"!=typeof b||b};break;case"JavaScript":const w=s.get("JS");let x;w instanceof BaseStream?x=w.getString():"string"==typeof w&&(x=w);const S=x&&recoverJsURL(stringToPDFString(x,!0));if(S){i=S.url;t.newWindow=S.newWindow;break}default:if("JavaScript"===a||"SubmitForm"===a)break;warn(`parseDestDictionary - unsupported action: "${a}".`)}}else e.has("Dest")&&(n=e.get("Dest"));if("string"==typeof i){const e=createValidAbsoluteUrl(i,a,{addDefaultProtocol:!0,tryConvertEncoding:!0});e&&(t.url=e.href);t.unsafeUrl=i}if(n){n instanceof Name&&(n=n.name);"string"==typeof n?t.dest=stringToPDFString(n,!0):Rn(n)&&(t.dest=n)}}}function mayHaveChildren(e){return e instanceof Ref||e instanceof Dict||e instanceof BaseStream||Array.isArray(e)}function addChildren(e,t){if(e instanceof Dict)e=e.getRawValues();else if(e instanceof BaseStream)e=e.dict.getRawValues();else if(!Array.isArray(e))return;for(const a of e)mayHaveChildren(a)&&t.push(a)}class ObjectLoader{refSet=new RefSet;constructor(e,t,a){this.dict=e;this.keys=t;this.xref=a}async load(){const{keys:e,dict:t}=this,a=[];for(const r of e){const e=t.getRaw(r);void 0!==e&&a.push(e)}await this.#Ce(a);this.refSet=null}async#Ce(e){const t=[],a=[];for(;e.length;){let r=e.pop();if(r instanceof Ref){if(this.refSet.has(r))continue;try{this.refSet.put(r);r=this.xref.fetch(r)}catch(e){if(!(e instanceof MissingDataException)){warn(`ObjectLoader.#walk - requesting all data: "${e}".`);await this.xref.stream.manager.requestAllChunks();return}t.push(r);a.push({begin:e.begin,end:e.end})}}if(r instanceof BaseStream){const e=r.getBaseStreams();if(e){let i=!1;for(const t of e)if(!t.isDataLoaded){i=!0;a.push({begin:t.start,end:t.end})}i&&t.push(r)}}addChildren(r,e)}if(a.length){await this.xref.stream.manager.requestRanges(a);for(const e of t)e instanceof Ref&&this.refSet.remove(e);await this.#Ce(t)}}static async load(e,t,a){if(a.stream.isDataLoaded)return;const r=new ObjectLoader(e,t,a);await r.load()}}const Nn=Symbol(),En=Symbol(),Pn=Symbol(),Ln=Symbol(),_n=Symbol(),jn=Symbol(),Un=Symbol(),Xn=Symbol(),qn=Symbol(),Hn=Symbol("content"),Wn=Symbol("data"),zn=Symbol(),$n=Symbol("extra"),Gn=Symbol(),Vn=Symbol(),Kn=Symbol(),Jn=Symbol(),Yn=Symbol(),Zn=Symbol(),Qn=Symbol(),es=Symbol(),ts=Symbol(),as=Symbol(),rs=Symbol(),is=Symbol(),ns=Symbol(),ss=Symbol(),os=Symbol(),cs=Symbol(),ls=Symbol(),hs=Symbol(),us=Symbol(),ds=Symbol(),fs=Symbol(),gs=Symbol(),ps=Symbol(),ms=Symbol(),bs=Symbol(),ys=Symbol(),ws=Symbol(),xs=Symbol(),Ss=Symbol(),As=Symbol(),ks=Symbol(),Cs=Symbol(),vs=Symbol("namespaceId"),Fs=Symbol("nodeName"),Is=Symbol(),Ts=Symbol(),Os=Symbol(),Ms=Symbol(),Ds=Symbol(),Bs=Symbol(),Rs=Symbol(),Ns=Symbol(),Es=Symbol("root"),Ls=Symbol(),_s=Symbol(),js=Symbol(),Us=Symbol(),Xs=Symbol(),qs=Symbol(),Hs=Symbol(),Ws=Symbol(),zs=Symbol(),$s=Symbol(),Gs=Symbol(),Vs=Symbol("uid"),Ks=Symbol(),Js={config:{id:0,check:e=>e.startsWith("http://www.xfa.org/schema/xci/")},connectionSet:{id:1,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-connection-set/")},datasets:{id:2,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-data/")},form:{id:3,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-form/")},localeSet:{id:4,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-locale-set/")},pdf:{id:5,check:e=>"http://ns.adobe.com/xdp/pdf/"===e},signature:{id:6,check:e=>"http://www.w3.org/2000/09/xmldsig#"===e},sourceSet:{id:7,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-source-set/")},stylesheet:{id:8,check:e=>"http://www.w3.org/1999/XSL/Transform"===e},template:{id:9,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-template/")},xdc:{id:10,check:e=>e.startsWith("http://www.xfa.org/schema/xdc/")},xdp:{id:11,check:e=>"http://ns.adobe.com/xdp/"===e},xfdf:{id:12,check:e=>"http://ns.adobe.com/xfdf/"===e},xhtml:{id:13,check:e=>"http://www.w3.org/1999/xhtml"===e},xmpmeta:{id:14,check:e=>"http://ns.adobe.com/xmpmeta/"===e}},Ys={pt:e=>e,cm:e=>e/2.54*72,mm:e=>e/25.4*72,in:e=>72*e,px:e=>e},Zs=/([+-]?\d+\.?\d*)(.*)/;function stripQuotes(e){return e.startsWith("'")||e.startsWith('"')?e.slice(1,-1):e}function getInteger({data:e,defaultValue:t,validate:a}){if(!e)return t;e=e.trim();const r=parseInt(e,10);return!isNaN(r)&&a(r)?r:t}function getFloat({data:e,defaultValue:t,validate:a}){if(!e)return t;e=e.trim();const r=parseFloat(e);return!isNaN(r)&&a(r)?r:t}function getKeyword({data:e,defaultValue:t,validate:a}){return e&&a(e=e.trim())?e:t}function getStringOption(e,t){return getKeyword({data:e,defaultValue:t[0],validate:e=>t.includes(e)})}function getMeasurement(e,t="0"){t||="0";if(!e)return getMeasurement(t);const a=e.trim().match(Zs);if(!a)return getMeasurement(t);const[,r,i]=a,n=parseFloat(r);if(isNaN(n))return getMeasurement(t);if(0===n)return 0;const s=Ys[i];return s?s(n):n}function getRatio(e){if(!e)return{num:1,den:1};const t=e.split(":",2).map(e=>parseFloat(e.trim())).filter(e=>!isNaN(e));1===t.length&&t.push(1);if(0===t.length)return{num:1,den:1};const[a,r]=t;return{num:a,den:r}}function getRelevant(e){return e?e.trim().split(/\s+/).map(e=>({excluded:"-"===e[0],viewname:e.substring(1)})):[]}class HTMLResult{static get FAILURE(){return shadow(this,"FAILURE",new HTMLResult(!1,null,null,null))}static get EMPTY(){return shadow(this,"EMPTY",new HTMLResult(!0,null,null,null))}constructor(e,t,a,r){this.success=e;this.html=t;this.bbox=a;this.breakNode=r}isBreak(){return!!this.breakNode}static breakNode(e){return new HTMLResult(!1,null,null,e)}static success(e,t=null){return new HTMLResult(!0,e,t,null)}}class FontFinder{constructor(e){this.fonts=new Map;this.cache=new Map;this.warned=new Set;this.defaultFont=null;this.add(e)}add(e,t=null){for(const t of e)this.addPdfFont(t);for(const e of this.fonts.values())e.regular||(e.regular=e.italic||e.bold||e.bolditalic);if(!t||0===t.size)return;const a=this.fonts.get("PdfJS-Fallback-PdfJS-XFA");for(const e of t)this.fonts.set(e,a)}addPdfFont(e){const t=e.cssFontInfo,a=t.fontFamily;let r=this.fonts.get(a);if(!r){r=Object.create(null);this.fonts.set(a,r);this.defaultFont||(this.defaultFont=r)}let i="";const n=parseFloat(t.fontWeight);0!==parseFloat(t.italicAngle)?i=n>=700?"bolditalic":"italic":n>=700&&(i="bold");if(!i){(e.name.includes("Bold")||e.psName?.includes("Bold"))&&(i="bold");(e.name.includes("Italic")||e.name.endsWith("It")||e.psName?.includes("Italic")||e.psName?.endsWith("It"))&&(i+="italic")}i||(i="regular");r[i]=e}getDefault(){return this.defaultFont}find(e,t=!0){let a=this.fonts.get(e)||this.cache.get(e);if(a)return a;const r=/,|-|_| |bolditalic|bold|italic|regular|it/gi;let i=e.replaceAll(r,"");a=this.fonts.get(i);if(a){this.cache.set(e,a);return a}i=i.toLowerCase();const n=[];for(const[e,t]of this.fonts.entries())e.replaceAll(r,"").toLowerCase().startsWith(i)&&n.push(t);if(0===n.length)for(const[,e]of this.fonts.entries())e.regular.name?.replaceAll(r,"").toLowerCase().startsWith(i)&&n.push(e);if(0===n.length){i=i.replaceAll(/psmt|mt/gi,"");for(const[e,t]of this.fonts.entries())e.replaceAll(r,"").toLowerCase().startsWith(i)&&n.push(t)}if(0===n.length)for(const e of this.fonts.values())e.regular.name?.replaceAll(r,"").toLowerCase().startsWith(i)&&n.push(e);if(n.length>=1){1!==n.length&&t&&warn(`XFA - Too many choices to guess the correct font: ${e}`);this.cache.set(e,n[0]);return n[0]}if(t&&!this.warned.has(e)){this.warned.add(e);warn(`XFA - Cannot find the font: ${e}`)}return null}}function selectFont(e,t){return"italic"===e.posture?"bold"===e.weight?t.bolditalic:t.italic:"bold"===e.weight?t.bold:t.regular}class text_FontInfo{constructor(e,t,a,r){this.lineHeight=a;this.paraMargin=t||{top:0,bottom:0,left:0,right:0};if(!e){[this.pdfFont,this.xfaFont]=this.defaultFont(r);return}this.xfaFont={typeface:e.typeface,posture:e.posture,weight:e.weight,size:e.size,letterSpacing:e.letterSpacing};const i=r.find(e.typeface);if(i){this.pdfFont=selectFont(e,i);this.pdfFont||([this.pdfFont,this.xfaFont]=this.defaultFont(r))}else[this.pdfFont,this.xfaFont]=this.defaultFont(r)}defaultFont(e){const t=e.find("Helvetica",!1)||e.find("Myriad Pro",!1)||e.find("Arial",!1)||e.getDefault();if(t?.regular){const e=t.regular;return[e,{typeface:e.cssFontInfo.fontFamily,posture:"normal",weight:"normal",size:10,letterSpacing:0}]}return[null,{typeface:"Courier",posture:"normal",weight:"normal",size:10,letterSpacing:0}]}}class FontSelector{constructor(e,t,a,r){this.fontFinder=r;this.stack=[new text_FontInfo(e,t,a,r)]}pushData(e,t,a){const r=this.stack.at(-1);for(const t of["typeface","posture","weight","size","letterSpacing"])e[t]||(e[t]=r.xfaFont[t]);for(const e of["top","bottom","left","right"])isNaN(t[e])&&(t[e]=r.paraMargin[e]);const i=new text_FontInfo(e,t,a||r.lineHeight,this.fontFinder);i.pdfFont||(i.pdfFont=r.pdfFont);this.stack.push(i)}popFont(){this.stack.pop()}topFont(){return this.stack.at(-1)}}class TextMeasure{constructor(e,t,a,r){this.glyphs=[];this.fontSelector=new FontSelector(e,t,a,r);this.extraHeight=0}pushData(e,t,a){this.fontSelector.pushData(e,t,a)}popFont(e){return this.fontSelector.popFont()}addPara(){const e=this.fontSelector.topFont();this.extraHeight+=e.paraMargin.top+e.paraMargin.bottom}addString(e){if(!e)return;const t=this.fontSelector.topFont(),a=t.xfaFont.size;if(t.pdfFont){const r=t.xfaFont.letterSpacing,i=t.pdfFont,n=i.lineHeight||1.2,s=t.lineHeight||Math.max(1.2,n)*a,o=n-(void 0===i.lineGap?.2:i.lineGap),c=Math.max(1,o)*a,l=a/1e3,h=i.defaultWidth||i.charsToGlyphs(" ")[0].width;for(const t of e.split(/[\u2029\n]/)){const e=i.encodeString(t).join(""),a=i.charsToGlyphs(e);for(const e of a){const t=e.width||h;this.glyphs.push([t*l+r,s,c,e.unicode,!1])}this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop();return}for(const t of e.split(/[\u2029\n]/)){for(const e of t.split(""))this.glyphs.push([a,1.2*a,a,e,!1]);this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}compute(e){let t=-1,a=0,r=0,i=0,n=0,s=0,o=!1,c=!0;for(let l=0,h=this.glyphs.length;le){r=Math.max(r,n);n=0;i+=s;s=m;t=-1;a=0;o=!0;c=!1}else{s=Math.max(m,s);a=n;n+=h;t=l}else if(n+h>e){i+=s;s=m;if(-1!==t){l=t;r=Math.max(r,a);n=0;t=-1;a=0}else{r=Math.max(r,n);n=h}o=!0;c=!1}else{n+=h;s=Math.max(m,s)}}r=Math.max(r,n);i+=s+this.extraHeight;return{width:1.02*r,height:i,isBroken:o}}}const Qs=/^[^.[]+/,eo=/^[^\]]+/,to=0,ao=1,ro=2,io=3,no=4,so=new Map([["$data",(e,t)=>e.datasets?e.datasets.data:e],["$record",(e,t)=>(e.datasets?e.datasets.data:e)[is]()[0]],["$template",(e,t)=>e.template],["$connectionSet",(e,t)=>e.connectionSet],["$form",(e,t)=>e.form],["$layout",(e,t)=>e.layout],["$host",(e,t)=>e.host],["$dataWindow",(e,t)=>e.dataWindow],["$event",(e,t)=>e.event],["!",(e,t)=>e.datasets],["$xfa",(e,t)=>e],["xfa",(e,t)=>e],["$",(e,t)=>t]]),oo=new WeakMap;function parseIndex(e){return"*"===(e=e.trim())?1/0:parseInt(e,10)||0}function parseExpression(e,t,a=!0){let r=e.match(Qs);if(!r)return null;let[i]=r;const n=[{name:i,cacheName:"."+i,index:0,js:null,formCalc:null,operator:to}];let s=i.length;for(;s0&&h.push(e)}if(0===h.length&&!o&&0===c){const a=t[cs]();if(!(t=a))return null;c=-1;e=[t];continue}e=isFinite(l)?h.filter(e=>le[l]):h.flat()}return 0===e.length?null:e}function createDataNode(e,t,a){const r=parseExpression(a);if(!r)return null;if(r.some(e=>e.operator===ao))return null;const i=so.get(r[0].name);let n=0;if(i){e=i(e,t);n=1}else e=t||e;for(let t=r.length;ne[Hs]()).join("")}get[ho](){const e=Object.getPrototypeOf(this);if(!e._attributes){const t=e._attributes=new Set;for(const e of Object.getOwnPropertyNames(this)){if(null===this[e]||this[e]instanceof XFAObject||this[e]instanceof XFAObjectArray)break;t.add(e)}}return shadow(this,ho,e._attributes)}[ys](e){let t=this;for(;t;){if(t===e)return!0;t=t[cs]()}return!1}[cs](){return this[Ao]}[os](){return this[cs]()}[is](e=null){return e?this[e]:this[uo]}[zn](){const e=Object.create(null);this[Hn]&&(e.$content=this[Hn]);for(const t of Object.getOwnPropertyNames(this)){const a=this[t];null!==a&&(a instanceof XFAObject?e[t]=a[zn]():a instanceof XFAObjectArray?a.isEmpty()||(e[t]=a.dump()):e[t]=a)}return e}[Gs](){return null}[zs](){return HTMLResult.EMPTY}*[ns](){for(const e of this[is]())yield e}*[mo](e,t){for(const a of this[ns]())if(!e||t===e.has(a[Fs])){const e=this[Yn](),t=a[zs](e);t.success||(this[$n].failingNode=a);yield t}}[Vn](){return null}[En](e,t){this[$n].children.push(e)}[Yn](){}[Ln]({filter:e=null,include:t=!0}){if(this[$n].generator){const e=this[Yn](),t=this[$n].failingNode[zs](e);if(!t.success)return t;t.html&&this[En](t.html,t.bbox);delete this[$n].failingNode}else this[$n].generator=this[mo](e,t);for(;;){const e=this[$n].generator.next();if(e.done)break;const t=e.value;if(!t.success)return t;t.html&&this[En](t.html,t.bbox)}this[$n].generator=null;return HTMLResult.EMPTY}[Us](e){this[Co]=new Set(Object.keys(e))}[yo](e){const t=this[ho],a=this[Co];return[...e].filter(e=>t.has(e)&&!a.has(e))}[Ls](e,t=new Set){for(const a of this[uo])a[ko](e,t)}[ko](e,t){const a=this[bo](e,t);a?this[co](a,e,t):this[Ls](e,t)}[bo](e,t){const{use:a,usehref:r}=this;if(!a&&!r)return null;let i=null,n=null,s=null,o=a;if(r){o=r;r.startsWith("#som(")&&r.endsWith(")")?n=r.slice(5,-1):r.startsWith(".#som(")&&r.endsWith(")")?n=r.slice(6,-1):r.startsWith("#")?s=r.slice(1):r.startsWith(".#")&&(s=r.slice(2))}else a.startsWith("#")?s=a.slice(1):n=a;this.use=this.usehref="";if(s)i=e.get(s);else{i=searchNode(e.get(Es),this,n,!0,!1);i&&(i=i[0])}if(!i){warn(`XFA - Invalid prototype reference: ${o}.`);return null}if(i[Fs]!==this[Fs]){warn(`XFA - Incompatible prototype: ${i[Fs]} !== ${this[Fs]}.`);return null}if(t.has(i)){warn("XFA - Cycle detected in prototypes use.");return null}t.add(i);const c=i[bo](e,t);c&&i[co](c,e,t);i[Ls](e,t);t.delete(i);return i}[co](e,t,a){if(a.has(e)){warn("XFA - Cycle detected in prototypes use.");return}!this[Hn]&&e[Hn]&&(this[Hn]=e[Hn]);new Set(a).add(e);for(const t of this[yo](e[Co])){this[t]=e[t];this[Co]&&this[Co].add(t)}for(const r of Object.getOwnPropertyNames(this)){if(this[ho].has(r))continue;const i=this[r],n=e[r];if(i instanceof XFAObjectArray){for(const e of i[uo])e[ko](t,a);for(let r=i[uo].length,s=n[uo].length;rXFAObject[fo](e)):"object"==typeof e&&null!==e?Object.assign({},e):e}[Xn](){const e=Object.create(Object.getPrototypeOf(this));for(const t of Object.getOwnPropertySymbols(this))try{e[t]=this[t]}catch{shadow(e,t,this[t])}e[Vs]=`${e[Fs]}${Fo++}`;e[uo]=[];for(const t of Object.getOwnPropertyNames(this)){if(this[ho].has(t)){e[t]=XFAObject[fo](this[t]);continue}const a=this[t];e[t]=a instanceof XFAObjectArray?new XFAObjectArray(a[xo]):null}for(const t of this[uo]){const a=t[Fs],r=t[Xn]();e[uo].push(r);r[Ao]=e;null===e[a]?e[a]=r:e[a][uo].push(r)}return e}[is](e=null){return e?this[uo].filter(t=>t[Fs]===e):this[uo]}[Zn](e){return this[e]}[Qn](e,t,a=!0){return Array.from(this[es](e,t,a))}*[es](e,t,a=!0){if("parent"!==e){for(const a of this[uo]){a[Fs]===e&&(yield a);a.name===e&&(yield a);(t||a[As]())&&(yield*a[es](e,t,!1))}a&&this[ho].has(e)&&(yield new XFAAttribute(this,e,this[e]))}else yield this[Ao]}}class XFAObjectArray{constructor(e=1/0){this[xo]=e;this[uo]=[]}get isXFAObject(){return!1}get isXFAObjectArray(){return!0}push(e){if(this[uo].length<=this[xo]){this[uo].push(e);return!0}warn(`XFA - node "${e[Fs]}" accepts no more than ${this[xo]} children`);return!1}isEmpty(){return 0===this[uo].length}dump(){return 1===this[uo].length?this[uo][0][zn]():this[uo].map(e=>e[zn]())}[Xn](){const e=new XFAObjectArray(this[xo]);e[uo]=this[uo].map(e=>e[Xn]());return e}get children(){return this[uo]}clear(){this[uo].length=0}}class XFAAttribute{constructor(e,t,a){this[Ao]=e;this[Fs]=t;this[Hn]=a;this[qn]=!1;this[Vs]="attribute"+Fo++}[cs](){return this[Ao]}[bs](){return!0}[ts](){return this[Hn].trim()}[Xs](e){e=e.value||"";this[Hn]=e.toString()}[Hs](){return this[Hn]}[ys](e){return this[Ao]===e||this[Ao][ys](e)}}class XmlObject extends XFAObject{constructor(e,t,a={}){super(e,t);this[Hn]="";this[go]=null;if("#text"!==t){const e=new Map;this[lo]=e;for(const[t,r]of Object.entries(a))e.set(t,new XFAAttribute(this,t,r));if(a.hasOwnProperty(Is)){const e=a[Is].xfa.dataNode;void 0!==e&&("dataGroup"===e?this[go]=!1:"dataValue"===e&&(this[go]=!0))}}this[qn]=!1}[$s](e){const t=this[Fs];if("#text"===t){e.push(encodeToXmlString(this[Hn]));return}const a=utf8StringToString(t),r=this[vs]===Io?"xfa:":"";e.push(`<${r}${a}`);for(const[t,a]of this[lo].entries()){const r=utf8StringToString(t);e.push(` ${r}="${encodeToXmlString(a[Hn])}"`)}null!==this[go]&&(this[go]?e.push(' xfa:dataNode="dataValue"'):e.push(' xfa:dataNode="dataGroup"'));if(this[Hn]||0!==this[uo].length){e.push(">");if(this[Hn])"string"==typeof this[Hn]?e.push(encodeToXmlString(this[Hn])):this[Hn][$s](e);else for(const t of this[uo])t[$s](e);e.push(``)}else e.push("/>")}[Ts](e){if(this[Hn]){const e=new XmlObject(this[vs],"#text");this[Pn](e);e[Hn]=this[Hn];this[Hn]=""}this[Pn](e);return!0}[Ms](e){this[Hn]+=e}[Gn](){if(this[Hn]&&this[uo].length>0){const e=new XmlObject(this[vs],"#text");this[Pn](e);e[Hn]=this[Hn];delete this[Hn]}}[zs](){return"#text"===this[Fs]?HTMLResult.success({name:"#text",value:this[Hn]}):HTMLResult.EMPTY}[is](e=null){return e?this[uo].filter(t=>t[Fs]===e):this[uo]}[Jn](){return this[lo]}[Zn](e){const t=this[lo].get(e);return void 0!==t?t:this[is](e)}*[es](e,t){const a=this[lo].get(e);a&&(yield a);for(const a of this[uo]){a[Fs]===e&&(yield a);t&&(yield*a[es](e,t))}}*[Kn](e,t){const a=this[lo].get(e);!a||t&&a[qn]||(yield a);for(const a of this[uo])yield*a[Kn](e,t)}*[rs](e,t,a){for(const r of this[uo]){r[Fs]!==e||a&&r[qn]||(yield r);t&&(yield*r[rs](e,t,a))}}[bs](){return null===this[go]?0===this[uo].length||this[uo][0][vs]===Js.xhtml.id:this[go]}[ts](){return null===this[go]?0===this[uo].length?this[Hn].trim():this[uo][0][vs]===Js.xhtml.id?this[uo][0][Hs]().trim():null:this[Hn].trim()}[Xs](e){e=e.value||"";this[Hn]=e.toString()}[zn](e=!1){const t=Object.create(null);e&&(t.$ns=this[vs]);this[Hn]&&(t.$content=this[Hn]);t.$name=this[Fs];t.children=[];for(const a of this[uo])t.children.push(a[zn](e));t.attributes=Object.create(null);for(const[e,a]of this[lo])t.attributes[e]=a[Hn];return t}}class ContentObject extends XFAObject{constructor(e,t){super(e,t);this[Hn]=""}[Ms](e){this[Hn]+=e}[Gn](){}}class OptionObject extends ContentObject{constructor(e,t,a){super(e,t);this[So]=a}[Gn](){this[Hn]=getKeyword({data:this[Hn],defaultValue:this[So][0],validate:e=>this[So].includes(e)})}[_n](e){super[_n](e);delete this[So]}}class StringObject extends ContentObject{[Gn](){this[Hn]=this[Hn].trim()}}class IntegerObject extends ContentObject{constructor(e,t,a,r){super(e,t);this[po]=a;this[vo]=r}[Gn](){this[Hn]=getInteger({data:this[Hn],defaultValue:this[po],validate:this[vo]})}[_n](e){super[_n](e);delete this[po];delete this[vo]}}class Option01 extends IntegerObject{constructor(e,t){super(e,t,0,e=>1===e)}}class Option10 extends IntegerObject{constructor(e,t){super(e,t,1,e=>0===e)}}function measureToString(e){return"string"==typeof e?"0px":Number.isInteger(e)?`${e}px`:`${e.toFixed(2)}px`}const Oo={anchorType(e,t){const a=e[os]();if(a&&(!a.layout||"position"===a.layout)){"transform"in t||(t.transform="");switch(e.anchorType){case"bottomCenter":t.transform+="translate(-50%, -100%)";break;case"bottomLeft":t.transform+="translate(0,-100%)";break;case"bottomRight":t.transform+="translate(-100%,-100%)";break;case"middleCenter":t.transform+="translate(-50%,-50%)";break;case"middleLeft":t.transform+="translate(0,-50%)";break;case"middleRight":t.transform+="translate(-100%,-50%)";break;case"topCenter":t.transform+="translate(-50%,0)";break;case"topRight":t.transform+="translate(-100%,0)"}}},dimensions(e,t){const a=e[os]();let r=e.w;const i=e.h;if(a.layout?.includes("row")){const t=a[$n],i=e.colSpan;let n;if(-1===i){n=Math.sumPrecise(t.columnWidths.slice(t.currentColumn));t.currentColumn=0}else{n=Math.sumPrecise(t.columnWidths.slice(t.currentColumn,t.currentColumn+i));t.currentColumn=(t.currentColumn+e.colSpan)%t.columnWidths.length}isNaN(n)||(r=e.w=n)}t.width=""!==r?measureToString(r):"auto";t.height=""!==i?measureToString(i):"auto"},position(e,t){const a=e[os]();if(!a?.layout||"position"===a.layout){t.position="absolute";t.left=measureToString(e.x);t.top=measureToString(e.y)}},rotate(e,t){if(e.rotate){"transform"in t||(t.transform="");t.transform+=`rotate(-${e.rotate}deg)`;t.transformOrigin="top left"}},presence(e,t){switch(e.presence){case"invisible":t.visibility="hidden";break;case"hidden":case"inactive":t.display="none"}},hAlign(e,t){if("para"===e[Fs])switch(e.hAlign){case"justifyAll":t.textAlign="justify-all";break;case"radix":t.textAlign="left";break;default:t.textAlign=e.hAlign}else switch(e.hAlign){case"left":t.alignSelf="start";break;case"center":t.alignSelf="center";break;case"right":t.alignSelf="end"}},margin(e,t){e.margin&&(t.margin=e.margin[Gs]().margin)}};function setMinMaxDimensions(e,t){if("position"===e[os]().layout){e.minW>0&&(t.minWidth=measureToString(e.minW));e.maxW>0&&(t.maxWidth=measureToString(e.maxW));e.minH>0&&(t.minHeight=measureToString(e.minH));e.maxH>0&&(t.maxHeight=measureToString(e.maxH))}}function layoutText(e,t,a,r,i,n){const s=new TextMeasure(t,a,r,i);"string"==typeof e?s.addString(e):e[Ds](s);return s.compute(n)}function layoutNode(e,t){let a=null,r=null,i=!1;if((!e.w||!e.h)&&e.value){let n=0,s=0;if(e.margin){n=e.margin.leftInset+e.margin.rightInset;s=e.margin.topInset+e.margin.bottomInset}let o=null,c=null;if(e.para){c=Object.create(null);o=""===e.para.lineHeight?null:e.para.lineHeight;c.top=""===e.para.spaceAbove?0:e.para.spaceAbove;c.bottom=""===e.para.spaceBelow?0:e.para.spaceBelow;c.left=""===e.para.marginLeft?0:e.para.marginLeft;c.right=""===e.para.marginRight?0:e.para.marginRight}let l=e.font;if(!l){const t=e[ls]();let a=e[cs]();for(;a&&a!==t;){if(a.font){l=a.font;break}a=a[cs]()}}const h=(e.w||t.width)-n,u=e[hs].fontFinder;if(e.value.exData&&e.value.exData[Hn]&&"text/html"===e.value.exData.contentType){const t=layoutText(e.value.exData[Hn],l,c,o,u,h);r=t.width;a=t.height;i=t.isBroken}else{const t=e.value[Hs]();if(t){const e=layoutText(t,l,c,o,u,h);r=e.width;a=e.height;i=e.isBroken}}null===r||e.w||(r+=n);null===a||e.h||(a+=s)}return{w:r,h:a,isBroken:i}}function computeBbox(e,t,a){let r;if(""!==e.w&&""!==e.h)r=[e.x,e.y,e.w,e.h];else{if(!a)return null;let i=e.w;if(""===i){if(0===e.maxW){const t=e[os]();i="position"===t.layout&&""!==t.w?0:e.minW}else i=Math.min(e.maxW,a.width);t.attributes.style.width=measureToString(i)}let n=e.h;if(""===n){if(0===e.maxH){const t=e[os]();n="position"===t.layout&&""!==t.h?0:e.minH}else n=Math.min(e.maxH,a.height);t.attributes.style.height=measureToString(n)}r=[e.x,e.y,i,n]}return r}function fixDimensions(e){const t=e[os]();if(t.layout?.includes("row")){const a=t[$n],r=e.colSpan;let i;i=-1===r?Math.sumPrecise(a.columnWidths.slice(a.currentColumn)):Math.sumPrecise(a.columnWidths.slice(a.currentColumn,a.currentColumn+r));isNaN(i)||(e.w=i)}t.layout&&"position"!==t.layout&&(e.x=e.y=0);"table"===e.layout&&""===e.w&&Array.isArray(e.columnWidths)&&(e.w=Math.sumPrecise(e.columnWidths))}function layoutClass(e){switch(e.layout){case"position":default:return"xfaPosition";case"lr-tb":return"xfaLrTb";case"rl-row":return"xfaRlRow";case"rl-tb":return"xfaRlTb";case"row":return"xfaRow";case"table":return"xfaTable";case"tb":return"xfaTb"}}function toStyle(e,...t){const a=Object.create(null);for(const r of t){const t=e[r];if(null!==t)if(Oo.hasOwnProperty(r))Oo[r](e,a);else if(t instanceof XFAObject){const e=t[Gs]();e?Object.assign(a,e):warn(`(DEBUG) - XFA - style for ${r} not implemented yet`)}}return a}function createWrapper(e,t){const{attributes:a}=t,{style:r}=a,i={name:"div",attributes:{class:["xfaWrapper"],style:Object.create(null)},children:[]};a.class.push("xfaWrapped");if(e.border){const{widths:a,insets:n}=e.border[$n];let s,o,c=n[0],l=n[3];const h=n[0]+n[2],u=n[1]+n[3];switch(e.border.hand){case"even":c-=a[0]/2;l-=a[3]/2;s=`calc(100% + ${(a[1]+a[3])/2-u}px)`;o=`calc(100% + ${(a[0]+a[2])/2-h}px)`;break;case"left":c-=a[0];l-=a[3];s=`calc(100% + ${a[1]+a[3]-u}px)`;o=`calc(100% + ${a[0]+a[2]-h}px)`;break;case"right":s=u?`calc(100% - ${u}px)`:"100%";o=h?`calc(100% - ${h}px)`:"100%"}const d=["xfaBorder"];isPrintOnly(e.border)&&d.push("xfaPrintOnly");const f={name:"div",attributes:{class:d,style:{top:`${c}px`,left:`${l}px`,width:s,height:o}},children:[]};for(const e of["border","borderWidth","borderColor","borderRadius","borderStyle"])if(void 0!==r[e]){f.attributes.style[e]=r[e];delete r[e]}i.children.push(f,t)}else i.children.push(t);for(const e of["background","backgroundClip","top","left","width","height","minWidth","minHeight","maxWidth","maxHeight","transform","transformOrigin","visibility"])if(void 0!==r[e]){i.attributes.style[e]=r[e];delete r[e]}i.attributes.style.position="absolute"===r.position?"absolute":"relative";delete r.position;if(r.alignSelf){i.attributes.style.alignSelf=r.alignSelf;delete r.alignSelf}return i}function fixTextIndent(e){const t=getMeasurement(e.textIndent,"0px");if(t>=0)return;const a="padding"+("left"===("right"===e.textAlign?"right":"left")?"Left":"Right"),r=getMeasurement(e[a],"0px");e[a]=r-t+"px"}function setAccess(e,t){switch(e.access){case"nonInteractive":t.push("xfaNonInteractive");break;case"readOnly":t.push("xfaReadOnly");break;case"protected":t.push("xfaDisabled")}}function isPrintOnly(e){return e.relevant.length>0&&!e.relevant[0].excluded&&"print"===e.relevant[0].viewname}function getCurrentPara(e){const t=e[ls]()[$n].paraStack;return t.length?t.at(-1):null}function setPara(e,t,a){if(a.attributes.class?.includes("xfaRich")){if(t){""===e.h&&(t.height="auto");""===e.w&&(t.width="auto")}const r=getCurrentPara(e);if(r){const e=a.attributes.style;e.display="flex";e.flexDirection="column";switch(r.vAlign){case"top":e.justifyContent="start";break;case"bottom":e.justifyContent="end";break;case"middle":e.justifyContent="center"}const t=r[Gs]();for(const[a,r]of Object.entries(t))a in e||(e[a]=r)}}}function setFontFamily(e,t,a,r){if(!a){delete r.fontFamily;return}const i=stripQuotes(e.typeface);r.fontFamily=`"${i}"`;const n=a.find(i);if(n){const{fontFamily:a}=n.regular.cssFontInfo;a!==i&&(r.fontFamily=`"${a}"`);const s=getCurrentPara(t);if(s&&""!==s.lineHeight)return;if(r.lineHeight)return;const o=selectFont(e,n);o&&(r.lineHeight=Math.max(1.2,o.lineHeight))}}function fixURL(e){const t=createValidAbsoluteUrl(e,null,{addDefaultProtocol:!0,tryConvertEncoding:!0});return t?t.href:null}function createLine(e,t){return{name:"div",attributes:{class:["lr-tb"===e.layout?"xfaLr":"xfaRl"]},children:t}}function flushHTML(e){if(!e[$n])return null;const t={name:"div",attributes:e[$n].attributes,children:e[$n].children};if(e[$n].failingNode){const a=e[$n].failingNode[Vn]();a&&(e.layout.endsWith("-tb")?t.children.push(createLine(e,[a])):t.children.push(a))}return 0===t.children.length?null:t}function addHTML(e,t,a){const r=e[$n],i=r.availableSpace,[n,s,o,c]=a;switch(e.layout){case"position":r.width=Math.max(r.width,n+o);r.height=Math.max(r.height,s+c);r.children.push(t);break;case"lr-tb":case"rl-tb":if(!r.line||1===r.attempt){r.line=createLine(e,[]);r.children.push(r.line);r.numberInLine=0}r.numberInLine+=1;r.line.children.push(t);if(0===r.attempt){r.currentWidth+=o;r.height=Math.max(r.height,r.prevHeight+c)}else{r.currentWidth=o;r.prevHeight=r.height;r.height+=c;r.attempt=0}r.width=Math.max(r.width,r.currentWidth);break;case"rl-row":case"row":{r.children.push(t);r.width+=o;r.height=Math.max(r.height,c);const e=measureToString(r.height);for(const t of r.children)t.attributes.style.height=e;break}case"table":case"tb":r.width=MathClamp(o,r.width,i.width);r.height+=c;r.children.push(t)}}function getAvailableSpace(e){const t=e[$n].availableSpace,a=e.margin?e.margin.topInset+e.margin.bottomInset:0,r=e.margin?e.margin.leftInset+e.margin.rightInset:0;switch(e.layout){case"lr-tb":case"rl-tb":return 0===e[$n].attempt?{width:t.width-r-e[$n].currentWidth,height:t.height-a-e[$n].prevHeight}:{width:t.width-r,height:t.height-a-e[$n].height};case"rl-row":case"row":return{width:Math.sumPrecise(e[$n].columnWidths.slice(e[$n].currentColumn)),height:t.height-r};case"table":case"tb":return{width:t.width-r,height:t.height-a-e[$n].height};default:return t}}function checkDimensions(e,t){if(null===e[ls]()[$n].firstUnsplittable)return!0;if(0===e.w||0===e.h)return!0;const a=e[os](),r=a[$n]?.attempt||0,[,i,n,s]=function getTransformedBBox(e){let t,a,r=""===e.w?NaN:e.w,i=""===e.h?NaN:e.h,[n,s]=[0,0];switch(e.anchorType||""){case"bottomCenter":[n,s]=[r/2,i];break;case"bottomLeft":[n,s]=[0,i];break;case"bottomRight":[n,s]=[r,i];break;case"middleCenter":[n,s]=[r/2,i/2];break;case"middleLeft":[n,s]=[0,i/2];break;case"middleRight":[n,s]=[r,i/2];break;case"topCenter":[n,s]=[r/2,0];break;case"topRight":[n,s]=[r,0]}switch(e.rotate||0){case 0:[t,a]=[-n,-s];break;case 90:[t,a]=[-s,n];[r,i]=[i,-r];break;case 180:[t,a]=[n,s];[r,i]=[-r,-i];break;case 270:[t,a]=[s,-n];[r,i]=[-i,r]}return[e.x+t+Math.min(0,r),e.y+a+Math.min(0,i),Math.abs(r),Math.abs(i)]}(e);switch(a.layout){case"lr-tb":case"rl-tb":return 0===r?e[ls]()[$n].noLayoutFailure?""!==e.w?Math.round(n-t.width)<=2:t.width>2:!(""!==e.h&&Math.round(s-t.height)>2)&&(""!==e.w?Math.round(n-t.width)<=2||0===a[$n].numberInLine&&t.height>2:t.width>2):!!e[ls]()[$n].noLayoutFailure||!(""!==e.h&&Math.round(s-t.height)>2)&&((""===e.w||Math.round(n-t.width)<=2||!a[Ss]())&&t.height>2);case"table":case"tb":return!!e[ls]()[$n].noLayoutFailure||(""===e.h||e[xs]()?(""===e.w||Math.round(n-t.width)<=2||!a[Ss]())&&t.height>2:Math.round(s-t.height)<=2);case"position":if(e[ls]()[$n].noLayoutFailure)return!0;if(""===e.h||Math.round(s+i-t.height)<=2)return!0;return s+i>e[ls]()[$n].currentContentArea.h;case"rl-row":case"row":return!!e[ls]()[$n].noLayoutFailure||(""===e.h||Math.round(s-t.height)<=2);default:return!0}}const Mo=Js.template.id,Do="http://www.w3.org/2000/svg",Bo=/^H(\d+)$/,Ro=new Set(["image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/apng","image/x-png","image/bmp","image/x-ms-bmp","image/tiff","image/tif","application/octet-stream"]),No=[[[66,77],"image/bmp"],[[255,216,255],"image/jpeg"],[[73,73,42,0],"image/tiff"],[[77,77,0,42],"image/tiff"],[[71,73,70,56,57,97],"image/gif"],[[137,80,78,71,13,10,26,10],"image/png"]];function getBorderDims(e){if(!e||!e.border)return{w:0,h:0};const t=e.border[as]();return t?{w:t.widths[0]+t.widths[2]+t.insets[0]+t.insets[2],h:t.widths[1]+t.widths[3]+t.insets[1]+t.insets[3]}:{w:0,h:0}}function hasMargin(e){return e.margin&&(e.margin.topInset||e.margin.rightInset||e.margin.bottomInset||e.margin.leftInset)}function _setValue(e,t){if(!e.value){const t=new Value({});e[Pn](t);e.value=t}e.value[Xs](t)}function*getContainedChildren(e){for(const t of e[is]())t instanceof SubformSet?yield*t[ns]():yield t}function isRequired(e){return"error"===e.validate?.nullTest}function setTabIndex(e){for(;e;){if(!e.traversal){e[qs]=e[cs]()[qs];return}if(e[qs])return;let t=null;for(const a of e.traversal[is]())if("next"===a.operation){t=a;break}if(!t||!t.ref){e[qs]=e[cs]()[qs];return}const a=e[ls]();e[qs]=++a[qs];const r=a[_s](t.ref,e);if(!r)return;e=r[0]}}function applyAssist(e,t){const a=e.assist;if(a){const e=a[zs]();e&&(t.title=e);const r=a.role.match(Bo);if(r){const e="heading",a=r[1];t.role=e;t["aria-level"]=a}}if("table"===e.layout)t.role="table";else if("row"===e.layout)t.role="row";else{const a=e[cs]();"row"===a.layout&&(t.role="TH"===a.assist?.role?"columnheader":"cell")}}function ariaLabel(e){if(!e.assist)return null;const t=e.assist;return t.speak&&""!==t.speak[Hn]?t.speak[Hn]:t.toolTip?t.toolTip[Hn]:null}function valueToHtml(e){return HTMLResult.success({name:"div",attributes:{class:["xfaRich"],style:Object.create(null)},children:[{name:"span",attributes:{style:Object.create(null)},value:e}]})}function setFirstUnsplittable(e){const t=e[ls]();if(null===t[$n].firstUnsplittable){t[$n].firstUnsplittable=e;t[$n].noLayoutFailure=!0}}function unsetFirstUnsplittable(e){const t=e[ls]();t[$n].firstUnsplittable===e&&(t[$n].noLayoutFailure=!1)}function handleBreak(e){if(e[$n])return!1;e[$n]=Object.create(null);if("auto"===e.targetType)return!1;const t=e[ls]();let a=null;if(e.target){a=t[_s](e.target,e[cs]());if(!a)return!1;a=a[0]}const{currentPageArea:r,currentContentArea:i}=t[$n];if("pageArea"===e.targetType){a instanceof PageArea||(a=null);if(e.startNew){e[$n].target=a||r;return!0}if(a&&a!==r){e[$n].target=a;return!0}return!1}a instanceof ContentArea||(a=null);const n=a&&a[cs]();let s,o=n;if(e.startNew)if(a){const e=n.contentArea.children,t=e.indexOf(i),r=e.indexOf(a);-1!==t&&te;r[$n].noLayoutFailure=!0;const s=t[zs](a);e[En](s.html,s.bbox);r[$n].noLayoutFailure=i;t[os]=n}class AppearanceFilter extends StringObject{constructor(e){super(Mo,"appearanceFilter");this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Arc extends XFAObject{constructor(e){super(Mo,"arc",!0);this.circular=getInteger({data:e.circular,defaultValue:0,validate:e=>1===e});this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.startAngle=getFloat({data:e.startAngle,defaultValue:0,validate:e=>!0});this.sweepAngle=getFloat({data:e.sweepAngle,defaultValue:360,validate:e=>!0});this.use=e.use||"";this.usehref=e.usehref||"";this.edge=null;this.fill=null}[zs](){const e=this.edge||new Edge({}),t=e[Gs](),a=Object.create(null);"visible"===this.fill?.presence?Object.assign(a,this.fill[Gs]()):a.fill="transparent";a.strokeWidth=measureToString("visible"===e.presence?e.thickness:0);a.stroke=t.color;let r;const i={xmlns:Do,style:{width:"100%",height:"100%",overflow:"visible"}};if(360===this.sweepAngle)r={name:"ellipse",attributes:{xmlns:Do,cx:"50%",cy:"50%",rx:"50%",ry:"50%",style:a}};else{const e=this.startAngle*Math.PI/180,t=this.sweepAngle*Math.PI/180,n=this.sweepAngle>180?1:0,[s,o,c,l]=[50*(1+Math.cos(e)),50*(1-Math.sin(e)),50*(1+Math.cos(e+t)),50*(1-Math.sin(e+t))];r={name:"path",attributes:{xmlns:Do,d:`M ${s} ${o} A 50 50 0 ${n} 0 ${c} ${l}`,vectorEffect:"non-scaling-stroke",style:a}};Object.assign(i,{viewBox:"0 0 100 100",preserveAspectRatio:"none"})}const n={name:"svg",children:[r],attributes:i};if(hasMargin(this[cs]()[cs]()))return HTMLResult.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[n]});n.attributes.style.position="absolute";return HTMLResult.success(n)}}class Area extends XFAObject{constructor(e){super(Mo,"area",!0);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.id=e.id||"";this.name=e.name||"";this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.desc=null;this.extras=null;this.area=new XFAObjectArray;this.draw=new XFAObjectArray;this.exObject=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.field=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray}*[ns](){yield*getContainedChildren(this)}[As](){return!0}[ms](){return!0}[En](e,t){const[a,r,i,n]=t;this[$n].width=Math.max(this[$n].width,a+i);this[$n].height=Math.max(this[$n].height,r+n);this[$n].children.push(e)}[Yn](){return this[$n].availableSpace}[zs](e){const t=toStyle(this,"position"),a={style:t,id:this[Vs],class:["xfaArea"]};isPrintOnly(this)&&a.class.push("xfaPrintOnly");this.name&&(a.xfaName=this.name);const r=[];this[$n]={children:r,width:0,height:0,availableSpace:e};const i=this[Ln]({filter:new Set(["area","draw","field","exclGroup","subform","subformSet"]),include:!0});if(!i.success){if(i.isBreak())return i;delete this[$n];return HTMLResult.FAILURE}t.width=measureToString(this[$n].width);t.height=measureToString(this[$n].height);const n={name:"div",attributes:a,children:r},s=[this.x,this.y,this[$n].width,this[$n].height];delete this[$n];return HTMLResult.success(n,s)}}class Assist extends XFAObject{constructor(e){super(Mo,"assist",!0);this.id=e.id||"";this.role=e.role||"";this.use=e.use||"";this.usehref=e.usehref||"";this.speak=null;this.toolTip=null}[zs](){return this.toolTip?.[Hn]||null}}class Barcode extends XFAObject{constructor(e){super(Mo,"barcode",!0);this.charEncoding=getKeyword({data:e.charEncoding?e.charEncoding.toLowerCase():"",defaultValue:"",validate:e=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(e)||e.match(/iso-8859-\d{2}/)});this.checksum=getStringOption(e.checksum,["none","1mod10","1mod10_1mod11","2mod10","auto"]);this.dataColumnCount=getInteger({data:e.dataColumnCount,defaultValue:-1,validate:e=>e>=0});this.dataLength=getInteger({data:e.dataLength,defaultValue:-1,validate:e=>e>=0});this.dataPrep=getStringOption(e.dataPrep,["none","flateCompress"]);this.dataRowCount=getInteger({data:e.dataRowCount,defaultValue:-1,validate:e=>e>=0});this.endChar=e.endChar||"";this.errorCorrectionLevel=getInteger({data:e.errorCorrectionLevel,defaultValue:-1,validate:e=>e>=0&&e<=8});this.id=e.id||"";this.moduleHeight=getMeasurement(e.moduleHeight,"5mm");this.moduleWidth=getMeasurement(e.moduleWidth,"0.25mm");this.printCheckDigit=getInteger({data:e.printCheckDigit,defaultValue:0,validate:e=>1===e});this.rowColumnRatio=getRatio(e.rowColumnRatio);this.startChar=e.startChar||"";this.textLocation=getStringOption(e.textLocation,["below","above","aboveEmbedded","belowEmbedded","none"]);this.truncate=getInteger({data:e.truncate,defaultValue:0,validate:e=>1===e});this.type=getStringOption(e.type?e.type.toLowerCase():"",["aztec","codabar","code2of5industrial","code2of5interleaved","code2of5matrix","code2of5standard","code3of9","code3of9extended","code11","code49","code93","code128","code128a","code128b","code128c","code128sscc","datamatrix","ean8","ean8add2","ean8add5","ean13","ean13add2","ean13add5","ean13pwcd","fim","logmars","maxicode","msi","pdf417","pdf417macro","plessey","postauscust2","postauscust3","postausreplypaid","postausstandard","postukrm4scc","postusdpbc","postusimb","postusstandard","postus5zip","qrcode","rfid","rss14","rss14expanded","rss14limited","rss14stacked","rss14stackedomni","rss14truncated","telepen","ucc128","ucc128random","ucc128sscc","upca","upcaadd2","upcaadd5","upcapwcd","upce","upceadd2","upceadd5","upcean2","upcean5","upsmaxicode"]);this.upsMode=getStringOption(e.upsMode,["usCarrier","internationalCarrier","secureSymbol","standardSymbol"]);this.use=e.use||"";this.usehref=e.usehref||"";this.wideNarrowRatio=getRatio(e.wideNarrowRatio);this.encrypt=null;this.extras=null}}class Bind extends XFAObject{constructor(e){super(Mo,"bind",!0);this.match=getStringOption(e.match,["once","dataRef","global","none"]);this.ref=e.ref||"";this.picture=null}}class BindItems extends XFAObject{constructor(e){super(Mo,"bindItems");this.connection=e.connection||"";this.labelRef=e.labelRef||"";this.ref=e.ref||"";this.valueRef=e.valueRef||""}}class Bookend extends XFAObject{constructor(e){super(Mo,"bookend");this.id=e.id||"";this.leader=e.leader||"";this.trailer=e.trailer||"";this.use=e.use||"";this.usehref=e.usehref||""}}class BooleanElement extends Option01{constructor(e){super(Mo,"boolean");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[zs](e){return valueToHtml(1===this[Hn]?"1":"0")}}class Border extends XFAObject{constructor(e){super(Mo,"border",!0);this.break=getStringOption(e.break,["close","open"]);this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.corner=new XFAObjectArray(4);this.edge=new XFAObjectArray(4);this.extras=null;this.fill=null;this.margin=null}[as](){if(!this[$n]){const e=this.edge.children.slice();if(e.length<4){const t=e.at(-1)||new Edge({});for(let a=e.length;a<4;a++)e.push(t)}const t=e.map(e=>e.thickness),a=[0,0,0,0];if(this.margin){a[0]=this.margin.topInset;a[1]=this.margin.rightInset;a[2]=this.margin.bottomInset;a[3]=this.margin.leftInset}this[$n]={widths:t,insets:a,edges:e}}return this[$n]}[Gs](){const{edges:e}=this[as](),t=e.map(e=>{const t=e[Gs]();t.color||="#000000";return t}),a=Object.create(null);this.margin&&Object.assign(a,this.margin[Gs]());"visible"===this.fill?.presence&&Object.assign(a,this.fill[Gs]());if(this.corner.children.some(e=>0!==e.radius)){const e=this.corner.children.map(e=>e[Gs]());if(2===e.length||3===e.length){const t=e.at(-1);for(let a=e.length;a<4;a++)e.push(t)}a.borderRadius=e.map(e=>e.radius).join(" ")}switch(this.presence){case"invisible":case"hidden":a.borderStyle="";break;case"inactive":a.borderStyle="none";break;default:a.borderStyle=t.map(e=>e.style).join(" ")}a.borderWidth=t.map(e=>e.width).join(" ");a.borderColor=t.map(e=>e.color).join(" ");return a}}class Break extends XFAObject{constructor(e){super(Mo,"break",!0);this.after=getStringOption(e.after,["auto","contentArea","pageArea","pageEven","pageOdd"]);this.afterTarget=e.afterTarget||"";this.before=getStringOption(e.before,["auto","contentArea","pageArea","pageEven","pageOdd"]);this.beforeTarget=e.beforeTarget||"";this.bookendLeader=e.bookendLeader||"";this.bookendTrailer=e.bookendTrailer||"";this.id=e.id||"";this.overflowLeader=e.overflowLeader||"";this.overflowTarget=e.overflowTarget||"";this.overflowTrailer=e.overflowTrailer||"";this.startNew=getInteger({data:e.startNew,defaultValue:0,validate:e=>1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}}class BreakAfter extends XFAObject{constructor(e){super(Mo,"breakAfter",!0);this.id=e.id||"";this.leader=e.leader||"";this.startNew=getInteger({data:e.startNew,defaultValue:0,validate:e=>1===e});this.target=e.target||"";this.targetType=getStringOption(e.targetType,["auto","contentArea","pageArea"]);this.trailer=e.trailer||"";this.use=e.use||"";this.usehref=e.usehref||"";this.script=null}}class BreakBefore extends XFAObject{constructor(e){super(Mo,"breakBefore",!0);this.id=e.id||"";this.leader=e.leader||"";this.startNew=getInteger({data:e.startNew,defaultValue:0,validate:e=>1===e});this.target=e.target||"";this.targetType=getStringOption(e.targetType,["auto","contentArea","pageArea"]);this.trailer=e.trailer||"";this.use=e.use||"";this.usehref=e.usehref||"";this.script=null}[zs](e){this[$n]={};return HTMLResult.FAILURE}}class Button extends XFAObject{constructor(e){super(Mo,"button",!0);this.highlight=getStringOption(e.highlight,["inverted","none","outline","push"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[zs](e){const t=this[cs]()[cs](),a={name:"button",attributes:{id:this[Vs],class:["xfaButton"],style:{}},children:[]};for(const e of t.event.children){if("click"!==e.activity||!e.script)continue;const t=recoverJsURL(e.script[Hn]);if(!t)continue;const r=fixURL(t.url);r&&a.children.push({name:"a",attributes:{id:"link"+this[Vs],href:r,newWindow:t.newWindow,class:["xfaLink"],style:{}},children:[]})}return HTMLResult.success(a)}}class Calculate extends XFAObject{constructor(e){super(Mo,"calculate",!0);this.id=e.id||"";this.override=getStringOption(e.override,["disabled","error","ignore","warning"]);this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.message=null;this.script=null}}class Caption extends XFAObject{constructor(e){super(Mo,"caption",!0);this.id=e.id||"";this.placement=getStringOption(e.placement,["left","bottom","inline","right","top"]);this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.reserve=Math.ceil(getMeasurement(e.reserve));this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.font=null;this.margin=null;this.para=null;this.value=null}[Xs](e){_setValue(this,e)}[as](e){if(!this[$n]){let{width:t,height:a}=e;switch(this.placement){case"left":case"right":case"inline":t=this.reserve<=0?t:this.reserve;break;case"top":case"bottom":a=this.reserve<=0?a:this.reserve}this[$n]=layoutNode(this,{width:t,height:a})}return this[$n]}[zs](e){if(!this.value)return HTMLResult.EMPTY;this[Rs]();const t=this.value[zs](e).html;if(!t){this[Bs]();return HTMLResult.EMPTY}const a=this.reserve;if(this.reserve<=0){const{w:t,h:a}=this[as](e);switch(this.placement){case"left":case"right":case"inline":this.reserve=t;break;case"top":case"bottom":this.reserve=a}}const r=[];"string"==typeof t?r.push({name:"#text",value:t}):r.push(t);const i=toStyle(this,"font","margin","visibility");switch(this.placement){case"left":case"right":this.reserve>0&&(i.width=measureToString(this.reserve));break;case"top":case"bottom":this.reserve>0&&(i.height=measureToString(this.reserve))}setPara(this,null,t);this[Bs]();this.reserve=a;return HTMLResult.success({name:"div",attributes:{style:i,class:["xfaCaption"]},children:r})}}class Certificate extends StringObject{constructor(e){super(Mo,"certificate");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Certificates extends XFAObject{constructor(e){super(Mo,"certificates",!0);this.credentialServerPolicy=getStringOption(e.credentialServerPolicy,["optional","required"]);this.id=e.id||"";this.url=e.url||"";this.urlPolicy=e.urlPolicy||"";this.use=e.use||"";this.usehref=e.usehref||"";this.encryption=null;this.issuers=null;this.keyUsage=null;this.oids=null;this.signing=null;this.subjectDNs=null}}class CheckButton extends XFAObject{constructor(e){super(Mo,"checkButton",!0);this.id=e.id||"";this.mark=getStringOption(e.mark,["default","check","circle","cross","diamond","square","star"]);this.shape=getStringOption(e.shape,["square","round"]);this.size=getMeasurement(e.size,"10pt");this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}[zs](e){const t=toStyle(this,"margin"),a=measureToString(this.size);t.width=t.height=a;let r,i,n;const s=this[cs]()[cs](),o=s.items.children.length&&s.items.children[0][zs]().html||[],c={on:(void 0!==o[0]?o[0]:"on").toString(),off:(void 0!==o[1]?o[1]:"off").toString()},l=(s.value?.[Hs]()||"off")===c.on||void 0,h=s[os](),u=s[Vs];let d;if(h instanceof ExclGroup){n=h[Vs];r="radio";i="xfaRadio";d=h[Wn]?.[Vs]||h[Vs]}else{r="checkbox";i="xfaCheckbox";d=s[Wn]?.[Vs]||s[Vs]}const f={name:"input",attributes:{class:[i],style:t,fieldId:u,dataId:d,type:r,checked:l,xfaOn:c.on,xfaOff:c.off,"aria-label":ariaLabel(s),"aria-required":!1}};n&&(f.attributes.name=n);if(isRequired(s)){f.attributes["aria-required"]=!0;f.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[f]})}}class ChoiceList extends XFAObject{constructor(e){super(Mo,"choiceList",!0);this.commitOn=getStringOption(e.commitOn,["select","exit"]);this.id=e.id||"";this.open=getStringOption(e.open,["userControl","always","multiSelect","onEntry"]);this.textEntry=getInteger({data:e.textEntry,defaultValue:0,validate:e=>1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}[zs](e){const t=toStyle(this,"border","margin"),a=this[cs]()[cs](),r={fontSize:`calc(${a.font?.size||10}px * var(--total-scale-factor))`},i=[];if(a.items.children.length>0){const e=a.items;let t=0,n=0;if(2===e.children.length){t=e.children[0].save;n=1-t}const s=e.children[t][zs]().html,o=e.children[n][zs]().html;let c=!1;const l=a.value?.[Hs]()||"";for(let e=0,t=s.length;eMathClamp(parseInt(e.trim(),10),0,255)).map(e=>isNaN(e)?0:e);if(n.length<3)return{r:a,g:r,b:i};[a,r,i]=n;return{r:a,g:r,b:i}}(e.value):"";this.extras=null}[us](){return!1}[Gs](){return this.value?Util.makeHexColor(this.value.r,this.value.g,this.value.b):null}}class Comb extends XFAObject{constructor(e){super(Mo,"comb");this.id=e.id||"";this.numberOfCells=getInteger({data:e.numberOfCells,defaultValue:0,validate:e=>e>=0});this.use=e.use||"";this.usehref=e.usehref||""}}class Connect extends XFAObject{constructor(e){super(Mo,"connect",!0);this.connection=e.connection||"";this.id=e.id||"";this.ref=e.ref||"";this.usage=getStringOption(e.usage,["exportAndImport","exportOnly","importOnly"]);this.use=e.use||"";this.usehref=e.usehref||"";this.picture=null}}class ContentArea extends XFAObject{constructor(e){super(Mo,"contentArea",!0);this.h=getMeasurement(e.h);this.id=e.id||"";this.name=e.name||"";this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.w=getMeasurement(e.w);this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.desc=null;this.extras=null}[zs](e){const t={left:measureToString(this.x),top:measureToString(this.y),width:measureToString(this.w),height:measureToString(this.h)},a=["xfaContentarea"];isPrintOnly(this)&&a.push("xfaPrintOnly");return HTMLResult.success({name:"div",children:[],attributes:{style:t,class:a,id:this[Vs]}})}}class Corner extends XFAObject{constructor(e){super(Mo,"corner",!0);this.id=e.id||"";this.inverted=getInteger({data:e.inverted,defaultValue:0,validate:e=>1===e});this.join=getStringOption(e.join,["square","round"]);this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.radius=getMeasurement(e.radius);this.stroke=getStringOption(e.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]);this.thickness=getMeasurement(e.thickness,"0.5pt");this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Gs](){const e=toStyle(this,"visibility");e.radius=measureToString("square"===this.join?0:this.radius);return e}}class DateElement extends ContentObject{constructor(e){super(Mo,"date");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Gn](){const e=this[Hn].trim();this[Hn]=e?new Date(e):null}[zs](e){return valueToHtml(this[Hn]?this[Hn].toString():"")}}class DateTime extends ContentObject{constructor(e){super(Mo,"dateTime");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Gn](){const e=this[Hn].trim();this[Hn]=e?new Date(e):null}[zs](e){return valueToHtml(this[Hn]?this[Hn].toString():"")}}class DateTimeEdit extends XFAObject{constructor(e){super(Mo,"dateTimeEdit",!0);this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.picker=getStringOption(e.picker,["host","none"]);this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.comb=null;this.extras=null;this.margin=null}[zs](e){const t=toStyle(this,"border","font","margin"),a=this[cs]()[cs](),r={name:"input",attributes:{type:"text",fieldId:a[Vs],dataId:a[Wn]?.[Vs]||a[Vs],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(a),"aria-required":!1}};if(isRequired(a)){r.attributes["aria-required"]=!0;r.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[r]})}}class Decimal extends ContentObject{constructor(e){super(Mo,"decimal");this.fracDigits=getInteger({data:e.fracDigits,defaultValue:2,validate:e=>!0});this.id=e.id||"";this.leadDigits=getInteger({data:e.leadDigits,defaultValue:-1,validate:e=>!0});this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Gn](){const e=parseFloat(this[Hn].trim());this[Hn]=isNaN(e)?null:e}[zs](e){return valueToHtml(null!==this[Hn]?this[Hn].toString():"")}}class DefaultUi extends XFAObject{constructor(e){super(Mo,"defaultUi",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}}class Desc extends XFAObject{constructor(e){super(Mo,"desc",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}}class DigestMethod extends OptionObject{constructor(e){super(Mo,"digestMethod",["","SHA1","SHA256","SHA512","RIPEMD160"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class DigestMethods extends XFAObject{constructor(e){super(Mo,"digestMethods",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.digestMethod=new XFAObjectArray}}class Draw extends XFAObject{constructor(e){super(Mo,"draw",!0);this.anchorType=getStringOption(e.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.locale=e.locale||"";this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.rotate=getInteger({data:e.rotate,defaultValue:0,validate:e=>e%90==0});this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.border=null;this.caption=null;this.desc=null;this.extras=null;this.font=null;this.keep=null;this.margin=null;this.para=null;this.traversal=null;this.ui=null;this.value=null;this.setProperty=new XFAObjectArray}[Xs](e){_setValue(this,e)}[zs](e){setTabIndex(this);if("hidden"===this.presence||"inactive"===this.presence)return HTMLResult.EMPTY;fixDimensions(this);this[Rs]();const t=this.w,a=this.h,{w:r,h:i,isBroken:n}=layoutNode(this,e);if(r&&""===this.w){if(n&&this[os]()[Ss]()){this[Bs]();return HTMLResult.FAILURE}this.w=r}i&&""===this.h&&(this.h=i);setFirstUnsplittable(this);if(!checkDimensions(this,e)){this.w=t;this.h=a;this[Bs]();return HTMLResult.FAILURE}unsetFirstUnsplittable(this);const s=toStyle(this,"font","hAlign","dimensions","position","presence","rotate","anchorType","border","margin");setMinMaxDimensions(this,s);if(s.margin){s.padding=s.margin;delete s.margin}const o=["xfaDraw"];this.font&&o.push("xfaFont");isPrintOnly(this)&&o.push("xfaPrintOnly");const c={style:s,id:this[Vs],class:o};this.name&&(c.xfaName=this.name);const l={name:"div",attributes:c,children:[]};applyAssist(this,c);const h=computeBbox(this,l,e),u=this.value?this.value[zs](e).html:null;if(null===u){this.w=t;this.h=a;this[Bs]();return HTMLResult.success(createWrapper(this,l),h)}l.children.push(u);setPara(this,s,u);this.w=t;this.h=a;this[Bs]();return HTMLResult.success(createWrapper(this,l),h)}}class Edge extends XFAObject{constructor(e){super(Mo,"edge",!0);this.cap=getStringOption(e.cap,["square","butt","round"]);this.id=e.id||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.stroke=getStringOption(e.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]);this.thickness=getMeasurement(e.thickness,"0.5pt");this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Gs](){const e=toStyle(this,"visibility");Object.assign(e,{linecap:this.cap,width:measureToString(this.thickness),color:this.color?this.color[Gs]():"#000000",style:""});if("visible"!==this.presence)e.style="none";else switch(this.stroke){case"solid":e.style="solid";break;case"dashDot":case"dashDotDot":case"dashed":e.style="dashed";break;case"dotted":e.style="dotted";break;case"embossed":e.style="ridge";break;case"etched":e.style="groove";break;case"lowered":e.style="inset";break;case"raised":e.style="outset"}return e}}class Encoding extends OptionObject{constructor(e){super(Mo,"encoding",["adbe.x509.rsa_sha1","adbe.pkcs7.detached","adbe.pkcs7.sha1"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Encodings extends XFAObject{constructor(e){super(Mo,"encodings",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.encoding=new XFAObjectArray}}class Encrypt extends XFAObject{constructor(e){super(Mo,"encrypt",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=null}}class EncryptData extends XFAObject{constructor(e){super(Mo,"encryptData",!0);this.id=e.id||"";this.operation=getStringOption(e.operation,["encrypt","decrypt"]);this.target=e.target||"";this.use=e.use||"";this.usehref=e.usehref||"";this.filter=null;this.manifest=null}}class Encryption extends XFAObject{constructor(e){super(Mo,"encryption",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=new XFAObjectArray}}class EncryptionMethod extends OptionObject{constructor(e){super(Mo,"encryptionMethod",["","AES256-CBC","TRIPLEDES-CBC","AES128-CBC","AES192-CBC"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class EncryptionMethods extends XFAObject{constructor(e){super(Mo,"encryptionMethods",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.encryptionMethod=new XFAObjectArray}}class Event extends XFAObject{constructor(e){super(Mo,"event",!0);this.activity=getStringOption(e.activity,["click","change","docClose","docReady","enter","exit","full","indexChange","initialize","mouseDown","mouseEnter","mouseExit","mouseUp","postExecute","postOpen","postPrint","postSave","postSign","postSubmit","preExecute","preOpen","prePrint","preSave","preSign","preSubmit","ready","validationState"]);this.id=e.id||"";this.listen=getStringOption(e.listen,["refOnly","refAndDescendents"]);this.name=e.name||"";this.ref=e.ref||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.encryptData=null;this.execute=null;this.script=null;this.signData=null;this.submit=null}}class ExData extends ContentObject{constructor(e){super(Mo,"exData");this.contentType=e.contentType||"";this.href=e.href||"";this.id=e.id||"";this.maxLength=getInteger({data:e.maxLength,defaultValue:-1,validate:e=>e>=-1});this.name=e.name||"";this.rid=e.rid||"";this.transferEncoding=getStringOption(e.transferEncoding,["none","base64","package"]);this.use=e.use||"";this.usehref=e.usehref||""}[ps](){return"text/html"===this.contentType}[Ts](e){if("text/html"===this.contentType&&e[vs]===Js.xhtml.id){this[Hn]=e;return!0}if("text/xml"===this.contentType){this[Hn]=e;return!0}return!1}[zs](e){return"text/html"===this.contentType&&this[Hn]?this[Hn][zs](e):HTMLResult.EMPTY}}class ExObject extends XFAObject{constructor(e){super(Mo,"exObject",!0);this.archive=e.archive||"";this.classId=e.classId||"";this.codeBase=e.codeBase||"";this.codeType=e.codeType||"";this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.exObject=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}}class ExclGroup extends XFAObject{constructor(e){super(Mo,"exclGroup",!0);this.access=getStringOption(e.access,["open","nonInteractive","protected","readOnly"]);this.accessKey=e.accessKey||"";this.anchorType=getStringOption(e.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.layout=getStringOption(e.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]);this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.bind=null;this.border=null;this.calculate=null;this.caption=null;this.desc=null;this.extras=null;this.margin=null;this.para=null;this.traversal=null;this.validate=null;this.connect=new XFAObjectArray;this.event=new XFAObjectArray;this.field=new XFAObjectArray;this.setProperty=new XFAObjectArray}[ms](){return!0}[us](){return!0}[Xs](e){for(const t of this.field.children){if(!t.value){const e=new Value({});t[Pn](e);t.value=e}t.value[Xs](e)}}[Ss](){return this.layout.endsWith("-tb")&&0===this[$n].attempt&&this[$n].numberInLine>0||this[cs]()[Ss]()}[xs](){const e=this[os]();if(!e[xs]())return!1;if(void 0!==this[$n]._isSplittable)return this[$n]._isSplittable;if("position"===this.layout||this.layout.includes("row")){this[$n]._isSplittable=!1;return!1}if(e.layout?.endsWith("-tb")&&0!==e[$n].numberInLine)return!1;this[$n]._isSplittable=!0;return!0}[Vn](){return flushHTML(this)}[En](e,t){addHTML(this,e,t)}[Yn](){return getAvailableSpace(this)}[zs](e){setTabIndex(this);if("hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return HTMLResult.EMPTY;fixDimensions(this);const t=[],a={id:this[Vs],class:[]};setAccess(this,a.class);this[$n]||=Object.create(null);Object.assign(this[$n],{children:t,attributes:a,attempt:0,line:null,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,e.width),height:Math.min(this.h||1/0,e.height)},width:0,height:0,prevHeight:0,currentWidth:0});const r=this[xs]();r||setFirstUnsplittable(this);if(!checkDimensions(this,e))return HTMLResult.FAILURE;const i=new Set(["field"]);if(this.layout.includes("row")){const e=this[os]().columnWidths;if(Array.isArray(e)&&e.length>0){this[$n].columnWidths=e;this[$n].currentColumn=0}}const n=toStyle(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),s=["xfaExclgroup"],o=layoutClass(this);o&&s.push(o);isPrintOnly(this)&&s.push("xfaPrintOnly");a.style=n;a.class=s;this.name&&(a.xfaName=this.name);this[Rs]();const c="lr-tb"===this.layout||"rl-tb"===this.layout,l=c?2:1;for(;this[$n].attempte>=1||-1===e});this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.locale=e.locale||"";this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.rotate=getInteger({data:e.rotate,defaultValue:0,validate:e=>e%90==0});this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.bind=null;this.border=null;this.calculate=null;this.caption=null;this.desc=null;this.extras=null;this.font=null;this.format=null;this.items=new XFAObjectArray(2);this.keep=null;this.margin=null;this.para=null;this.traversal=null;this.ui=null;this.validate=null;this.value=null;this.bindItems=new XFAObjectArray;this.connect=new XFAObjectArray;this.event=new XFAObjectArray;this.setProperty=new XFAObjectArray}[ms](){return!0}[Xs](e){_setValue(this,e)}[zs](e){setTabIndex(this);if(!this.ui){this.ui=new Ui({});this.ui[hs]=this[hs];this[Pn](this.ui);let e;switch(this.items.children.length){case 0:e=new TextEdit({});this.ui.textEdit=e;break;case 1:e=new CheckButton({});this.ui.checkButton=e;break;case 2:e=new ChoiceList({});this.ui.choiceList=e}this.ui[Pn](e)}if(!this.ui||"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return HTMLResult.EMPTY;this.caption&&delete this.caption[$n];this[Rs]();const t=this.caption?this.caption[zs](e).html:null,a=this.w,r=this.h;let i=0,n=0;if(this.margin){i=this.margin.leftInset+this.margin.rightInset;n=this.margin.topInset+this.margin.bottomInset}let s=null;if(""===this.w||""===this.h){let t=null,a=null,r=0,o=0;if(this.ui.checkButton)r=o=this.ui.checkButton.size;else{const{w:t,h:a}=layoutNode(this,e);if(null!==t){r=t;o=a}else o=function fonts_getMetrics(e,t=!1){let a=null;if(e){const t=stripQuotes(e.typeface),r=e[hs].fontFinder.find(t);a=selectFont(e,r)}if(!a)return{lineHeight:12,lineGap:2,lineNoGap:10};const r=e.size||10,i=a.lineHeight?Math.max(t?0:1.2,a.lineHeight):1.2,n=void 0===a.lineGap?.2:a.lineGap;return{lineHeight:i*r,lineGap:n*r,lineNoGap:Math.max(1,i-n)*r}}(this.font,!0).lineNoGap}s=getBorderDims(this.ui[as]());r+=s.w;o+=s.h;if(this.caption){const{w:i,h:n,isBroken:s}=this.caption[as](e);if(s&&this[os]()[Ss]()){this[Bs]();return HTMLResult.FAILURE}t=i;a=n;switch(this.caption.placement){case"left":case"right":case"inline":t+=r;break;case"top":case"bottom":a+=o}}else{t=r;a=o}if(t&&""===this.w){t+=i;this.w=Math.min(this.maxW<=0?1/0:this.maxW,this.minW+1e>=1&&e<=5});this.appearanceFilter=null;this.certificates=null;this.digestMethods=null;this.encodings=null;this.encryptionMethods=null;this.handler=null;this.lockDocument=null;this.mdp=null;this.reasons=null;this.timeStamp=null}}class Float extends ContentObject{constructor(e){super(Mo,"float");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Gn](){const e=parseFloat(this[Hn].trim());this[Hn]=isNaN(e)?null:e}[zs](e){return valueToHtml(null!==this[Hn]?this[Hn].toString():"")}}class template_Font extends XFAObject{constructor(e){super(Mo,"font",!0);this.baselineShift=getMeasurement(e.baselineShift);this.fontHorizontalScale=getFloat({data:e.fontHorizontalScale,defaultValue:100,validate:e=>e>=0});this.fontVerticalScale=getFloat({data:e.fontVerticalScale,defaultValue:100,validate:e=>e>=0});this.id=e.id||"";this.kerningMode=getStringOption(e.kerningMode,["none","pair"]);this.letterSpacing=getMeasurement(e.letterSpacing,"0");this.lineThrough=getInteger({data:e.lineThrough,defaultValue:0,validate:e=>1===e||2===e});this.lineThroughPeriod=getStringOption(e.lineThroughPeriod,["all","word"]);this.overline=getInteger({data:e.overline,defaultValue:0,validate:e=>1===e||2===e});this.overlinePeriod=getStringOption(e.overlinePeriod,["all","word"]);this.posture=getStringOption(e.posture,["normal","italic"]);this.size=getMeasurement(e.size,"10pt");this.typeface=e.typeface||"Courier";this.underline=getInteger({data:e.underline,defaultValue:0,validate:e=>1===e||2===e});this.underlinePeriod=getStringOption(e.underlinePeriod,["all","word"]);this.use=e.use||"";this.usehref=e.usehref||"";this.weight=getStringOption(e.weight,["normal","bold"]);this.extras=null;this.fill=null}[_n](e){super[_n](e);this[hs].usedTypefaces.add(this.typeface)}[Gs](){const e=toStyle(this,"fill"),t=e.color;if(t)if("#000000"===t)delete e.color;else if(!t.startsWith("#")){e.background=t;e.backgroundClip="text";e.color="transparent"}this.baselineShift&&(e.verticalAlign=measureToString(this.baselineShift));e.fontKerning="none"===this.kerningMode?"none":"normal";e.letterSpacing=measureToString(this.letterSpacing);if(0!==this.lineThrough){e.textDecoration="line-through";2===this.lineThrough&&(e.textDecorationStyle="double")}if(0!==this.overline){e.textDecoration="overline";2===this.overline&&(e.textDecorationStyle="double")}e.fontStyle=this.posture;e.fontSize=measureToString(.99*this.size);setFontFamily(this,this,this[hs].fontFinder,e);if(0!==this.underline){e.textDecoration="underline";2===this.underline&&(e.textDecorationStyle="double")}e.fontWeight=this.weight;return e}}class Format extends XFAObject{constructor(e){super(Mo,"format",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.picture=null}}class Handler extends StringObject{constructor(e){super(Mo,"handler");this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Hyphenation extends XFAObject{constructor(e){super(Mo,"hyphenation");this.excludeAllCaps=getInteger({data:e.excludeAllCaps,defaultValue:0,validate:e=>1===e});this.excludeInitialCap=getInteger({data:e.excludeInitialCap,defaultValue:0,validate:e=>1===e});this.hyphenate=getInteger({data:e.hyphenate,defaultValue:0,validate:e=>1===e});this.id=e.id||"";this.pushCharacterCount=getInteger({data:e.pushCharacterCount,defaultValue:3,validate:e=>e>=0});this.remainCharacterCount=getInteger({data:e.remainCharacterCount,defaultValue:3,validate:e=>e>=0});this.use=e.use||"";this.usehref=e.usehref||"";this.wordCharacterCount=getInteger({data:e.wordCharacterCount,defaultValue:7,validate:e=>e>=0})}}class Image extends StringObject{constructor(e){super(Mo,"image");this.aspect=getStringOption(e.aspect,["fit","actual","height","none","width"]);this.contentType=e.contentType||"";this.href=e.href||"";this.id=e.id||"";this.name=e.name||"";this.transferEncoding=getStringOption(e.transferEncoding,["base64","none","package"]);this.use=e.use||"";this.usehref=e.usehref||""}[zs](){if(this.contentType&&!Ro.has(this.contentType.toLowerCase()))return HTMLResult.EMPTY;let e=this[hs].images?.get(this.href);if(!e&&(this.href||!this[Hn]))return HTMLResult.EMPTY;e||"base64"!==this.transferEncoding||(e=function fromBase64Util(e){return Uint8Array.fromBase64?Uint8Array.fromBase64(e):stringToBytes(atob(e))}(this[Hn]));if(!e)return HTMLResult.EMPTY;if(!this.contentType){for(const[t,a]of No)if(e.length>t.length&&t.every((t,a)=>t===e[a])){this.contentType=a;break}if(!this.contentType)return HTMLResult.EMPTY}const t=new Blob([e],{type:this.contentType});let a;switch(this.aspect){case"fit":case"actual":break;case"height":a={height:"100%",objectFit:"fill"};break;case"none":a={width:"100%",height:"100%",objectFit:"fill"};break;case"width":a={width:"100%",objectFit:"fill"}}const r=this[cs]();return HTMLResult.success({name:"img",attributes:{class:["xfaImage"],style:a,src:URL.createObjectURL(t),alt:r?ariaLabel(r[cs]()):null}})}}class ImageEdit extends XFAObject{constructor(e){super(Mo,"imageEdit",!0);this.data=getStringOption(e.data,["link","embed"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}[zs](e){return"embed"===this.data?HTMLResult.success({name:"div",children:[],attributes:{}}):HTMLResult.EMPTY}}class Integer extends ContentObject{constructor(e){super(Mo,"integer");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Gn](){const e=parseInt(this[Hn].trim(),10);this[Hn]=isNaN(e)?null:e}[zs](e){return valueToHtml(null!==this[Hn]?this[Hn].toString():"")}}class Issuers extends XFAObject{constructor(e){super(Mo,"issuers",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=new XFAObjectArray}}class Items extends XFAObject{constructor(e){super(Mo,"items",!0);this.id=e.id||"";this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.ref=e.ref||"";this.save=getInteger({data:e.save,defaultValue:0,validate:e=>1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}[zs](){const e=[];for(const t of this[is]())e.push(t[Hs]());return HTMLResult.success(e)}}class Keep extends XFAObject{constructor(e){super(Mo,"keep",!0);this.id=e.id||"";const t=["none","contentArea","pageArea"];this.intact=getStringOption(e.intact,t);this.next=getStringOption(e.next,t);this.previous=getStringOption(e.previous,t);this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}}class KeyUsage extends XFAObject{constructor(e){super(Mo,"keyUsage");const t=["","yes","no"];this.crlSign=getStringOption(e.crlSign,t);this.dataEncipherment=getStringOption(e.dataEncipherment,t);this.decipherOnly=getStringOption(e.decipherOnly,t);this.digitalSignature=getStringOption(e.digitalSignature,t);this.encipherOnly=getStringOption(e.encipherOnly,t);this.id=e.id||"";this.keyAgreement=getStringOption(e.keyAgreement,t);this.keyCertSign=getStringOption(e.keyCertSign,t);this.keyEncipherment=getStringOption(e.keyEncipherment,t);this.nonRepudiation=getStringOption(e.nonRepudiation,t);this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Line extends XFAObject{constructor(e){super(Mo,"line",!0);this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.slope=getStringOption(e.slope,["\\","/"]);this.use=e.use||"";this.usehref=e.usehref||"";this.edge=null}[zs](){const e=this[cs]()[cs](),t=this.edge||new Edge({}),a=t[Gs](),r=Object.create(null),i="visible"===t.presence?t.thickness:0;r.strokeWidth=measureToString(i);r.stroke=a.color;let n,s,o,c,l="100%",h="100%";if(e.w<=i){[n,s,o,c]=["50%",0,"50%","100%"];l=r.strokeWidth}else if(e.h<=i){[n,s,o,c]=[0,"50%","100%","50%"];h=r.strokeWidth}else"\\"===this.slope?[n,s,o,c]=[0,0,"100%","100%"]:[n,s,o,c]=[0,"100%","100%",0];const u={name:"svg",children:[{name:"line",attributes:{xmlns:Do,x1:n,y1:s,x2:o,y2:c,style:r}}],attributes:{xmlns:Do,width:l,height:h,style:{overflow:"visible"}}};if(hasMargin(e))return HTMLResult.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[u]});u.attributes.style.position="absolute";return HTMLResult.success(u)}}class Linear extends XFAObject{constructor(e){super(Mo,"linear",!0);this.id=e.id||"";this.type=getStringOption(e.type,["toRight","toBottom","toLeft","toTop"]);this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Gs](e){e=e?e[Gs]():"#FFFFFF";return`linear-gradient(${this.type.replace(/([RBLT])/," $1").toLowerCase()}, ${e}, ${this.color?this.color[Gs]():"#000000"})`}}class LockDocument extends ContentObject{constructor(e){super(Mo,"lockDocument");this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}[Gn](){this[Hn]=getStringOption(this[Hn],["auto","0","1"])}}class Manifest extends XFAObject{constructor(e){super(Mo,"manifest",!0);this.action=getStringOption(e.action,["include","all","exclude"]);this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.ref=new XFAObjectArray}}class Margin extends XFAObject{constructor(e){super(Mo,"margin",!0);this.bottomInset=getMeasurement(e.bottomInset,"0");this.id=e.id||"";this.leftInset=getMeasurement(e.leftInset,"0");this.rightInset=getMeasurement(e.rightInset,"0");this.topInset=getMeasurement(e.topInset,"0");this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[Gs](){return{margin:measureToString(this.topInset)+" "+measureToString(this.rightInset)+" "+measureToString(this.bottomInset)+" "+measureToString(this.leftInset)}}}class Mdp extends XFAObject{constructor(e){super(Mo,"mdp");this.id=e.id||"";this.permissions=getInteger({data:e.permissions,defaultValue:2,validate:e=>1===e||3===e});this.signatureType=getStringOption(e.signatureType,["filler","author"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Medium extends XFAObject{constructor(e){super(Mo,"medium");this.id=e.id||"";this.imagingBBox=function getBBox(e){const t=-1;if(!e)return{x:t,y:t,width:t,height:t};const a=e.split(",",4).map(e=>getMeasurement(e.trim(),"-1"));if(a.length<4||a[2]<0||a[3]<0)return{x:t,y:t,width:t,height:t};const[r,i,n,s]=a;return{x:r,y:i,width:n,height:s}}(e.imagingBBox);this.long=getMeasurement(e.long);this.orientation=getStringOption(e.orientation,["portrait","landscape"]);this.short=getMeasurement(e.short);this.stock=e.stock||"";this.trayIn=getStringOption(e.trayIn,["auto","delegate","pageFront"]);this.trayOut=getStringOption(e.trayOut,["auto","delegate"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Message extends XFAObject{constructor(e){super(Mo,"message",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.text=new XFAObjectArray}}class NumericEdit extends XFAObject{constructor(e){super(Mo,"numericEdit",!0);this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.comb=null;this.extras=null;this.margin=null}[zs](e){const t=toStyle(this,"border","font","margin"),a=this[cs]()[cs](),r={name:"input",attributes:{type:"text",fieldId:a[Vs],dataId:a[Wn]?.[Vs]||a[Vs],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(a),"aria-required":!1}};if(isRequired(a)){r.attributes["aria-required"]=!0;r.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[r]})}}class Occur extends XFAObject{constructor(e){super(Mo,"occur",!0);this.id=e.id||"";this.initial=""!==e.initial?getInteger({data:e.initial,defaultValue:"",validate:e=>!0}):"";this.max=""!==e.max?getInteger({data:e.max,defaultValue:1,validate:e=>!0}):"";this.min=""!==e.min?getInteger({data:e.min,defaultValue:1,validate:e=>!0}):"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[_n](){const e=this[cs](),t=this.min;""===this.min&&(this.min=e instanceof PageArea||e instanceof PageSet?0:1);""===this.max&&(this.max=""===t?e instanceof PageArea||e instanceof PageSet?-1:1:this.min);-1!==this.max&&this.max!0});this.name=e.name||"";this.numbered=getInteger({data:e.numbered,defaultValue:1,validate:e=>!0});this.oddOrEven=getStringOption(e.oddOrEven,["any","even","odd"]);this.pagePosition=getStringOption(e.pagePosition,["any","first","last","only","rest"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.desc=null;this.extras=null;this.medium=null;this.occur=null;this.area=new XFAObjectArray;this.contentArea=new XFAObjectArray;this.draw=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.field=new XFAObjectArray;this.subform=new XFAObjectArray}[ks](){if(!this[$n]){this[$n]={numberOfUse:0};return!0}return!this.occur||-1===this.occur.max||this[$n].numberOfUsee.oddOrEven===t&&e.pagePosition===a);if(r)return r;r=this.pageArea.children.find(e=>"any"===e.oddOrEven&&e.pagePosition===a);if(r)return r;r=this.pageArea.children.find(e=>"any"===e.oddOrEven&&"any"===e.pagePosition);return r||this.pageArea.children[0]}}class Para extends XFAObject{constructor(e){super(Mo,"para",!0);this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.lineHeight=e.lineHeight?getMeasurement(e.lineHeight,"0pt"):"";this.marginLeft=e.marginLeft?getMeasurement(e.marginLeft,"0pt"):"";this.marginRight=e.marginRight?getMeasurement(e.marginRight,"0pt"):"";this.orphans=getInteger({data:e.orphans,defaultValue:0,validate:e=>e>=0});this.preserve=e.preserve||"";this.radixOffset=e.radixOffset?getMeasurement(e.radixOffset,"0pt"):"";this.spaceAbove=e.spaceAbove?getMeasurement(e.spaceAbove,"0pt"):"";this.spaceBelow=e.spaceBelow?getMeasurement(e.spaceBelow,"0pt"):"";this.tabDefault=e.tabDefault?getMeasurement(this.tabDefault):"";this.tabStops=(e.tabStops||"").trim().split(/\s+/).map((e,t)=>t%2==1?getMeasurement(e):e);this.textIndent=e.textIndent?getMeasurement(e.textIndent,"0pt"):"";this.use=e.use||"";this.usehref=e.usehref||"";this.vAlign=getStringOption(e.vAlign,["top","bottom","middle"]);this.widows=getInteger({data:e.widows,defaultValue:0,validate:e=>e>=0});this.hyphenation=null}[Gs](){const e=toStyle(this,"hAlign");""!==this.marginLeft&&(e.paddingLeft=measureToString(this.marginLeft));""!==this.marginRight&&(e.paddingRight=measureToString(this.marginRight));""!==this.spaceAbove&&(e.paddingTop=measureToString(this.spaceAbove));""!==this.spaceBelow&&(e.paddingBottom=measureToString(this.spaceBelow));if(""!==this.textIndent){e.textIndent=measureToString(this.textIndent);fixTextIndent(e)}this.lineHeight>0&&(e.lineHeight=measureToString(this.lineHeight));""!==this.tabDefault&&(e.tabSize=measureToString(this.tabDefault));this.tabStops.length;this.hyphenatation&&Object.assign(e,this.hyphenatation[Gs]());return e}}class PasswordEdit extends XFAObject{constructor(e){super(Mo,"passwordEdit",!0);this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.passwordChar=e.passwordChar||"*";this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}}class template_Pattern extends XFAObject{constructor(e){super(Mo,"pattern",!0);this.id=e.id||"";this.type=getStringOption(e.type,["crossHatch","crossDiagonal","diagonalLeft","diagonalRight","horizontal","vertical"]);this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Gs](e){e=e?e[Gs]():"#FFFFFF";const t=this.color?this.color[Gs]():"#000000",a="repeating-linear-gradient",r=`${e},${e} 5px,${t} 5px,${t} 10px`;switch(this.type){case"crossHatch":return`${a}(to top,${r}) ${a}(to right,${r})`;case"crossDiagonal":return`${a}(45deg,${r}) ${a}(-45deg,${r})`;case"diagonalLeft":return`${a}(45deg,${r})`;case"diagonalRight":return`${a}(-45deg,${r})`;case"horizontal":return`${a}(to top,${r})`;case"vertical":return`${a}(to right,${r})`}return""}}class Picture extends StringObject{constructor(e){super(Mo,"picture");this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Proto extends XFAObject{constructor(e){super(Mo,"proto",!0);this.appearanceFilter=new XFAObjectArray;this.arc=new XFAObjectArray;this.area=new XFAObjectArray;this.assist=new XFAObjectArray;this.barcode=new XFAObjectArray;this.bindItems=new XFAObjectArray;this.bookend=new XFAObjectArray;this.boolean=new XFAObjectArray;this.border=new XFAObjectArray;this.break=new XFAObjectArray;this.breakAfter=new XFAObjectArray;this.breakBefore=new XFAObjectArray;this.button=new XFAObjectArray;this.calculate=new XFAObjectArray;this.caption=new XFAObjectArray;this.certificate=new XFAObjectArray;this.certificates=new XFAObjectArray;this.checkButton=new XFAObjectArray;this.choiceList=new XFAObjectArray;this.color=new XFAObjectArray;this.comb=new XFAObjectArray;this.connect=new XFAObjectArray;this.contentArea=new XFAObjectArray;this.corner=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.dateTimeEdit=new XFAObjectArray;this.decimal=new XFAObjectArray;this.defaultUi=new XFAObjectArray;this.desc=new XFAObjectArray;this.digestMethod=new XFAObjectArray;this.digestMethods=new XFAObjectArray;this.draw=new XFAObjectArray;this.edge=new XFAObjectArray;this.encoding=new XFAObjectArray;this.encodings=new XFAObjectArray;this.encrypt=new XFAObjectArray;this.encryptData=new XFAObjectArray;this.encryption=new XFAObjectArray;this.encryptionMethod=new XFAObjectArray;this.encryptionMethods=new XFAObjectArray;this.event=new XFAObjectArray;this.exData=new XFAObjectArray;this.exObject=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.execute=new XFAObjectArray;this.extras=new XFAObjectArray;this.field=new XFAObjectArray;this.fill=new XFAObjectArray;this.filter=new XFAObjectArray;this.float=new XFAObjectArray;this.font=new XFAObjectArray;this.format=new XFAObjectArray;this.handler=new XFAObjectArray;this.hyphenation=new XFAObjectArray;this.image=new XFAObjectArray;this.imageEdit=new XFAObjectArray;this.integer=new XFAObjectArray;this.issuers=new XFAObjectArray;this.items=new XFAObjectArray;this.keep=new XFAObjectArray;this.keyUsage=new XFAObjectArray;this.line=new XFAObjectArray;this.linear=new XFAObjectArray;this.lockDocument=new XFAObjectArray;this.manifest=new XFAObjectArray;this.margin=new XFAObjectArray;this.mdp=new XFAObjectArray;this.medium=new XFAObjectArray;this.message=new XFAObjectArray;this.numericEdit=new XFAObjectArray;this.occur=new XFAObjectArray;this.oid=new XFAObjectArray;this.oids=new XFAObjectArray;this.overflow=new XFAObjectArray;this.pageArea=new XFAObjectArray;this.pageSet=new XFAObjectArray;this.para=new XFAObjectArray;this.passwordEdit=new XFAObjectArray;this.pattern=new XFAObjectArray;this.picture=new XFAObjectArray;this.radial=new XFAObjectArray;this.reason=new XFAObjectArray;this.reasons=new XFAObjectArray;this.rectangle=new XFAObjectArray;this.ref=new XFAObjectArray;this.script=new XFAObjectArray;this.setProperty=new XFAObjectArray;this.signData=new XFAObjectArray;this.signature=new XFAObjectArray;this.signing=new XFAObjectArray;this.solid=new XFAObjectArray;this.speak=new XFAObjectArray;this.stipple=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray;this.subjectDN=new XFAObjectArray;this.subjectDNs=new XFAObjectArray;this.submit=new XFAObjectArray;this.text=new XFAObjectArray;this.textEdit=new XFAObjectArray;this.time=new XFAObjectArray;this.timeStamp=new XFAObjectArray;this.toolTip=new XFAObjectArray;this.traversal=new XFAObjectArray;this.traverse=new XFAObjectArray;this.ui=new XFAObjectArray;this.validate=new XFAObjectArray;this.value=new XFAObjectArray;this.variables=new XFAObjectArray}}class Radial extends XFAObject{constructor(e){super(Mo,"radial",!0);this.id=e.id||"";this.type=getStringOption(e.type,["toEdge","toCenter"]);this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Gs](e){e=e?e[Gs]():"#FFFFFF";const t=this.color?this.color[Gs]():"#000000";return`radial-gradient(circle at center, ${"toEdge"===this.type?`${e},${t}`:`${t},${e}`})`}}class Reason extends StringObject{constructor(e){super(Mo,"reason");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Reasons extends XFAObject{constructor(e){super(Mo,"reasons",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.reason=new XFAObjectArray}}class Rectangle extends XFAObject{constructor(e){super(Mo,"rectangle",!0);this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.corner=new XFAObjectArray(4);this.edge=new XFAObjectArray(4);this.fill=null}[zs](){const e=this.edge.children.length?this.edge.children[0]:new Edge({}),t=e[Gs](),a=Object.create(null);"visible"===this.fill?.presence?Object.assign(a,this.fill[Gs]()):a.fill="transparent";a.strokeWidth=measureToString("visible"===e.presence?e.thickness:0);a.stroke=t.color;const r=(this.corner.children.length?this.corner.children[0]:new Corner({}))[Gs](),i={name:"svg",children:[{name:"rect",attributes:{xmlns:Do,width:"100%",height:"100%",x:0,y:0,rx:r.radius,ry:r.radius,style:a}}],attributes:{xmlns:Do,style:{overflow:"visible"},width:"100%",height:"100%"}};if(hasMargin(this[cs]()[cs]()))return HTMLResult.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[i]});i.attributes.style.position="absolute";return HTMLResult.success(i)}}class RefElement extends StringObject{constructor(e){super(Mo,"ref");this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Script extends StringObject{constructor(e){super(Mo,"script");this.binding=e.binding||"";this.contentType=e.contentType||"";this.id=e.id||"";this.name=e.name||"";this.runAt=getStringOption(e.runAt,["client","both","server"]);this.use=e.use||"";this.usehref=e.usehref||""}}class SetProperty extends XFAObject{constructor(e){super(Mo,"setProperty");this.connection=e.connection||"";this.ref=e.ref||"";this.target=e.target||""}}class SignData extends XFAObject{constructor(e){super(Mo,"signData",!0);this.id=e.id||"";this.operation=getStringOption(e.operation,["sign","clear","verify"]);this.ref=e.ref||"";this.target=e.target||"";this.use=e.use||"";this.usehref=e.usehref||"";this.filter=null;this.manifest=null}}class Signature extends XFAObject{constructor(e){super(Mo,"signature",!0);this.id=e.id||"";this.type=getStringOption(e.type,["PDF1.3","PDF1.6"]);this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.filter=null;this.manifest=null;this.margin=null}}class Signing extends XFAObject{constructor(e){super(Mo,"signing",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=new XFAObjectArray}}class Solid extends XFAObject{constructor(e){super(Mo,"solid",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[Gs](e){return e?e[Gs]():"#FFFFFF"}}class Speak extends StringObject{constructor(e){super(Mo,"speak");this.disable=getInteger({data:e.disable,defaultValue:0,validate:e=>1===e});this.id=e.id||"";this.priority=getStringOption(e.priority,["custom","caption","name","toolTip"]);this.rid=e.rid||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Stipple extends XFAObject{constructor(e){super(Mo,"stipple",!0);this.id=e.id||"";this.rate=getInteger({data:e.rate,defaultValue:50,validate:e=>e>=0&&e<=100});this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[Gs](e){const t=this.rate/100;return Util.makeHexColor(Math.round(e.value.r*(1-t)+this.value.r*t),Math.round(e.value.g*(1-t)+this.value.g*t),Math.round(e.value.b*(1-t)+this.value.b*t))}}class Subform extends XFAObject{constructor(e){super(Mo,"subform",!0);this.access=getStringOption(e.access,["open","nonInteractive","protected","readOnly"]);this.allowMacro=getInteger({data:e.allowMacro,defaultValue:0,validate:e=>1===e});this.anchorType=getStringOption(e.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.columnWidths=(e.columnWidths||"").trim().split(/\s+/).map(e=>"-1"===e?-1:getMeasurement(e));this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.layout=getStringOption(e.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]);this.locale=e.locale||"";this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.mergeMode=getStringOption(e.mergeMode,["consumeData","matchTemplate"]);this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.restoreState=getStringOption(e.restoreState,["manual","auto"]);this.scope=getStringOption(e.scope,["name","none"]);this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.bind=null;this.bookend=null;this.border=null;this.break=null;this.calculate=null;this.desc=null;this.extras=null;this.keep=null;this.margin=null;this.occur=null;this.overflow=null;this.pageSet=null;this.para=null;this.traversal=null;this.validate=null;this.variables=null;this.area=new XFAObjectArray;this.breakAfter=new XFAObjectArray;this.breakBefore=new XFAObjectArray;this.connect=new XFAObjectArray;this.draw=new XFAObjectArray;this.event=new XFAObjectArray;this.exObject=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.field=new XFAObjectArray;this.proto=new XFAObjectArray;this.setProperty=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray}[os](){const e=this[cs]();return e instanceof SubformSet?e[os]():e}[ms](){return!0}[Ss](){return this.layout.endsWith("-tb")&&0===this[$n].attempt&&this[$n].numberInLine>0||this[cs]()[Ss]()}*[ns](){yield*getContainedChildren(this)}[Vn](){return flushHTML(this)}[En](e,t){addHTML(this,e,t)}[Yn](){return getAvailableSpace(this)}[xs](){const e=this[os]();if(!e[xs]())return!1;if(void 0!==this[$n]._isSplittable)return this[$n]._isSplittable;if("position"===this.layout||this.layout.includes("row")){this[$n]._isSplittable=!1;return!1}if(this.keep&&"none"!==this.keep.intact){this[$n]._isSplittable=!1;return!1}if(e.layout?.endsWith("-tb")&&0!==e[$n].numberInLine)return!1;this[$n]._isSplittable=!0;return!0}[zs](e){setTabIndex(this);if(this.break){if("auto"!==this.break.after||""!==this.break.afterTarget){const e=new BreakAfter({targetType:this.break.after,target:this.break.afterTarget,startNew:this.break.startNew.toString()});e[hs]=this[hs];this[Pn](e);this.breakAfter.push(e)}if("auto"!==this.break.before||""!==this.break.beforeTarget){const e=new BreakBefore({targetType:this.break.before,target:this.break.beforeTarget,startNew:this.break.startNew.toString()});e[hs]=this[hs];this[Pn](e);this.breakBefore.push(e)}if(""!==this.break.overflowTarget){const e=new Overflow({target:this.break.overflowTarget,leader:this.break.overflowLeader,trailer:this.break.overflowTrailer});e[hs]=this[hs];this[Pn](e);this.overflow.push(e)}this[Ns](this.break);this.break=null}if("hidden"===this.presence||"inactive"===this.presence)return HTMLResult.EMPTY;(this.breakBefore.children.length>1||this.breakAfter.children.length>1)&&warn("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");if(this.breakBefore.children.length>=1){const e=this.breakBefore.children[0];if(handleBreak(e))return HTMLResult.breakNode(e)}if(this[$n]?.afterBreakAfter)return HTMLResult.EMPTY;fixDimensions(this);const t=[],a={id:this[Vs],class:[]};setAccess(this,a.class);this[$n]||=Object.create(null);Object.assign(this[$n],{children:t,line:null,attributes:a,attempt:0,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,e.width),height:Math.min(this.h||1/0,e.height)},width:0,height:0,prevHeight:0,currentWidth:0});const r=this[ls](),i=r[$n].noLayoutFailure,n=this[xs]();n||setFirstUnsplittable(this);if(!checkDimensions(this,e))return HTMLResult.FAILURE;const s=new Set(["area","draw","exclGroup","field","subform","subformSet"]);if(this.layout.includes("row")){const e=this[os]().columnWidths;if(Array.isArray(e)&&e.length>0){this[$n].columnWidths=e;this[$n].currentColumn=0}}const o=toStyle(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),c=["xfaSubform"],l=layoutClass(this);l&&c.push(l);a.style=o;a.class=c;this.name&&(a.xfaName=this.name);if(this.overflow){const t=this.overflow[as]();if(t.addLeader){t.addLeader=!1;handleOverflow(this,t.leader,e)}}this[Rs]();const h="lr-tb"===this.layout||"rl-tb"===this.layout,u=h?2:1;for(;this[$n].attempt=1){const e=this.breakAfter.children[0];if(handleBreak(e)){this[$n].afterBreakAfter=y;return HTMLResult.breakNode(e)}}delete this[$n];return y}}class SubformSet extends XFAObject{constructor(e){super(Mo,"subformSet",!0);this.id=e.id||"";this.name=e.name||"";this.relation=getStringOption(e.relation,["ordered","choice","unordered"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.bookend=null;this.break=null;this.desc=null;this.extras=null;this.occur=null;this.overflow=null;this.breakAfter=new XFAObjectArray;this.breakBefore=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray}*[ns](){yield*getContainedChildren(this)}[os](){let e=this[cs]();for(;!(e instanceof Subform);)e=e[cs]();return e}[ms](){return!0}}class SubjectDN extends ContentObject{constructor(e){super(Mo,"subjectDN");this.delimiter=e.delimiter||",";this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Gn](){this[Hn]=new Map(this[Hn].split(this.delimiter).map(e=>{(e=e.split("=",2))[0]=e[0].trim();return e}))}}class SubjectDNs extends XFAObject{constructor(e){super(Mo,"subjectDNs",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.subjectDN=new XFAObjectArray}}class Submit extends XFAObject{constructor(e){super(Mo,"submit",!0);this.embedPDF=getInteger({data:e.embedPDF,defaultValue:0,validate:e=>1===e});this.format=getStringOption(e.format,["xdp","formdata","pdf","urlencoded","xfd","xml"]);this.id=e.id||"";this.target=e.target||"";this.textEncoding=getKeyword({data:e.textEncoding?e.textEncoding.toLowerCase():"",defaultValue:"",validate:e=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(e)||e.match(/iso-8859-\d{2}/)});this.use=e.use||"";this.usehref=e.usehref||"";this.xdpContent=e.xdpContent||"";this.encrypt=null;this.encryptData=new XFAObjectArray;this.signData=new XFAObjectArray}}class Template extends XFAObject{constructor(e){super(Mo,"template",!0);this.baseProfile=getStringOption(e.baseProfile,["full","interactiveForms"]);this.extras=null;this.subform=new XFAObjectArray}[Gn](){0===this.subform.children.length&&warn("XFA - No subforms in template node.");this.subform.children.length>=2&&warn("XFA - Several subforms in template node: please file a bug.");this[qs]=5e3}[xs](){return!0}[_s](e,t){return e.startsWith("#")?[this[ds].get(e.slice(1))]:searchNode(this,t,e,!0,!0)}*[Ws](){if(!this.subform.children.length)return HTMLResult.success({name:"div",children:[]});this[$n]={overflowNode:null,firstUnsplittable:null,currentContentArea:null,currentPageArea:null,noLayoutFailure:!1,pageNumber:1,pagePosition:"first",oddOrEven:"odd",blankOrNotBlank:"nonBlank",paraStack:[]};const e=this.subform.children[0];e.pageSet[jn]();const t=e.pageSet.pageArea.children,a={name:"div",children:[]};let r=null,i=null,n=null;if(e.breakBefore.children.length>=1){i=e.breakBefore.children[0];n=i.target}else if(e.subform.children.length>=1&&e.subform.children[0].breakBefore.children.length>=1){i=e.subform.children[0].breakBefore.children[0];n=i.target}else if(e.break?.beforeTarget){i=e.break;n=i.beforeTarget}else if(e.subform.children.length>=1&&e.subform.children[0].break?.beforeTarget){i=e.subform.children[0].break;n=i.beforeTarget}if(i){const e=this[_s](n,i[cs]());if(e instanceof PageArea){r=e;i[$n]={}}}r||=t[0];r[$n]={numberOfUse:1};const s=r[cs]();s[$n]={numberOfUse:1,pageIndex:s.pageArea.children.indexOf(r),pageSetIndex:0};let o,c=null,l=null,h=!0,u=0,d=0;for(;;){if(h)u=0;else{a.children.pop();if(3===++u){warn("XFA - Something goes wrong: please file a bug.");return a}}o=null;this[$n].currentPageArea=r;const t=r[zs]().html;a.children.push(t);if(c){this[$n].noLayoutFailure=!0;t.children.push(c[zs](r[$n].space).html);c=null}if(l){this[$n].noLayoutFailure=!0;t.children.push(l[zs](r[$n].space).html);l=null}const i=r.contentArea.children,n=t.children.filter(e=>e.attributes.class.includes("xfaContentarea"));h=!1;this[$n].firstUnsplittable=null;this[$n].noLayoutFailure=!1;const flush=t=>{const a=e[Vn]();if(a){h||=a.children?.length>0;n[t].children.push(a)}};for(let t=d,r=i.length;t0;n[t].children.push(u.html)}else!h&&a.children.length>1&&a.children.pop();return a}if(u.isBreak()){const e=u.breakNode;flush(t);if("auto"===e.targetType)continue;if(e.leader){c=this[_s](e.leader,e[cs]());c=c?c[0]:null}if(e.trailer){l=this[_s](e.trailer,e[cs]());l=l?l[0]:null}if("pageArea"===e.targetType){o=e[$n].target;t=1/0}else if(e[$n].target){o=e[$n].target;d=e[$n].index+1;t=1/0}else t=e[$n].index;continue}if(this[$n].overflowNode){const e=this[$n].overflowNode;this[$n].overflowNode=null;const a=e[as](),r=a.target;a.addLeader=null!==a.leader;a.addTrailer=null!==a.trailer;flush(t);const n=t;t=1/0;if(r instanceof PageArea)o=r;else if(r instanceof ContentArea){const e=i.indexOf(r);if(-1!==e)e>n?t=e-1:d=e;else{o=r[cs]();d=o.contentArea.children.indexOf(r)}}continue}flush(t)}this[$n].pageNumber+=1;o&&(o[ks]()?o[$n].numberOfUse+=1:o=null);r=o||r[ss]();yield null}}}class Text extends ContentObject{constructor(e){super(Mo,"text");this.id=e.id||"";this.maxChars=getInteger({data:e.maxChars,defaultValue:0,validate:e=>e>=0});this.name=e.name||"";this.rid=e.rid||"";this.use=e.use||"";this.usehref=e.usehref||""}[Nn](){return!0}[Ts](e){if(e[vs]===Js.xhtml.id){this[Hn]=e;return!0}warn(`XFA - Invalid content in Text: ${e[Fs]}.`);return!1}[Ms](e){this[Hn]instanceof XFAObject||super[Ms](e)}[Gn](){"string"==typeof this[Hn]&&(this[Hn]=this[Hn].replaceAll("\r\n","\n"))}[as](){return"string"==typeof this[Hn]?this[Hn].split(/[\u2029\u2028\n]/).filter(e=>!!e).join("\n"):this[Hn][Hs]()}[zs](e){if("string"==typeof this[Hn]){const e=valueToHtml(this[Hn]).html;if(this[Hn].includes("\u2029")){e.name="div";e.children=[];this[Hn].split("\u2029").map(e=>e.split(/[\u2028\n]/).flatMap(e=>[{name:"span",value:e},{name:"br"}])).forEach(t=>{e.children.push({name:"p",children:t})})}else if(/[\u2028\n]/.test(this[Hn])){e.name="div";e.children=[];this[Hn].split(/[\u2028\n]/).forEach(t=>{e.children.push({name:"span",value:t},{name:"br"})})}return HTMLResult.success(e)}return this[Hn][zs](e)}}class TextEdit extends XFAObject{constructor(e){super(Mo,"textEdit",!0);this.allowRichText=getInteger({data:e.allowRichText,defaultValue:0,validate:e=>1===e});this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.multiLine=getInteger({data:e.multiLine,defaultValue:"",validate:e=>0===e||1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.vScrollPolicy=getStringOption(e.vScrollPolicy,["auto","off","on"]);this.border=null;this.comb=null;this.extras=null;this.margin=null}[zs](e){const t=toStyle(this,"border","font","margin");let a;const r=this[cs]()[cs]();""===this.multiLine&&(this.multiLine=r instanceof Draw?1:0);a=1===this.multiLine?{name:"textarea",attributes:{dataId:r[Wn]?.[Vs]||r[Vs],fieldId:r[Vs],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(r),"aria-required":!1}}:{name:"input",attributes:{type:"text",dataId:r[Wn]?.[Vs]||r[Vs],fieldId:r[Vs],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(r),"aria-required":!1}};if(isRequired(r)){a.attributes["aria-required"]=!0;a.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[a]})}}class Time extends StringObject{constructor(e){super(Mo,"time");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[Gn](){const e=this[Hn].trim();this[Hn]=e?new Date(e):null}[zs](e){return valueToHtml(this[Hn]?this[Hn].toString():"")}}class TimeStamp extends XFAObject{constructor(e){super(Mo,"timeStamp");this.id=e.id||"";this.server=e.server||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class ToolTip extends StringObject{constructor(e){super(Mo,"toolTip");this.id=e.id||"";this.rid=e.rid||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Traversal extends XFAObject{constructor(e){super(Mo,"traversal",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.traverse=new XFAObjectArray}}class Traverse extends XFAObject{constructor(e){super(Mo,"traverse",!0);this.id=e.id||"";this.operation=getStringOption(e.operation,["next","back","down","first","left","right","up"]);this.ref=e.ref||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.script=null}get name(){return this.operation}[As](){return!1}}class Ui extends XFAObject{constructor(e){super(Mo,"ui",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.picture=null;this.barcode=null;this.button=null;this.checkButton=null;this.choiceList=null;this.dateTimeEdit=null;this.defaultUi=null;this.imageEdit=null;this.numericEdit=null;this.passwordEdit=null;this.signature=null;this.textEdit=null}[as](){if(void 0===this[$n]){for(const e of Object.getOwnPropertyNames(this)){if("extras"===e||"picture"===e)continue;const t=this[e];if(t instanceof XFAObject){this[$n]=t;return t}}this[$n]=null}return this[$n]}[zs](e){const t=this[as]();return t?t[zs](e):HTMLResult.EMPTY}}class Validate extends XFAObject{constructor(e){super(Mo,"validate",!0);this.formatTest=getStringOption(e.formatTest,["warning","disabled","error"]);this.id=e.id||"";this.nullTest=getStringOption(e.nullTest,["disabled","error","warning"]);this.scriptTest=getStringOption(e.scriptTest,["error","disabled","warning"]);this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.message=null;this.picture=null;this.script=null}}class Value extends XFAObject{constructor(e){super(Mo,"value",!0);this.id=e.id||"";this.override=getInteger({data:e.override,defaultValue:0,validate:e=>1===e});this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.arc=null;this.boolean=null;this.date=null;this.dateTime=null;this.decimal=null;this.exData=null;this.float=null;this.image=null;this.integer=null;this.line=null;this.rectangle=null;this.text=null;this.time=null}[Xs](e){const t=this[cs]();if(t instanceof Field&&t.ui?.imageEdit){if(!this.image){this.image=new Image({});this[Pn](this.image)}this.image[Hn]=e[Hn];return}const a=e[Fs];if(null===this[a]){for(const e of Object.getOwnPropertyNames(this)){const t=this[e];if(t instanceof XFAObject){this[e]=null;this[Ns](t)}}this[e[Fs]]=e;this[Pn](e)}else this[a][Hn]=e[Hn]}[Hs](){if(this.exData)return"string"==typeof this.exData[Hn]?this.exData[Hn].trim():this.exData[Hn][Hs]().trim();for(const e of Object.getOwnPropertyNames(this)){if("image"===e)continue;const t=this[e];if(t instanceof XFAObject)return(t[Hn]||"").toString().trim()}return null}[zs](e){for(const t of Object.getOwnPropertyNames(this)){const a=this[t];if(a instanceof XFAObject)return a[zs](e)}return HTMLResult.EMPTY}}class Variables extends XFAObject{constructor(e){super(Mo,"variables",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.manifest=new XFAObjectArray;this.script=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}[As](){return!0}}class TemplateNamespace{static[Ks](e,t){if(TemplateNamespace.hasOwnProperty(e)){const a=TemplateNamespace[e](t);a[Us](t);return a}}static appearanceFilter(e){return new AppearanceFilter(e)}static arc(e){return new Arc(e)}static area(e){return new Area(e)}static assist(e){return new Assist(e)}static barcode(e){return new Barcode(e)}static bind(e){return new Bind(e)}static bindItems(e){return new BindItems(e)}static bookend(e){return new Bookend(e)}static boolean(e){return new BooleanElement(e)}static border(e){return new Border(e)}static break(e){return new Break(e)}static breakAfter(e){return new BreakAfter(e)}static breakBefore(e){return new BreakBefore(e)}static button(e){return new Button(e)}static calculate(e){return new Calculate(e)}static caption(e){return new Caption(e)}static certificate(e){return new Certificate(e)}static certificates(e){return new Certificates(e)}static checkButton(e){return new CheckButton(e)}static choiceList(e){return new ChoiceList(e)}static color(e){return new Color(e)}static comb(e){return new Comb(e)}static connect(e){return new Connect(e)}static contentArea(e){return new ContentArea(e)}static corner(e){return new Corner(e)}static date(e){return new DateElement(e)}static dateTime(e){return new DateTime(e)}static dateTimeEdit(e){return new DateTimeEdit(e)}static decimal(e){return new Decimal(e)}static defaultUi(e){return new DefaultUi(e)}static desc(e){return new Desc(e)}static digestMethod(e){return new DigestMethod(e)}static digestMethods(e){return new DigestMethods(e)}static draw(e){return new Draw(e)}static edge(e){return new Edge(e)}static encoding(e){return new Encoding(e)}static encodings(e){return new Encodings(e)}static encrypt(e){return new Encrypt(e)}static encryptData(e){return new EncryptData(e)}static encryption(e){return new Encryption(e)}static encryptionMethod(e){return new EncryptionMethod(e)}static encryptionMethods(e){return new EncryptionMethods(e)}static event(e){return new Event(e)}static exData(e){return new ExData(e)}static exObject(e){return new ExObject(e)}static exclGroup(e){return new ExclGroup(e)}static execute(e){return new Execute(e)}static extras(e){return new Extras(e)}static field(e){return new Field(e)}static fill(e){return new Fill(e)}static filter(e){return new Filter(e)}static float(e){return new Float(e)}static font(e){return new template_Font(e)}static format(e){return new Format(e)}static handler(e){return new Handler(e)}static hyphenation(e){return new Hyphenation(e)}static image(e){return new Image(e)}static imageEdit(e){return new ImageEdit(e)}static integer(e){return new Integer(e)}static issuers(e){return new Issuers(e)}static items(e){return new Items(e)}static keep(e){return new Keep(e)}static keyUsage(e){return new KeyUsage(e)}static line(e){return new Line(e)}static linear(e){return new Linear(e)}static lockDocument(e){return new LockDocument(e)}static manifest(e){return new Manifest(e)}static margin(e){return new Margin(e)}static mdp(e){return new Mdp(e)}static medium(e){return new Medium(e)}static message(e){return new Message(e)}static numericEdit(e){return new NumericEdit(e)}static occur(e){return new Occur(e)}static oid(e){return new Oid(e)}static oids(e){return new Oids(e)}static overflow(e){return new Overflow(e)}static pageArea(e){return new PageArea(e)}static pageSet(e){return new PageSet(e)}static para(e){return new Para(e)}static passwordEdit(e){return new PasswordEdit(e)}static pattern(e){return new template_Pattern(e)}static picture(e){return new Picture(e)}static proto(e){return new Proto(e)}static radial(e){return new Radial(e)}static reason(e){return new Reason(e)}static reasons(e){return new Reasons(e)}static rectangle(e){return new Rectangle(e)}static ref(e){return new RefElement(e)}static script(e){return new Script(e)}static setProperty(e){return new SetProperty(e)}static signData(e){return new SignData(e)}static signature(e){return new Signature(e)}static signing(e){return new Signing(e)}static solid(e){return new Solid(e)}static speak(e){return new Speak(e)}static stipple(e){return new Stipple(e)}static subform(e){return new Subform(e)}static subformSet(e){return new SubformSet(e)}static subjectDN(e){return new SubjectDN(e)}static subjectDNs(e){return new SubjectDNs(e)}static submit(e){return new Submit(e)}static template(e){return new Template(e)}static text(e){return new Text(e)}static textEdit(e){return new TextEdit(e)}static time(e){return new Time(e)}static timeStamp(e){return new TimeStamp(e)}static toolTip(e){return new ToolTip(e)}static traversal(e){return new Traversal(e)}static traverse(e){return new Traverse(e)}static ui(e){return new Ui(e)}static validate(e){return new Validate(e)}static value(e){return new Value(e)}static variables(e){return new Variables(e)}}const Eo=Js.datasets.id;function createText(e){const t=new Text({});t[Hn]=e;return t}class Binder{constructor(e){this.root=e;this.datasets=e.datasets;this.data=e.datasets?.data||new XmlObject(Js.datasets.id,"data");this.emptyMerge=0===this.data[is]().length;this.root.form=this.form=e.template[Xn]()}_isConsumeData(){return!this.emptyMerge&&this._mergeMode}_isMatchTemplate(){return!this._isConsumeData()}bind(){this._bindElement(this.form,this.data);return this.form}getData(){return this.data}_bindValue(e,t,a){e[Wn]=t;if(e[us]())if(t[bs]()){const a=t[ts]();e[Xs](createText(a))}else if(e instanceof Field&&"multiSelect"===e.ui?.choiceList?.open){const a=t[is]().map(e=>e[Hn].trim()).join("\n");e[Xs](createText(a))}else this._isConsumeData()&&warn("XFA - Nodes haven't the same type.");else!t[bs]()||this._isMatchTemplate()?this._bindElement(e,t):warn("XFA - Nodes haven't the same type.")}_findDataByNameToConsume(e,t,a,r){if(!e)return null;let i,n;for(let r=0;r<3;r++){i=a[rs](e,!1,!0);for(;;){n=i.next().value;if(!n)break;if(t===n[bs]())return n}if(a[vs]===Js.datasets.id&&"data"===a[Fs])break;a=a[cs]()}if(!r)return null;i=this.data[rs](e,!0,!1);n=i.next().value;if(n)return n;i=this.data[Kn](e,!0);n=i.next().value;return n?.[bs]()?n:null}_setProperties(e,t){if(e.hasOwnProperty("setProperty"))for(const{ref:a,target:r,connection:i}of e.setProperty.children){if(i)continue;if(!a)continue;const n=searchNode(this.root,t,a,!1,!1);if(!n){warn(`XFA - Invalid reference: ${a}.`);continue}const[s]=n;if(!s[ys](this.data)){warn("XFA - Invalid node: must be a data node.");continue}const o=searchNode(this.root,e,r,!1,!1);if(!o){warn(`XFA - Invalid target: ${r}.`);continue}const[c]=o;if(!c[ys](e)){warn("XFA - Invalid target: must be a property or subproperty.");continue}const l=c[cs]();if(c instanceof SetProperty||l instanceof SetProperty){warn("XFA - Invalid target: cannot be a setProperty or one of its properties.");continue}if(c instanceof BindItems||l instanceof BindItems){warn("XFA - Invalid target: cannot be a bindItems or one of its properties.");continue}const h=s[Hs](),u=c[Fs];if(c instanceof XFAAttribute){const e=Object.create(null);e[u]=h;const t=Reflect.construct(Object.getPrototypeOf(l).constructor,[e]);l[u]=t[u];continue}if(c.hasOwnProperty(Hn)){c[Wn]=s;c[Hn]=h;c[Gn]()}else warn("XFA - Invalid node to use in setProperty")}}_bindItems(e,t){if(!e.hasOwnProperty("items")||!e.hasOwnProperty("bindItems")||e.bindItems.isEmpty())return;for(const t of e.items.children)e[Ns](t);e.items.clear();const a=new Items({}),r=new Items({});e[Pn](a);e.items.push(a);e[Pn](r);e.items.push(r);for(const{ref:i,labelRef:n,valueRef:s,connection:o}of e.bindItems.children){if(o)continue;if(!i)continue;const e=searchNode(this.root,t,i,!1,!1);if(e)for(const t of e){if(!t[ys](this.datasets)){warn(`XFA - Invalid ref (${i}): must be a datasets child.`);continue}const e=searchNode(this.root,t,n,!0,!1);if(!e){warn(`XFA - Invalid label: ${n}.`);continue}const[o]=e;if(!o[ys](this.datasets)){warn("XFA - Invalid label: must be a datasets child.");continue}const c=searchNode(this.root,t,s,!0,!1);if(!c){warn(`XFA - Invalid value: ${s}.`);continue}const[l]=c;if(!l[ys](this.datasets)){warn("XFA - Invalid value: must be a datasets child.");continue}const h=createText(o[Hs]()),u=createText(l[Hs]());a[Pn](h);a.text.push(h);r[Pn](u);r.text.push(u)}else warn(`XFA - Invalid reference: ${i}.`)}}_bindOccurrences(e,t,a){let r;if(t.length>1){r=e[Xn]();r[Ns](r.occur);r.occur=null}this._bindValue(e,t[0],a);this._setProperties(e,t[0]);this._bindItems(e,t[0]);if(1===t.length)return;const i=e[cs](),n=e[Fs],s=i[fs](e);for(let e=1,o=t.length;et.name===e.name).length:a[r].children.length;const n=a[fs](e)+1,s=t.initial-i;if(s){const t=e[Xn]();t[Ns](t.occur);t.occur=null;a[r].push(t);a[gs](n,t);for(let e=1;e0)this._bindOccurrences(r,[e[0]],null);else if(this.emptyMerge){const e=t[vs]===Eo?-1:t[vs],a=r[Wn]=new XmlObject(e,r.name||"root");t[Pn](a);this._bindElement(r,a)}continue}if(!r[ms]())continue;let e=!1,i=null,n=null,s=null;if(r.bind){switch(r.bind.match){case"none":this._setAndBind(r,t);continue;case"global":e=!0;break;case"dataRef":if(!r.bind.ref){warn(`XFA - ref is empty in node ${r[Fs]}.`);this._setAndBind(r,t);continue}n=r.bind.ref}r.bind.picture&&(i=r.bind.picture[Hn])}const[o,c]=this._getOccurInfo(r);if(n){s=searchNode(this.root,t,n,!0,!1);if(null===s){s=createDataNode(this.data,t,n);if(!s)continue;this._isConsumeData()&&(s[qn]=!0);this._setAndBind(r,s);continue}this._isConsumeData()&&(s=s.filter(e=>!e[qn]));s.length>c?s=s.slice(0,c):0===s.length&&(s=null);s&&this._isConsumeData()&&s.forEach(e=>{e[qn]=!0})}else{if(!r.name){this._setAndBind(r,t);continue}if(this._isConsumeData()){const a=[];for(;a.length0?a:null}else{s=t[rs](r.name,!1,this.emptyMerge).next().value;if(!s){if(0===o){a.push(r);continue}const e=t[vs]===Eo?-1:t[vs];s=r[Wn]=new XmlObject(e,r.name);this.emptyMerge&&(s[qn]=!0);t[Pn](s);this._setAndBind(r,s);continue}this.emptyMerge&&(s[qn]=!0);s=[s]}}s?this._bindOccurrences(r,s,i):o>0?this._setAndBind(r,t):a.push(r)}a.forEach(e=>e[cs]()[Ns](e))}}class DataHandler{constructor(e,t){this.data=t;this.dataset=e.datasets||null}serialize(e){const t=[[-1,this.data[is]()]];for(;t.length>0;){const a=t.at(-1),[r,i]=a;if(r+1===i.length){t.pop();continue}const n=i[++a[0]],s=e.get(n[Vs]);if(s)n[Xs](s);else{const t=n[Jn]();for(const a of t.values()){const t=e.get(a[Vs]);if(t){a[Xs](t);break}}}const o=n[is]();o.length>0&&t.push([-1,o])}const a=[''];if(this.dataset)for(const e of this.dataset[is]())"data"!==e[Fs]&&e[$s](a);this.data[$s](a);a.push("");return a.join("")}}const Po=Js.config.id;class Acrobat extends XFAObject{constructor(e){super(Po,"acrobat",!0);this.acrobat7=null;this.autoSave=null;this.common=null;this.validate=null;this.validateApprovalSignatures=null;this.submitUrl=new XFAObjectArray}}class Acrobat7 extends XFAObject{constructor(e){super(Po,"acrobat7",!0);this.dynamicRender=null}}class ADBE_JSConsole extends OptionObject{constructor(e){super(Po,"ADBE_JSConsole",["delegate","Enable","Disable"])}}class ADBE_JSDebugger extends OptionObject{constructor(e){super(Po,"ADBE_JSDebugger",["delegate","Enable","Disable"])}}class AddSilentPrint extends Option01{constructor(e){super(Po,"addSilentPrint")}}class AddViewerPreferences extends Option01{constructor(e){super(Po,"addViewerPreferences")}}class AdjustData extends Option10{constructor(e){super(Po,"adjustData")}}class AdobeExtensionLevel extends IntegerObject{constructor(e){super(Po,"adobeExtensionLevel",0,e=>e>=1&&e<=8)}}class Agent extends XFAObject{constructor(e){super(Po,"agent",!0);this.name=e.name?e.name.trim():"";this.common=new XFAObjectArray}}class AlwaysEmbed extends ContentObject{constructor(e){super(Po,"alwaysEmbed")}}class Amd extends StringObject{constructor(e){super(Po,"amd")}}class config_Area extends XFAObject{constructor(e){super(Po,"area");this.level=getInteger({data:e.level,defaultValue:0,validate:e=>e>=1&&e<=3});this.name=getStringOption(e.name,["","barcode","coreinit","deviceDriver","font","general","layout","merge","script","signature","sourceSet","templateCache"])}}class Attributes extends OptionObject{constructor(e){super(Po,"attributes",["preserve","delegate","ignore"])}}class AutoSave extends OptionObject{constructor(e){super(Po,"autoSave",["disabled","enabled"])}}class Base extends StringObject{constructor(e){super(Po,"base")}}class BatchOutput extends XFAObject{constructor(e){super(Po,"batchOutput");this.format=getStringOption(e.format,["none","concat","zip","zipCompress"])}}class BehaviorOverride extends ContentObject{constructor(e){super(Po,"behaviorOverride")}[Gn](){this[Hn]=new Map(this[Hn].trim().split(/\s+/).filter(e=>e.includes(":")).map(e=>e.split(":",2)))}}class Cache extends XFAObject{constructor(e){super(Po,"cache",!0);this.templateCache=null}}class Change extends Option01{constructor(e){super(Po,"change")}}class Common extends XFAObject{constructor(e){super(Po,"common",!0);this.data=null;this.locale=null;this.localeSet=null;this.messaging=null;this.suppressBanner=null;this.template=null;this.validationMessaging=null;this.versionControl=null;this.log=new XFAObjectArray}}class Compress extends XFAObject{constructor(e){super(Po,"compress");this.scope=getStringOption(e.scope,["imageOnly","document"])}}class CompressLogicalStructure extends Option01{constructor(e){super(Po,"compressLogicalStructure")}}class CompressObjectStream extends Option10{constructor(e){super(Po,"compressObjectStream")}}class Compression extends XFAObject{constructor(e){super(Po,"compression",!0);this.compressLogicalStructure=null;this.compressObjectStream=null;this.level=null;this.type=null}}class Config extends XFAObject{constructor(e){super(Po,"config",!0);this.acrobat=null;this.present=null;this.trace=null;this.agent=new XFAObjectArray}}class Conformance extends OptionObject{constructor(e){super(Po,"conformance",["A","B"])}}class ContentCopy extends Option01{constructor(e){super(Po,"contentCopy")}}class Copies extends IntegerObject{constructor(e){super(Po,"copies",1,e=>e>=1)}}class Creator extends StringObject{constructor(e){super(Po,"creator")}}class CurrentPage extends IntegerObject{constructor(e){super(Po,"currentPage",0,e=>e>=0)}}class Data extends XFAObject{constructor(e){super(Po,"data",!0);this.adjustData=null;this.attributes=null;this.incrementalLoad=null;this.outputXSL=null;this.range=null;this.record=null;this.startNode=null;this.uri=null;this.window=null;this.xsl=null;this.excludeNS=new XFAObjectArray;this.transform=new XFAObjectArray}}class Debug extends XFAObject{constructor(e){super(Po,"debug",!0);this.uri=null}}class DefaultTypeface extends ContentObject{constructor(e){super(Po,"defaultTypeface");this.writingScript=getStringOption(e.writingScript,["*","Arabic","Cyrillic","EastEuropeanRoman","Greek","Hebrew","Japanese","Korean","Roman","SimplifiedChinese","Thai","TraditionalChinese","Vietnamese"])}}class Destination extends OptionObject{constructor(e){super(Po,"destination",["pdf","pcl","ps","webClient","zpl"])}}class DocumentAssembly extends Option01{constructor(e){super(Po,"documentAssembly")}}class Driver extends XFAObject{constructor(e){super(Po,"driver",!0);this.name=e.name?e.name.trim():"";this.fontInfo=null;this.xdc=null}}class DuplexOption extends OptionObject{constructor(e){super(Po,"duplexOption",["simplex","duplexFlipLongEdge","duplexFlipShortEdge"])}}class DynamicRender extends OptionObject{constructor(e){super(Po,"dynamicRender",["forbidden","required"])}}class Embed extends Option01{constructor(e){super(Po,"embed")}}class config_Encrypt extends Option01{constructor(e){super(Po,"encrypt")}}class config_Encryption extends XFAObject{constructor(e){super(Po,"encryption",!0);this.encrypt=null;this.encryptionLevel=null;this.permissions=null}}class EncryptionLevel extends OptionObject{constructor(e){super(Po,"encryptionLevel",["40bit","128bit"])}}class Enforce extends StringObject{constructor(e){super(Po,"enforce")}}class Equate extends XFAObject{constructor(e){super(Po,"equate");this.force=getInteger({data:e.force,defaultValue:1,validate:e=>0===e});this.from=e.from||"";this.to=e.to||""}}class EquateRange extends XFAObject{constructor(e){super(Po,"equateRange");this.from=e.from||"";this.to=e.to||"";this._unicodeRange=e.unicodeRange||""}get unicodeRange(){const e=[],t=/U\+([0-9a-fA-F]+)/,a=this._unicodeRange;for(let r of a.split(",").map(e=>e.trim()).filter(e=>!!e)){r=r.split("-",2).map(e=>{const a=e.match(t);return a?parseInt(a[1],16):0});1===r.length&&r.push(r[0]);e.push(r)}return shadow(this,"unicodeRange",e)}}class Exclude extends ContentObject{constructor(e){super(Po,"exclude")}[Gn](){this[Hn]=this[Hn].trim().split(/\s+/).filter(e=>e&&["calculate","close","enter","exit","initialize","ready","validate"].includes(e))}}class ExcludeNS extends StringObject{constructor(e){super(Po,"excludeNS")}}class FlipLabel extends OptionObject{constructor(e){super(Po,"flipLabel",["usePrinterSetting","on","off"])}}class config_FontInfo extends XFAObject{constructor(e){super(Po,"fontInfo",!0);this.embed=null;this.map=null;this.subsetBelow=null;this.alwaysEmbed=new XFAObjectArray;this.defaultTypeface=new XFAObjectArray;this.neverEmbed=new XFAObjectArray}}class FormFieldFilling extends Option01{constructor(e){super(Po,"formFieldFilling")}}class GroupParent extends StringObject{constructor(e){super(Po,"groupParent")}}class IfEmpty extends OptionObject{constructor(e){super(Po,"ifEmpty",["dataValue","dataGroup","ignore","remove"])}}class IncludeXDPContent extends StringObject{constructor(e){super(Po,"includeXDPContent")}}class IncrementalLoad extends OptionObject{constructor(e){super(Po,"incrementalLoad",["none","forwardOnly"])}}class IncrementalMerge extends Option01{constructor(e){super(Po,"incrementalMerge")}}class Interactive extends Option01{constructor(e){super(Po,"interactive")}}class Jog extends OptionObject{constructor(e){super(Po,"jog",["usePrinterSetting","none","pageSet"])}}class LabelPrinter extends XFAObject{constructor(e){super(Po,"labelPrinter",!0);this.name=getStringOption(e.name,["zpl","dpl","ipl","tcpl"]);this.batchOutput=null;this.flipLabel=null;this.fontInfo=null;this.xdc=null}}class Layout extends OptionObject{constructor(e){super(Po,"layout",["paginate","panel"])}}class Level extends IntegerObject{constructor(e){super(Po,"level",0,e=>e>0)}}class Linearized extends Option01{constructor(e){super(Po,"linearized")}}class Locale extends StringObject{constructor(e){super(Po,"locale")}}class LocaleSet extends StringObject{constructor(e){super(Po,"localeSet")}}class Log extends XFAObject{constructor(e){super(Po,"log",!0);this.mode=null;this.threshold=null;this.to=null;this.uri=null}}class MapElement extends XFAObject{constructor(e){super(Po,"map",!0);this.equate=new XFAObjectArray;this.equateRange=new XFAObjectArray}}class MediumInfo extends XFAObject{constructor(e){super(Po,"mediumInfo",!0);this.map=null}}class config_Message extends XFAObject{constructor(e){super(Po,"message",!0);this.msgId=null;this.severity=null}}class Messaging extends XFAObject{constructor(e){super(Po,"messaging",!0);this.message=new XFAObjectArray}}class Mode extends OptionObject{constructor(e){super(Po,"mode",["append","overwrite"])}}class ModifyAnnots extends Option01{constructor(e){super(Po,"modifyAnnots")}}class MsgId extends IntegerObject{constructor(e){super(Po,"msgId",1,e=>e>=1)}}class NameAttr extends StringObject{constructor(e){super(Po,"nameAttr")}}class NeverEmbed extends ContentObject{constructor(e){super(Po,"neverEmbed")}}class NumberOfCopies extends IntegerObject{constructor(e){super(Po,"numberOfCopies",null,e=>e>=2&&e<=5)}}class OpenAction extends XFAObject{constructor(e){super(Po,"openAction",!0);this.destination=null}}class Output extends XFAObject{constructor(e){super(Po,"output",!0);this.to=null;this.type=null;this.uri=null}}class OutputBin extends StringObject{constructor(e){super(Po,"outputBin")}}class OutputXSL extends XFAObject{constructor(e){super(Po,"outputXSL",!0);this.uri=null}}class Overprint extends OptionObject{constructor(e){super(Po,"overprint",["none","both","draw","field"])}}class Packets extends StringObject{constructor(e){super(Po,"packets")}[Gn](){"*"!==this[Hn]&&(this[Hn]=this[Hn].trim().split(/\s+/).filter(e=>["config","datasets","template","xfdf","xslt"].includes(e)))}}class PageOffset extends XFAObject{constructor(e){super(Po,"pageOffset");this.x=getInteger({data:e.x,defaultValue:"useXDCSetting",validate:e=>!0});this.y=getInteger({data:e.y,defaultValue:"useXDCSetting",validate:e=>!0})}}class PageRange extends StringObject{constructor(e){super(Po,"pageRange")}[Gn](){const e=this[Hn].trim().split(/\s+/).map(e=>parseInt(e,10)),t=[];for(let a=0,r=e.length;a!1)}}class Pcl extends XFAObject{constructor(e){super(Po,"pcl",!0);this.name=e.name||"";this.batchOutput=null;this.fontInfo=null;this.jog=null;this.mediumInfo=null;this.outputBin=null;this.pageOffset=null;this.staple=null;this.xdc=null}}class Pdf extends XFAObject{constructor(e){super(Po,"pdf",!0);this.name=e.name||"";this.adobeExtensionLevel=null;this.batchOutput=null;this.compression=null;this.creator=null;this.encryption=null;this.fontInfo=null;this.interactive=null;this.linearized=null;this.openAction=null;this.pdfa=null;this.producer=null;this.renderPolicy=null;this.scriptModel=null;this.silentPrint=null;this.submitFormat=null;this.tagged=null;this.version=null;this.viewerPreferences=null;this.xdc=null}}class Pdfa extends XFAObject{constructor(e){super(Po,"pdfa",!0);this.amd=null;this.conformance=null;this.includeXDPContent=null;this.part=null}}class Permissions extends XFAObject{constructor(e){super(Po,"permissions",!0);this.accessibleContent=null;this.change=null;this.contentCopy=null;this.documentAssembly=null;this.formFieldFilling=null;this.modifyAnnots=null;this.plaintextMetadata=null;this.print=null;this.printHighQuality=null}}class PickTrayByPDFSize extends Option01{constructor(e){super(Po,"pickTrayByPDFSize")}}class config_Picture extends StringObject{constructor(e){super(Po,"picture")}}class PlaintextMetadata extends Option01{constructor(e){super(Po,"plaintextMetadata")}}class Presence extends OptionObject{constructor(e){super(Po,"presence",["preserve","dissolve","dissolveStructure","ignore","remove"])}}class Present extends XFAObject{constructor(e){super(Po,"present",!0);this.behaviorOverride=null;this.cache=null;this.common=null;this.copies=null;this.destination=null;this.incrementalMerge=null;this.layout=null;this.output=null;this.overprint=null;this.pagination=null;this.paginationOverride=null;this.script=null;this.validate=null;this.xdp=null;this.driver=new XFAObjectArray;this.labelPrinter=new XFAObjectArray;this.pcl=new XFAObjectArray;this.pdf=new XFAObjectArray;this.ps=new XFAObjectArray;this.submitUrl=new XFAObjectArray;this.webClient=new XFAObjectArray;this.zpl=new XFAObjectArray}}class Print extends Option01{constructor(e){super(Po,"print")}}class PrintHighQuality extends Option01{constructor(e){super(Po,"printHighQuality")}}class PrintScaling extends OptionObject{constructor(e){super(Po,"printScaling",["appdefault","noScaling"])}}class PrinterName extends StringObject{constructor(e){super(Po,"printerName")}}class Producer extends StringObject{constructor(e){super(Po,"producer")}}class Ps extends XFAObject{constructor(e){super(Po,"ps",!0);this.name=e.name||"";this.batchOutput=null;this.fontInfo=null;this.jog=null;this.mediumInfo=null;this.outputBin=null;this.staple=null;this.xdc=null}}class Range extends ContentObject{constructor(e){super(Po,"range")}[Gn](){this[Hn]=this[Hn].split(",",2).map(e=>e.split("-").map(e=>parseInt(e.trim(),10))).filter(e=>e.every(e=>!isNaN(e))).map(e=>{1===e.length&&e.push(e[0]);return e})}}class Record extends ContentObject{constructor(e){super(Po,"record")}[Gn](){this[Hn]=this[Hn].trim();const e=parseInt(this[Hn],10);!isNaN(e)&&e>=0&&(this[Hn]=e)}}class Relevant extends ContentObject{constructor(e){super(Po,"relevant")}[Gn](){this[Hn]=this[Hn].trim().split(/\s+/)}}class Rename extends ContentObject{constructor(e){super(Po,"rename")}[Gn](){this[Hn]=this[Hn].trim();(this[Hn].toLowerCase().startsWith("xml")||new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*","u").test(this[Hn]))&&warn("XFA - Rename: invalid XFA name")}}class RenderPolicy extends OptionObject{constructor(e){super(Po,"renderPolicy",["server","client"])}}class RunScripts extends OptionObject{constructor(e){super(Po,"runScripts",["both","client","none","server"])}}class config_Script extends XFAObject{constructor(e){super(Po,"script",!0);this.currentPage=null;this.exclude=null;this.runScripts=null}}class ScriptModel extends OptionObject{constructor(e){super(Po,"scriptModel",["XFA","none"])}}class Severity extends OptionObject{constructor(e){super(Po,"severity",["ignore","error","information","trace","warning"])}}class SilentPrint extends XFAObject{constructor(e){super(Po,"silentPrint",!0);this.addSilentPrint=null;this.printerName=null}}class Staple extends XFAObject{constructor(e){super(Po,"staple");this.mode=getStringOption(e.mode,["usePrinterSetting","on","off"])}}class StartNode extends StringObject{constructor(e){super(Po,"startNode")}}class StartPage extends IntegerObject{constructor(e){super(Po,"startPage",0,e=>!0)}}class SubmitFormat extends OptionObject{constructor(e){super(Po,"submitFormat",["html","delegate","fdf","xml","pdf"])}}class SubmitUrl extends StringObject{constructor(e){super(Po,"submitUrl")}}class SubsetBelow extends IntegerObject{constructor(e){super(Po,"subsetBelow",100,e=>e>=0&&e<=100)}}class SuppressBanner extends Option01{constructor(e){super(Po,"suppressBanner")}}class Tagged extends Option01{constructor(e){super(Po,"tagged")}}class config_Template extends XFAObject{constructor(e){super(Po,"template",!0);this.base=null;this.relevant=null;this.startPage=null;this.uri=null;this.xsl=null}}class Threshold extends OptionObject{constructor(e){super(Po,"threshold",["trace","error","information","warning"])}}class To extends OptionObject{constructor(e){super(Po,"to",["null","memory","stderr","stdout","system","uri"])}}class TemplateCache extends XFAObject{constructor(e){super(Po,"templateCache");this.maxEntries=getInteger({data:e.maxEntries,defaultValue:5,validate:e=>e>=0})}}class Trace extends XFAObject{constructor(e){super(Po,"trace",!0);this.area=new XFAObjectArray}}class Transform extends XFAObject{constructor(e){super(Po,"transform",!0);this.groupParent=null;this.ifEmpty=null;this.nameAttr=null;this.picture=null;this.presence=null;this.rename=null;this.whitespace=null}}class Type extends OptionObject{constructor(e){super(Po,"type",["none","ascii85","asciiHex","ccittfax","flate","lzw","runLength","native","xdp","mergedXDP"])}}class Uri extends StringObject{constructor(e){super(Po,"uri")}}class config_Validate extends OptionObject{constructor(e){super(Po,"validate",["preSubmit","prePrint","preExecute","preSave"])}}class ValidateApprovalSignatures extends ContentObject{constructor(e){super(Po,"validateApprovalSignatures")}[Gn](){this[Hn]=this[Hn].trim().split(/\s+/).filter(e=>["docReady","postSign"].includes(e))}}class ValidationMessaging extends OptionObject{constructor(e){super(Po,"validationMessaging",["allMessagesIndividually","allMessagesTogether","firstMessageOnly","noMessages"])}}class Version extends OptionObject{constructor(e){super(Po,"version",["1.7","1.6","1.5","1.4","1.3","1.2"])}}class VersionControl extends XFAObject{constructor(e){super(Po,"VersionControl");this.outputBelow=getStringOption(e.outputBelow,["warn","error","update"]);this.sourceAbove=getStringOption(e.sourceAbove,["warn","error"]);this.sourceBelow=getStringOption(e.sourceBelow,["update","maintain"])}}class ViewerPreferences extends XFAObject{constructor(e){super(Po,"viewerPreferences",!0);this.ADBE_JSConsole=null;this.ADBE_JSDebugger=null;this.addViewerPreferences=null;this.duplexOption=null;this.enforce=null;this.numberOfCopies=null;this.pageRange=null;this.pickTrayByPDFSize=null;this.printScaling=null}}class WebClient extends XFAObject{constructor(e){super(Po,"webClient",!0);this.name=e.name?e.name.trim():"";this.fontInfo=null;this.xdc=null}}class Whitespace extends OptionObject{constructor(e){super(Po,"whitespace",["preserve","ltrim","normalize","rtrim","trim"])}}class Window extends ContentObject{constructor(e){super(Po,"window")}[Gn](){const e=this[Hn].split(",",2).map(e=>parseInt(e.trim(),10));if(e.some(e=>isNaN(e)))this[Hn]=[0,0];else{1===e.length&&e.push(e[0]);this[Hn]=e}}}class Xdc extends XFAObject{constructor(e){super(Po,"xdc",!0);this.uri=new XFAObjectArray;this.xsl=new XFAObjectArray}}class Xdp extends XFAObject{constructor(e){super(Po,"xdp",!0);this.packets=null}}class Xsl extends XFAObject{constructor(e){super(Po,"xsl",!0);this.debug=null;this.uri=null}}class Zpl extends XFAObject{constructor(e){super(Po,"zpl",!0);this.name=e.name?e.name.trim():"";this.batchOutput=null;this.flipLabel=null;this.fontInfo=null;this.xdc=null}}class ConfigNamespace{static[Ks](e,t){if(ConfigNamespace.hasOwnProperty(e))return ConfigNamespace[e](t)}static acrobat(e){return new Acrobat(e)}static acrobat7(e){return new Acrobat7(e)}static ADBE_JSConsole(e){return new ADBE_JSConsole(e)}static ADBE_JSDebugger(e){return new ADBE_JSDebugger(e)}static addSilentPrint(e){return new AddSilentPrint(e)}static addViewerPreferences(e){return new AddViewerPreferences(e)}static adjustData(e){return new AdjustData(e)}static adobeExtensionLevel(e){return new AdobeExtensionLevel(e)}static agent(e){return new Agent(e)}static alwaysEmbed(e){return new AlwaysEmbed(e)}static amd(e){return new Amd(e)}static area(e){return new config_Area(e)}static attributes(e){return new Attributes(e)}static autoSave(e){return new AutoSave(e)}static base(e){return new Base(e)}static batchOutput(e){return new BatchOutput(e)}static behaviorOverride(e){return new BehaviorOverride(e)}static cache(e){return new Cache(e)}static change(e){return new Change(e)}static common(e){return new Common(e)}static compress(e){return new Compress(e)}static compressLogicalStructure(e){return new CompressLogicalStructure(e)}static compressObjectStream(e){return new CompressObjectStream(e)}static compression(e){return new Compression(e)}static config(e){return new Config(e)}static conformance(e){return new Conformance(e)}static contentCopy(e){return new ContentCopy(e)}static copies(e){return new Copies(e)}static creator(e){return new Creator(e)}static currentPage(e){return new CurrentPage(e)}static data(e){return new Data(e)}static debug(e){return new Debug(e)}static defaultTypeface(e){return new DefaultTypeface(e)}static destination(e){return new Destination(e)}static documentAssembly(e){return new DocumentAssembly(e)}static driver(e){return new Driver(e)}static duplexOption(e){return new DuplexOption(e)}static dynamicRender(e){return new DynamicRender(e)}static embed(e){return new Embed(e)}static encrypt(e){return new config_Encrypt(e)}static encryption(e){return new config_Encryption(e)}static encryptionLevel(e){return new EncryptionLevel(e)}static enforce(e){return new Enforce(e)}static equate(e){return new Equate(e)}static equateRange(e){return new EquateRange(e)}static exclude(e){return new Exclude(e)}static excludeNS(e){return new ExcludeNS(e)}static flipLabel(e){return new FlipLabel(e)}static fontInfo(e){return new config_FontInfo(e)}static formFieldFilling(e){return new FormFieldFilling(e)}static groupParent(e){return new GroupParent(e)}static ifEmpty(e){return new IfEmpty(e)}static includeXDPContent(e){return new IncludeXDPContent(e)}static incrementalLoad(e){return new IncrementalLoad(e)}static incrementalMerge(e){return new IncrementalMerge(e)}static interactive(e){return new Interactive(e)}static jog(e){return new Jog(e)}static labelPrinter(e){return new LabelPrinter(e)}static layout(e){return new Layout(e)}static level(e){return new Level(e)}static linearized(e){return new Linearized(e)}static locale(e){return new Locale(e)}static localeSet(e){return new LocaleSet(e)}static log(e){return new Log(e)}static map(e){return new MapElement(e)}static mediumInfo(e){return new MediumInfo(e)}static message(e){return new config_Message(e)}static messaging(e){return new Messaging(e)}static mode(e){return new Mode(e)}static modifyAnnots(e){return new ModifyAnnots(e)}static msgId(e){return new MsgId(e)}static nameAttr(e){return new NameAttr(e)}static neverEmbed(e){return new NeverEmbed(e)}static numberOfCopies(e){return new NumberOfCopies(e)}static openAction(e){return new OpenAction(e)}static output(e){return new Output(e)}static outputBin(e){return new OutputBin(e)}static outputXSL(e){return new OutputXSL(e)}static overprint(e){return new Overprint(e)}static packets(e){return new Packets(e)}static pageOffset(e){return new PageOffset(e)}static pageRange(e){return new PageRange(e)}static pagination(e){return new Pagination(e)}static paginationOverride(e){return new PaginationOverride(e)}static part(e){return new Part(e)}static pcl(e){return new Pcl(e)}static pdf(e){return new Pdf(e)}static pdfa(e){return new Pdfa(e)}static permissions(e){return new Permissions(e)}static pickTrayByPDFSize(e){return new PickTrayByPDFSize(e)}static picture(e){return new config_Picture(e)}static plaintextMetadata(e){return new PlaintextMetadata(e)}static presence(e){return new Presence(e)}static present(e){return new Present(e)}static print(e){return new Print(e)}static printHighQuality(e){return new PrintHighQuality(e)}static printScaling(e){return new PrintScaling(e)}static printerName(e){return new PrinterName(e)}static producer(e){return new Producer(e)}static ps(e){return new Ps(e)}static range(e){return new Range(e)}static record(e){return new Record(e)}static relevant(e){return new Relevant(e)}static rename(e){return new Rename(e)}static renderPolicy(e){return new RenderPolicy(e)}static runScripts(e){return new RunScripts(e)}static script(e){return new config_Script(e)}static scriptModel(e){return new ScriptModel(e)}static severity(e){return new Severity(e)}static silentPrint(e){return new SilentPrint(e)}static staple(e){return new Staple(e)}static startNode(e){return new StartNode(e)}static startPage(e){return new StartPage(e)}static submitFormat(e){return new SubmitFormat(e)}static submitUrl(e){return new SubmitUrl(e)}static subsetBelow(e){return new SubsetBelow(e)}static suppressBanner(e){return new SuppressBanner(e)}static tagged(e){return new Tagged(e)}static template(e){return new config_Template(e)}static templateCache(e){return new TemplateCache(e)}static threshold(e){return new Threshold(e)}static to(e){return new To(e)}static trace(e){return new Trace(e)}static transform(e){return new Transform(e)}static type(e){return new Type(e)}static uri(e){return new Uri(e)}static validate(e){return new config_Validate(e)}static validateApprovalSignatures(e){return new ValidateApprovalSignatures(e)}static validationMessaging(e){return new ValidationMessaging(e)}static version(e){return new Version(e)}static versionControl(e){return new VersionControl(e)}static viewerPreferences(e){return new ViewerPreferences(e)}static webClient(e){return new WebClient(e)}static whitespace(e){return new Whitespace(e)}static window(e){return new Window(e)}static xdc(e){return new Xdc(e)}static xdp(e){return new Xdp(e)}static xsl(e){return new Xsl(e)}static zpl(e){return new Zpl(e)}}const Lo=Js.connectionSet.id;class ConnectionSet extends XFAObject{constructor(e){super(Lo,"connectionSet",!0);this.wsdlConnection=new XFAObjectArray;this.xmlConnection=new XFAObjectArray;this.xsdConnection=new XFAObjectArray}}class EffectiveInputPolicy extends XFAObject{constructor(e){super(Lo,"effectiveInputPolicy");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class EffectiveOutputPolicy extends XFAObject{constructor(e){super(Lo,"effectiveOutputPolicy");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Operation extends StringObject{constructor(e){super(Lo,"operation");this.id=e.id||"";this.input=e.input||"";this.name=e.name||"";this.output=e.output||"";this.use=e.use||"";this.usehref=e.usehref||""}}class RootElement extends StringObject{constructor(e){super(Lo,"rootElement");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class SoapAction extends StringObject{constructor(e){super(Lo,"soapAction");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class SoapAddress extends StringObject{constructor(e){super(Lo,"soapAddress");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class connection_set_Uri extends StringObject{constructor(e){super(Lo,"uri");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class WsdlAddress extends StringObject{constructor(e){super(Lo,"wsdlAddress");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class WsdlConnection extends XFAObject{constructor(e){super(Lo,"wsdlConnection",!0);this.dataDescription=e.dataDescription||"";this.name=e.name||"";this.effectiveInputPolicy=null;this.effectiveOutputPolicy=null;this.operation=null;this.soapAction=null;this.soapAddress=null;this.wsdlAddress=null}}class XmlConnection extends XFAObject{constructor(e){super(Lo,"xmlConnection",!0);this.dataDescription=e.dataDescription||"";this.name=e.name||"";this.uri=null}}class XsdConnection extends XFAObject{constructor(e){super(Lo,"xsdConnection",!0);this.dataDescription=e.dataDescription||"";this.name=e.name||"";this.rootElement=null;this.uri=null}}class ConnectionSetNamespace{static[Ks](e,t){if(ConnectionSetNamespace.hasOwnProperty(e))return ConnectionSetNamespace[e](t)}static connectionSet(e){return new ConnectionSet(e)}static effectiveInputPolicy(e){return new EffectiveInputPolicy(e)}static effectiveOutputPolicy(e){return new EffectiveOutputPolicy(e)}static operation(e){return new Operation(e)}static rootElement(e){return new RootElement(e)}static soapAction(e){return new SoapAction(e)}static soapAddress(e){return new SoapAddress(e)}static uri(e){return new connection_set_Uri(e)}static wsdlAddress(e){return new WsdlAddress(e)}static wsdlConnection(e){return new WsdlConnection(e)}static xmlConnection(e){return new XmlConnection(e)}static xsdConnection(e){return new XsdConnection(e)}}const _o=Js.datasets.id;class datasets_Data extends XmlObject{constructor(e){super(_o,"data",e)}[ws](){return!0}}class Datasets extends XFAObject{constructor(e){super(_o,"datasets",!0);this.data=null;this.Signature=null}[Ts](e){const t=e[Fs];("data"===t&&e[vs]===_o||"Signature"===t&&e[vs]===Js.signature.id)&&(this[t]=e);this[Pn](e)}}class DatasetsNamespace{static[Ks](e,t){if(DatasetsNamespace.hasOwnProperty(e))return DatasetsNamespace[e](t)}static datasets(e){return new Datasets(e)}static data(e){return new datasets_Data(e)}}const jo=Js.localeSet.id;class CalendarSymbols extends XFAObject{constructor(e){super(jo,"calendarSymbols",!0);this.name="gregorian";this.dayNames=new XFAObjectArray(2);this.eraNames=null;this.meridiemNames=null;this.monthNames=new XFAObjectArray(2)}}class CurrencySymbol extends StringObject{constructor(e){super(jo,"currencySymbol");this.name=getStringOption(e.name,["symbol","isoname","decimal"])}}class CurrencySymbols extends XFAObject{constructor(e){super(jo,"currencySymbols",!0);this.currencySymbol=new XFAObjectArray(3)}}class DatePattern extends StringObject{constructor(e){super(jo,"datePattern");this.name=getStringOption(e.name,["full","long","med","short"])}}class DatePatterns extends XFAObject{constructor(e){super(jo,"datePatterns",!0);this.datePattern=new XFAObjectArray(4)}}class DateTimeSymbols extends ContentObject{constructor(e){super(jo,"dateTimeSymbols")}}class Day extends StringObject{constructor(e){super(jo,"day")}}class DayNames extends XFAObject{constructor(e){super(jo,"dayNames",!0);this.abbr=getInteger({data:e.abbr,defaultValue:0,validate:e=>1===e});this.day=new XFAObjectArray(7)}}class Era extends StringObject{constructor(e){super(jo,"era")}}class EraNames extends XFAObject{constructor(e){super(jo,"eraNames",!0);this.era=new XFAObjectArray(2)}}class locale_set_Locale extends XFAObject{constructor(e){super(jo,"locale",!0);this.desc=e.desc||"";this.name="isoname";this.calendarSymbols=null;this.currencySymbols=null;this.datePatterns=null;this.dateTimeSymbols=null;this.numberPatterns=null;this.numberSymbols=null;this.timePatterns=null;this.typeFaces=null}}class locale_set_LocaleSet extends XFAObject{constructor(e){super(jo,"localeSet",!0);this.locale=new XFAObjectArray}}class Meridiem extends StringObject{constructor(e){super(jo,"meridiem")}}class MeridiemNames extends XFAObject{constructor(e){super(jo,"meridiemNames",!0);this.meridiem=new XFAObjectArray(2)}}class Month extends StringObject{constructor(e){super(jo,"month")}}class MonthNames extends XFAObject{constructor(e){super(jo,"monthNames",!0);this.abbr=getInteger({data:e.abbr,defaultValue:0,validate:e=>1===e});this.month=new XFAObjectArray(12)}}class NumberPattern extends StringObject{constructor(e){super(jo,"numberPattern");this.name=getStringOption(e.name,["full","long","med","short"])}}class NumberPatterns extends XFAObject{constructor(e){super(jo,"numberPatterns",!0);this.numberPattern=new XFAObjectArray(4)}}class NumberSymbol extends StringObject{constructor(e){super(jo,"numberSymbol");this.name=getStringOption(e.name,["decimal","grouping","percent","minus","zero"])}}class NumberSymbols extends XFAObject{constructor(e){super(jo,"numberSymbols",!0);this.numberSymbol=new XFAObjectArray(5)}}class TimePattern extends StringObject{constructor(e){super(jo,"timePattern");this.name=getStringOption(e.name,["full","long","med","short"])}}class TimePatterns extends XFAObject{constructor(e){super(jo,"timePatterns",!0);this.timePattern=new XFAObjectArray(4)}}class TypeFace extends XFAObject{constructor(e){super(jo,"typeFace",!0);this.name=""|e.name}}class TypeFaces extends XFAObject{constructor(e){super(jo,"typeFaces",!0);this.typeFace=new XFAObjectArray}}class LocaleSetNamespace{static[Ks](e,t){if(LocaleSetNamespace.hasOwnProperty(e))return LocaleSetNamespace[e](t)}static calendarSymbols(e){return new CalendarSymbols(e)}static currencySymbol(e){return new CurrencySymbol(e)}static currencySymbols(e){return new CurrencySymbols(e)}static datePattern(e){return new DatePattern(e)}static datePatterns(e){return new DatePatterns(e)}static dateTimeSymbols(e){return new DateTimeSymbols(e)}static day(e){return new Day(e)}static dayNames(e){return new DayNames(e)}static era(e){return new Era(e)}static eraNames(e){return new EraNames(e)}static locale(e){return new locale_set_Locale(e)}static localeSet(e){return new locale_set_LocaleSet(e)}static meridiem(e){return new Meridiem(e)}static meridiemNames(e){return new MeridiemNames(e)}static month(e){return new Month(e)}static monthNames(e){return new MonthNames(e)}static numberPattern(e){return new NumberPattern(e)}static numberPatterns(e){return new NumberPatterns(e)}static numberSymbol(e){return new NumberSymbol(e)}static numberSymbols(e){return new NumberSymbols(e)}static timePattern(e){return new TimePattern(e)}static timePatterns(e){return new TimePatterns(e)}static typeFace(e){return new TypeFace(e)}static typeFaces(e){return new TypeFaces(e)}}const Uo=Js.signature.id;class signature_Signature extends XFAObject{constructor(e){super(Uo,"signature",!0)}}class SignatureNamespace{static[Ks](e,t){if(SignatureNamespace.hasOwnProperty(e))return SignatureNamespace[e](t)}static signature(e){return new signature_Signature(e)}}const Xo=Js.stylesheet.id;class Stylesheet extends XFAObject{constructor(e){super(Xo,"stylesheet",!0)}}class StylesheetNamespace{static[Ks](e,t){if(StylesheetNamespace.hasOwnProperty(e))return StylesheetNamespace[e](t)}static stylesheet(e){return new Stylesheet(e)}}const qo=Js.xdp.id;class xdp_Xdp extends XFAObject{constructor(e){super(qo,"xdp",!0);this.uuid=e.uuid||"";this.timeStamp=e.timeStamp||"";this.config=null;this.connectionSet=null;this.datasets=null;this.localeSet=null;this.stylesheet=new XFAObjectArray;this.template=null}[Os](e){const t=Js[e[Fs]];return t&&e[vs]===t.id}}class XdpNamespace{static[Ks](e,t){if(XdpNamespace.hasOwnProperty(e))return XdpNamespace[e](t)}static xdp(e){return new xdp_Xdp(e)}}const Ho=Js.xhtml.id,Wo=Symbol(),zo=new Set(["color","font","font-family","font-size","font-stretch","font-style","font-weight","margin","margin-bottom","margin-left","margin-right","margin-top","letter-spacing","line-height","orphans","page-break-after","page-break-before","page-break-inside","tab-interval","tab-stop","text-align","text-decoration","text-indent","vertical-align","widows","kerning-mode","xfa-font-horizontal-scale","xfa-font-vertical-scale","xfa-spacerun","xfa-tab-stops"]),$o=new Map([["page-break-after","breakAfter"],["page-break-before","breakBefore"],["page-break-inside","breakInside"],["kerning-mode",e=>"none"===e?"none":"normal"],["xfa-font-horizontal-scale",e=>`scaleX(${Math.max(0,parseInt(e)/100).toFixed(2)})`],["xfa-font-vertical-scale",e=>`scaleY(${Math.max(0,parseInt(e)/100).toFixed(2)})`],["xfa-spacerun",""],["xfa-tab-stops",""],["font-size",(e,t)=>measureToString(.99*(e=t.fontSize=Math.abs(getMeasurement(e))))],["letter-spacing",e=>measureToString(getMeasurement(e))],["line-height",e=>measureToString(getMeasurement(e))],["margin",e=>measureToString(getMeasurement(e))],["margin-bottom",e=>measureToString(getMeasurement(e))],["margin-left",e=>measureToString(getMeasurement(e))],["margin-right",e=>measureToString(getMeasurement(e))],["margin-top",e=>measureToString(getMeasurement(e))],["text-indent",e=>measureToString(getMeasurement(e))],["font-family",e=>e],["vertical-align",e=>measureToString(getMeasurement(e))]]),Go=/\s+/g,Vo=/[\r\n]+/g,Ko=/\r\n?/g;function mapStyle(e,t,a){const r=Object.create(null);if(!e)return r;const i=Object.create(null);for(const[t,a]of e.split(";").map(e=>e.split(":",2))){const e=$o.get(t);if(""===e)continue;let n=a;e&&(n="string"==typeof e?e:e(a,i));t.endsWith("scale")?r.transform=r.transform?`${r[t]} ${n}`:n:r[t.replaceAll(/-([a-zA-Z])/g,(e,t)=>t.toUpperCase())]=n}r.fontFamily&&setFontFamily({typeface:r.fontFamily,weight:r.fontWeight||"normal",posture:r.fontStyle||"normal",size:i.fontSize||0},t,t[hs].fontFinder,r);if(a&&r.verticalAlign&&"0px"!==r.verticalAlign&&r.fontSize){const e=.583,t=.333,a=getMeasurement(r.fontSize);r.fontSize=measureToString(a*e);r.verticalAlign=measureToString(Math.sign(getMeasurement(r.verticalAlign))*a*t)}a&&r.fontSize&&(r.fontSize=`calc(${r.fontSize} * var(--total-scale-factor))`);fixTextIndent(r);return r}const Jo=new Set(["body","html"]);class XhtmlObject extends XmlObject{constructor(e,t){super(Ho,t);this[Wo]=!1;this.style=e.style||""}[_n](e){super[_n](e);this.style=function checkStyle(e){return e.style?e.style.split(";").filter(e=>!!e.trim()).map(e=>e.split(":",2).map(e=>e.trim())).filter(([t,a])=>{"font-family"===t&&e[hs].usedTypefaces.add(a);return zo.has(t)}).map(e=>e.join(":")).join(";"):""}(this)}[Nn](){return!Jo.has(this[Fs])}[Ms](e,t=!1){if(t)this[Wo]=!0;else{e=e.replaceAll(Vo,"");this.style.includes("xfa-spacerun:yes")||(e=e.replaceAll(Go," "))}e&&(this[Hn]+=e)}[Ds](e,t=!0){const a=Object.create(null),r={top:NaN,bottom:NaN,left:NaN,right:NaN};let i=null;for(const[e,t]of this.style.split(";").map(e=>e.split(":",2)))switch(e){case"font-family":a.typeface=stripQuotes(t);break;case"font-size":a.size=getMeasurement(t);break;case"font-weight":a.weight=t;break;case"font-style":a.posture=t;break;case"letter-spacing":a.letterSpacing=getMeasurement(t);break;case"margin":const e=t.split(/ \t/).map(e=>getMeasurement(e));switch(e.length){case 1:r.top=r.bottom=r.left=r.right=e[0];break;case 2:r.top=r.bottom=e[0];r.left=r.right=e[1];break;case 3:r.top=e[0];r.bottom=e[2];r.left=r.right=e[1];break;case 4:r.top=e[0];r.left=e[1];r.bottom=e[2];r.right=e[3]}break;case"margin-top":r.top=getMeasurement(t);break;case"margin-bottom":r.bottom=getMeasurement(t);break;case"margin-left":r.left=getMeasurement(t);break;case"margin-right":r.right=getMeasurement(t);break;case"line-height":i=getMeasurement(t)}e.pushData(a,r,i);if(this[Hn])e.addString(this[Hn]);else for(const t of this[is]())"#text"!==t[Fs]?t[Ds](e):e.addString(t[Hn]);t&&e.popFont()}[zs](e){const t=[];this[$n]={children:t};this[Ln]({});if(0===t.length&&!this[Hn])return HTMLResult.EMPTY;let a;a=this[Wo]?this[Hn]?this[Hn].replaceAll(Ko,"\n"):void 0:this[Hn]||void 0;return HTMLResult.success({name:this[Fs],attributes:{href:this.href,style:mapStyle(this.style,this,this[Wo])},children:t,value:a})}}class A extends XhtmlObject{constructor(e){super(e,"a");this.href=fixURL(e.href)||""}}class B extends XhtmlObject{constructor(e){super(e,"b")}[Ds](e){e.pushFont({weight:"bold"});super[Ds](e);e.popFont()}}class Body extends XhtmlObject{constructor(e){super(e,"body")}[zs](e){const t=super[zs](e),{html:a}=t;if(!a)return HTMLResult.EMPTY;a.name="div";a.attributes.class=["xfaRich"];return t}}class Br extends XhtmlObject{constructor(e){super(e,"br")}[Hs](){return"\n"}[Ds](e){e.addString("\n")}[zs](e){return HTMLResult.success({name:"br"})}}class Html extends XhtmlObject{constructor(e){super(e,"html")}[zs](e){const t=[];this[$n]={children:t};this[Ln]({});if(0===t.length)return HTMLResult.success({name:"div",attributes:{class:["xfaRich"],style:{}},value:this[Hn]||""});if(1===t.length){const e=t[0];if(e.attributes?.class.includes("xfaRich"))return HTMLResult.success(e)}return HTMLResult.success({name:"div",attributes:{class:["xfaRich"],style:{}},children:t})}}class I extends XhtmlObject{constructor(e){super(e,"i")}[Ds](e){e.pushFont({posture:"italic"});super[Ds](e);e.popFont()}}class Li extends XhtmlObject{constructor(e){super(e,"li")}}class Ol extends XhtmlObject{constructor(e){super(e,"ol")}}class P extends XhtmlObject{constructor(e){super(e,"p")}[Ds](e){super[Ds](e,!1);e.addString("\n");e.addPara();e.popFont()}[Hs](){return this[cs]()[is]().at(-1)===this?super[Hs]():super[Hs]()+"\n"}}class Span extends XhtmlObject{constructor(e){super(e,"span")}}class Sub extends XhtmlObject{constructor(e){super(e,"sub")}}class Sup extends XhtmlObject{constructor(e){super(e,"sup")}}class Ul extends XhtmlObject{constructor(e){super(e,"ul")}}class XhtmlNamespace{static[Ks](e,t){if(XhtmlNamespace.hasOwnProperty(e))return XhtmlNamespace[e](t)}static a(e){return new A(e)}static b(e){return new B(e)}static body(e){return new Body(e)}static br(e){return new Br(e)}static html(e){return new Html(e)}static i(e){return new I(e)}static li(e){return new Li(e)}static ol(e){return new Ol(e)}static p(e){return new P(e)}static span(e){return new Span(e)}static sub(e){return new Sub(e)}static sup(e){return new Sup(e)}static ul(e){return new Ul(e)}}const Yo={config:ConfigNamespace,connection:ConnectionSetNamespace,datasets:DatasetsNamespace,localeSet:LocaleSetNamespace,signature:SignatureNamespace,stylesheet:StylesheetNamespace,template:TemplateNamespace,xdp:XdpNamespace,xhtml:XhtmlNamespace};class UnknownNamespace{constructor(e){this.namespaceId=e}[Ks](e,t){return new XmlObject(this.namespaceId,e,t)}}class Root extends XFAObject{constructor(e){super(-1,"root",Object.create(null));this.element=null;this[ds]=e}[Ts](e){this.element=e;return!0}[Gn](){super[Gn]();if(this.element.template instanceof Template){this[ds].set(Es,this.element);this.element.template[Ls](this[ds]);this.element.template[ds]=this[ds]}}}class Empty extends XFAObject{constructor(){super(-1,"",Object.create(null))}[Ts](e){return!1}}class Builder{constructor(e=null){this._namespaceStack=[];this._nsAgnosticLevel=0;this._namespacePrefixes=new Map;this._namespaces=new Map;this._nextNsId=Math.max(...Object.values(Js).map(({id:e})=>e));this._currentNamespace=e||new UnknownNamespace(++this._nextNsId)}buildRoot(e){return new Root(e)}build({nsPrefix:e,name:t,attributes:a,namespace:r,prefixes:i}){const n=null!==r;if(n){this._namespaceStack.push(this._currentNamespace);this._currentNamespace=this._searchNamespace(r)}i&&this._addNamespacePrefix(i);if(a.hasOwnProperty(Is)){const e=Yo.datasets,t=a[Is];let r=null;for(const[a,i]of Object.entries(t)){if(this._getNamespaceToUse(a)===e){r={xfa:i};break}}r?a[Is]=r:delete a[Is]}const s=this._getNamespaceToUse(e),o=s?.[Ks](t,a)||new Empty;o[ws]()&&this._nsAgnosticLevel++;(n||i||o[ws]())&&(o[Un]={hasNamespace:n,prefixes:i,nsAgnostic:o[ws]()});return o}isNsAgnostic(){return this._nsAgnosticLevel>0}_searchNamespace(e){let t=this._namespaces.get(e);if(t)return t;for(const[a,{check:r}]of Object.entries(Js))if(r(e)){t=Yo[a];if(t){this._namespaces.set(e,t);return t}break}t=new UnknownNamespace(++this._nextNsId);this._namespaces.set(e,t);return t}_addNamespacePrefix(e){for(const{prefix:t,value:a}of e){const e=this._searchNamespace(a);let r=this._namespacePrefixes.get(t);if(!r){r=[];this._namespacePrefixes.set(t,r)}r.push(e)}}_getNamespaceToUse(e){if(!e)return this._currentNamespace;const t=this._namespacePrefixes.get(e);if(t?.length>0)return t.at(-1);warn(`Unknown namespace prefix: ${e}.`);return null}clean(e){const{hasNamespace:t,prefixes:a,nsAgnostic:r}=e;t&&(this._currentNamespace=this._namespaceStack.pop());a&&a.forEach(({prefix:e})=>{this._namespacePrefixes.get(e).pop()});r&&this._nsAgnosticLevel--}}class XFAParser extends XMLParserBase{constructor(e=null,t=!1){super();this._builder=new Builder(e);this._stack=[];this._globalData={usedTypefaces:new Set};this._ids=new Map;this._current=this._builder.buildRoot(this._ids);this._errorCode=Sn;this._whiteRegex=/^\s+$/;this._nbsps=/\xa0+/g;this._richText=t}parse(e){this.parseXml(e);if(this._errorCode===Sn){this._current[Gn]();return this._current.element}}onText(e){e=e.replace(this._nbsps,e=>e.slice(1)+" ");this._richText||this._current[Nn]()?this._current[Ms](e,this._richText):this._whiteRegex.test(e)||this._current[Ms](e.trim())}onCdata(e){this._current[Ms](e)}_mkAttributes(e,t){let a=null,r=null;const i=Object.create({});for(const{name:n,value:s}of e)if("xmlns"===n)a?warn(`XFA - multiple namespace definition in <${t}>`):a=s;else if(n.startsWith("xmlns:")){const e=n.substring(6);r??=[];r.push({prefix:e,value:s})}else{const e=n.indexOf(":");if(-1===e)i[n]=s;else{const t=i[Is]??=Object.create(null),[a,r]=[n.slice(0,e),n.slice(e+1)];(t[a]||=Object.create(null))[r]=s}}return[a,r,i]}_getNameAndPrefix(e,t){const a=e.indexOf(":");return-1===a?[e,null]:[e.substring(a+1),t?"":e.substring(0,a)]}onBeginElement(e,t,a){const[r,i,n]=this._mkAttributes(t,e),[s,o]=this._getNameAndPrefix(e,this._builder.isNsAgnostic()),c=this._builder.build({nsPrefix:o,name:s,attributes:n,namespace:r,prefixes:i});c[hs]=this._globalData;if(a){c[Gn]();this._current[Ts](c)&&c[js](this._ids);c[_n](this._builder)}else{this._stack.push(this._current);this._current=c}}onEndElement(e){const t=this._current;if(t[ps]()&&"string"==typeof t[Hn]){const e=new XFAParser;e._globalData=this._globalData;const a=e.parse(t[Hn]);t[Hn]=null;t[Ts](a)}t[Gn]();this._current=this._stack.pop();this._current[Ts](t)&&t[js](this._ids);t[_n](this._builder)}onError(e){this._errorCode=e}}class XFAFactory{constructor(e){try{this.root=(new XFAParser).parse(XFAFactory._createDocument(e));const t=new Binder(this.root);this.form=t.bind();this.dataHandler=new DataHandler(this.root,t.getData());this.form[hs].template=this.form}catch(e){warn(`XFA - an error occurred during parsing and binding: ${e}`)}}isValid(){return!(!this.root||!this.form)}_createPagesHelper(){const e=this.form[Ws]();return new Promise((t,a)=>{const nextIteration=()=>{try{const a=e.next();a.done?t(a.value):setTimeout(nextIteration,0)}catch(e){a(e)}};setTimeout(nextIteration,0)})}async _createPages(){try{this.pages=await this._createPagesHelper();this.dims=this.pages.children.map(e=>{const{width:t,height:a}=e.attributes.style;return[0,0,parseInt(t),parseInt(a)]})}catch(e){warn(`XFA - an error occurred during layout: ${e}`)}}getBoundingBox(e){return this.dims[e]}async getNumPages(){this.pages||await this._createPages();return this.dims.length}setImages(e){this.form[hs].images=e}setFonts(e){this.form[hs].fontFinder=new FontFinder(e);const t=[];for(let e of this.form[hs].usedTypefaces){e=stripQuotes(e);this.form[hs].fontFinder.find(e)||t.push(e)}return t.length>0?t:null}appendFonts(e,t){this.form[hs].fontFinder.add(e,t)}async getPages(){this.pages||await this._createPages();const e=this.pages;this.pages=null;return e}serializeData(e){return this.dataHandler.serialize(e)}static _createDocument(e){return e["/xdp:xdp"]?Object.values(e).join(""):e["xdp:xdp"]}static getRichTextAsHtml(e){if(!e||"string"!=typeof e)return null;try{let t=new XFAParser(XhtmlNamespace,!0).parse(e);if(!["body","xhtml"].includes(t[Fs])){const e=XhtmlNamespace.body({});e[Pn](t);t=e}const a=t[zs]();if(!a.success)return null;const{html:r}=a,{attributes:i}=r;if(i){i.class&&(i.class=i.class.filter(e=>!e.startsWith("xfa")));i.dir="auto"}return{html:r,str:t[Hs]()}}catch(e){warn(`XFA - an error occurred during parsing of rich text: ${e}`)}return null}}class AnnotationFactory{static createGlobals(e){return Promise.all([e.ensureCatalog("acroForm"),e.ensureDoc("xfaDatasets"),e.ensureCatalog("structTreeRoot"),e.ensureCatalog("baseUrl"),e.ensureCatalog("attachments"),e.ensureCatalog("globalColorSpaceCache")]).then(([t,a,r,i,n,s])=>({pdfManager:e,acroForm:t instanceof Dict?t:Dict.empty,xfaDatasets:a,structTreeRoot:r,baseUrl:i,attachments:n,globalColorSpaceCache:s}),e=>{warn(`createGlobals: "${e}".`);return null})}static async create(e,t,a,r,i,n,s,o){const c=i?await this._getPageIndex(e,t,a.pdfManager):null;return a.pdfManager.ensure(this,"_create",[e,t,a,r,i,n,s,c,o])}static _create(e,t,a,r,i=!1,n=null,s=null,o=null,c=null){const l=e.fetchIfRef(t);if(!(l instanceof Dict))return;let h=l.get("Subtype");h=h instanceof Name?h.name:null;if(s&&!s.has(F[h.toUpperCase()]))return null;const{acroForm:u,pdfManager:d}=a,f=t instanceof Ref?t.toString():`annot_${r.createObjId()}`,g={xref:e,ref:t,dict:l,subtype:h,id:f,annotationGlobals:a,collectFields:i,orphanFields:n,needAppearances:!i&&!0===u.get("NeedAppearances"),pageIndex:o,evaluatorOptions:d.evaluatorOptions,pageRef:c};switch(h){case"Link":return new LinkAnnotation(g);case"Text":return new TextAnnotation(g);case"Widget":let e=getInheritableProperty({dict:l,key:"FT"});e=e instanceof Name?e.name:null;switch(e){case"Tx":return new TextWidgetAnnotation(g);case"Btn":return new ButtonWidgetAnnotation(g);case"Ch":return new ChoiceWidgetAnnotation(g);case"Sig":return new SignatureWidgetAnnotation(g)}warn(`Unimplemented widget field type "${e}", falling back to base field type.`);return new WidgetAnnotation(g);case"Popup":return new PopupAnnotation(g);case"FreeText":return new FreeTextAnnotation(g);case"Line":return new LineAnnotation(g);case"Square":return new SquareAnnotation(g);case"Circle":return new CircleAnnotation(g);case"PolyLine":return new PolylineAnnotation(g);case"Polygon":return new PolygonAnnotation(g);case"Caret":return new CaretAnnotation(g);case"Ink":return new InkAnnotation(g);case"Highlight":return new HighlightAnnotation(g);case"Underline":return new UnderlineAnnotation(g);case"Squiggly":return new SquigglyAnnotation(g);case"StrikeOut":return new StrikeOutAnnotation(g);case"Stamp":return new StampAnnotation(g);case"FileAttachment":return new FileAttachmentAnnotation(g);default:i||warn(h?`Unimplemented annotation type "${h}", falling back to base annotation.`:"Annotation is missing the required /Subtype.");return new Annotation(g)}}static async _getPageIndex(e,t,a){try{const r=await e.fetchIfRefAsync(t);if(!(r instanceof Dict))return-1;const i=r.getRaw("P");if(i instanceof Ref)try{return await a.ensureCatalog("getPageIndex",[i])}catch(e){info(`_getPageIndex -- not a valid page reference: "${e}".`)}if(r.has("Kids"))return-1;const n=await a.ensureDoc("numPages");for(let e=0;ee/255)||t}function getQuadPoints(e,t){const a=e.getArray("QuadPoints");if(!isNumberArray(a,null)||0===a.length||a.length%8>0)return null;const r=new Float32Array(a.length);for(let e=0,i=a.length;et[2]||gt[3]))return null;r.set([d,p,f,p,d,g,f,g],e)}return r}function getTransformMatrix(e,t,a){const r=new Float32Array([1/0,1/0,-1/0,-1/0]);Util.axialAlignedBoundingBox(t,a,r);const[i,n,s,o]=r;if(i===s||n===o)return[1,0,0,1,e[0],e[1]];const c=(e[2]-e[0])/(s-i),l=(e[3]-e[1])/(o-n);return[c,0,0,l,e[0]-i*c,e[1]-n*l]}class Annotation{constructor(e){const{dict:t,xref:a,annotationGlobals:r,ref:i,orphanFields:n}=e,s=n?.get(i);s&&t.set("Parent",s);this.setTitle(t.get("T"));this.setContents(t.get("Contents"));this.setModificationDate(t.get("M"));this.setFlags(t.get("F"));this.setRectangle(t.getArray("Rect"));this.setColor(t.getArray("C"));this.setBorderStyle(t);this.setAppearance(t);this.setOptionalContent(t);const o=t.get("MK");this.setBorderAndBackgroundColors(o);this.setRotation(o,t);this.ref=e.ref instanceof Ref?e.ref:null;this._streams=[];this.appearance&&this._streams.push(this.appearance);const c=!!(this.flags&L),l=!!(this.flags&_);this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,backgroundColor:this.backgroundColor,borderColor:this.borderColor,rotation:this.rotation,contentsObj:this._contents,hasAppearance:!!this.appearance,id:e.id,modificationDate:this.modificationDate,rect:this.rectangle,subtype:e.subtype,hasOwnCanvas:!1,noRotate:!!(this.flags&N),noHTML:c&&l,isEditable:!1,structParent:-1};if(r.structTreeRoot){let a=t.get("StructParent");this.data.structParent=a=Number.isInteger(a)&&a>=0?a:-1;r.structTreeRoot.addAnnotationIdToPage(e.pageRef,a)}if(e.collectFields){const r=t.get("Kids");if(Array.isArray(r)){const e=[];for(const t of r)t instanceof Ref&&e.push(t.toString());0!==e.length&&(this.data.kidIds=e)}this.data.actions=collectActions(a,t,te);this.data.fieldName=this._constructFieldName(t);this.data.pageIndex=e.pageIndex}const h=t.get("IT");h instanceof Name&&(this.data.it=h.name);this._isOffscreenCanvasSupported=e.evaluatorOptions.isOffscreenCanvasSupported;this._fallbackFontDict=null;this._needAppearances=!1}_hasFlag(e,t){return!!(e&t)}_buildFlags(e,t){let{flags:a}=this;if(void 0===e){if(void 0===t)return;return t?a&~R:a&~D|R}if(e){a|=R;return t?a&~E|D:a&~D|E}a&=~(D|E);return t?a&~R:a|R}_isViewable(e){return!this._hasFlag(e,M)&&!this._hasFlag(e,E)}_isPrintable(e){return this._hasFlag(e,R)&&!this._hasFlag(e,D)&&!this._hasFlag(e,M)}mustBeViewed(e,t){const a=e?.get(this.data.id)?.noView;return void 0!==a?!a:this.viewable&&!this._hasFlag(this.flags,D)}mustBePrinted(e){const t=e?.get(this.data.id)?.noPrint;return void 0!==t?!t:this.printable}mustBeViewedWhenEditing(e,t=null){return e?!this.data.isEditable:!t?.has(this.data.id)}get viewable(){return null!==this.data.quadPoints&&(0===this.flags||this._isViewable(this.flags))}get printable(){return null!==this.data.quadPoints&&(0!==this.flags&&this._isPrintable(this.flags))}_parseStringHelper(e){const t="string"==typeof e?stringToPDFString(e):"";return{str:t,dir:t&&"rtl"===bidi(t).dir?"rtl":"ltr"}}setDefaultAppearance(e){const{dict:t,annotationGlobals:a}=e,r=getInheritableProperty({dict:t,key:"DA"})||a.acroForm.get("DA");this._defaultAppearance="string"==typeof r?r:"";this.data.defaultAppearanceData=parseDefaultAppearance(this._defaultAppearance)}setTitle(e){this._title=this._parseStringHelper(e)}setContents(e){this._contents=this._parseStringHelper(e)}setModificationDate(e){this.modificationDate="string"==typeof e?e:null}setFlags(e){this.flags=Number.isInteger(e)&&e>0?e:0;this.flags&M&&"Annotation"!==this.constructor.name&&(this.flags^=M)}hasFlag(e){return this._hasFlag(this.flags,e)}setRectangle(e){this.rectangle=lookupNormalRect(e,[0,0,0,0])}setColor(e){this.color=getRgbColor(e)}setLineEndings(e){this.lineEndings=["None","None"];if(Array.isArray(e)&&2===e.length)for(let t=0;t<2;t++){const a=e[t];if(a instanceof Name)switch(a.name){case"None":continue;case"Square":case"Circle":case"Diamond":case"OpenArrow":case"ClosedArrow":case"Butt":case"ROpenArrow":case"RClosedArrow":case"Slash":this.lineEndings[t]=a.name;continue}warn(`Ignoring invalid lineEnding: ${a}`)}}setRotation(e,t){this.rotation=0;let a=e instanceof Dict?e.get("R")||0:t.get("Rotate")||0;if(Number.isInteger(a)&&0!==a){a%=360;a<0&&(a+=360);a%90==0&&(this.rotation=a)}}setBorderAndBackgroundColors(e){if(e instanceof Dict){this.borderColor=getRgbColor(e.getArray("BC"),null);this.backgroundColor=getRgbColor(e.getArray("BG"),null)}else this.borderColor=this.backgroundColor=null}setBorderStyle(e){this.borderStyle=new AnnotationBorderStyle;if(e instanceof Dict)if(e.has("BS")){const t=e.get("BS");if(t instanceof Dict){const e=t.get("Type");if(!e||isName(e,"Border")){this.borderStyle.setWidth(t.get("W"),this.rectangle);this.borderStyle.setStyle(t.get("S"));this.borderStyle.setDashArray(t.getArray("D"))}}}else if(e.has("Border")){const t=e.getArray("Border");if(Array.isArray(t)&&t.length>=3){this.borderStyle.setHorizontalCornerRadius(t[0]);this.borderStyle.setVerticalCornerRadius(t[1]);this.borderStyle.setWidth(t[2],this.rectangle);4===t.length&&this.borderStyle.setDashArray(t[3],!0)}}else this.borderStyle.setWidth(0)}setAppearance(e){this.appearance=null;const t=e.get("AP");if(!(t instanceof Dict))return;const a=t.get("N");if(a instanceof BaseStream){this.appearance=a;return}if(!(a instanceof Dict))return;const r=e.get("AS");if(!(r instanceof Name&&a.has(r.name)))return;const i=a.get(r.name);i instanceof BaseStream&&(this.appearance=i)}setOptionalContent(e){this.oc=null;const t=e.get("OC");t instanceof Name?warn("setOptionalContent: Support for /Name-entry is not implemented."):t instanceof Dict&&(this.oc=t)}async loadResources(e,t){const a=await t.dict.getAsync("Resources");a&&await ObjectLoader.load(a,e,a.xref);return a}async getOperatorList(e,t,a,r){const{hasOwnCanvas:i,id:n,rect:o}=this.data;let c=this.appearance;const l=!!(i&&a&s);if(l&&(0===this.width||0===this.height)){this.data.hasOwnCanvas=!1;return{opList:new OperatorList,separateForm:!1,separateCanvas:!1}}if(!c){if(!l)return{opList:new OperatorList,separateForm:!1,separateCanvas:!1};c=new StringStream("");c.dict=new Dict}const h=c.dict,u=await this.loadResources(ha,c),d=lookupRect(h.getArray("BBox"),[0,0,1,1]),f=lookupMatrix(h.getArray("Matrix"),la),g=getTransformMatrix(o,d,f),p=new OperatorList;let m;this.oc&&(m=await e.parseMarkedContentProps(this.oc,null));void 0!==m&&p.addOp(St,["OC",m]);p.addOp(Ot,[n,o,g,f,l]);await e.getOperatorList({stream:c,task:t,resources:u,operatorList:p,fallbackFontDict:this._fallbackFontDict});p.addOp(Mt,[]);void 0!==m&&p.addOp(At,[]);this.reset();return{opList:p,separateForm:!1,separateCanvas:l}}async save(e,t,a,r){return null}get overlaysTextContent(){return!1}get hasTextContent(){return!1}async extractTextContent(e,t,a){if(!this.appearance)return;const r=await this.loadResources(ua,this.appearance),i=[],n=[];let s=null;const o={desiredSize:Math.Infinity,ready:!0,enqueue(e,t){for(const t of e.items)if(void 0!==t.str){s||=t.transform.slice(-2);n.push(t.str);if(t.hasEOL){i.push(n.join("").trimEnd());n.length=0}}}};await e.getTextContent({stream:this.appearance,task:t,resources:r,includeMarkedContent:!0,keepWhiteSpace:!0,sink:o,viewBox:a});this.reset();n.length&&i.push(n.join("").trimEnd());if(i.length>1||i[0]){const e=this.appearance.dict,t=lookupRect(e.getArray("BBox"),null),a=lookupMatrix(e.getArray("Matrix"),null);this.data.textPosition=this._transformPoint(s,t,a);this.data.textContent=i}}_transformPoint(e,t,a){const{rect:r}=this.data;t||=[0,0,1,1];a||=[1,0,0,1,0,0];const i=getTransformMatrix(r,t,a);i[4]-=r[0];i[5]-=r[1];const n=e.slice();Util.applyTransform(n,i);Util.applyTransform(n,a);return n}getFieldObject(){return this.data.kidIds?{id:this.data.id,actions:this.data.actions,name:this.data.fieldName,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,type:"",kidIds:this.data.kidIds,page:this.data.pageIndex,rotation:this.rotation}:null}reset(){for(const e of this._streams)e.reset()}_constructFieldName(e){if(!e.has("T")&&!e.has("Parent")){warn("Unknown field name, falling back to empty field name.");return""}if(!e.has("Parent"))return stringToPDFString(e.get("T"));const t=[];e.has("T")&&t.unshift(stringToPDFString(e.get("T")));let a=e;const r=new RefSet;e.objId&&r.put(e.objId);for(;a.has("Parent");){a=a.get("Parent");if(!(a instanceof Dict)||a.objId&&r.has(a.objId))break;a.objId&&r.put(a.objId);a.has("T")&&t.unshift(stringToPDFString(a.get("T")))}return t.join(".")}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}class AnnotationBorderStyle{constructor(){this.width=1;this.rawWidth=1;this.style=J;this.dashArray=[3];this.horizontalCornerRadius=0;this.verticalCornerRadius=0}setWidth(e,t=[0,0,0,0]){if(e instanceof Name)this.width=0;else if("number"==typeof e){if(e>0){this.rawWidth=e;const a=(t[2]-t[0])/2,r=(t[3]-t[1])/2;if(a>0&&r>0&&(e>a||e>r)){warn(`AnnotationBorderStyle.setWidth - ignoring width: ${e}`);e=1}}this.width=e}}setStyle(e){if(e instanceof Name)switch(e.name){case"S":this.style=J;break;case"D":this.style=Y;break;case"B":this.style=Z;break;case"I":this.style=Q;break;case"U":this.style=ee}}setDashArray(e,t=!1){if(Array.isArray(e)){let a=!0,r=!0;for(const t of e){if(!(+t>=0)){a=!1;break}t>0&&(r=!1)}if(0===e.length||a&&!r){this.dashArray=e;t&&this.setStyle(Name.get("D"))}else this.width=0}else e&&(this.width=0)}setHorizontalCornerRadius(e){Number.isInteger(e)&&(this.horizontalCornerRadius=e)}setVerticalCornerRadius(e){Number.isInteger(e)&&(this.verticalCornerRadius=e)}}class MarkupAnnotation extends Annotation{constructor(e){super(e);const{dict:t}=e;if(t.has("IRT")){const e=t.getRaw("IRT");this.data.inReplyTo=e instanceof Ref?e.toString():null;const a=t.get("RT");this.data.replyType=a instanceof Name?a.name:O}let a=null;if(this.data.replyType===T){const e=t.get("IRT");this.setTitle(e.get("T"));this.data.titleObj=this._title;this.setContents(e.get("Contents"));this.data.contentsObj=this._contents;if(e.has("CreationDate")){this.setCreationDate(e.get("CreationDate"));this.data.creationDate=this.creationDate}else this.data.creationDate=null;if(e.has("M")){this.setModificationDate(e.get("M"));this.data.modificationDate=this.modificationDate}else this.data.modificationDate=null;a=e.getRaw("Popup");if(e.has("C")){this.setColor(e.getArray("C"));this.data.color=this.color}else this.data.color=null}else{this.data.titleObj=this._title;this.setCreationDate(t.get("CreationDate"));this.data.creationDate=this.creationDate;a=t.getRaw("Popup");t.has("C")||(this.data.color=null)}this.data.popupRef=a instanceof Ref?a.toString():null;t.has("RC")&&(this.data.richText=XFAFactory.getRichTextAsHtml(t.get("RC")))}setCreationDate(e){this.creationDate="string"==typeof e?e:null}_setDefaultAppearance({xref:e,extra:t,strokeColor:a,fillColor:r,blendMode:i,strokeAlpha:n,fillAlpha:s,pointsCallback:o}){const c=this.data.rect=[1/0,1/0,-1/0,-1/0],l=["q"];t&&l.push(t);a&&l.push(`${a[0]} ${a[1]} ${a[2]} RG`);r&&l.push(`${r[0]} ${r[1]} ${r[2]} rg`);const h=this.data.quadPoints||Float32Array.from([this.rectangle[0],this.rectangle[3],this.rectangle[2],this.rectangle[3],this.rectangle[0],this.rectangle[1],this.rectangle[2],this.rectangle[1]]);for(let e=0,t=h.length;e"string"==typeof e).map(e=>stringToPDFString(e)):e instanceof Name?stringToPDFString(e.name):"string"==typeof e?stringToPDFString(e):null}hasFieldFlag(e){return!!(this.data.fieldFlags&e)}_isViewable(e){return!0}mustBeViewed(e,t){return t?this.viewable:super.mustBeViewed(e,t)&&!this._hasFlag(this.flags,E)}getRotationMatrix(e){let t=e?.get(this.data.id)?.rotation;void 0===t&&(t=this.rotation);return 0===t?la:getRotationMatrix(t,this.width,this.height)}getBorderAndBackgroundAppearances(e){let t=e?.get(this.data.id)?.rotation;void 0===t&&(t=this.rotation);if(!this.backgroundColor&&!this.borderColor)return"";const a=0===t||180===t?`0 0 ${this.width} ${this.height} re`:`0 0 ${this.height} ${this.width} re`;let r="";this.backgroundColor&&(r=`${getPdfColor(this.backgroundColor,!0)} ${a} f `);if(this.borderColor){r+=`${this.borderStyle.width||1} w ${getPdfColor(this.borderColor,!1)} ${a} S `}return r}async getOperatorList(e,t,a,r){if(a&l&&!(this instanceof SignatureWidgetAnnotation)&&!this.data.noHTML&&!this.data.hasOwnCanvas)return{opList:new OperatorList,separateForm:!0,separateCanvas:!1};if(!this._hasText)return super.getOperatorList(e,t,a,r);const i=await this._getAppearance(e,t,a,r);if(this.appearance&&null===i)return super.getOperatorList(e,t,a,r);const n=new OperatorList;if(!this._defaultAppearance||null===i)return{opList:n,separateForm:!1,separateCanvas:!1};const o=!!(this.data.hasOwnCanvas&&a&s),c=[0,0,this.width,this.height],h=getTransformMatrix(this.data.rect,c,[1,0,0,1,0,0]);let u;this.oc&&(u=await e.parseMarkedContentProps(this.oc,null));void 0!==u&&n.addOp(St,["OC",u]);n.addOp(Ot,[this.data.id,this.data.rect,h,this.getRotationMatrix(r),o]);const d=new StringStream(i);await e.getOperatorList({stream:d,task:t,resources:this._fieldResources.mergedResources,operatorList:n});n.addOp(Mt,[]);void 0!==u&&n.addOp(At,[]);return{opList:n,separateForm:!1,separateCanvas:o}}_getMKDict(e){const t=new Dict(null);e&&t.set("R",e);t.setIfArray("BC",getPdfColorArray(this.borderColor));t.setIfArray("BG",getPdfColorArray(this.backgroundColor));return t.size>0?t:null}amendSavedDict(e,t){}setValue(e,t,a,r){const{dict:i,ref:n}=function getParentToUpdate(e,t,a){const r=new RefSet,i=e,n={dict:null,ref:null};for(;e instanceof Dict&&!r.has(t);){r.put(t);if(e.has("T"))break;if(!((t=e.getRaw("Parent"))instanceof Ref))return n;e=a.fetch(t)}if(e instanceof Dict&&e!==i){n.dict=e;n.ref=t}return n}(e,this.ref,a);if(i){if(!r.has(n)){const e=i.clone();e.set("V",t);r.put(n,{data:e});return e}}else e.set("V",t);return null}async save(e,t,a,r){const i=a?.get(this.data.id),n=this._buildFlags(i?.noView,i?.noPrint);let s=i?.value,o=i?.rotation;if(s===this.data.fieldValue||void 0===s){if(!this._hasValueFromXFA&&void 0===o&&void 0===n)return;s||=this.data.fieldValue}if(void 0===o&&!this._hasValueFromXFA&&Array.isArray(s)&&Array.isArray(this.data.fieldValue)&&isArrayEqual(s,this.data.fieldValue)&&void 0===n)return;void 0===o&&(o=this.rotation);let l=null;if(!this._needAppearances){l=await this._getAppearance(e,t,c,a);if(null===l&&void 0===n)return}let h=!1;if(l?.needAppearances){h=!0;l=null}const{xref:u}=e,d=u.fetchIfRef(this.ref);if(!(d instanceof Dict))return;const f=new Dict(u);for(const e of d.getKeys())"AP"!==e&&f.set(e,d.getRaw(e));if(void 0!==n){f.set("F",n);if(null===l&&!h){const e=d.getRaw("AP");e&&f.set("AP",e)}}const g={path:this.data.fieldName,value:s},p=this.setValue(f,Array.isArray(s)?s.map(stringToAsciiOrUTF16BE):stringToAsciiOrUTF16BE(s),u,r);this.amendSavedDict(a,p||f);const m=this._getMKDict(o);m&&f.set("MK",m);r.put(this.ref,{data:f,xfa:g,needAppearances:h});if(null!==l){const e=u.getNewTemporaryRef(),t=new Dict(u);f.set("AP",t);t.set("N",e);const i=this._getSaveFieldResources(u),n=new StringStream(l),s=n.dict=new Dict(u);s.setIfName("Subtype","Form");s.set("Resources",i);const c=o%180==0?[0,0,this.width,this.height]:[0,0,this.height,this.width];s.set("BBox",c);const h=this.getRotationMatrix(a);h!==la&&s.set("Matrix",h);r.put(e,{data:n,xfa:null,needAppearances:!1})}f.set("M",`D:${getModificationDate()}`)}async _getAppearance(e,t,a,r){if(this.data.password)return null;const n=r?.get(this.data.id);let s,o;if(n){s=n.formattedValue||n.value;o=n.rotation}if(void 0===o&&void 0===s&&!this._needAppearances&&(!this._hasValueFromXFA||this.appearance))return null;const l=this.getBorderAndBackgroundAppearances(r);if(void 0===s){s=this.data.fieldValue;if(!s)return`/Tx BMC q ${l}Q EMC`}Array.isArray(s)&&1===s.length&&(s=s[0]);assert("string"==typeof s,"Expected `value` to be a string.");s=s.trimEnd();if(this.data.combo){const e=this.data.options.find(({exportValue:e})=>s===e);s=e?.displayValue||s}if(""===s)return`/Tx BMC q ${l}Q EMC`;void 0===o&&(o=this.rotation);let h,u=-1;if(this.data.multiLine){h=s.split(/\r\n?|\n/).map(e=>e.normalize("NFC"));u=h.length}else h=[s.replace(/\r\n?|\n/,"").normalize("NFC")];let{width:d,height:f}=this;90!==o&&270!==o||([d,f]=[f,d]);this._defaultAppearance||(this.data.defaultAppearanceData=parseDefaultAppearance(this._defaultAppearance="/Helvetica 0 Tf 0 g"));let g,p,m,b=await WidgetAnnotation._getFontData(e,t,this.data.defaultAppearanceData,this._fieldResources.mergedResources);const y=[];let w=!1;for(const e of h){const t=b.encodeString(e);t.length>1&&(w=!0);y.push(t.join(""))}if(w&&a&c)return{needAppearances:!0};if(w&&this._isOffscreenCanvasSupported){const a=this.data.comb?"monospace":"sans-serif",r=new FakeUnicodeFont(e.xref,a),i=r.createFontResources(h.join("")),n=i.getRaw("Font");if(this._fieldResources.mergedResources.has("Font")){const e=this._fieldResources.mergedResources.get("Font");for(const t of n.getKeys())e.set(t,n.getRaw(t))}else this._fieldResources.mergedResources.set("Font",n);const o=r.fontName.name;b=await WidgetAnnotation._getFontData(e,t,{fontName:o,fontSize:0},i);for(let e=0,t=y.length;e2)return`/Tx BMC q ${l}BT `+g+` 1 0 0 1 ${numberToString(2)} ${numberToString(C)} Tm (${escapeString(y[0])}) Tj ET Q EMC`;return`/Tx BMC q ${l}BT `+g+` 1 0 0 1 0 0 Tm ${this._renderText(y[0],b,p,d,k,{shift:0},2,C)} ET Q EMC`}static async _getFontData(e,t,a,r){const i=new OperatorList,n={font:null,clone(){return this}},{fontName:s,fontSize:o}=a;await e.handleSetFont(r,[s&&Name.get(s),o],null,i,t,n,null);return n.font}_getTextWidth(e,t){return Math.sumPrecise(t.charsToGlyphs(e).map(e=>e.width))/1e3}_computeFontSize(e,t,r,i,n){let{fontSize:s}=this.data.defaultAppearanceData,o=(s||12)*a,c=Math.round(e/o);if(!s){const roundWithTwoDigits=e=>Math.floor(100*e)/100;if(-1===n){const n=this._getTextWidth(r,i);s=roundWithTwoDigits(Math.min(e/a,t/n));c=1}else{const l=r.split(/\r\n?|\n/),h=[];for(const e of l){const t=i.encodeString(e).join(""),a=i.charsToGlyphs(t),r=i.getCharPositions(t);h.push({line:t,glyphs:a,positions:r})}const isTooBig=a=>{let r=0;for(const n of h){r+=this._splitLine(null,i,a,t,n).length*a;if(r>e)return!0}return!1};c=Math.max(c,n);for(;;){o=e/c;s=roundWithTwoDigits(o/a);if(!isTooBig(s))break;c++}}const{fontName:l,fontColor:h}=this.data.defaultAppearanceData;this._defaultAppearance=function createDefaultAppearance({fontSize:e,fontName:t,fontColor:a}){return`/${escapePDFName(t)} ${e} Tf ${getPdfColor(a,!0)}`}({fontSize:s,fontName:l,fontColor:h})}return[this._defaultAppearance,s,e/c]}_renderText(e,t,a,r,i,n,s,o){let c;if(1===i){c=(r-this._getTextWidth(e,t)*a)/2}else if(2===i){c=r-this._getTextWidth(e,t)*a-s}else c=s;const l=numberToString(c-n.shift);n.shift=c;return`${l} ${o=numberToString(o)} Td (${escapeString(e)}) Tj`}_getSaveFieldResources(e){const{localResources:t,appearanceResources:a,acroFormResources:r}=this._fieldResources,i=this.data.defaultAppearanceData?.fontName;if(!i)return t||Dict.empty;for(const e of[t,a])if(e instanceof Dict){const t=e.get("Font");if(t instanceof Dict&&t.has(i))return e}if(r instanceof Dict){const a=r.get("Font");if(a instanceof Dict&&a.has(i)){const r=new Dict(e);r.set(i,a.getRaw(i));const n=new Dict(e);n.set("Font",r);return Dict.merge({xref:e,dictArray:[n,t],mergeSubDicts:!0})}}return t||Dict.empty}getFieldObject(){return null}}class TextWidgetAnnotation extends WidgetAnnotation{constructor(e){super(e);const{dict:t}=e;if(t.has("PMD")){this.flags|=D;this.data.hidden=!0;warn("Barcodes are not supported")}this.data.hasOwnCanvas=this.data.readOnly&&!this.data.noHTML;this._hasText=!0;"string"!=typeof this.data.fieldValue&&(this.data.fieldValue="");let a=getInheritableProperty({dict:t,key:"Q"});(!Number.isInteger(a)||a<0||a>2)&&(a=null);this.data.textAlignment=a;let r=getInheritableProperty({dict:t,key:"MaxLen"});(!Number.isInteger(r)||r<0)&&(r=0);this.data.maxLen=r;this.data.multiLine=this.hasFieldFlag(X);this.data.comb=this.hasFieldFlag(K)&&!this.data.multiLine&&!this.data.password&&!this.hasFieldFlag($)&&0!==this.data.maxLen;this.data.doNotScroll=this.hasFieldFlag(V);const{data:{actions:i}}=this;if(!i)return;const n=/^AF(Date|Time)_(?:Keystroke|Format)(?:Ex)?\(['"]?([^'"]+)['"]?\);$/;let s=!1;(1===i.Format?.length&&1===i.Keystroke?.length&&n.test(i.Format[0])&&n.test(i.Keystroke[0])||0===i.Format?.length&&1===i.Keystroke?.length&&n.test(i.Keystroke[0])||0===i.Keystroke?.length&&1===i.Format?.length&&n.test(i.Format[0]))&&(s=!0);const o=[];i.Format&&o.push(...i.Format);i.Keystroke&&o.push(...i.Keystroke);if(s){delete i.Keystroke;i.Format=o}for(const e of o){const t=e.match(n);if(!t)continue;const a="Date"===t[1];let r=t[2];const i=parseInt(r,10);isNaN(i)||Math.floor(Math.log10(i))+1!==t[2].length||(r=(a?wn:xn)[i]??r);this.data.datetimeFormat=r;if(!s)break;if(a){if(/HH|MM|ss|h/.test(r)){this.data.datetimeType="datetime-local";this.data.timeStep=/ss/.test(r)?1:60}else this.data.datetimeType="date";break}this.data.datetimeType="time";this.data.timeStep=/ss/.test(r)?1:60;break}}get hasTextContent(){return!!this.appearance&&!this._needAppearances}_getCombAppearance(e,t,a,r,i,n,s,o,c,l,h){const u=i/this.data.maxLen,d=this.getBorderAndBackgroundAppearances(h),f=[],g=t.getCharPositions(a);for(const[e,t]of g)f.push(`(${escapeString(a.substring(e,t))}) Tj`);const p=f.join(` ${numberToString(u)} 0 Td `);return`/Tx BMC q ${d}BT `+e+` 1 0 0 1 ${numberToString(s)} ${numberToString(o+c)} Tm ${p} ET Q EMC`}_getMultilineAppearance(e,t,a,r,i,n,s,o,c,l,h,u){const d=[],f=i-2*o,g={shift:0};for(let e=0,n=t.length;er){c.push(e.substring(d,a));d=a;f=p;l=-1;u=-1}else{f+=p;l=a;h=i;u=t}else if(f+p>r)if(-1!==l){c.push(e.substring(d,h));d=h;t=u+1;l=-1;f=0}else{c.push(e.substring(d,a));d=a;f=p}else f+=p}dt?`\\${t}`:"\\s+");new RegExp(`^\\s*${n}\\s*$`).test(this.data.fieldValue)&&(this.data.textContent=this.data.fieldValue.split("\n"))}getFieldObject(){return{id:this.data.id,value:this.data.fieldValue,defaultValue:this.data.defaultFieldValue||"",multiline:this.data.multiLine,password:this.data.password,charLimit:this.data.maxLen,comb:this.data.comb,editable:!this.data.readOnly,hidden:this.data.hidden,name:this.data.fieldName,rect:this.data.rect,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,datetimeFormat:this.data.datetimeFormat,hasDatetimeHTML:!!this.data.datetimeType,type:"text"}}}class ButtonWidgetAnnotation extends WidgetAnnotation{constructor(e){super(e);this.checkedAppearance=null;this.uncheckedAppearance=null;const t=this.hasFieldFlag(H),a=this.hasFieldFlag(W);this.data.checkBox=!t&&!a;this.data.radioButton=t&&!a;this.data.pushButton=a;this.data.isTooltipOnly=!1;if(this.data.checkBox)this._processCheckBox(e);else if(this.data.radioButton)this._processRadioButton(e);else if(this.data.pushButton){this.data.hasOwnCanvas=!0;this.data.noHTML=!1;this._processPushButton(e)}else warn("Invalid field flags for button widget annotation")}async getOperatorList(e,t,a,r){if(this.data.pushButton)return super.getOperatorList(e,t,a,!1,r);let i=null,n=null;if(r){const e=r.get(this.data.id);i=e?e.value:null;n=e?e.rotation:null}if(null===i&&this.appearance)return super.getOperatorList(e,t,a,r);null==i&&(i=this.data.checkBox?this.data.fieldValue===this.data.exportValue:this.data.fieldValue===this.data.buttonValue);const s=i?this.checkedAppearance:this.uncheckedAppearance;if(s){const i=this.appearance,o=lookupMatrix(s.dict.getArray("Matrix"),la);n&&s.dict.set("Matrix",this.getRotationMatrix(r));this.appearance=s;const c=super.getOperatorList(e,t,a,r);this.appearance=i;s.dict.set("Matrix",o);return c}return{opList:new OperatorList,separateForm:!1,separateCanvas:!1}}async save(e,t,a,r){this.data.checkBox?this._saveCheckbox(e,t,a,r):this.data.radioButton&&this._saveRadioButton(e,t,a,r)}async _saveCheckbox(e,t,a,r){if(!a)return;const i=a.get(this.data.id),n=this._buildFlags(i?.noView,i?.noPrint);let s=i?.rotation,o=i?.value;if(void 0===s&&void 0===n){if(void 0===o)return;if(this.data.fieldValue===this.data.exportValue===o)return}let c=e.xref.fetchIfRef(this.ref);if(!(c instanceof Dict))return;c=c.clone();void 0===s&&(s=this.rotation);void 0===o&&(o=this.data.fieldValue===this.data.exportValue);const l={path:this.data.fieldName,value:o?this.data.exportValue:""},h=Name.get(o?this.data.exportValue:"Off");this.setValue(c,h,e.xref,r);c.set("AS",h);c.set("M",`D:${getModificationDate()}`);void 0!==n&&c.set("F",n);const u=this._getMKDict(s);u&&c.set("MK",u);r.put(this.ref,{data:c,xfa:l,needAppearances:!1})}async _saveRadioButton(e,t,a,r){if(!a)return;const i=a.get(this.data.id),n=this._buildFlags(i?.noView,i?.noPrint);let s=i?.rotation,o=i?.value;if(void 0===s&&void 0===n){if(void 0===o)return;if(this.data.fieldValue===this.data.buttonValue===o)return}let c=e.xref.fetchIfRef(this.ref);if(!(c instanceof Dict))return;c=c.clone();void 0===o&&(o=this.data.fieldValue===this.data.buttonValue);void 0===s&&(s=this.rotation);const l={path:this.data.fieldName,value:o?this.data.buttonValue:""},h=Name.get(o?this.data.buttonValue:"Off");o&&this.setValue(c,h,e.xref,r);c.set("AS",h);c.set("M",`D:${getModificationDate()}`);void 0!==n&&c.set("F",n);const u=this._getMKDict(s);u&&c.set("MK",u);r.put(this.ref,{data:c,xfa:l,needAppearances:!1})}_getDefaultCheckedAppearance(e,t){const{width:a,height:r}=this,i=[0,0,a,r],n=.8*Math.min(a,r);let s,o;if("check"===t){s={width:.755*n,height:.705*n};o="3"}else if("disc"===t){s={width:.791*n,height:.705*n};o="l"}else unreachable(`_getDefaultCheckedAppearance - unsupported type: ${t}`);const c=`q BT /PdfJsZaDb ${n} Tf 0 g ${numberToString((a-s.width)/2)} ${numberToString((r-s.height)/2)} Td (${o}) Tj ET Q`,l=new Dict(e.xref);l.set("FormType",1);l.setIfName("Subtype","Form");l.setIfName("Type","XObject");l.set("BBox",i);l.set("Matrix",[1,0,0,1,0,0]);l.set("Length",c.length);const h=new Dict(e.xref),u=new Dict(e.xref);u.set("PdfJsZaDb",this.fallbackFontDict);h.set("Font",u);l.set("Resources",h);this.checkedAppearance=new StringStream(c);this.checkedAppearance.dict=l;this._streams.push(this.checkedAppearance)}_processCheckBox(e){const t=e.dict.get("AP");if(!(t instanceof Dict))return;const a=t.get("N");if(!(a instanceof Dict))return;const r=this._decodeFormValue(e.dict.get("AS"));"string"==typeof r&&(this.data.fieldValue=r);const i=null!==this.data.fieldValue&&"Off"!==this.data.fieldValue?this.data.fieldValue:"Yes",n=this._decodeFormValue(a.getKeys());if(0===n.length)n.push("Off",i);else if(1===n.length)"Off"===n[0]?n.push(i):n.unshift("Off");else if(n.includes(i)){n.length=0;n.push("Off",i)}else{const e=n.find(e=>"Off"!==e);n.length=0;n.push("Off",e)}n.includes(this.data.fieldValue)||(this.data.fieldValue="Off");this.data.exportValue=n[1];const s=a.get(this.data.exportValue);this.checkedAppearance=s instanceof BaseStream?s:null;const o=a.get("Off");this.uncheckedAppearance=o instanceof BaseStream?o:null;this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(e,"check");this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance);this._fallbackFontDict=this.fallbackFontDict;null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processRadioButton(e){this.data.buttonValue=null;const t=e.dict.get("Parent");if(t instanceof Dict){this.parent=e.dict.getRaw("Parent");const a=t.get("V");a instanceof Name&&(this.data.fieldValue=this._decodeFormValue(a))}const a=e.dict.get("AP");if(!(a instanceof Dict))return;const r=a.get("N");if(!(r instanceof Dict))return;for(const e of r.getKeys())if("Off"!==e){this.data.buttonValue=this._decodeFormValue(e);break}const i=r.get(this.data.buttonValue);this.checkedAppearance=i instanceof BaseStream?i:null;const n=r.get("Off");this.uncheckedAppearance=n instanceof BaseStream?n:null;this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(e,"disc");this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance);this._fallbackFontDict=this.fallbackFontDict;null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processPushButton(e){const{dict:t,annotationGlobals:a}=e;if(t.has("A")||t.has("AA")||this.data.alternativeText){this.data.isTooltipOnly=!t.has("A")&&!t.has("AA");Catalog.parseDestDictionary({destDict:t,resultObj:this.data,docBaseUrl:a.baseUrl,docAttachments:a.attachments})}else warn("Push buttons without action dictionaries are not supported")}getFieldObject(){let e,t="button";if(this.data.checkBox){t="checkbox";e=this.data.exportValue}else if(this.data.radioButton){t="radiobutton";e=this.data.buttonValue}return{id:this.data.id,value:this.data.fieldValue||"Off",defaultValue:this.data.defaultFieldValue,exportValues:e,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,hidden:this.data.hidden,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:t}}get fallbackFontDict(){const e=new Dict;e.setIfName("BaseFont","ZapfDingbats");e.setIfName("Type","FallbackType");e.setIfName("Subtype","FallbackType");e.setIfName("Encoding","ZapfDingbatsEncoding");return shadow(this,"fallbackFontDict",e)}}class ChoiceWidgetAnnotation extends WidgetAnnotation{constructor(e){super(e);const{dict:t,xref:a}=e;this.indices=t.getArray("I");this.hasIndices=Array.isArray(this.indices)&&this.indices.length>0;this.data.options=[];const r=getInheritableProperty({dict:t,key:"Opt"});if(Array.isArray(r))for(let e=0,t=r.length;e=0&&t0&&(this.data.options=this.data.fieldValue.map(e=>({exportValue:e,displayValue:e})));this.data.combo=this.hasFieldFlag(z);this.data.multiSelect=this.hasFieldFlag(G);this._hasText=!0}getFieldObject(){const e=this.data.combo?"combobox":"listbox",t=this.data.fieldValue.length>0?this.data.fieldValue[0]:null;return{id:this.data.id,value:t,defaultValue:this.data.defaultFieldValue,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,numItems:this.data.fieldValue.length,multipleSelection:this.data.multiSelect,hidden:this.data.hidden,actions:this.data.actions,items:this.data.options,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:e}}amendSavedDict(e,t){if(!this.hasIndices)return;let a=e?.get(this.data.id)?.value;Array.isArray(a)||(a=[a]);const r=[],{options:i}=this.data;for(let e=0,t=0,n=i.length;ea){a=r;t=e}}[f,g]=this._computeFontSize(e,c-4,t,d,-1)}const p=g*a,m=(p-g)/2,b=Math.floor(l/p);let y=0;if(u.length>0){const e=Math.min(...u),t=Math.max(...u);y=Math.max(0,t-b+1);y>e&&(y=e)}const w=Math.min(y+b+1,h),x=["/Tx BMC q",`1 1 ${c} ${l} re W n`];if(u.length){x.push("0.600006 0.756866 0.854904 rg");for(const e of u)y<=e&&ee.trimEnd());const{coords:e,bbox:t,matrix:r}=FakeUnicodeFont.getFirstPositionInfo(this.rectangle,this.rotation,a);this.data.textPosition=this._transformPoint(e,t,r)}if(this._isOffscreenCanvasSupported){const i=e.dict.get("CA"),n=new FakeUnicodeFont(r,"sans-serif");this.appearance=n.createAppearance(this._contents.str,this.rectangle,this.rotation,a,t,i);this._streams.push(this.appearance)}else warn("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.")}}get hasTextContent(){return this._hasAppearance}static createNewDict(e,t,{apRef:a,ap:r}){const{color:i,date:n,fontSize:s,oldAnnotation:o,rect:c,rotation:l,user:h,value:u}=e,d=o||new Dict(t);d.setIfNotExists("Type",Name.get("Annot"));d.setIfNotExists("Subtype",Name.get("FreeText"));d.set(o?"M":"CreationDate",`D:${getModificationDate(n)}`);o&&d.delete("RC");d.setIfArray("Rect",c);const f=`/Helv ${s} Tf ${getPdfColor(i,!0)}`;d.set("DA",f);d.setIfDefined("Contents",stringToAsciiOrUTF16BE(u));d.setIfNotExists("F",4);d.setIfNotExists("Border",[0,0,0]);d.setIfNumber("Rotate",l);d.setIfDefined("T",stringToAsciiOrUTF16BE(h));if(a||r){const e=new Dict(t);d.set("AP",e);e.set("N",a||r)}return d}static async createNewAppearanceStream(e,t,r){const{baseFontRef:i,evaluator:n,task:s}=r,{color:o,fontSize:c,rect:l,rotation:h,value:u}=e;if(!o)return null;const d=new Dict(t),f=new Dict(t);if(i)f.set("Helv",i);else{const e=new Dict(t);e.setIfName("BaseFont","Helvetica");e.setIfName("Type","Font");e.setIfName("Subtype","Type1");e.setIfName("Encoding","WinAnsiEncoding");f.set("Helv",e)}d.set("Font",f);const g=await WidgetAnnotation._getFontData(n,s,{fontName:"Helv",fontSize:c},d),[p,m,b,y]=l;let w=b-p,x=y-m;h%180!=0&&([w,x]=[x,w]);const S=u.split("\n"),k=c/1e3;let C=-1/0;const v=[];for(let e of S){const t=g.encodeString(e);if(t.length>1)return null;e=t.join("");v.push(e);let a=0;const r=g.charsToGlyphs(e);for(const e of r)a+=e.width*k;C=Math.max(C,a)}let F=1;C>w&&(F=w/C);let T=1;const O=a*c,M=1*c,D=O*S.length;D>x&&(T=x/D);const R=c*Math.min(F,T);let N,E,L;switch(h){case 0:L=[1,0,0,1];E=[l[0],l[1],w,x];N=[l[0],l[3]-M];break;case 90:L=[0,1,-1,0];E=[l[1],-l[2],w,x];N=[l[1],-l[0]-M];break;case 180:L=[-1,0,0,-1];E=[-l[2],-l[3],w,x];N=[-l[2],-l[1]-M];break;case 270:L=[0,-1,1,0];E=[-l[3],l[0],w,x];N=[-l[3],l[2]-M]}const _=["q",`${L.join(" ")} 0 0 cm`,`${E.join(" ")} re W n`,"BT",`${getPdfColor(o,!0)}`,`0 Tc /Helv ${numberToString(R)} Tf`];_.push(`${N.join(" ")} Td (${escapeString(v[0])}) Tj`);const j=numberToString(O);for(let e=1,t=v.length;e{e.push(`${r[0]} ${r[1]} m`,`${r[2]} ${r[3]} l`,"S");return[t[0]-o,t[7]-o,t[2]+o,t[3]+o]}})}}}class SquareAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:a}=e;this.data.annotationType=F.SQUARE;this.data.hasOwnCanvas=this.data.noRotate;this.data.noHTML=!1;if(!this.appearance){const e=getPdfColorArray(this.color,[0,0,0]),r=t.get("CA"),i=getPdfColorArray(getRgbColor(t.getArray("IC"),null)),n=i?r:null;if(0===this.borderStyle.width&&!i)return;this._setDefaultAppearance({xref:a,extra:`${this.borderStyle.width} w`,strokeColor:e,fillColor:i,strokeAlpha:r,fillAlpha:n,pointsCallback:(e,t)=>{const a=t[4]+this.borderStyle.width/2,r=t[5]+this.borderStyle.width/2,n=t[6]-t[4]-this.borderStyle.width,s=t[3]-t[7]-this.borderStyle.width;e.push(`${a} ${r} ${n} ${s} re`);i?e.push("B"):e.push("S");return[t[0],t[7],t[2],t[3]]}})}}}class CircleAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:a}=e;this.data.annotationType=F.CIRCLE;if(!this.appearance){const e=getPdfColorArray(this.color,[0,0,0]),r=t.get("CA"),i=getPdfColorArray(getRgbColor(t.getArray("IC"),null)),n=i?r:null;if(0===this.borderStyle.width&&!i)return;const s=4/3*Math.tan(Math.PI/8);this._setDefaultAppearance({xref:a,extra:`${this.borderStyle.width} w`,strokeColor:e,fillColor:i,strokeAlpha:r,fillAlpha:n,pointsCallback:(e,t)=>{const a=t[0]+this.borderStyle.width/2,r=t[1]-this.borderStyle.width/2,n=t[6]-this.borderStyle.width/2,o=t[7]+this.borderStyle.width/2,c=a+(n-a)/2,l=r+(o-r)/2,h=(n-a)/2*s,u=(o-r)/2*s;e.push(`${c} ${o} m`,`${c+h} ${o} ${n} ${l+u} ${n} ${l} c`,`${n} ${l-u} ${c+h} ${r} ${c} ${r} c`,`${c-h} ${r} ${a} ${l-u} ${a} ${l} c`,`${a} ${l+u} ${c-h} ${o} ${c} ${o} c`,"h");i?e.push("B"):e.push("S");return[t[0],t[7],t[2],t[3]]}})}}}class PolylineAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:a}=e;this.data.annotationType=F.POLYLINE;this.data.hasOwnCanvas=this.data.noRotate;this.data.noHTML=!1;this.data.vertices=null;if(!(this instanceof PolygonAnnotation)){this.setLineEndings(t.getArray("LE"));this.data.lineEndings=this.lineEndings}const r=t.getArray("Vertices");if(!isNumberArray(r,null))return;const i=this.data.vertices=Float32Array.from(r);if(!this.appearance){const e=getPdfColorArray(this.color,[0,0,0]),r=t.get("CA");let n,s=getRgbColor(t.getArray("IC"),null);s&&(s=getPdfColorArray(s));n=s?this.color?s.every((t,a)=>t===e[a])?"f":"B":"f":"S";const o=this.borderStyle.width||1,c=2*o,l=[1/0,1/0,-1/0,-1/0];for(let e=0,t=i.length;e{for(let t=0,a=i.length;t{for(const t of this.data.inkLists){for(let a=0,r=t.length;a0){const e=new Dict(t);g.set("BS",e);e.set("W",d)}g.setIfArray("C",getPdfColorArray(n));g.setIfNumber("CA",o);if(r||a){const e=new Dict(t);g.set("AP",e);e.set("N",a||r)}return g}static async createNewAppearanceStream(e,t,a){if(e.outlines)return this.createNewAppearanceStreamForHighlight(e,t,a);const{color:r,rect:i,paths:n,thickness:s,opacity:o}=e;if(!r)return null;const c=[`${s} w 1 J 1 j`,`${getPdfColor(r,!1)}`];1!==o&&c.push("/R0 gs");for(const e of n.lines){c.push(`${numberToString(e[4])} ${numberToString(e[5])} m`);for(let t=6,a=e.length;t{e.push(`${t[0]} ${t[1]} m`,`${t[2]} ${t[3]} l`,`${t[6]} ${t[7]} l`,`${t[4]} ${t[5]} l`,"f");return[t[0],t[7],t[2],t[3]]}})}}else this.data.popupRef=null}get overlaysTextContent(){return!0}static createNewDict(e,t,{apRef:a,ap:r}){const{color:i,date:n,oldAnnotation:s,opacity:o,rect:c,rotation:l,user:h,quadPoints:u}=e,d=s||new Dict(t);d.setIfNotExists("Type",Name.get("Annot"));d.setIfNotExists("Subtype",Name.get("Highlight"));d.set(s?"M":"CreationDate",`D:${getModificationDate(n)}`);d.setIfArray("Rect",c);d.setIfNotExists("F",4);d.setIfNotExists("Border",[0,0,0]);d.setIfNumber("Rotate",l);d.setIfArray("QuadPoints",u);d.setIfArray("C",getPdfColorArray(i));d.setIfNumber("CA",o);d.setIfDefined("T",stringToAsciiOrUTF16BE(h));if(a||r){const e=new Dict(t);d.set("AP",e);e.set("N",a||r)}return d}static async createNewAppearanceStream(e,t,a){const{color:r,rect:i,outlines:n,opacity:s}=e;if(!r)return null;const o=[`${getPdfColor(r,!0)}`,"/R0 gs"],c=[];for(const e of n){c.length=0;c.push(`${numberToString(e[0])} ${numberToString(e[1])} m`);for(let t=2,a=e.length;t{e.push(`${t[4]} ${t[5]+1.3} m`,`${t[6]} ${t[7]+1.3} l`,"S");return[t[0],t[7],t[2],t[3]]}})}}else this.data.popupRef=null}get overlaysTextContent(){return!0}}class SquigglyAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:a}=e;this.data.annotationType=F.SQUIGGLY;if(this.data.quadPoints=getQuadPoints(t,null)){if(!this.appearance){const e=getPdfColorArray(this.color,[0,0,0]),r=t.get("CA");this._setDefaultAppearance({xref:a,extra:"[] 0 d 1 w",strokeColor:e,strokeAlpha:r,pointsCallback:(e,t)=>{const a=(t[1]-t[5])/6;let r=a,i=t[4];const n=t[5],s=t[6];e.push(`${i} ${n+r} m`);do{i+=2;r=0===r?a:0;e.push(`${i} ${n+r} l`)}while(i{e.push((t[0]+t[4])/2+" "+(t[1]+t[5])/2+" m",(t[2]+t[6])/2+" "+(t[3]+t[7])/2+" l","S");return[t[0],t[7],t[2],t[3]]}})}}else this.data.popupRef=null}get overlaysTextContent(){return!0}}class StampAnnotation extends MarkupAnnotation{#ve=null;constructor(e){super(e);this.data.annotationType=F.STAMP;this.data.hasOwnCanvas=this.data.noRotate;this.data.isEditable=!this.data.noHTML;this.data.noHTML=!1}mustBeViewedWhenEditing(e,t=null){if(e){if(!this.data.isEditable)return!0;this.#ve??=this.data.hasOwnCanvas;this.data.hasOwnCanvas=!0;return!0}if(null!==this.#ve){this.data.hasOwnCanvas=this.#ve;this.#ve=null}return!t?.has(this.data.id)}static async createImage(e,t){const{width:a,height:r}=e,i=new OffscreenCanvas(a,r),n=i.getContext("2d",{alpha:!0});n.drawImage(e,0,0);const s=n.getImageData(0,0,a,r).data,o=new Uint32Array(s.buffer),c=o.some(FeatureTest.isLittleEndian?e=>e>>>24!=255:e=>!!(255&~e));if(c){n.fillStyle="white";n.fillRect(0,0,a,r);n.drawImage(e,0,0)}const l=i.convertToBlob({type:"image/jpeg",quality:1}).then(e=>e.arrayBuffer()),h=Name.get("XObject"),u=Name.get("Image"),d=new Dict(t);d.set("Type",h);d.set("Subtype",u);d.set("BitsPerComponent",8);d.setIfName("ColorSpace","DeviceRGB");d.setIfName("Filter","DCTDecode");d.set("BBox",[0,0,a,r]);d.set("Width",a);d.set("Height",r);let f=null;if(c){const e=new Uint8Array(o.length);if(FeatureTest.isLittleEndian)for(let t=0,a=o.length;t>>24;else for(let t=0,a=o.length;t=0&&n<=1?n:null}}const Zo={get r(){return shadow(this,"r",new Uint8Array([7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21]))},get k(){return shadow(this,"k",new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-701558691,38016083,-660478335,-405537848,568446438,-1019803690,-187363961,1163531501,-1444681467,-51403784,1735328473,-1926607734,-378558,-2022574463,1839030562,-35309556,-1530992060,1272893353,-155497632,-1094730640,681279174,-358537222,-722521979,76029189,-640364487,-421815835,530742520,-995338651,-198630844,1126891415,-1416354905,-57434055,1700485571,-1894986606,-1051523,-2054922799,1873313359,-30611744,-1560198380,1309151649,-145523070,-1120210379,718787259,-343485551]))}};function calculateMD5(e,t,a){let r=1732584193,i=-271733879,n=-1732584194,s=271733878;const o=a+72&-64,c=new Uint8Array(o);let l,h;for(l=0;l>5&255;c[l++]=a>>13&255;c[l++]=a>>21&255;c[l++]=a>>>29&255;l+=3;const d=new Int32Array(16),{k:f,r:g}=Zo;for(l=0;l>>32-n)|0;a=r}r=r+a|0;i=i+o|0;n=n+u|0;s=s+p|0}return new Uint8Array([255&r,r>>8&255,r>>16&255,r>>>24&255,255&i,i>>8&255,i>>16&255,i>>>24&255,255&n,n>>8&255,n>>16&255,n>>>24&255,255&s,s>>8&255,s>>16&255,s>>>24&255])}function decodeString(e){try{return stringToUTF8String(e)}catch(t){warn(`UTF-8 decoding failed: "${t}".`);return e}}class DatasetXMLParser extends SimpleXMLParser{constructor(e){super(e);this.node=null}onEndElement(e){const t=super.onEndElement(e);if(t&&"xfa:datasets"===e){this.node=t;throw new Error("Aborting DatasetXMLParser.")}}}class DatasetReader{constructor(e){if(e.datasets)this.node=new SimpleXMLParser({hasAttributes:!0}).parseFromString(e.datasets).documentElement;else{const t=new DatasetXMLParser({hasAttributes:!0});try{t.parseFromString(e["xdp:xdp"])}catch{}this.node=t.node}}getValue(e){if(!this.node||!e)return"";const t=this.node.searchNode(parseXFAPath(e),0);if(!t)return"";const a=t.firstChild;return"value"===a?.nodeName?t.children.map(e=>decodeString(e.textContent)):decodeString(t.textContent)}}class SingleIntersector{#Ie;#Te=1/0;#Oe=1/0;#Me=-1/0;#De=-1/0;#Be=null;#Re=[];#Ne=[];#Ee=-1;#Pe=!1;constructor(e){this.#Ie=e;const t=e.data.quadPoints;if(t){for(let e=0,a=t.length;e8&&(this.#Be=t)}else[this.#Te,this.#Oe,this.#Me,this.#De]=e.data.rect}overlaps(e){return!(this.#Te>=e.#Me||this.#Me<=e.#Te||this.#Oe>=e.#De||this.#De<=e.#Oe)}#Le(e,t){if(this.#Te>=e||this.#Me<=e||this.#Oe>=t||this.#De<=t)return!1;const a=this.#Be;if(!a)return!0;if(this.#Ee>=0){const r=this.#Ee;if(!(a[r]>=e||a[r+2]<=e||a[r+5]>=t||a[r+1]<=t))return!0;this.#Ee=-1}for(let r=0,i=a.length;r=e||a[r+2]<=e||a[r+5]>=t||a[r+1]<=t)){this.#Ee=r;return!0}return!1}addGlyph(e,t,a){if(!this.#Le(e,t)){this.disableExtraChars();return!1}if(this.#Ne.length>0){this.#Re.push(this.#Ne.join(""));this.#Ne.length=0}this.#Re.push(a);this.#Pe=!0;return!0}addExtraChar(e){this.#Pe&&this.#Ne.push(e)}disableExtraChars(){if(this.#Pe){this.#Pe=!1;this.#Ne.length=0}}setText(){this.#Ie.data.overlaidText=this.#Re.join("")}}class Intersector{#_e=new Map;constructor(e){for(const t of e){if(!t.data.quadPoints&&!t.data.rect)continue;const e=new SingleIntersector(t);for(const[t,a]of this.#_e)t.overlaps(e)&&(a?a.add(e):this.#_e.set(t,new Set([e])));this.#_e.set(e,null)}}addGlyph(e,t,a,r){const i=e[4]+t/2,n=e[5]+a/2;let s;for(const[e,t]of this.#_e)s?s.has(e)?e.addGlyph(i,n,r):e.disableExtraChars():e.addGlyph(i,n,r)&&(s=t)}addExtraChar(e){for(const t of this.#_e.keys())t.addExtraChar(e)}setText(){for(const e of this.#_e.keys())e.setText()}}class Word64{constructor(e,t){this.high=0|e;this.low=0|t}and(e){this.high&=e.high;this.low&=e.low}xor(e){this.high^=e.high;this.low^=e.low}shiftRight(e){if(e>=32){this.low=this.high>>>e-32|0;this.high=0}else{this.low=this.low>>>e|this.high<<32-e;this.high=this.high>>>e|0}}rotateRight(e){let t,a;if(32&e){a=this.low;t=this.high}else{t=this.low;a=this.high}e&=31;this.low=t>>>e|a<<32-e;this.high=a>>>e|t<<32-e}not(){this.high=~this.high;this.low=~this.low}add(e){const t=(this.low>>>0)+(e.low>>>0);let a=(this.high>>>0)+(e.high>>>0);t>4294967295&&(a+=1);this.low=0|t;this.high=0|a}copyTo(e,t){e[t]=this.high>>>24&255;e[t+1]=this.high>>16&255;e[t+2]=this.high>>8&255;e[t+3]=255&this.high;e[t+4]=this.low>>>24&255;e[t+5]=this.low>>16&255;e[t+6]=this.low>>8&255;e[t+7]=255&this.low}assign(e){this.high=e.high;this.low=e.low}}const Qo={get k(){return shadow(this,"k",[new Word64(1116352408,3609767458),new Word64(1899447441,602891725),new Word64(3049323471,3964484399),new Word64(3921009573,2173295548),new Word64(961987163,4081628472),new Word64(1508970993,3053834265),new Word64(2453635748,2937671579),new Word64(2870763221,3664609560),new Word64(3624381080,2734883394),new Word64(310598401,1164996542),new Word64(607225278,1323610764),new Word64(1426881987,3590304994),new Word64(1925078388,4068182383),new Word64(2162078206,991336113),new Word64(2614888103,633803317),new Word64(3248222580,3479774868),new Word64(3835390401,2666613458),new Word64(4022224774,944711139),new Word64(264347078,2341262773),new Word64(604807628,2007800933),new Word64(770255983,1495990901),new Word64(1249150122,1856431235),new Word64(1555081692,3175218132),new Word64(1996064986,2198950837),new Word64(2554220882,3999719339),new Word64(2821834349,766784016),new Word64(2952996808,2566594879),new Word64(3210313671,3203337956),new Word64(3336571891,1034457026),new Word64(3584528711,2466948901),new Word64(113926993,3758326383),new Word64(338241895,168717936),new Word64(666307205,1188179964),new Word64(773529912,1546045734),new Word64(1294757372,1522805485),new Word64(1396182291,2643833823),new Word64(1695183700,2343527390),new Word64(1986661051,1014477480),new Word64(2177026350,1206759142),new Word64(2456956037,344077627),new Word64(2730485921,1290863460),new Word64(2820302411,3158454273),new Word64(3259730800,3505952657),new Word64(3345764771,106217008),new Word64(3516065817,3606008344),new Word64(3600352804,1432725776),new Word64(4094571909,1467031594),new Word64(275423344,851169720),new Word64(430227734,3100823752),new Word64(506948616,1363258195),new Word64(659060556,3750685593),new Word64(883997877,3785050280),new Word64(958139571,3318307427),new Word64(1322822218,3812723403),new Word64(1537002063,2003034995),new Word64(1747873779,3602036899),new Word64(1955562222,1575990012),new Word64(2024104815,1125592928),new Word64(2227730452,2716904306),new Word64(2361852424,442776044),new Word64(2428436474,593698344),new Word64(2756734187,3733110249),new Word64(3204031479,2999351573),new Word64(3329325298,3815920427),new Word64(3391569614,3928383900),new Word64(3515267271,566280711),new Word64(3940187606,3454069534),new Word64(4118630271,4000239992),new Word64(116418474,1914138554),new Word64(174292421,2731055270),new Word64(289380356,3203993006),new Word64(460393269,320620315),new Word64(685471733,587496836),new Word64(852142971,1086792851),new Word64(1017036298,365543100),new Word64(1126000580,2618297676),new Word64(1288033470,3409855158),new Word64(1501505948,4234509866),new Word64(1607167915,987167468),new Word64(1816402316,1246189591)])}};function ch(e,t,a,r,i){e.assign(t);e.and(a);i.assign(t);i.not();i.and(r);e.xor(i)}function maj(e,t,a,r,i){e.assign(t);e.and(a);i.assign(t);i.and(r);e.xor(i);i.assign(a);i.and(r);e.xor(i)}function sigma(e,t,a){e.assign(t);e.rotateRight(28);a.assign(t);a.rotateRight(34);e.xor(a);a.assign(t);a.rotateRight(39);e.xor(a)}function sigmaPrime(e,t,a){e.assign(t);e.rotateRight(14);a.assign(t);a.rotateRight(18);e.xor(a);a.assign(t);a.rotateRight(41);e.xor(a)}function littleSigma(e,t,a){e.assign(t);e.rotateRight(1);a.assign(t);a.rotateRight(8);e.xor(a);a.assign(t);a.shiftRight(7);e.xor(a)}function littleSigmaPrime(e,t,a){e.assign(t);e.rotateRight(19);a.assign(t);a.rotateRight(61);e.xor(a);a.assign(t);a.shiftRight(6);e.xor(a)}function calculateSHA512(e,t,a,r=!1){let i,n,s,o,c,l,h,u;if(r){i=new Word64(3418070365,3238371032);n=new Word64(1654270250,914150663);s=new Word64(2438529370,812702999);o=new Word64(355462360,4144912697);c=new Word64(1731405415,4290775857);l=new Word64(2394180231,1750603025);h=new Word64(3675008525,1694076839);u=new Word64(1203062813,3204075428)}else{i=new Word64(1779033703,4089235720);n=new Word64(3144134277,2227873595);s=new Word64(1013904242,4271175723);o=new Word64(2773480762,1595750129);c=new Word64(1359893119,2917565137);l=new Word64(2600822924,725511199);h=new Word64(528734635,4215389547);u=new Word64(1541459225,327033209)}const d=128*Math.ceil((a+17)/128),f=new Uint8Array(d);let g,p;for(g=0;g>>29&255;f[g++]=a>>21&255;f[g++]=a>>13&255;f[g++]=a>>5&255;f[g++]=a<<3&255;const b=new Array(80);for(g=0;g<80;g++)b[g]=new Word64(0,0);const{k:y}=Qo;let w=new Word64(0,0),x=new Word64(0,0),S=new Word64(0,0),k=new Word64(0,0),C=new Word64(0,0),v=new Word64(0,0),F=new Word64(0,0),T=new Word64(0,0);const O=new Word64(0,0),M=new Word64(0,0),D=new Word64(0,0),R=new Word64(0,0);let N,E;for(g=0;g>>t|e<<32-t}function calculate_sha256_ch(e,t,a){return e&t^~e&a}function calculate_sha256_maj(e,t,a){return e&t^e&a^t&a}function calculate_sha256_sigma(e){return rotr(e,2)^rotr(e,13)^rotr(e,22)}function calculate_sha256_sigmaPrime(e){return rotr(e,6)^rotr(e,11)^rotr(e,25)}function calculate_sha256_littleSigma(e){return rotr(e,7)^rotr(e,18)^e>>>3}function calculate_sha256_littleSigmaPrime(e){return rotr(e,17)^rotr(e,19)^e>>>10}function calculateSHA256(e,t,a){let r=1779033703,i=3144134277,n=1013904242,s=2773480762,o=1359893119,c=2600822924,l=528734635,h=1541459225;const u=64*Math.ceil((a+9)/64),d=new Uint8Array(u);let f,g;for(f=0;f>>29&255;d[f++]=a>>21&255;d[f++]=a>>13&255;d[f++]=a>>5&255;d[f++]=a<<3&255;const m=new Uint32Array(64),{k:b}=ec;for(f=0;f>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,o>>24&255,o>>16&255,o>>8&255,255&o,c>>24&255,c>>16&255,c>>8&255,255&c,l>>24&255,l>>16&255,l>>8&255,255&l,h>>24&255,h>>16&255,h>>8&255,255&h])}class DecryptStream extends DecodeStream{constructor(e,t,a){super(t);this.str=e;this.dict=e.dict;this.decrypt=a;this.nextChunk=null;this.initialized=!1}readBlock(){let e;if(this.initialized)e=this.nextChunk;else{e=this.str.getBytes(512);this.initialized=!0}if(!e?.length){this.eof=!0;return}this.nextChunk=this.str.getBytes(512);const t=this.nextChunk?.length>0;e=(0,this.decrypt)(e,!t);const a=this.bufferLength,r=a+e.length;this.ensureBuffer(r).set(e,a);this.bufferLength=r}}class ARCFourCipher{constructor(e){this.a=0;this.b=0;const t=new Uint8Array(256),a=e.length;for(let e=0;e<256;++e)t[e]=e;for(let r=0,i=0;r<256;++r){const n=t[r];i=i+n+e[r%a]&255;t[r]=t[i];t[i]=n}this.s=t}encryptBlock(e){let t=this.a,a=this.b;const r=this.s,i=e.length,n=new Uint8Array(i);for(let s=0;st<128?t<<1:t<<1^27);constructor(){this.buffer=new Uint8Array(16);this.bufferPosition=0}_expandKey(e){unreachable("Cannot call `_expandKey` on the base class")}_decrypt(e,t){let a,r,i;const n=new Uint8Array(16);n.set(e);for(let e=0,a=this._keySize;e<16;++e,++a)n[e]^=t[a];for(let e=this._cyclesOfRepetition-1;e>=1;--e){a=n[13];n[13]=n[9];n[9]=n[5];n[5]=n[1];n[1]=a;a=n[14];r=n[10];n[14]=n[6];n[10]=n[2];n[6]=a;n[2]=r;a=n[15];r=n[11];i=n[7];n[15]=n[3];n[11]=a;n[7]=r;n[3]=i;for(let e=0;e<16;++e)n[e]=this._inv_s[n[e]];for(let a=0,r=16*e;a<16;++a,++r)n[a]^=t[r];for(let e=0;e<16;e+=4){const t=this._mix[n[e]],r=this._mix[n[e+1]],i=this._mix[n[e+2]],s=this._mix[n[e+3]];a=t^r>>>8^r<<24^i>>>16^i<<16^s>>>24^s<<8;n[e]=a>>>24&255;n[e+1]=a>>16&255;n[e+2]=a>>8&255;n[e+3]=255&a}}a=n[13];n[13]=n[9];n[9]=n[5];n[5]=n[1];n[1]=a;a=n[14];r=n[10];n[14]=n[6];n[10]=n[2];n[6]=a;n[2]=r;a=n[15];r=n[11];i=n[7];n[15]=n[3];n[11]=a;n[7]=r;n[3]=i;for(let e=0;e<16;++e){n[e]=this._inv_s[n[e]];n[e]^=t[e]}return n}_encrypt(e,t){const a=this._s;let r,i,n;const s=new Uint8Array(16);s.set(e);for(let e=0;e<16;++e)s[e]^=t[e];for(let e=1;e=r;--a)if(e[a]!==t){t=0;break}o-=t;n[n.length-1]=e.subarray(0,16-t)}}const c=new Uint8Array(o);for(let e=0,t=0,a=n.length;e=256&&(o=255&(27^o))}for(let t=0;t<4;++t){a[e]=r^=a[e-32];e++;a[e]=i^=a[e-32];e++;a[e]=n^=a[e-32];e++;a[e]=s^=a[e-32];e++}}return a}}class PDFBase{_hash(e,t,a){unreachable("Abstract method `_hash` called")}checkOwnerPassword(e,t,a,r){const i=new Uint8Array(e.length+56);i.set(e,0);i.set(t,e.length);i.set(a,e.length+t.length);return isArrayEqual(this._hash(e,i,a),r)}checkUserPassword(e,t,a){const r=new Uint8Array(e.length+8);r.set(e,0);r.set(t,e.length);return isArrayEqual(this._hash(e,r,[]),a)}getOwnerKey(e,t,a,r){const i=new Uint8Array(e.length+56);i.set(e,0);i.set(t,e.length);i.set(a,e.length+t.length);const n=this._hash(e,i,a);return new AES256Cipher(n).decryptBlock(r,!1,new Uint8Array(16))}getUserKey(e,t,a){const r=new Uint8Array(e.length+8);r.set(e,0);r.set(t,e.length);const i=this._hash(e,r,[]);return new AES256Cipher(i).decryptBlock(a,!1,new Uint8Array(16))}}class PDF17 extends PDFBase{_hash(e,t,a){return calculateSHA256(t,0,t.length)}}class PDF20 extends PDFBase{_hash(e,t,a){let r=calculateSHA256(t,0,t.length).subarray(0,32),i=[0],n=0;for(;n<64||i.at(-1)>n-32;){const t=e.length+r.length+a.length,s=new Uint8Array(t);let o=0;s.set(e,o);o+=e.length;s.set(r,o);o+=r.length;s.set(a,o);const c=new Uint8Array(64*t);for(let e=0,a=0;e<64;e++,a+=t)c.set(s,a);i=new AES128Cipher(r.subarray(0,16)).encrypt(c,r.subarray(16,32));const l=Math.sumPrecise(i.slice(0,16))%3;0===l?r=calculateSHA256(i,0,i.length):1===l?r=calculateSHA384(i,0,i.length):2===l&&(r=calculateSHA512(i,0,i.length));n++}return r.subarray(0,32)}}class CipherTransform{constructor(e,t){this.StringCipherConstructor=e;this.StreamCipherConstructor=t}createStream(e,t){const a=new this.StreamCipherConstructor;return new DecryptStream(e,t,function cipherTransformDecryptStream(e,t){return a.decryptBlock(e,t)})}decryptString(e){const t=new this.StringCipherConstructor;let a=stringToBytes(e);a=t.decryptBlock(a,!0);return bytesToString(a)}encryptString(e){const t=new this.StringCipherConstructor;if(t instanceof AESBaseCipher){const a=16-e.length%16;e+=String.fromCharCode(a).repeat(a);const r=new Uint8Array(16);crypto.getRandomValues(r);let i=stringToBytes(e);i=t.encrypt(i,r);const n=new Uint8Array(16+i.length);n.set(r);n.set(i,16);return bytesToString(n)}let a=stringToBytes(e);a=t.encrypt(a);return bytesToString(a)}}class CipherTransformFactory{static get _defaultPasswordBytes(){return shadow(this,"_defaultPasswordBytes",new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]))}#je(e,t,a,r,i,n,s,o,c,l,h,u){if(t){const e=Math.min(127,t.length);t=t.subarray(0,e)}else t=[];const d=6===e?new PDF20:new PDF17;return d.checkUserPassword(t,o,s)?d.getUserKey(t,c,h):t.length&&d.checkOwnerPassword(t,r,n,a)?d.getOwnerKey(t,i,n,l):null}#Ue(e,t,a,r,i,n,s,o){const c=40+a.length+e.length,l=new Uint8Array(c);let h,u,d=0;if(t){u=Math.min(32,t.length);for(;d>8&255;l[d++]=i>>16&255;l[d++]=i>>>24&255;l.set(e,d);d+=e.length;if(n>=4&&!o){l.fill(255,d,d+4);d+=4}let f=calculateMD5(l,0,d);const g=s>>3;if(n>=3)for(h=0;h<50;++h)f=calculateMD5(f,0,g);const p=f.subarray(0,g);let m,b;if(n>=3){d=0;l.set(CipherTransformFactory._defaultPasswordBytes,d);d+=32;l.set(e,d);d+=e.length;m=new ARCFourCipher(p);b=m.encryptBlock(calculateMD5(l,0,d));u=p.length;const t=new Uint8Array(u);for(h=1;h<=19;++h){for(let e=0;er[t]===e)?p:null}#Xe(e,t,a,r){const i=new Uint8Array(32);let n=0;const s=Math.min(32,e.length);for(;n>3;if(a>=3)for(o=0;o<50;++o)c=calculateMD5(c,0,c.length);let h,u;if(a>=3){u=t;const e=new Uint8Array(l);for(o=19;o>=0;o--){for(let t=0;t>8&255;n[s++]=e>>16&255;n[s++]=255&t;n[s++]=t>>8&255;if(r){n[s++]=115;n[s++]=65;n[s++]=108;n[s++]=84}return calculateMD5(n,0,s).subarray(0,Math.min(i+5,16))}#He(e,t,a,r,i){if(!(t instanceof Name))throw new FormatError("Invalid crypt filter name.");const n=this,s=e.get(t.name),o=s?.get("CFM");if(!o||"None"===o.name)return function(){return new NullCipher};if("V2"===o.name)return function(){return new ARCFourCipher(n.#qe(a,r,i,!1))};if("AESV2"===o.name)return function(){return new AES128Cipher(n.#qe(a,r,i,!0))};if("AESV3"===o.name)return function(){return new AES256Cipher(i)};throw new FormatError("Unknown crypto method")}constructor(e,t,a){const r=e.get("Filter");if(!isName(r,"Standard"))throw new FormatError("unknown encryption method");this.filterName=r.name;this.dict=e;const i=e.get("V");if(!Number.isInteger(i)||1!==i&&2!==i&&4!==i&&5!==i)throw new FormatError("unsupported encryption algorithm");this.algorithm=i;let n=e.get("Length");if(!n)if(i<=3)n=40;else{const t=e.get("CF"),a=e.get("StmF");if(t instanceof Dict&&a instanceof Name){t.suppressEncryption=!0;const e=t.get(a.name);n=e?.get("Length")||128;n<40&&(n<<=3)}}if(!Number.isInteger(n)||n<40||n%8!=0)throw new FormatError("invalid key length");const s=stringToBytes(e.get("O")),o=stringToBytes(e.get("U")),c=s.subarray(0,32),l=o.subarray(0,32),h=e.get("P"),u=e.get("R"),d=(4===i||5===i)&&!1!==e.get("EncryptMetadata");this.encryptMetadata=d;const f=stringToBytes(t);let g,p;if(a){if(6===u)try{a=utf8StringToString(a)}catch{warn("CipherTransformFactory: Unable to convert UTF8 encoded password.")}g=stringToBytes(a)}if(5!==i)p=this.#Ue(f,g,c,l,h,u,n,d);else{const t=s.subarray(32,40),a=s.subarray(40,48),r=o.subarray(0,48),i=o.subarray(32,40),n=o.subarray(40,48),h=stringToBytes(e.get("OE")),d=stringToBytes(e.get("UE")),f=stringToBytes(e.get("Perms"));p=this.#je(u,g,c,t,a,r,l,i,n,h,d,f)}if(!p){if(!a)throw new PasswordException("No password given",Gt);const e=this.#Xe(g,c,u,n);p=this.#Ue(f,e,c,l,h,u,n,d)}if(!p)throw new PasswordException("Incorrect Password",Vt);if(4===i&&p.length<16){this.encryptionKey=new Uint8Array(16);this.encryptionKey.set(p)}else this.encryptionKey=p;if(i>=4){const t=e.get("CF");t instanceof Dict&&(t.suppressEncryption=!0);this.cf=t;this.stmf=e.get("StmF")||Name.get("Identity");this.strf=e.get("StrF")||Name.get("Identity");this.eff=e.get("EFF")||this.stmf}}createCipherTransform(e,t){if(4===this.algorithm||5===this.algorithm)return new CipherTransform(this.#He(this.cf,this.strf,e,t,this.encryptionKey),this.#He(this.cf,this.stmf,e,t,this.encryptionKey));const a=this.#qe(e,t,this.encryptionKey,!1),cipherConstructor=function(){return new ARCFourCipher(a)};return new CipherTransform(cipherConstructor,cipherConstructor)}}class XRef{constructor(e,t){this.stream=e;this.pdfManager=t;this.entries=[];this._xrefStms=new Set;this._cacheMap=new Map;this._pendingRefs=new RefSet;this._newPersistentRefNum=null;this._newTemporaryRefNum=null;this._persistentRefsCache=null}getNewPersistentRef(e){null===this._newPersistentRefNum&&(this._newPersistentRefNum=this.entries.length||1);const t=this._newPersistentRefNum++;this._cacheMap.set(t,e);return Ref.get(t,0)}getNewTemporaryRef(){if(null===this._newTemporaryRefNum){this._newTemporaryRefNum=this.entries.length||1;if(this._newPersistentRefNum){this._persistentRefsCache=new Map;for(let e=this._newTemporaryRefNum;e0;){const[s,o]=n;if(!Number.isInteger(s)||!Number.isInteger(o))throw new FormatError(`Invalid XRef range fields: ${s}, ${o}`);if(!Number.isInteger(a)||!Number.isInteger(r)||!Number.isInteger(i))throw new FormatError(`Invalid XRef entry fields length: ${s}, ${o}`);for(let n=t.entryNum;n=e.length);){a+=String.fromCharCode(r);r=e[t]}return a}function skipUntil(e,t,a){const r=a.length,i=e.length;let n=0;for(;t=r)break;t++;n++}return n}const e=/\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g,t=/\b(startxref|\d+\s+\d+\s+obj)\b/g,a=/^(\d+)\s+(\d+)\s+obj\b/,r=new Uint8Array([116,114,97,105,108,101,114]),i=new Uint8Array([115,116,97,114,116,120,114,101,102]),n=new Uint8Array([47,88,82,101,102]);this.entries.length=0;this._cacheMap.clear();const s=this.stream;s.pos=0;const o=s.getBytes(),c=bytesToString(o),l=o.length;let h=s.start;const u=[],d=[];for(;h=l)break;f=o[h]}while(10!==f&&13!==f);continue}const g=readToken(o,h);let p;if(g.startsWith("xref")&&(4===g.length||/\s/.test(g[4]))){h+=skipUntil(o,h,r);u.push(h);h+=skipUntil(o,h,i)}else if(p=a.exec(g)){const t=0|p[1],a=0|p[2],r=h+g.length;let i,u=!1;if(this.entries[t]){if(this.entries[t].gen===a)try{new Parser({lexer:new Lexer(s.makeSubStream(r))}).getObj();u=!0}catch(e){e instanceof ParserEOFException?warn(`indexObjects -- checking object (${g}): "${e}".`):u=!0}}else u=!0;u&&(this.entries[t]={offset:h-s.start,gen:a,uncompressed:!0});e.lastIndex=r;const f=e.exec(c);if(f){i=e.lastIndex+1-h;if("endobj"!==f[1]){warn(`indexObjects: Found "${f[1]}" inside of another "obj", caused by missing "endobj" -- trying to recover.`);i-=f[1].length+1}}else i=l-h;const m=o.subarray(h,h+i),b=skipUntil(m,0,n);if(b0&&t[3]-t[1]>0)return t;warn(`Empty, or invalid, /${e} entry.`)}return null}get mediaBox(){return shadow(this,"mediaBox",this.#Ve("MediaBox")||tc)}get cropBox(){return shadow(this,"cropBox",this.#Ve("CropBox")||this.mediaBox)}get userUnit(){const e=this.pageDict.get("UserUnit");return shadow(this,"userUnit","number"==typeof e&&e>0?e:1)}get view(){const{cropBox:e,mediaBox:t}=this;if(e!==t&&!isArrayEqual(e,t)){const a=Util.intersect(e,t);if(a&&a[2]-a[0]>0&&a[3]-a[1]>0)return shadow(this,"view",a);warn("Empty /CropBox and /MediaBox intersection.")}return shadow(this,"view",t)}get rotate(){let e=this.#Ge("Rotate")||0;e%90!=0?e=0:e>=360?e%=360:e<0&&(e=(e%360+360)%360);return shadow(this,"rotate",e)}#Ke(e,t){if(!this.evaluatorOptions.ignoreErrors)throw e;warn(`getContentStream - ignoring sub-stream (${t}): "${e}".`)}async getContentStream(){const e=await this.pdfManager.ensure(this,"content");return e instanceof BaseStream?e:Array.isArray(e)?new StreamsSequenceStream(e,this.#Ke.bind(this)):new NullStream}get xfaData(){return shadow(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}async#Je(e,t,a){const r=[];for(const i of e)if(i.id){const e=Ref.fromString(i.id);if(!e){warn(`A non-linked annotation cannot be modified: ${i.id}`);continue}if(i.deleted){t.put(e,e);if(i.popupRef){const e=Ref.fromString(i.popupRef);e&&t.put(e,e)}continue}if(i.popup?.deleted){const e=Ref.fromString(i.popupRef);e&&t.put(e,e)}a?.put(e);i.ref=e;r.push(this.xref.fetchAsync(e).then(e=>{e instanceof Dict&&(i.oldAnnotation=e.clone())},()=>{warn(`Cannot fetch \`oldAnnotation\` for: ${e}.`)}));delete i.id}await Promise.all(r)}async saveNewAnnotations(e,t,a,r,i){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");const n=this.#$e(e),s=new RefSetCache,o=new RefSet;await this.#Je(a,s,o);const c=this.pageDict,l=this.annotations.filter(e=>!(e instanceof Ref&&s.has(e))),h=await AnnotationFactory.saveNewAnnotations(n,t,a,r,i);for(const{ref:e}of h.annotations)e instanceof Ref&&!o.has(e)&&l.push(e);const u=c.clone();u.set("Annots",l);i.put(this.ref,{data:u});for(const e of s)i.put(e,{data:null})}async save(e,t,a,r){const i=this.#$e(e),n=await this._parsedAnnotations,s=[];for(const e of n)s.push(e.save(i,t,a,r).catch(function(e){warn(`save - ignoring annotation data during "${t.name}" task: "${e}".`);return null}));return Promise.all(s)}async loadResources(e){await(this.#ze??=this.pdfManager.ensure(this,"resources"));await ObjectLoader.load(this.resources,e,this.xref)}async#Ye(e,t){const a=e?.get("Resources");if(!(a instanceof Dict&&a.size))return this.resources;await ObjectLoader.load(a,t,this.xref);return Dict.merge({xref:this.xref,dictArray:[a,this.resources],mergeSubDicts:!0})}async getOperatorList({handler:e,sink:t,task:a,intent:r,cacheKey:i,annotationStorage:c=null,modifiedIds:d=null}){const g=this.getContentStream(),p=this.loadResources(ha),m=this.#$e(e),b=this.xfaFactory?null:getNewAnnotationsMap(c),y=b?.get(this.pageIndex);let w=Promise.resolve(null),x=null;if(y){const e=this.pdfManager.ensureDoc("annotationGlobals");let t;const r=new Set;for(const{bitmapId:e,bitmap:t}of y)!e||t||r.has(e)||r.add(e);const{isOffscreenCanvasSupported:i}=this.evaluatorOptions;if(r.size>0){const e=y.slice();for(const[t,a]of c)t.startsWith(f)&&a.bitmap&&r.has(a.bitmapId)&&e.push(a);t=AnnotationFactory.generateImages(e,this.xref,i)}else t=AnnotationFactory.generateImages(y,this.xref,i);x=new RefSet;w=Promise.all([e,this.#Je(y,x,null)]).then(([e])=>e?AnnotationFactory.printNewAnnotations(e,m,a,y,t):null)}const S=Promise.all([g,p]).then(async([n])=>{const s=await this.#Ye(n.dict,ha),o=new OperatorList(r,t);e.send("StartRenderPage",{transparency:m.hasBlendModes(s,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:i});await m.getOperatorList({stream:n,task:a,resources:s,operatorList:o});return o});let[k,C,v]=await Promise.all([S,this._parsedAnnotations,w]);if(v){C=C.filter(e=>!(e.ref&&x.has(e.ref)));for(let e=0,t=v.length;ee.ref&&isRefsEqual(e.ref,a.refToReplace));if(r>=0){C.splice(r,1,a);v.splice(e--,1);t--}}}C=C.concat(v)}if(0===C.length||r&h){k.flush(!0);return{length:k.totalLength}}const F=!!(r&l),T=!!(r&u),O=!!(r&n),M=!!(r&s),D=!!(r&o),R=[];for(const e of C)(O||M&&e.mustBeViewed(c,F)&&e.mustBeViewedWhenEditing(T,d)||D&&e.mustBePrinted(c))&&R.push(e.getOperatorList(m,a,r,c).catch(function(e){warn(`getOperatorList - ignoring annotation data during "${a.name}" task: "${e}".`);return{opList:null,separateForm:!1,separateCanvas:!1}}));const N=await Promise.all(R);let E=!1,L=!1;for(const{opList:e,separateForm:t,separateCanvas:a}of N){k.addOpList(e);E||=t;L||=a}k.flush(!0,{form:E,canvas:L});return{length:k.totalLength}}async extractTextContent({handler:e,task:t,includeMarkedContent:a,disableNormalization:r,sink:i,intersector:n=null}){const s=this.getContentStream(),o=this.loadResources(ua),c=this.pdfManager.ensureCatalog("lang"),[l,,h]=await Promise.all([s,o,c]),u=await this.#Ye(l.dict,ua);return this.#$e(e).getTextContent({stream:l,task:t,resources:u,includeMarkedContent:a,disableNormalization:r,sink:i,viewBox:this.view,lang:h,intersector:n})}async getStructTree(){const e=await this.pdfManager.ensureCatalog("structTreeRoot");if(!e)return null;await this._parsedAnnotations;try{const t=await this.pdfManager.ensure(this,"_parseStructTree",[e]);return await this.pdfManager.ensure(t,"serializable")}catch(e){warn(`getStructTree: "${e}".`);return null}}_parseStructTree(e){const t=new StructTreePage(e,this.pageDict);t.parse(this.ref);return t}async getAnnotationsData(e,t,a){const r=await this._parsedAnnotations;if(0===r.length)return r;const i=[],c=[];let l;const h=!!(a&n),u=!!(a&s),d=!!(a&o),f=[];for(const a of r){const r=h||u&&a.viewable;(r||d&&a.printable)&&i.push(a.data);if(a.hasTextContent&&r){l??=this.#$e(e);c.push(a.extractTextContent(l,t,[-1/0,-1/0,1/0,1/0]).catch(function(e){warn(`getAnnotationsData - ignoring textContent during "${t.name}" task: "${e}".`)}))}else a.overlaysTextContent&&r&&f.push(a)}if(f.length>0){const a=new Intersector(f);c.push(this.extractTextContent({handler:e,task:t,includeMarkedContent:!1,disableNormalization:!1,sink:null,viewBox:this.view,lang:null,intersector:a}).then(()=>{a.setText()}))}await Promise.all(c);return i}get annotations(){const e=this.#Ge("Annots");return shadow(this,"annotations",Array.isArray(e)?e:[])}get _parsedAnnotations(){const e=this.pdfManager.ensure(this,"annotations").then(async e=>{if(0===e.length)return e;const[t,a]=await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureDoc("fieldObjects")]);if(!t)return[];const r=a?.orphanFields,i=[];for(const a of e)i.push(AnnotationFactory.create(this.xref,a,t,this._localIdFactory,!1,r,null,this.ref).catch(function(e){warn(`_parsedAnnotations: "${e}".`);return null}));const n=[];let s,o;for(const e of await Promise.all(i))e&&(e instanceof WidgetAnnotation?(o||=[]).push(e):e instanceof PopupAnnotation?(s||=[]).push(e):n.push(e));o&&n.push(...o);s&&n.push(...s);return n});this.#We=!0;return shadow(this,"_parsedAnnotations",e)}get jsActions(){return shadow(this,"jsActions",collectActions(this.xref,this.pageDict,re))}async collectAnnotationsByType(e,t,a,r,i){const{pageIndex:n}=this;if(this.#We){const e=await this._parsedAnnotations;for(const{data:t}of e)if(!a||a.has(t.annotationType)){t.pageIndex=n;r.push(Promise.resolve(t))}return}const s=await this.pdfManager.ensure(this,"annotations");for(const o of s)r.push(AnnotationFactory.create(this.xref,o,i,this._localIdFactory,!1,null,a,this.ref).then(async a=>{if(!a)return null;a.data.pageIndex=n;if(a.hasTextContent&&a.viewable){const r=this.#$e(e);await a.extractTextContent(r,t,[-1/0,-1/0,1/0,1/0])}return a.data}).catch(function(e){warn(`collectAnnotationsByType: "${e}".`);return null}))}}const ac=new Uint8Array([37,80,68,70,45]),rc=new Uint8Array([115,116,97,114,116,120,114,101,102]),ic=new Uint8Array([101,110,100,111,98,106]);function find(e,t,a=1024,r=!1){const i=t.length,n=e.peekBytes(a),s=n.length-i;if(s<=0)return!1;if(r){const a=i-1;let r=n.length-1;for(;r>=a;){let s=0;for(;s=i){e.pos+=r-a;return!0}r--}}else{let a=0;for(;a<=s;){let r=0;for(;r=i){e.pos+=a;return!0}a++}}return!1}class PDFDocument{#Ze=new Map;#Qe=null;constructor(e,t){if(t.length<=0)throw new InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=e;this.stream=t;this.xref=new XRef(t,e);const a={font:0};this._globalIdFactory=class{static getDocId(){return`g_${e.docId}`}static createFontId(){return"f"+ ++a.font}static createObjId(){unreachable("Abstract method `createObjId` called.")}static getPageObjId(){unreachable("Abstract method `getPageObjId` called.")}}}parse(e){this.xref.parse(e);this.catalog=new Catalog(this.pdfManager,this.xref)}get linearization(){let e=null;try{e=Linearization.create(this.stream)}catch(e){if(e instanceof MissingDataException)throw e;info(e)}return shadow(this,"linearization",e)}get startXRef(){const e=this.stream;let t=0;if(this.linearization){e.reset();if(find(e,ic)){e.skip(6);let a=e.peekByte();for(;isWhiteSpace(a);){e.pos++;a=e.peekByte()}t=e.pos-e.start}}else{const a=1024,r=rc.length;let i=!1,n=e.end;for(;!i&&n>0;){n-=a-r;n<0&&(n=0);e.pos=n;i=find(e,rc,a,!0)}if(i){e.skip(9);let a;do{a=e.getByte()}while(isWhiteSpace(a));let r="";for(;a>=32&&a<=57;){r+=String.fromCharCode(a);a=e.getByte()}t=parseInt(r,10);isNaN(t)&&(t=0)}}return shadow(this,"startXRef",t)}checkHeader(){const e=this.stream;e.reset();if(!find(e,ac))return;e.moveStart();e.skip(ac.length);let t,a="";for(;(t=e.getByte())>32&&a.length<7;)a+=String.fromCharCode(t);oa.test(a)?this.#Qe=a:warn(`Invalid PDF header version: ${a}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let e=0;e=this.catalog.hasActualNumPages?this.catalog.numPages:this.xfaFactory?this.xfaFactory.getNumPages():this.linearization?this.linearization.numPages:this.catalog.numPages;return shadow(this,"numPages",e)}#et(e,t=0){return!!Array.isArray(e)&&e.every(e=>{if(!((e=this.xref.fetchIfRef(e))instanceof Dict))return!1;if(e.has("Kids")){if(++t>10){warn("#hasOnlyDocumentSignatures: maximum recursion depth reached");return!1}return this.#et(e.get("Kids"),t)}const a=isName(e.get("FT"),"Sig"),r=e.get("Rect"),i=Array.isArray(r)&&r.every(e=>0===e);return a&&i})}#tt(e,t,a=new RefSet){if(Array.isArray(e))for(let r of e){if(r instanceof Ref){if(a.has(r))continue;a.put(r)}r=this.xref.fetchIfRef(r);if(!(r instanceof Dict))continue;if(r.has("Kids")){this.#tt(r.get("Kids"),t,a);continue}if(!isName(r.get("FT"),"Sig"))continue;const e=r.get("V");if(!(e instanceof Dict))continue;const i=e.get("SubFilter");i instanceof Name&&t.add(i.name)}}get _xfaStreams(){const{acroForm:e}=this.catalog;if(!e)return null;const t=e.get("XFA"),a=new Map(["xdp:xdp","template","datasets","config","connectionSet","localeSet","stylesheet","/xdp:xdp"].map(e=>[e,null]));if(t instanceof BaseStream&&!t.isEmpty){a.set("xdp:xdp",t);return a}if(!Array.isArray(t)||0===t.length)return null;for(let e=0,r=t.length;el.handleSetFont(r,[Name.get(e),1],null,h,t,d,a,i).catch(e=>{warn(`loadXfaFonts: "${e}".`);return null}),f=[];for(const[e,t]of i){const a=t.get("FontDescriptor");if(!(a instanceof Dict))continue;let r=a.get("FontFamily");r=r.replaceAll(/[ ]+(\d)/g,"$1");const i={fontFamily:r,fontWeight:a.get("FontWeight"),italicAngle:-a.get("ItalicAngle")};validateCSSFont(i)&&f.push(parseFont(e,null,i))}await Promise.all(f);const g=this.xfaFactory.setFonts(u);if(!g)return;n.ignoreErrors=!0;f.length=0;u.length=0;const p=new Set;for(const e of g)getXfaFontName(`${e}-Regular`)||p.add(e);p.size&&g.push("PdfJS-Fallback");for(const e of g)if(!p.has(e))for(const t of[{name:"Regular",fontWeight:400,italicAngle:0},{name:"Bold",fontWeight:700,italicAngle:0},{name:"Italic",fontWeight:400,italicAngle:12},{name:"BoldItalic",fontWeight:700,italicAngle:12}]){const a=`${e}-${t.name}`;f.push(parseFont(a,getXfaFontDict(a),{fontFamily:e,fontWeight:t.fontWeight,italicAngle:t.italicAngle}))}await Promise.all(f);this.xfaFactory.appendFonts(u,p)}loadXfaResources(e,t){return Promise.all([this.#rt(e,t).catch(()=>{}),this.#at()])}serializeXfaData(e){return this.xfaFactory?this.xfaFactory.serializeData(e):null}get version(){return this.catalog.version||this.#Qe}get formInfo(){const e={hasFields:!1,hasAcroForm:!1,hasXfa:!1,hasSignatures:!1},{acroForm:t}=this.catalog;if(!t)return shadow(this,"formInfo",e);try{const a=t.get("Fields"),r=Array.isArray(a)&&a.length>0;e.hasFields=r;const i=t.get("XFA");e.hasXfa=Array.isArray(i)&&i.length>0||i instanceof BaseStream&&!i.isEmpty;const n=!!(1&t.get("SigFlags")),s=n&&this.#et(a);e.hasAcroForm=r&&!s;e.hasSignatures=n}catch(e){if(e instanceof MissingDataException)throw e;warn(`Cannot fetch form information: "${e}".`)}return shadow(this,"formInfo",e)}get documentInfo(){const{catalog:e,formInfo:t,xref:a}=this,r={PDFFormatVersion:this.version,Language:e.lang,EncryptFilterName:a.encrypt?.filterName??null,IsLinearized:!!this.linearization,IsAcroFormPresent:t.hasAcroForm,IsXFAPresent:t.hasXfa,IsCollectionPresent:!!e.collection,IsSignaturesPresent:t.hasSignatures};let i;try{i=a.trailer.get("Info")}catch(e){if(e instanceof MissingDataException)throw e;info("The document information dictionary is invalid.")}if(!(i instanceof Dict))return shadow(this,"documentInfo",r);for(const[e,t]of i){switch(e){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if("string"==typeof t){r[e]=stringToPDFString(t);continue}break;case"Trapped":if(t instanceof Name){r[e]=t;continue}break;default:let a;switch(typeof t){case"string":a=stringToPDFString(t);break;case"number":case"boolean":a=t;break;default:t instanceof Name&&(a=t)}if(void 0===a){warn(`Bad value, for custom key "${e}", in Info: ${t}.`);continue}r.Custom??=Object.create(null);r.Custom[e]=a;continue}warn(`Bad value, for key "${e}", in Info: ${t}.`)}return shadow(this,"documentInfo",r)}get fingerprints(){const e="\0".repeat(16);function validate(t){return"string"==typeof t&&16===t.length&&t!==e}const t=this.xref.trailer.get("ID");let a,r;if(Array.isArray(t)&&validate(t[0])){a=stringToBytes(t[0]);t[1]!==t[0]&&validate(t[1])&&(r=stringToBytes(t[1]))}else a=calculateMD5(this.stream.getByteRange(0,1024),0,1024);return shadow(this,"fingerprints",[toHexUtil(a),r?toHexUtil(r):null])}async#it(e){const{catalog:t,linearization:a,xref:r}=this,i=Ref.get(a.objectNumberFirst,0);try{const e=await r.fetchAsync(i);if(e instanceof Dict){let a=e.getRaw("Type");a instanceof Ref&&(a=await r.fetchAsync(a));if(isName(a,"Page")||!e.has("Type")&&!e.has("Kids")&&e.has("Contents")){t.pageKidsCountCache.has(i)||t.pageKidsCountCache.put(i,1);t.pageIndexCache.has(i)||t.pageIndexCache.put(i,0);return[e,i]}}throw new FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.")}catch(a){warn(`_getLinearizationPage: "${a.message}".`);return t.getPageDict(e)}}getPage(e){const t=this.#Ze.get(e);if(t)return t;const{catalog:a,linearization:r,xfaFactory:i}=this;let n;n=i?Promise.resolve([Dict.empty,null]):r?.pageFirst===e?this.#it(e):a.getPageDict(e);n=n.then(([t,r])=>new Page({pdfManager:this.pdfManager,xref:this.xref,pageIndex:e,pageDict:t,ref:r,globalIdFactory:this._globalIdFactory,fontCache:a.fontCache,builtInCMapCache:a.builtInCMapCache,standardFontDataCache:a.standardFontDataCache,globalColorSpaceCache:a.globalColorSpaceCache,globalImageCache:a.globalImageCache,systemFontCache:a.systemFontCache,nonBlendModesSet:a.nonBlendModesSet,xfaFactory:i}));this.#Ze.set(e,n);return n}async checkFirstPage(e=!1){if(!e)try{await this.getPage(0)}catch(e){if(e instanceof XRefEntryException){this.#Ze.delete(0);await this.cleanup();throw new XRefParseException}}}async checkLastPage(e=!1){const{catalog:t,pdfManager:a}=this;t.setActualNumPages();let r;try{await Promise.all([a.ensureDoc("xfaFactory"),a.ensureDoc("linearization"),a.ensureCatalog("numPages")]);if(this.xfaFactory)return;r=this.linearization?this.linearization.numPages:t.numPages;if(!Number.isInteger(r))throw new FormatError("Page count is not an integer.");if(r<=1)return;await this.getPage(r-1)}catch(i){this.#Ze.delete(r-1);await this.cleanup();if(i instanceof XRefEntryException&&!e)throw new XRefParseException;warn(`checkLastPage - invalid /Pages tree /Count: ${r}.`);let n;try{n=await t.getAllPageDicts(e)}catch(a){if(a instanceof XRefEntryException&&!e)throw new XRefParseException;t.setActualNumPages(1);return}for(const[e,[r,i]]of n){let n;if(r instanceof Error){n=Promise.reject(r);n.catch(()=>{})}else n=Promise.resolve(new Page({pdfManager:a,xref:this.xref,pageIndex:e,pageDict:r,ref:i,globalIdFactory:this._globalIdFactory,fontCache:t.fontCache,builtInCMapCache:t.builtInCMapCache,standardFontDataCache:t.standardFontDataCache,globalColorSpaceCache:this.globalColorSpaceCache,globalImageCache:t.globalImageCache,systemFontCache:t.systemFontCache,nonBlendModesSet:t.nonBlendModesSet,xfaFactory:null}));this.#Ze.set(e,n)}t.setActualNumPages(n.size)}}async fontFallback(e,t){const{catalog:a,pdfManager:r}=this;for(const i of await Promise.all(a.fontCache))if(i.loadedName===e){i.fallback(t,r.evaluatorOptions);return}}async cleanup(e=!1){return this.catalog?this.catalog.cleanup(e):clearGlobalCaches()}async#nt(e,t,a,r,i,n,s){const{xref:o}=this;if(!(a instanceof Ref)||n.has(a))return;n.put(a);const c=await o.fetchAsync(a);if(!(c instanceof Dict))return;let l=await c.getAsync("Subtype");l=l instanceof Name?l.name:null;if("Link"===l)return;if(c.has("T")){const t=stringToPDFString(await c.getAsync("T"));e=""===e?t:`${e}.${t}`}else{let a=c;for(;;){a=a.getRaw("Parent")||t;if(a instanceof Ref){if(n.has(a))break;a=await o.fetchAsync(a)}if(!(a instanceof Dict))break;if(a.has("T")){const t=stringToPDFString(await a.getAsync("T"));e=""===e?t:`${e}.${t}`;break}}}t&&!c.has("Parent")&&isName(c.get("Subtype"),"Widget")&&s.put(a,t);r.has(e)||r.set(e,[]);r.get(e).push(AnnotationFactory.create(o,a,i,null,!0,s,null,null).then(e=>e?.getFieldObject()).catch(function(e){warn(`#collectFieldObjects: "${e}".`);return null}));if(!c.has("Kids"))return;const h=await c.getAsync("Kids");if(Array.isArray(h))for(const t of h)await this.#nt(e,a,t,r,i,n,s)}get fieldObjects(){return shadow(this,"fieldObjects",this.pdfManager.ensureDoc("formInfo").then(async e=>{if(!e.hasFields)return null;const t=await this.annotationGlobals;if(!t)return null;const{acroForm:a}=t,r=new RefSet,i=Object.create(null),n=new Map,s=new RefSetCache;for(const e of a.get("Fields"))await this.#nt("",null,e,n,t,r,s);const o=[];for(const[e,t]of n)o.push(Promise.all(t).then(t=>{(t=t.filter(e=>!!e)).length>0&&(i[e]=t)}));await Promise.all(o);return{allFields:objectSize(i)>0?i:null,orphanFields:s}}))}get hasJSActions(){return shadow(this,"hasJSActions",this.pdfManager.ensureDoc("_parseHasJSActions"))}async _parseHasJSActions(){const[e,t]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return!!e||!!t?.allFields&&Object.values(t.allFields).some(e=>e.some(e=>null!==e.actions))}get calculationOrderIds(){const e=this.catalog.acroForm?.get("CO");if(!Array.isArray(e)||0===e.length)return shadow(this,"calculationOrderIds",null);const t=[];for(const a of e)a instanceof Ref&&t.push(a.toString());return shadow(this,"calculationOrderIds",t.length?t:null)}get annotationGlobals(){return shadow(this,"annotationGlobals",AnnotationFactory.createGlobals(this.pdfManager))}}class BasePdfManager{constructor({docBaseUrl:e,docId:t,enableXfa:a,evaluatorOptions:r,handler:i,password:n}){this._docBaseUrl=function parseDocBaseUrl(e){if(e){const t=createValidAbsoluteUrl(e);if(t)return t.href;warn(`Invalid absolute docBaseUrl: "${e}".`)}return null}(e);this._docId=t;this._password=n;this.enableXfa=a;r.isOffscreenCanvasSupported&&=FeatureTest.isOffscreenCanvasSupported;r.isImageDecoderSupported&&=FeatureTest.isImageDecoderSupported;this.evaluatorOptions=Object.freeze(r);ImageResizer.setOptions(r);JpegStream.setOptions(r);OperatorList.setOptions(r);const s={...r,handler:i};JpxImage.setOptions(s);IccColorSpace.setOptions(s);CmykICCBasedCS.setOptions(s)}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}ensureDoc(e,t){return this.ensure(this.pdfDocument,e,t)}ensureXRef(e,t){return this.ensure(this.pdfDocument.xref,e,t)}ensureCatalog(e,t){return this.ensure(this.pdfDocument.catalog,e,t)}getPage(e){return this.pdfDocument.getPage(e)}fontFallback(e,t){return this.pdfDocument.fontFallback(e,t)}cleanup(e=!1){return this.pdfDocument.cleanup(e)}async ensure(e,t,a){unreachable("Abstract method `ensure` called")}requestRange(e,t){unreachable("Abstract method `requestRange` called")}requestLoadedStream(e=!1){unreachable("Abstract method `requestLoadedStream` called")}sendProgressiveData(e){unreachable("Abstract method `sendProgressiveData` called")}updatePassword(e){this._password=e}terminate(e){unreachable("Abstract method `terminate` called")}}class LocalPdfManager extends BasePdfManager{constructor(e){super(e);const t=new Stream(e.source);this.pdfDocument=new PDFDocument(this,t);this._loadedStreamPromise=Promise.resolve(t)}async ensure(e,t,a){const r=e[t];return"function"==typeof r?r.apply(e,a):r}requestRange(e,t){return Promise.resolve()}requestLoadedStream(e=!1){return this._loadedStreamPromise}terminate(e){}}class NetworkPdfManager extends BasePdfManager{constructor(e){super(e);this.streamManager=new ChunkedStreamManager(e.source,{msgHandler:e.handler,length:e.length,disableAutoFetch:e.disableAutoFetch,rangeChunkSize:e.rangeChunkSize});this.pdfDocument=new PDFDocument(this,this.streamManager.getStream())}async ensure(e,t,a){try{const r=e[t];return"function"==typeof r?r.apply(e,a):r}catch(r){if(!(r instanceof MissingDataException))throw r;await this.requestRange(r.begin,r.end);return this.ensure(e,t,a)}}requestRange(e,t){return this.streamManager.requestRange(e,t)}requestLoadedStream(e=!1){return this.streamManager.requestAllChunks(e)}sendProgressiveData(e){this.streamManager.onReceiveData({chunk:e})}terminate(e){this.streamManager.abort(e)}}const nc=1,sc=2,oc=1,cc=2,lc=3,hc=4,uc=5,dc=6,fc=7,gc=8;function onFn(){}function wrapReason(e){if(e instanceof AbortException||e instanceof InvalidPDFException||e instanceof PasswordException||e instanceof ResponseException||e instanceof UnknownErrorException)return e;e instanceof Error||"object"==typeof e&&null!==e||unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');switch(e.name){case"AbortException":return new AbortException(e.message);case"InvalidPDFException":return new InvalidPDFException(e.message);case"PasswordException":return new PasswordException(e.message,e.code);case"ResponseException":return new ResponseException(e.message,e.status,e.missing);case"UnknownErrorException":return new UnknownErrorException(e.message,e.details)}return new UnknownErrorException(e.message,e.toString())}class MessageHandler{#st=new AbortController;constructor(e,t,a){this.sourceName=e;this.targetName=t;this.comObj=a;this.callbackId=1;this.streamId=1;this.streamSinks=Object.create(null);this.streamControllers=Object.create(null);this.callbackCapabilities=Object.create(null);this.actionHandler=Object.create(null);a.addEventListener("message",this.#ot.bind(this),{signal:this.#st.signal})}#ot({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#ct(e);return}if(e.callback){const t=e.callbackId,a=this.callbackCapabilities[t];if(!a)throw new Error(`Cannot resolve callback ${t}`);delete this.callbackCapabilities[t];if(e.callback===nc)a.resolve(e.data);else{if(e.callback!==sc)throw new Error("Unexpected callback case");a.reject(wrapReason(e.reason))}return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const a=this.sourceName,r=e.sourceName,i=this.comObj;Promise.try(t,e.data).then(function(t){i.postMessage({sourceName:a,targetName:r,callback:nc,callbackId:e.callbackId,data:t})},function(t){i.postMessage({sourceName:a,targetName:r,callback:sc,callbackId:e.callbackId,reason:wrapReason(t)})});return}e.streamId?this.#lt(e):t(e.data)}on(e,t){const a=this.actionHandler;if(a[e])throw new Error(`There is already an actionName called "${e}"`);a[e]=t}send(e,t,a){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},a)}sendWithPromise(e,t,a){const r=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[r]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},a)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,a,r){const i=this.streamId++,n=this.sourceName,s=this.targetName,o=this.comObj;return new ReadableStream({start:a=>{const c=Promise.withResolvers();this.streamControllers[i]={controller:a,startCall:c,pullCall:null,cancelCall:null,isClosed:!1};o.postMessage({sourceName:n,targetName:s,action:e,streamId:i,data:t,desiredSize:a.desiredSize},r);return c.promise},pull:e=>{const t=Promise.withResolvers();this.streamControllers[i].pullCall=t;o.postMessage({sourceName:n,targetName:s,stream:dc,streamId:i,desiredSize:e.desiredSize});return t.promise},cancel:e=>{assert(e instanceof Error,"cancel must have a valid reason");const t=Promise.withResolvers();this.streamControllers[i].cancelCall=t;this.streamControllers[i].isClosed=!0;o.postMessage({sourceName:n,targetName:s,stream:oc,streamId:i,reason:wrapReason(e)});return t.promise}},a)}#lt(e){const t=e.streamId,a=this.sourceName,r=e.sourceName,i=this.comObj,n=this,s=this.actionHandler[e.action],o={enqueue(e,n=1,s){if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=n;if(o>0&&this.desiredSize<=0){this.sinkCapability=Promise.withResolvers();this.ready=this.sinkCapability.promise}i.postMessage({sourceName:a,targetName:r,stream:hc,streamId:t,chunk:e},s)},close(){if(!this.isCancelled){this.isCancelled=!0;i.postMessage({sourceName:a,targetName:r,stream:lc,streamId:t});delete n.streamSinks[t]}},error(e){assert(e instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;i.postMessage({sourceName:a,targetName:r,stream:uc,streamId:t,reason:wrapReason(e)})}},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};o.sinkCapability.resolve();o.ready=o.sinkCapability.promise;this.streamSinks[t]=o;Promise.try(s,e.data,o).then(function(){i.postMessage({sourceName:a,targetName:r,stream:gc,streamId:t,success:!0})},function(e){i.postMessage({sourceName:a,targetName:r,stream:gc,streamId:t,reason:wrapReason(e)})})}#ct(e){const t=e.streamId,a=this.sourceName,r=e.sourceName,i=this.comObj,n=this.streamControllers[t],s=this.streamSinks[t];switch(e.stream){case gc:e.success?n.startCall.resolve():n.startCall.reject(wrapReason(e.reason));break;case fc:e.success?n.pullCall.resolve():n.pullCall.reject(wrapReason(e.reason));break;case dc:if(!s){i.postMessage({sourceName:a,targetName:r,stream:fc,streamId:t,success:!0});break}s.desiredSize<=0&&e.desiredSize>0&&s.sinkCapability.resolve();s.desiredSize=e.desiredSize;Promise.try(s.onPull||onFn).then(function(){i.postMessage({sourceName:a,targetName:r,stream:fc,streamId:t,success:!0})},function(e){i.postMessage({sourceName:a,targetName:r,stream:fc,streamId:t,reason:wrapReason(e)})});break;case hc:assert(n,"enqueue should have stream controller");if(n.isClosed)break;n.controller.enqueue(e.chunk);break;case lc:assert(n,"close should have stream controller");if(n.isClosed)break;n.isClosed=!0;n.controller.close();this.#ht(n,t);break;case uc:assert(n,"error should have stream controller");n.controller.error(wrapReason(e.reason));this.#ht(n,t);break;case cc:e.success?n.cancelCall.resolve():n.cancelCall.reject(wrapReason(e.reason));this.#ht(n,t);break;case oc:if(!s)break;const o=wrapReason(e.reason);Promise.try(s.onCancel||onFn,o).then(function(){i.postMessage({sourceName:a,targetName:r,stream:cc,streamId:t,success:!0})},function(e){i.postMessage({sourceName:a,targetName:r,stream:cc,streamId:t,reason:wrapReason(e)})});s.sinkCapability.reject(o);s.isCancelled=!0;delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#ht(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]);delete this.streamControllers[t]}destroy(){this.#st?.abort();this.#st=null}}async function writeObject(e,t,a,{encrypt:r=null}){const i=r?.createCipherTransform(e.num,e.gen);a.push(`${e.num} ${e.gen} obj\n`);t instanceof Dict?await writeDict(t,a,i):t instanceof BaseStream?await writeStream(t,a,i):(Array.isArray(t)||ArrayBuffer.isView(t))&&await writeArray(t,a,i);a.push("\nendobj\n")}async function writeDict(e,t,a){t.push("<<");for(const r of e.getKeys()){t.push(` /${escapePDFName(r)} `);await writeValue(e.getRaw(r),t,a)}t.push(">>")}async function writeStream(e,t,a){let r=e.getBytes();const{dict:i}=e,[n,s]=await Promise.all([i.getAsync("Filter"),i.getAsync("DecodeParms")]),o=isName(Array.isArray(n)?await i.xref.fetchIfRefAsync(n[0]):n,"FlateDecode");if(r.length>=256||o)try{const e=new CompressionStream("deflate"),t=e.writable.getWriter();await t.ready;t.write(r).then(async()=>{await t.ready;await t.close()}).catch(()=>{});const a=await new Response(e.readable).arrayBuffer();r=new Uint8Array(a);let c,l;if(n){if(!o){c=Array.isArray(n)?[Name.get("FlateDecode"),...n]:[Name.get("FlateDecode"),n];s&&(l=Array.isArray(s)?[null,...s]:[null,s])}}else c=Name.get("FlateDecode");c&&i.set("Filter",c);l&&i.set("DecodeParms",l)}catch(e){info(`writeStream - cannot compress data: "${e}".`)}let c=bytesToString(r);a&&(c=a.encryptString(c));i.set("Length",c.length);await writeDict(i,t,a);t.push(" stream\n",c,"\nendstream")}async function writeArray(e,t,a){t.push("[");let r=!0;for(const i of e){r?r=!1:t.push(" ");await writeValue(i,t,a)}t.push("]")}async function writeValue(e,t,a){if(e instanceof Name)t.push(`/${escapePDFName(e.name)}`);else if(e instanceof Ref)t.push(`${e.num} ${e.gen} R`);else if(Array.isArray(e)||ArrayBuffer.isView(e))await writeArray(e,t,a);else if("string"==typeof e){a&&(e=a.encryptString(e));t.push(`(${escapeString(e)})`)}else"number"==typeof e?t.push(numberToString(e)):"boolean"==typeof e?t.push(e.toString()):e instanceof Dict?await writeDict(e,t,a):e instanceof BaseStream?await writeStream(e,t,a):null===e?t.push("null"):warn(`Unhandled value in writer: ${typeof e}, please file a bug.`)}function writeInt(e,t,a,r){for(let i=t+a-1;i>a-1;i--){r[i]=255&e;e>>=8}return a+t}function writeString(e,t,a){const r=e.length;for(let i=0;i1&&(n=a.documentElement.searchNode([i.at(-1)],0));n?n.childNodes=Array.isArray(r)?r.map(e=>new SimpleDOMNode("value",e)):[new SimpleDOMNode("#text",r)]:warn(`Node not found for path: ${t}`)}const r=[];a.documentElement.dump(r);return r.join("")}(r.fetchIfRef(t).getString(),a)}const i=new StringStream(e);i.dict=new Dict(r);i.dict.setIfName("Type","EmbeddedFile");a.put(t,{data:i})}function getIndexes(e){const t=[];for(const{ref:a}of e)a.num===t.at(-2)+t.at(-1)?t[t.length-1]+=1:t.push(a.num,1);return t}function computeIDs(e,t,a){if(Array.isArray(t.fileIds)&&t.fileIds.length>0){const r=function computeMD5(e,t){const a=Math.floor(Date.now()/1e3),r=t.filename||"",i=[a.toString(),r,e.toString(),...t.infoMap.values()],n=Math.sumPrecise(i.map(e=>e.length)),s=new Uint8Array(n);let o=0;for(const e of i)o=writeString(e,o,s);return bytesToString(calculateMD5(s,0,s.length))}(e,t);a.set("ID",[t.fileIds[0],r])}}async function incrementalUpdate({originalData:e,xrefInfo:t,changes:a,xref:r=null,hasXfa:i=!1,xfaDatasetsRef:n=null,hasXfaDatasetsEntry:s=!1,needAppearances:o,acroFormRef:c=null,acroForm:l=null,xfaData:h=null,useXrefStream:u=!1}){await async function updateAcroform({xref:e,acroForm:t,acroFormRef:a,hasXfa:r,hasXfaDatasetsEntry:i,xfaDatasetsRef:n,needAppearances:s,changes:o}){!r||i||n||warn("XFA - Cannot save it");if(!s&&(!r||!n||i))return;const c=t.clone();if(r&&!i){const e=t.get("XFA").slice();e.splice(2,0,"datasets");e.splice(3,0,n);c.set("XFA",e)}s&&c.set("NeedAppearances",!0);o.put(a,{data:c})}({xref:r,acroForm:l,acroFormRef:c,hasXfa:i,hasXfaDatasetsEntry:s,xfaDatasetsRef:n,needAppearances:o,changes:a});i&&updateXFA({xfaData:h,xfaDatasetsRef:n,changes:a,xref:r});const d=function getTrailerDict(e,t,a){const r=new Dict(null);r.set("Prev",e.startXRef);const i=e.newRef;if(a){t.put(i,{data:""});r.set("Size",i.num+1);r.setIfName("Type","XRef")}else r.set("Size",i.num);null!==e.rootRef&&r.set("Root",e.rootRef);null!==e.infoRef&&r.set("Info",e.infoRef);null!==e.encryptRef&&r.set("Encrypt",e.encryptRef);return r}(t,a,u),f=[],g=await async function writeChanges(e,t,a=[]){const r=[];for(const[i,{data:n}]of e.items())if(null!==n&&"string"!=typeof n){await writeObject(i,n,a,t);r.push({ref:i,data:a.join("")});a.length=0}else r.push({ref:i,data:n});return r.sort((e,t)=>e.ref.num-t.ref.num)}(a,r,f);let p=e.length;const m=e.at(-1);if(10!==m&&13!==m){f.push("\n");p+=1}for(const{data:e}of g)null!==e&&f.push(e);await(u?async function getXRefStreamTable(e,t,a,r,i){const n=[];let s=0,o=0;for(const{ref:e,data:r}of a){let a;s=Math.max(s,t);if(null!==r){a=Math.min(e.gen,65535);n.push([1,t,a]);t+=r.length}else{a=Math.min(e.gen+1,65535);n.push([0,0,a])}o=Math.max(o,a)}r.set("Index",getIndexes(a));const c=[1,getSizeInBytes(s),getSizeInBytes(o)];r.set("W",c);computeIDs(t,e,r);const l=Math.sumPrecise(c),h=new Uint8Array(l*n.length),u=new Stream(h);u.dict=r;let d=0;for(const[e,t,a]of n){d=writeInt(e,c[0],d,h);d=writeInt(t,c[1],d,h);d=writeInt(a,c[2],d,h)}await writeObject(e.newRef,u,i,{});i.push("startxref\n",t.toString(),"\n%%EOF\n")}(t,p,g,d,f):async function getXRefTable(e,t,a,r,i){i.push("xref\n");const n=getIndexes(a);let s=0;for(const{ref:e,data:r}of a){if(e.num===n[s]){i.push(`${n[s]} ${n[s+1]}\n`);s+=2}if(null!==r){i.push(`${t.toString().padStart(10,"0")} ${Math.min(e.gen,65535).toString().padStart(5,"0")} n\r\n`);t+=r.length}else i.push(`0000000000 ${Math.min(e.gen+1,65535).toString().padStart(5,"0")} f\r\n`)}computeIDs(t,e,r);i.push("trailer\n");await writeDict(r,i);i.push("\nstartxref\n",t.toString(),"\n%%EOF\n")}(t,p,g,d,f));const b=e.length+Math.sumPrecise(f.map(e=>e.length)),y=new Uint8Array(b);y.set(e);let w=e.length;for(const e of f)w=writeString(e,w,y);return y}class PDFWorkerStream{constructor(e){this._msgHandler=e;this._contentLength=null;this._fullRequestReader=null;this._rangeRequestReaders=[]}getFullReader(){assert(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once.");this._fullRequestReader=new PDFWorkerStreamReader(this._msgHandler);return this._fullRequestReader}getRangeReader(e,t){const a=new PDFWorkerStreamRangeReader(e,t,this._msgHandler);this._rangeRequestReaders.push(a);return a}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class PDFWorkerStreamReader{constructor(e){this._msgHandler=e;this.onProgress=null;this._contentLength=null;this._isRangeSupported=!1;this._isStreamingSupported=!1;const t=this._msgHandler.sendWithStream("GetReader");this._reader=t.getReader();this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then(e=>{this._isStreamingSupported=e.isStreamingSupported;this._isRangeSupported=e.isRangeSupported;this._contentLength=e.contentLength})}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){const{value:e,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class PDFWorkerStreamRangeReader{constructor(e,t,a){this._msgHandler=a;this.onProgress=null;const r=this._msgHandler.sendWithStream("GetRangeReader",{begin:e,end:t});this._reader=r.getReader()}get isStreamingSupported(){return!1}async read(){const{value:e,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class WorkerTask{constructor(e){this.name=e;this.terminated=!1;this._capability=Promise.withResolvers()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}class WorkerMessageHandler{static{"undefined"==typeof window&&!e&&"undefined"!=typeof self&&"function"==typeof self.postMessage&&"onmessage"in self&&this.initializeFromPort(self)}static setup(e,t){let a=!1;e.on("test",t=>{if(!a){a=!0;e.send("test",t instanceof Uint8Array)}});e.on("configure",e=>{!function setVerbosityLevel(e){Number.isInteger(e)&&(Kt=e)}(e.verbosity)});e.on("GetDocRequest",e=>this.createDocumentHandler(e,t))}static createDocumentHandler(e,t){let a,r=!1,i=null;const n=new Set,s=getVerbosityLevel(),{docId:o,apiVersion:c}=e,l="5.4.296";if(c!==l)throw new Error(`The API version "${c}" does not match the Worker version "${l}".`);const buildMsg=(e,t)=>`The \`${e}.prototype\` contains unexpected enumerable property "${t}", thus breaking e.g. \`for...in\` iteration of ${e}s.`;for(const e in{})throw new Error(buildMsg("Object",e));for(const e in[])throw new Error(buildMsg("Array",e));const h=o+"_worker";let u=new MessageHandler(h,o,t);function ensureNotTerminated(){if(r)throw new Error("Worker was terminated")}function startWorkerTask(e){n.add(e)}function finishWorkerTask(e){e.finish();n.delete(e)}async function loadDocument(e){await a.ensureDoc("checkHeader");await a.ensureDoc("parseStartXRef");await a.ensureDoc("parse",[e]);await a.ensureDoc("checkFirstPage",[e]);await a.ensureDoc("checkLastPage",[e]);const t=await a.ensureDoc("isPureXfa");if(t){const e=new WorkerTask("loadXfaResources");startWorkerTask(e);await a.ensureDoc("loadXfaResources",[u,e]);finishWorkerTask(e)}const[r,i]=await Promise.all([a.ensureDoc("numPages"),a.ensureDoc("fingerprints")]);return{numPages:r,fingerprints:i,htmlForXfa:t?await a.ensureDoc("htmlForXfa"):null}}function setupDoc(e){function onSuccess(e){ensureNotTerminated();u.send("GetDoc",{pdfInfo:e})}function onFailure(e){ensureNotTerminated();if(e instanceof PasswordException){const t=new WorkerTask(`PasswordException: response ${e.code}`);startWorkerTask(t);u.sendWithPromise("PasswordRequest",e).then(function({password:e}){finishWorkerTask(t);a.updatePassword(e);pdfManagerReady()}).catch(function(){finishWorkerTask(t);u.send("DocException",e)})}else u.send("DocException",wrapReason(e))}function pdfManagerReady(){ensureNotTerminated();loadDocument(!1).then(onSuccess,function(e){ensureNotTerminated();e instanceof XRefParseException?a.requestLoadedStream().then(function(){ensureNotTerminated();loadDocument(!0).then(onSuccess,onFailure)}):onFailure(e)})}ensureNotTerminated();(async function getPdfManager({data:e,password:t,disableAutoFetch:a,rangeChunkSize:r,length:n,docBaseUrl:s,enableXfa:c,evaluatorOptions:l}){const h={source:null,disableAutoFetch:a,docBaseUrl:s,docId:o,enableXfa:c,evaluatorOptions:l,handler:u,length:n,password:t,rangeChunkSize:r};if(e){h.source=e;return new LocalPdfManager(h)}const d=new PDFWorkerStream(u),f=d.getFullReader(),g=Promise.withResolvers();let p,m=[],b=0;f.headersReady.then(function(){if(f.isRangeSupported){h.source=d;h.length=f.contentLength;h.disableAutoFetch||=f.isStreamingSupported;p=new NetworkPdfManager(h);for(const e of m)p.sendProgressiveData(e);m=[];g.resolve(p);i=null}}).catch(function(e){g.reject(e);i=null});new Promise(function(e,t){const readChunk=function({value:e,done:a}){try{ensureNotTerminated();if(a){if(!p){const e=arrayBuffersToBytes(m);m=[];n&&e.length!==n&&warn("reported HTTP length is different from actual");h.source=e;p=new LocalPdfManager(h);g.resolve(p)}i=null;return}b+=e.byteLength;f.isStreamingSupported||u.send("DocProgress",{loaded:b,total:Math.max(b,f.contentLength||0)});p?p.sendProgressiveData(e):m.push(e);f.read().then(readChunk,t)}catch(e){t(e)}};f.read().then(readChunk,t)}).catch(function(e){g.reject(e);i=null});i=e=>{d.cancelAllRequests(e)};return g.promise})(e).then(function(e){if(r){e.terminate(new AbortException("Worker was terminated."));throw new Error("Worker was terminated")}a=e;a.requestLoadedStream(!0).then(e=>{u.send("DataLoaded",{length:e.bytes.byteLength})})}).then(pdfManagerReady,onFailure)}u.on("GetPage",function(e){return a.getPage(e.pageIndex).then(function(e){return Promise.all([a.ensure(e,"rotate"),a.ensure(e,"ref"),a.ensure(e,"userUnit"),a.ensure(e,"view")]).then(function([e,t,a,r]){return{rotate:e,ref:t,refStr:t?.toString()??null,userUnit:a,view:r}})})});u.on("GetPageIndex",function(e){const t=Ref.get(e.num,e.gen);return a.ensureCatalog("getPageIndex",[t])});u.on("GetDestinations",function(e){return a.ensureCatalog("destinations")});u.on("GetDestination",function(e){return a.ensureCatalog("getDestination",[e.id])});u.on("GetPageLabels",function(e){return a.ensureCatalog("pageLabels")});u.on("GetPageLayout",function(e){return a.ensureCatalog("pageLayout")});u.on("GetPageMode",function(e){return a.ensureCatalog("pageMode")});u.on("GetViewerPreferences",function(e){return a.ensureCatalog("viewerPreferences")});u.on("GetOpenAction",function(e){return a.ensureCatalog("openAction")});u.on("GetAttachments",function(e){return a.ensureCatalog("attachments")});u.on("GetDocJSActions",function(e){return a.ensureCatalog("jsActions")});u.on("GetPageJSActions",function({pageIndex:e}){return a.getPage(e).then(e=>a.ensure(e,"jsActions"))});u.on("GetAnnotationsByType",async function({types:e,pageIndexesToSkip:t}){const[r,i]=await Promise.all([a.ensureDoc("numPages"),a.ensureDoc("annotationGlobals")]);if(!i)return null;const n=[],s=[];let o=null;try{for(let c=0,l=r;ct&&t.collectAnnotationsByType(u,o,e,s,i)||[]))}await Promise.all(n);return(await Promise.all(s)).filter(e=>!!e)}finally{o&&finishWorkerTask(o)}});u.on("GetOutline",function(e){return a.ensureCatalog("documentOutline")});u.on("GetOptionalContentConfig",function(e){return a.ensureCatalog("optionalContentConfig")});u.on("GetPermissions",function(e){return a.ensureCatalog("permissions")});u.on("GetMetadata",function(e){return Promise.all([a.ensureDoc("documentInfo"),a.ensureCatalog("metadata")])});u.on("GetMarkInfo",function(e){return a.ensureCatalog("markInfo")});u.on("GetData",function(e){return a.requestLoadedStream().then(e=>e.bytes)});u.on("GetAnnotations",function({pageIndex:e,intent:t}){return a.getPage(e).then(function(a){const r=new WorkerTask(`GetAnnotations: page ${e}`);startWorkerTask(r);return a.getAnnotationsData(u,r,t).then(e=>{finishWorkerTask(r);return e},e=>{finishWorkerTask(r);throw e})})});u.on("GetFieldObjects",function(e){return a.ensureDoc("fieldObjects").then(e=>e?.allFields||null)});u.on("HasJSActions",function(e){return a.ensureDoc("hasJSActions")});u.on("GetCalculationOrderIds",function(e){return a.ensureDoc("calculationOrderIds")});u.on("SaveDocument",async function({isPureXfa:e,numPages:t,annotationStorage:r,filename:i}){const n=[a.requestLoadedStream(),a.ensureCatalog("acroForm"),a.ensureCatalog("acroFormRef"),a.ensureDoc("startXRef"),a.ensureDoc("xref"),a.ensureCatalog("structTreeRoot")],s=new RefSetCache,o=[],c=e?null:getNewAnnotationsMap(r),[l,h,d,f,g,p]=await Promise.all(n),m=g.trailer.getRaw("Root")||null;let b;if(c){p?await p.canUpdateStructTree({pdfManager:a,newAnnotationsByPage:c})&&(b=p):await StructTreeRoot.canCreateStructureTree({catalogRef:m,pdfManager:a,newAnnotationsByPage:c})&&(b=null);const e=AnnotationFactory.generateImages(r.values(),g,a.evaluatorOptions.isOffscreenCanvasSupported),t=void 0===b?o:[];for(const[r,i]of c)t.push(a.getPage(r).then(t=>{const a=new WorkerTask(`Save (editor): page ${r}`);startWorkerTask(a);return t.saveNewAnnotations(u,a,i,e,s).finally(function(){finishWorkerTask(a)})}));null===b?o.push(Promise.all(t).then(async()=>{await StructTreeRoot.createStructureTree({newAnnotationsByPage:c,xref:g,catalogRef:m,pdfManager:a,changes:s})})):b&&o.push(Promise.all(t).then(async()=>{await b.updateStructureTree({newAnnotationsByPage:c,pdfManager:a,changes:s})}))}if(e)o.push(a.ensureDoc("serializeXfaData",[r]));else for(let e=0;ee.needAppearances),S=h instanceof Dict&&h.get("XFA")||null;let k=null,C=!1;if(Array.isArray(S)){for(let e=0,t=S.length;e{g.resetNewTemporaryRef()})});u.on("GetOperatorList",function(e,t){const r=e.pageIndex;a.getPage(r).then(function(a){const i=new WorkerTask(`GetOperatorList: page ${r}`);startWorkerTask(i);const n=s>=ne?Date.now():0;a.getOperatorList({handler:u,sink:t,task:i,intent:e.intent,cacheKey:e.cacheKey,annotationStorage:e.annotationStorage,modifiedIds:e.modifiedIds}).then(function(e){finishWorkerTask(i);n&&info(`page=${r+1} - getOperatorList: time=${Date.now()-n}ms, len=${e.length}`);t.close()},function(e){finishWorkerTask(i);i.terminated||t.error(e)})})});u.on("GetTextContent",function(e,t){const{pageIndex:r,includeMarkedContent:i,disableNormalization:n}=e;a.getPage(r).then(function(e){const a=new WorkerTask("GetTextContent: page "+r);startWorkerTask(a);const o=s>=ne?Date.now():0;e.extractTextContent({handler:u,task:a,sink:t,includeMarkedContent:i,disableNormalization:n}).then(function(){finishWorkerTask(a);o&&info(`page=${r+1} - getTextContent: time=`+(Date.now()-o)+"ms");t.close()},function(e){finishWorkerTask(a);a.terminated||t.error(e)})})});u.on("GetStructTree",function(e){return a.getPage(e.pageIndex).then(e=>a.ensure(e,"getStructTree"))});u.on("FontFallback",function(e){return a.fontFallback(e.id,u)});u.on("Cleanup",function(e){return a.cleanup(!0)});u.on("Terminate",function(e){r=!0;const t=[];if(a){a.terminate(new AbortException("Worker was terminated."));const e=a.cleanup();t.push(e);a=null}else clearGlobalCaches();i?.(new AbortException("Worker was terminated."));for(const e of n){t.push(e.finished);e.terminate()}return Promise.all(t).then(function(){u.destroy();u=null})});u.on("Ready",function(t){setupDoc(e);e=null});return h}static initializeFromPort(e){const t=new MessageHandler("worker","main",e);this.setup(t,e);t.send("ready",null)}}globalThis.pdfjsWorker={WorkerMessageHandler};export{WorkerMessageHandler}; ================================================ FILE: web-app/build/static/css/main.849b542e.css ================================================ .ReactVirtualized__Table__headerRow{font-weight:700;text-transform:uppercase}.ReactVirtualized__Table__headerRow,.ReactVirtualized__Table__row{align-items:center;display:flex;flex-direction:row}.ReactVirtualized__Table__headerTruncatedText{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ReactVirtualized__Table__headerColumn,.ReactVirtualized__Table__rowColumn{margin-right:10px;min-width:0}.ReactVirtualized__Table__rowColumn{text-overflow:ellipsis;white-space:nowrap}.ReactVirtualized__Table__headerColumn:first-of-type,.ReactVirtualized__Table__rowColumn:first-of-type{margin-left:10px}.ReactVirtualized__Table__sortableHeaderColumn{cursor:pointer}.ReactVirtualized__Table__sortableHeaderIconContainer{align-items:center;display:flex}.ReactVirtualized__Table__sortableHeaderIcon{fill:currentColor;flex:0 0 24px;height:1em;width:1em}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif;margin:0}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}.removeArrows input::-webkit-inner-spin-button,.removeArrows input::-webkit-outer-spin-button,input.removeArrows::-webkit-inner-spin-button,input.removeArrows::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.removeArrows input[type=number],input.removeArrows[type=number]{-moz-appearance:textfield} ================================================ FILE: web-app/build/static/js/1004.94dbce53.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[1004],{51004:(e,t,s)=>{s.r(t),s.d(t,{default:()=>A});var n=s(9950),a=s(28429),c=s(89132),i=s(98341),l=s(93598),o=s(26843),d=s(55604),r=s(49078),_=s(47304),b=s(99491),u=s(30272),h=s(82817),T=s(70444),x=s(48965),O=s(70503),C=s(44414);const j=(0,d.A)(n.lazy(()=>s.e(4402).then(s.bind(s,54402)))),S=(0,d.A)(n.lazy(()=>s.e(7102).then(s.bind(s,57102)))),p=(0,d.A)(n.lazy(()=>s.e(5692).then(s.bind(s,95692)))),E=(0,d.A)(n.lazy(()=>s.e(7945).then(s.bind(s,17945)))),I=(0,d.A)(n.lazy(()=>s.e(9033).then(s.bind(s,39033)))),f=(0,d.A)(n.lazy(()=>s.e(3576).then(s.bind(s,73576)))),m=(0,d.A)(n.lazy(()=>s.e(8231).then(s.bind(s,8231)))),A=()=>{var e;const t=(0,b.jL)(),s=(0,a.Zp)(),d=(0,a.g)(),A=(0,a.zy)(),N=(0,i.d4)(r.Rq),k=(0,i.d4)(_.Nx),y=(0,i.d4)(_.fT),U=(0,i.d4)(r.nM),[V,g]=(0,n.useState)(!1),[L,v]=(0,n.useState)(!1),R=d.bucketName||"",B=(0,o._)(R,l.Sg),G=(0,o._)(R,l.Nt);(0,n.useEffect)(()=>{t((0,r.ph)("bucket_details"))},[]),(0,n.useEffect)(()=>{V||(t((0,_.ZU)(!0)),g(!0))},[V,t,g]),(0,n.useEffect)(()=>{k&&T.F.buckets.bucketInfo(R).then(e=>{t((0,_.ZU)(!1)),t((0,_.$T)(e.data))}).catch(e=>{t((0,_.ZU)(!1)),t((0,r.C9)((0,x.S)(e)))})},[R,k,t]);let w="/buckets/".concat(R);const F={events:"/admin/events",replication:"/admin/replication",lifecycle:"/admin/lifecycle",access:"/admin/access",prefix:"/admin/prefix"},P=e=>{let t=F[e];return t=t?"".concat(w).concat(t):"".concat(w).concat("/admin/summary"),t};return(0,C.jsxs)(n.Fragment,{children:[L&&(0,C.jsx)(j,{deleteOpen:L,selectedBucket:R,closeDeleteModalAndRefresh:e=>{(e=>{v(!1),e&&s("/buckets")})(e)}}),(0,C.jsx)(h.A,{label:(0,C.jsx)(c.EGL,{label:"Buckets",onClick:()=>s("/buckets")}),actions:(0,C.jsxs)(n.Fragment,{children:[(0,C.jsx)(u.A,{tooltip:G?"Browse Bucket":(0,l.vj)(l.pC[l.ac.BUCKET_VIEWER],"browsing this bucket"),children:(0,C.jsx)(c.$nd,{id:"switch-browse-view","aria-label":"Browse Bucket",onClick:()=>{s("/browser/".concat(R))},icon:(0,C.jsx)(c.sjq,{style:{width:20,height:20,marginTop:-3}}),style:{padding:"0 10px"},disabled:!G})}),(0,C.jsx)(O.A,{})]})}),(0,C.jsxs)(c.Mxu,{children:[(0,C.jsx)(c.lcx,{icon:(0,C.jsx)(n.Fragment,{children:(0,C.jsx)(c.brV,{width:40})}),title:R,subTitle:(0,C.jsxs)(o.R,{scopes:[l.OV.S3_GET_BUCKET_POLICY,l.OV.S3_GET_ACTIONS],resource:R,children:[(0,C.jsx)("span",{style:{fontSize:15},children:"Access: "}),(0,C.jsx)("span",{style:{fontWeight:600,fontSize:15,textTransform:"capitalize"},children:null===y||void 0===y||null===(e=y.access)||void 0===e?void 0:e.toLowerCase()})]}),actions:(0,C.jsxs)(n.Fragment,{children:[(0,C.jsx)(o.R,{scopes:l.Sg,resource:R,errorProps:{disabled:!0},children:(0,C.jsx)(u.A,{tooltip:B?"":(0,l.vj)([l.OV.S3_DELETE_BUCKET,l.OV.S3_FORCE_DELETE_BUCKET],"deleting this bucket"),children:(0,C.jsx)(c.$nd,{id:"delete-bucket-button",onClick:()=>{v(!0)},label:"Delete Bucket",icon:(0,C.jsx)(c.ucK,{}),variant:"secondary",disabled:!B})})}),(0,C.jsx)(c.$nd,{id:"refresh-bucket-info",onClick:()=>{t((0,_.ZU)(!0))},label:"Refresh",icon:(0,C.jsx)(c.fNY,{})})]}),sx:{marginBottom:15}}),(0,C.jsx)(c.azJ,{children:(0,C.jsx)(c.tUM,{currentTabOrPath:A.pathname,useRouteTabs:!0,onTabClick:e=>{s(e)},options:[{tabConfig:{label:"Summary",id:"summary",to:P("summary")}},{tabConfig:{label:"Events",id:"events",disabled:!(0,o._)(R,[l.OV.S3_GET_BUCKET_NOTIFICATIONS,l.OV.S3_PUT_BUCKET_NOTIFICATIONS,l.OV.S3_GET_ACTIONS,l.OV.S3_PUT_ACTIONS]),to:P("events")}},{tabConfig:{label:"Replication",id:"replication",disabled:!N||U.enabled&&U.curSite||!(0,o._)(R,[l.OV.S3_GET_REPLICATION_CONFIGURATION,l.OV.S3_PUT_REPLICATION_CONFIGURATION,l.OV.S3_GET_ACTIONS,l.OV.S3_PUT_ACTIONS]),to:P("replication")}},{tabConfig:{label:"Lifecycle",id:"lifecycle",disabled:!N||!(0,o._)(R,[l.OV.S3_GET_LIFECYCLE_CONFIGURATION,l.OV.S3_PUT_LIFECYCLE_CONFIGURATION,l.OV.S3_GET_ACTIONS,l.OV.S3_PUT_ACTIONS]),to:P("lifecycle")}},{tabConfig:{label:"Access",id:"access",disabled:!(0,o._)(R,[l.OV.ADMIN_GET_POLICY,l.OV.ADMIN_LIST_USER_POLICIES,l.OV.ADMIN_LIST_USERS]),to:P("access")}},{tabConfig:{label:"Anonymous",id:"anonymous",disabled:!(0,o._)(R,[l.OV.S3_GET_BUCKET_POLICY,l.OV.S3_GET_ACTIONS]),to:P("prefix")}}],routes:(0,C.jsxs)(a.BV,{children:[(0,C.jsx)(a.qh,{path:"summary",element:(0,C.jsx)(E,{})}),(0,C.jsx)(a.qh,{path:"events",element:(0,C.jsx)(I,{})}),N&&(0,C.jsx)(a.qh,{path:"replication",element:(0,C.jsx)(f,{})}),N&&(0,C.jsx)(a.qh,{path:"lifecycle",element:(0,C.jsx)(m,{})}),(0,C.jsx)(a.qh,{path:"access",element:(0,C.jsx)(p,{})}),(0,C.jsx)(a.qh,{path:"prefix",element:(0,C.jsx)(S,{})}),(0,C.jsx)(a.qh,{path:"*",element:(0,C.jsx)(a.C5,{to:"/buckets/".concat(R,"/admin/summary")})})]})})})]})]})}},55604:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(89379),a=s(9950),c=s(44414);const i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(s){return(0,c.jsx)(a.Suspense,{fallback:t,children:(0,c.jsx)(e,(0,n.A)({},s))})}}}}]); ================================================ FILE: web-app/build/static/js/116.d72fac0b.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[116],{30116:(e,t,a)=>{a.r(t),a.d(t,{default:()=>y});var n=a(9950),l=a(87946),r=a.n(l),s=a(89132),i=a(70444),o=a(48965),c=a(45246),d=a(59908),u=a(49078),h=a(99491),g=a(32680),p=a(66147),x=a(58093),m=a(44414);const y=e=>{let{open:t,closeModalAndRefresh:a,bucketName:l,setReplicationRules:y}=e;const v=(0,h.jL)(),[b,S]=(0,n.useState)(!1),[j,f]=(0,n.useState)("1"),[C,k]=(0,n.useState)(""),[A,R]=(0,n.useState)(""),[_,B]=(0,n.useState)(""),[D,w]=(0,n.useState)(""),[E,I]=(0,n.useState)(""),[M,L]=(0,n.useState)(""),[T,N]=(0,n.useState)(""),[O,K]=(0,n.useState)(!0),[U,P]=(0,n.useState)(!0),[F,q]=(0,n.useState)(!0),[z,G]=(0,n.useState)(!0),[V,H]=(0,n.useState)(""),[J,Y]=(0,n.useState)("async"),[W,$]=(0,n.useState)("100"),[X,Q]=(0,n.useState)("Gi"),[Z,ee]=(0,n.useState)("60");(0,n.useEffect)(()=>{if(0===y.length)return void f("1");const e=y.reduce((e,t)=>t.priority>e?t.priority:e,0);f((e+1).toString())},[y]);return(0,m.jsx)(g.A,{modalOpen:t,onClose:()=>{a()},title:"Set Bucket Replication",titleIcon:(0,m.jsx)(s.WBh,{}),children:(0,m.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),S(!0),(()=>{const e=[{originBucket:l,destinationBucket:M}],t=parseInt(Z),n="".concat(O?"https://":"http://").concat(_),s={accessKey:C,secretKey:A,targetURL:n,region:T,bucketsRelation:e,syncMode:J,bandwidth:"async"===J?parseInt((0,d.q5)(W,X,!0)):0,healthCheckPeriod:t,prefix:E,tags:V,replicateDeleteMarkers:U,replicateDeletes:F,priority:parseInt(j),storageClass:D,replicateMetadata:z};i.F.bucketsReplication.setMultiBucketReplication(s).then(e=>{S(!1);const t=r()(e.data,"replicationState",[]);if(t.length>0){const e=t[0];return S(!1),e.errorString&&""!==e.errorString?void v((0,u.Dy)({errorMessage:e.errorString,detailedError:""})):void a()}v((0,u.Dy)({errorMessage:"No changes applied",detailedError:""}))}).catch(e=>{S(!1),v((0,u.Dy)((0,o.S)(e.error)))})})()},children:(0,m.jsxs)(s.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,m.jsx)(s.cl_,{id:"priority",name:"priority",onChange:e=>{e.target.validity.valid&&f(e.target.value)},label:"Priority",value:j,pattern:"[0-9]*"}),(0,m.jsx)(s.cl_,{id:"targetURL",name:"targetURL",onChange:e=>{B(e.target.value)},placeholder:"play.min.io",label:"Target URL",value:_}),(0,m.jsx)(s.dOG,{checked:O,id:"useTLS",name:"useTLS",label:"Use TLS",onChange:e=>{K(e.target.checked)},value:"yes"}),(0,m.jsx)(s.cl_,{id:"accessKey",name:"accessKey",onChange:e=>{k(e.target.value)},label:"Access Key",value:C}),(0,m.jsx)(s.cl_,{id:"secretKey",name:"secretKey",onChange:e=>{R(e.target.value)},label:"Secret Key",value:A}),(0,m.jsx)(s.cl_,{id:"targetBucket",name:"targetBucket",onChange:e=>{L(e.target.value)},label:"Target Bucket",value:M}),(0,m.jsx)(s.cl_,{id:"region",name:"region",onChange:e=>{N(e.target.value)},label:"Region",value:T}),(0,m.jsx)(s.l6P,{id:"replication_mode",name:"replication_mode",onChange:e=>{Y(e)},label:"Replication Mode",value:J,options:[{label:"Asynchronous",value:"async"},{label:"Synchronous",value:"sync"}]}),"async"===J&&(0,m.jsx)(s.azJ,{className:"inputItem",children:(0,m.jsx)(s.cl_,{type:"number",id:"bandwidth_scalar",name:"bandwidth_scalar",onChange:e=>{e.target.validity.valid&&$(e.target.value)},label:"Bandwidth",value:W,min:"0",pattern:"[0-9]*",overlayObject:(0,m.jsx)(x.A,{id:"quota_unit",onUnitChange:e=>{Q(e)},unitSelected:X,unitsList:(0,d.l9)(["Ki"]),disabled:!1})})}),(0,m.jsx)(s.cl_,{id:"healthCheck",name:"healthCheck",onChange:e=>{ee(e.target.value)},label:"Health Check Duration",value:Z}),(0,m.jsx)(s.cl_,{id:"storageClass",name:"storageClass",onChange:e=>{w(e.target.value)},placeholder:"STANDARD_IA,REDUCED_REDUNDANCY etc",label:"Storage Class",value:D}),(0,m.jsxs)("fieldset",{className:"inputItem",children:[(0,m.jsx)("legend",{children:"Object Filters"}),(0,m.jsx)(s.cl_,{id:"prefix",name:"prefix",onChange:e=>{I(e.target.value)},placeholder:"prefix",label:"Prefix",value:E}),(0,m.jsx)(p.A,{name:"tags",label:"Tags",elements:"",onChange:e=>{H(e)},keyPlaceholder:"Tag Key",valuePlaceholder:"Tag Value",withBorder:!0})]}),(0,m.jsxs)("fieldset",{className:"inputItem",children:[(0,m.jsx)("legend",{children:"Replication Options"}),(0,m.jsx)(s.dOG,{checked:z,id:"metadatataSync",name:"metadatataSync",label:"Metadata Sync",onChange:e=>{G(e.target.checked)},description:"Metadata Sync"}),(0,m.jsx)(s.dOG,{checked:U,id:"deleteMarker",name:"deleteMarker",label:"Delete Marker",onChange:e=>{P(e.target.checked)},description:"Replicate soft deletes"}),(0,m.jsx)(s.dOG,{checked:F,id:"repDelete",name:"repDelete",label:"Deletes",onChange:e=>{q(e.target.checked)},description:"Replicate versioned deletes"})]}),(0,m.jsxs)(s.xA9,{item:!0,xs:12,sx:c.Uz.modalButtonBar,children:[(0,m.jsx)(s.$nd,{id:"cancel",type:"button",variant:"regular",disabled:b,onClick:()=>{a()},label:"Cancel"}),(0,m.jsx)(s.$nd,{id:"submit",type:"submit",variant:"callAction",color:"primary",disabled:b,label:"Save"})]})]})})})}},32680:(e,t,a)=>{a.d(t,{A:()=>d});var n=a(9950),l=a(98341),r=a(89132),s=a(99491),i=a(49078),o=a(96382),c=a(44414);const d=e=>{let{onClose:t,modalOpen:a,title:d,children:u,wideLimit:h=!0,titleIcon:g=null,iconColor:p="default",sx:x}=e;const m=(0,s.jL)(),[y,v]=(0,n.useState)(!1),b=(0,l.d4)(e=>e.system.modalSnackBar);(0,n.useEffect)(()=>{m((0,i.h0)(""))},[m]),(0,n.useEffect)(()=>{if(b){if(""===b.message)return void v(!1);"error"!==b.type&&v(!0)}},[b]);let S="";return b&&(S=b.detailedErrorMsg,(""===S||S&&S.length<5)&&(S=b.message)),(0,c.jsxs)(r.ngX,{onClose:t,open:a,title:d,titleIcon:g,widthLimit:h,sx:x,iconColor:p,children:[(0,c.jsx)(o.A,{isModal:!0}),(0,c.jsx)(r.qb_,{onClose:()=>{v(!1),m((0,i.h0)(""))},open:y,message:S,mode:"inline",variant:"error"===b.type?"error":"default",autoHideDuration:"error"===b.type?10:5,condensed:!0}),u]})}},58093:(e,t,a)=>{a.d(t,{A:()=>d});var n=a(9950),l=a(89132),r=a(19335),s=a(87946),i=a.n(s),o=a(44414);const c=r.Ay.button(e=>{let{theme:t}=e;return{border:"1px solid ".concat(i()(t,"borderColor","#E2E2E2")),borderRadius:3,color:i()(t,"secondaryText","#5B5C5C"),backgroundColor:i()(t,"boxBackground","#FBFAFA"),fontSize:12}}),d=e=>{let{id:t,unitSelected:a,unitsList:r,disabled:s=!1,onUnitChange:i}=e;const[d,u]=n.useState(null),h=Boolean(d),g=e=>{u(null),""!==e&&i&&i(e)};return(0,o.jsxs)(n.Fragment,{children:[(0,o.jsx)(c,{id:"".concat(t,"-button"),"aria-controls":"".concat(t,"-menu"),"aria-haspopup":"true","aria-expanded":h?"true":void 0,onClick:e=>{u(e.currentTarget)},disabled:s,type:"button",children:a}),(0,o.jsx)(l.Vey,{id:"upload-main-menu",options:r,selectedOption:"",onSelect:e=>g(e),hideTriggerAction:()=>{g("")},open:h,anchorEl:d,anchorOrigin:"end"})]})}},66147:(e,t,a)=>{a.d(t,{A:()=>d});var n=a(9950),l=a(87946),r=a.n(l),s=a(95491),i=a.n(s),o=a(89132),c=a(44414);const d=e=>{let{elements:t,name:a,label:l,tooltip:s="",keyPlaceholder:d="",valuePlaceholder:u="",onChange:h,withBorder:g=!1}=e;const[p,x]=(0,n.useState)([""]),[m,y]=(0,n.useState)([""]),v=(0,n.createRef)();(0,n.useEffect)(()=>{if(1===p.length&&""===p[0]&&1===m.length&&""===m[0]&&t&&""!==t){const e=t.split("&");let a=[],n=[];e.forEach(e=>{const t=e.split("=");2===t.length&&(a.push(t[0]),n.push(t[1]))}),a.push(""),n.push(""),x(a),y(n)}},[p,m,t]),(0,n.useEffect)(()=>{const e=v.current;e&&p.length>1&&e.scrollIntoView(!1)},[p]);const b=(0,n.useRef)(!0);(0,n.useLayoutEffect)(()=>{b.current?b.current=!1:f()},[p,m]);const S=e=>{e.persist();let t=[...p];const a=r()(e.target,"dataset.index","0");t[parseInt(a)]=e.target.value,x(t)},j=e=>{e.persist();let t=[...m];const a=r()(e.target,"dataset.index","0");t[parseInt(a)]=e.target.value,y(t)},f=i()(()=>{let e="";p.forEach((t,a)=>{if(p[a]&&m[a]){let n="".concat(t,"=").concat(m[a]);0!==a&&(n="&".concat(n)),e="".concat(e).concat(n)}}),h(e)},500),C=m.map((e,t)=>(0,c.jsxs)(o.xA9,{item:!0,xs:12,className:"lineInputBoxes inputItem",children:[(0,c.jsx)(o.cl_,{id:"".concat(a,"-key-").concat(t.toString()),label:"",name:"".concat(a,"-").concat(t.toString()),value:p[t],onChange:S,index:t,placeholder:d}),(0,c.jsx)("span",{className:"queryDiv",children:":"}),(0,c.jsx)(o.cl_,{id:"".concat(a,"-value-").concat(t.toString()),label:"",name:"".concat(a,"-").concat(t.toString()),value:m[t],onChange:j,index:t,placeholder:u,overlayIcon:t===m.length-1?(0,c.jsx)(o.REV,{}):null,overlayAction:()=>{(()=>{if(""!==p[p.length-1].trim()&&""!==m[m.length-1].trim()){const e=[...p],t=[...m];e.push(""),t.push(""),x(e),y(t)}})()}})]},"query-pair-".concat(a,"-").concat(t.toString())));return(0,c.jsx)(n.Fragment,{children:(0,c.jsxs)(o.xA9,{item:!0,xs:12,sx:{"& .lineInputBoxes":{display:"flex"},"& .queryDiv":{alignSelf:"center",margin:"-15px 4px 0",fontWeight:600}},className:"inputItem",children:[(0,c.jsxs)(o.l1Y,{children:[l,""!==s&&(0,c.jsx)(o.azJ,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,c.jsx)(o.m_M,{tooltip:s,placement:"top",children:(0,c.jsx)(o.NTw,{style:{width:13,height:13}})})})]}),(0,c.jsxs)(o.azJ,{withBorders:g,sx:{padding:15,height:150,overflowY:"auto",position:"relative",marginTop:15},children:[C,(0,c.jsx)("div",{ref:v})]})]})})}}}]); ================================================ FILE: web-app/build/static/js/1366.a5842d56.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[1366],{31366:(e,l,t)=>{t.r(l),t.d(l,{default:()=>u});var a=t(9950),o=t(89132),n=t(31690),c=t(99491),i=t(49078),s=t(82817),r=t(70503),d=t(44414),p=null;const u=()=>{const[e,l]=(0,a.useState)(!1),[t,u]=(0,a.useState)(["cpu","mem","block","mutex","goroutines"]),b=e=>{let l=[];l=t.indexOf(e.target.value)>-1?t.filter(l=>l!==e.target.value):[...t,e.target.value],u(l)},m=(0,c.jL)();return(0,a.useEffect)(()=>{m((0,i.ph)("profile"))},[]),(0,d.jsxs)(a.Fragment,{children:[(0,d.jsx)(s.A,{label:"Profile",actions:(0,d.jsx)(r.A,{})}),(0,d.jsx)(o.Mxu,{children:(0,d.jsxs)(o.Hbc,{children:[(0,d.jsxs)(o.azJ,{sx:{display:"flex",gap:10,"& div":{width:"initial"},"& .inputItem:not(:last-of-type)":{marginBottom:0}},children:[(0,d.jsx)(o.l1Y,{noMinWidth:!0,children:"Types to profile:"}),[{label:"cpu",value:"cpu"},{label:"mem",value:"mem"},{label:"block",value:"block"},{label:"mutex",value:"mutex"},{label:"goroutines",value:"goroutines"}].map(l=>(0,d.jsx)(o.Sc0,{checked:t.indexOf(l.value)>-1,disabled:e,id:"checkbox-".concat(l.label),label:l.label,name:"checkbox-".concat(l.label),onChange:b,value:l.value},"checkbox-".concat(l.label)))]}),(0,d.jsxs)(o.azJ,{sx:{display:"flex",justifyContent:"flex-end",marginTop:24,gap:10},children:[(0,d.jsx)(o.$nd,{id:"start-profiling",type:"submit",variant:"callAction",disabled:e||t.length<1,onClick:()=>{(()=>{const e=t.join(","),a=new URL(window.location.toString()),o=a.port,c=new URL(document.baseURI).pathname,i=(0,n.nw)(a.protocol);if(null!==(p=new WebSocket("".concat(i,"://").concat(a.hostname,":").concat(o).concat(c,"ws/profile?types=").concat(e))))p.onopen=()=>{l(!0),p.send("ok")},p.onmessage=e=>{let t=new Blob([e.data],{type:"application/zip"});l(!1);var a=document.createElement("a");a.href=window.URL.createObjectURL(t),a.download="profile.zip",document.body.appendChild(a),a.click(),document.body.removeChild(a)},p.onclose=()=>{console.log("connection closed by server"),l(!1)}})()},label:"Start Profiling"}),(0,d.jsx)(o.$nd,{id:"stop-profiling",type:"submit",variant:"callAction",color:"primary",disabled:!e,onClick:()=>{p.close(1e3),l(!1)},label:"Stop Profiling"})]})]})})]})}}}]); ================================================ FILE: web-app/build/static/js/1378.ffc1d661.chunk.js ================================================ (self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[1378],{59660:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],o=0;o{"use strict";var o=n(59660),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,i,l,a,s,c,d=!1;t||(t={}),n=t.debug||!1;try{if(l=o(),a=document.createRange(),s=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(o){if(o.stopPropagation(),t.format)if(o.preventDefault(),"undefined"===typeof o.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=r[t.format]||r.default;window.clipboardData.setData(i,e)}else o.clipboardData.clearData(),o.clipboardData.setData(t.format,e);t.onCopy&&(o.preventDefault(),t.onCopy(o.clipboardData))}),document.body.appendChild(c),a.selectNodeContents(c),s.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");d=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),d=!0}catch(u){n&&console.error("unable to copy using clipboardData: ",u),n&&console.error("falling back to prompt"),i=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,e)}}finally{s&&("function"==typeof s.removeRange?s.removeRange(a):s.removeAllRanges()),c&&document.body.removeChild(c),l()}return d}},91378:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>j});var o=n(9950),r=n(98341),i=n(89132);const l="error",a="success",s="inProgress";var c=n(99491),d=n(31690),u=n(49078),p=n(47146),f=n(70444),h=n(44414);const x=e=>{let{title:t,children:n}=e;const[r,l]=(0,o.useState)("N/A"),[a,s]=(0,o.useState)(0),[c,d]=(0,o.useState)(0),[u,p]=(0,o.useState)(!0);return(0,o.useEffect)(()=>{u&&f.F.admin.adminInfo({defaultOnly:!0}).then(e=>{var t;const n=null===(t=e.data.servers)||void 0===t?void 0:t.length;if(s(n||0),e.data.servers&&e.data.servers.length>0){l(e.data.servers[0].version||"N/A");const t=e.data.servers.reduce((e,t)=>e+(t.drives?t.drives.length:0),0);d(t)}p(!1)}).catch(()=>{p(!1)})},[u]),(0,h.jsxs)(i.xA9,{item:!0,xs:12,children:[(0,h.jsx)(i._xt,{separator:!0,children:t}),(0,h.jsxs)(i.xA9,{item:!0,xs:12,children:[(0,h.jsx)(i.xA9,{item:!0,xs:12,sx:{padding:0,marginBottom:25},children:(0,h.jsx)(i.xA9,{container:!0,sx:{padding:25},children:u?(0,h.jsx)(o.Fragment,{children:(0,h.jsx)(i.xA9,{item:!0,xs:12,sx:{textAlign:"center"},children:(0,h.jsx)(i.aHM,{style:{width:25,height:25}})})}):(0,h.jsxs)(o.Fragment,{children:[(0,h.jsxs)(i.xA9,{item:!0,xs:12,md:4,sx:{fontSize:18,display:"flex",alignItems:"center","& svg":{marginRight:10}},children:[(0,h.jsx)(i.JUN,{})," ",(0,h.jsx)("strong",{children:a}),"\xa0nodes,\xa0",(0,h.jsx)("strong",{children:c}),"\xa0 drives"]}),(0,h.jsxs)(i.xA9,{item:!0,xs:12,md:4,sx:{fontSize:12,justifyContent:"center",alignSelf:"center",alignItems:"center",display:"flex"},children:[(0,h.jsx)("span",{style:{marginRight:20},children:(0,h.jsx)(i.mzI,{})})," ","MinIO VERSION\xa0",(0,h.jsx)("strong",{children:r})]})]})})}),n]})]})};var g=n(82817),y=n(70503),m=n(94797);const b=e=>{let{serverHealthInfo:t}=e;const[n,r]=(0,o.useState)("tab-details"),[l,a]=(0,o.useState)(!1),[s,c]=(0,o.useState)(!1),[d,u]=(0,o.useState)(!1),[p,f]=(0,o.useState)(!1),[x,g]=(0,o.useState)(!1),[y,b]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[C,S]=(0,o.useState)(!1),[w,O]=(0,o.useState)(!1),[k,A]=(0,o.useState)(!1),[T,D]=(0,o.useState)(!1),[H,R]=(0,o.useState)(!1),[I,J]=(0,o.useState)(!1),[P,N]=(0,o.useState)(!1),[E,z]=(0,o.useState)(!1),[U,_]=(0,o.useState)(!1);return(0,h.jsx)(i.azJ,{sx:{textAlign:"center",marginBottom:25},children:(0,h.jsx)(i.tUM,{currentTabOrPath:n,onTabClick:e=>{r(e)},horizontal:!0,horizontalBarBackground:!0,options:[{tabConfig:{icon:(0,h.jsx)(i.dLE,{}),id:"tab-details",label:"Health Info (Preview)"},content:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(i.nD3,{title:"System Health Info",id:"system-health-info",expanded:l,onTitleClick:()=>a(!l),sx:{marginTop:0},children:[(0,h.jsx)(i.nD3,{title:"CPU Info",id:"cpu-info",expanded:s,onTitleClick:()=>c(!s),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.sys.cpus,null,4),editorHeight:"850px",onChange:()=>{},readOnly:!0})}),(0,h.jsx)(i.nD3,{title:"Drives Partitions Info",id:"drives-partitions-info",expanded:d,onTitleClick:()=>u(!d),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.sys.partitions,null,4),editorHeight:"850px",onChange:()=>{},readOnly:!0})}),(0,h.jsx)(i.nD3,{title:"OS Info",id:"os-info",expanded:p,onTitleClick:()=>f(!p),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.sys.osinfo,null,4),editorHeight:"850px",onChange:()=>{},readOnly:!0})}),(0,h.jsx)(i.nD3,{title:"Memory Info",id:"memory-info",expanded:x,onTitleClick:()=>g(!x),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.sys.meminfo,null,4),editorHeight:"450px",onChange:()=>{},readOnly:!0})}),(0,h.jsx)(i.nD3,{title:"Process Info",id:"process-info",expanded:y,onTitleClick:()=>b(!y),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.sys.procinfo,null,4),editorHeight:"850px",onChange:()=>{},readOnly:!0})}),(0,h.jsx)(i.nD3,{title:"Network Info",id:"network-info",expanded:j,onTitleClick:()=>v(!j),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.sys.netinfo,null,4),editorHeight:"450px",onChange:()=>{},readOnly:!0})}),(0,h.jsx)(i.nD3,{title:"Erros",id:"errors-info",expanded:C,onTitleClick:()=>S(!C),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.sys.errors,null,4),editorHeight:"250px",onChange:()=>{},readOnly:!0})}),(0,h.jsx)(i.nD3,{title:"Services",id:"services-info",expanded:w,onTitleClick:()=>O(!w),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.sys.services,null,4),editorHeight:"450px",onChange:()=>{},readOnly:!0})}),(0,h.jsx)(i.nD3,{title:"Server Config",id:"config-info",expanded:k,onTitleClick:()=>A(!k),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.sys.config,null,4),editorHeight:"450px",onChange:()=>{},readOnly:!0})})]}),(0,h.jsxs)(i.nD3,{title:"MinIO Health Info",id:"minio-health",expanded:T,onTitleClick:()=>D(!T),sx:{marginTop:10},children:[(0,h.jsxs)(i.nD3,{title:"Info",id:"minio-health-info",expanded:I,onTitleClick:()=>J(!I),sx:{marginTop:10},children:[(0,h.jsxs)(i.azJ,{useBackground:!0,sx:{margin:"10px 0px",padding:"5px"},children:["Mode: ",t.minio.info.mode,(0,h.jsx)("br",{}),"deploymentID: ",t.minio.info.deploymentID,(0,h.jsx)("br",{}),"Buckets: ",t.minio.info.buckets.count,"\u2003 Objects: ",t.minio.info.objects.count,"\u2003 Usage: ",t.minio.info.usage.size," Bytes",(0,h.jsx)("br",{})]}),(0,h.jsx)(i.nD3,{title:"Backend",id:"minio-backend-info",expanded:P,onTitleClick:()=>N(!P),sx:{marginTop:5},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.minio.info.backend,null,4),editorHeight:"300px",onChange:()=>{},readOnly:!0})}),(0,h.jsx)(i.nD3,{title:"Servers",id:"minio-info-servers",expanded:E,onTitleClick:()=>z(!E),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.minio.info.servers,null,4),editorHeight:"450px",onChange:()=>{},readOnly:!0})}),(0,h.jsx)(i.nD3,{title:"Metrics",id:"minio-info-metrics",expanded:U,onTitleClick:()=>_(!U),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.minio.info.metrics,null,4),editorHeight:"400px",onChange:()=>{},readOnly:!0})})]}),(0,h.jsx)(i.nD3,{title:"Config",id:"minio-health-config",expanded:H,onTitleClick:()=>R(!H),sx:{marginTop:0},children:(0,h.jsx)(m.A,{label:"",value:JSON.stringify(t.minio.config.config,null,4),editorHeight:"800px",onChange:()=>{},readOnly:!0})})]})]})},{tabConfig:{icon:(0,h.jsx)(i.loI,{}),id:"tab-raw",label:"RAW JSON"},content:(0,h.jsxs)(i.azJ,{children:[(0,h.jsx)(i.$nd,{label:"Download JSON",id:"download-results","aria-label":"Download JSON",onClick:()=>{const e=new Date;let n=document.createElement("a");n.setAttribute("href","data:application/json;charset=utf-8,"+JSON.stringify(t)),n.setAttribute("download","health_results-".concat(e.toISOString(),".json")),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)},icon:(0,h.jsx)(i.s3U,{}),variant:"callAction"}),(0,h.jsx)(m.A,{label:"Server Health Info",value:JSON.stringify(t,null,4),editorHeight:"850px",onChange:()=>{},readOnly:!0})]})}]})})},j=()=>{const e=(0,c.jL)(),t=(0,r.d4)(e=>e.healthInfo.message),n=(0,r.d4)(e=>e.system.serverDiagnosticStatus),[f,m]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!0),[C,S]=(0,o.useState)(""),[w,O]=(0,o.useState)("Start Health Report"),[k,A]=(0,o.useState)("Health Report"),[T,D]=(0,o.useState)(""),[H,R]=(0,o.useState)(""),[I,J]=(0,o.useState)();(0,o.useEffect)(()=>n===s?(A("Health Report in progress..."),void S("Health Report started. Please do not refresh page during diagnosis.")):n===a?(A("Health Report complete"),S("Health Report file is ready to be downloaded."),void O("Start Health Report")):n===l?(A("Error"),S("An error occurred while getting the Health Report file."),void O("Retry Health Report")):void 0,[n,f]),(0,o.useEffect)(()=>{n===a&&t!=={}&&v(!1),n===s&&v(!0),m(!1)},[n,t]),(0,o.useEffect)(()=>{if(f){e((0,p.Zq)()),D(""),J(void 0);const t=new URL(window.location.toString()),n=!1?"9090":t.port,o=(0,d.nw)(t.protocol),r=new URL(document.baseURI).pathname,i=new WebSocket("".concat(o,"://").concat(t.hostname,":").concat(n).concat(r,"ws/health-info?deadline=1h"));let c=null;null!==i&&(i.onopen=()=>{console.log("WebSocket Client Connected"),i.send("ok"),c=setInterval(()=>{i.send("ok")},1e4),S("Health Report started. Please do not refresh page during diagnosis."),e((0,u.f7)(s))},i.onmessage=t=>{let n=JSON.parse(t.data.toString());n.serverHealthInfo&&(e((0,p.zJ)(n.serverHealthInfo)),J(n.serverHealthInfo)),""!==n.encoded&&D(n.encoded),n.subnetResponse&&R(n.subnetResponse)},i.onerror=t=>{console.error("error closing websocket:",t),i.close(1e3),clearInterval(c),e((0,u.f7)(l))},i.onclose=t=>{clearInterval(c),t.code===d.Sf||t.code===d.gU||t.code===d.wU?(console.log("connection closed by server with code:",t.code),S("An error occurred while getting the Health Report file."),e((0,u.f7)(l))):(console.log("connection closed by server"),S("Health Report file is ready to be downloaded."),e((0,u.f7)(a)))})}else m(!1)},[f,e]);return(0,o.useEffect)(()=>{e((0,u.ph)("health_info"))},[e]),(0,h.jsxs)(o.Fragment,{children:[(0,h.jsx)(g.A,{label:"Health",actions:(0,h.jsx)(y.A,{})}),(0,h.jsxs)(i.Mxu,{children:[(0,h.jsx)(i.azJ,{withBorders:!0,children:(0,h.jsx)(x,{title:k,children:(0,h.jsx)(i.xA9,{container:!0,sx:{justifyContent:"flex-start",gap:20},children:(0,h.jsxs)(i.xA9,{item:!0,xs:12,sx:{textAlign:"center",marginBottom:25},children:[(0,h.jsx)("h2",{children:C}),(0,h.jsxs)(i.azJ,{sx:{textAlign:"center",marginBottom:25},children:[" ",""!==H&&!H.toLowerCase().includes("error")&&(0,h.jsxs)(i.xA9,{item:!0,xs:12,children:[(0,h.jsx)("strong",{children:"Health report generated successfully!"}),"\xa0"," ",(0,h.jsx)("strong",{children:"You can download the the Health report JSON File."})]}),(""===H||H.toLowerCase().includes("error"))&&n===a&&(0,h.jsxs)(i.xA9,{item:!0,xs:12,children:[(0,h.jsx)("strong",{children:"Something went wrong."}),"\xa0"," ",(0,h.jsx)("strong",{children:"May try again or download Health report JSON File."})]})]}),n===s?(0,h.jsx)(i.azJ,{sx:{paddingTop:8,paddingLeft:40},children:(0,h.jsx)(i.aHM,{style:{width:25,height:25}})}):(0,h.jsx)(o.Fragment,{children:(0,h.jsxs)(i.azJ,{sx:{display:"flex",gap:10,alignItems:"center",justifyContent:"center"},children:[(0,h.jsx)(i.azJ,{children:n!==l&&!j&&(0,h.jsx)(i.$nd,{id:"download",type:"submit",variant:"callAction",onClick:()=>(()=>{let e=document.createElement("a");e.setAttribute("href","data:application/gzip;base64,".concat(T)),e.setAttribute("download","diagnostic.json.gz"),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)})(),disabled:j,label:"Download"})}),(0,h.jsx)(i.azJ,{children:(0,h.jsx)(i.$nd,{id:"start-new-diagnostic",type:"submit",variant:"callAction",disabled:f,onClick:()=>{m(!0)},label:w})})]})})]},"start-download")})})}),!f&&(0,h.jsxs)(o.Fragment,{children:[(0,h.jsx)("br",{}),void 0===I?(0,h.jsx)(i.lVp,{title:"Cluster Health Report will be generated, you will be able to download the JSON File.",iconComponent:(0,h.jsx)(i.mo0,{}),help:"If the Health report cannot be generated at this time, please wait a moment and try again."}):(0,h.jsx)(b,{serverHealthInfo:I})]})]})]})}},94702:(e,t,n)=>{"use strict";function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.CopyToClipboard=void 0;var r=a(n(9950)),i=a(n(67243)),l=["text","onCopy","options","children"];function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function c(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function u(e,t){for(var n=0;n{"use strict";n.d(t,{A:()=>c});var o=n(9950),r=n(89132),i=n(95189),l=n.n(i),a=n(30272),s=n(44414);const c=e=>{let{value:t,label:n="",tooltip:i="",mode:c="json",onChange:d,editorHeight:u=250,helptip:p,readOnly:f=!1,disabled:h=!1}=e;return(0,s.jsx)(r.BYM,{value:t,onChange:e=>d(e),mode:c,tooltip:i,editorHeight:u,label:n,readOnly:f,disabled:h,helpTools:(0,s.jsx)(o.Fragment,{children:(0,s.jsx)(a.A,{tooltip:"Copy to Clipboard",children:(0,s.jsx)(l(),{text:t,children:(0,s.jsx)(r.$nd,{type:"button",id:"copy-code-mirror",icon:(0,s.jsx)(r.TdU,{}),color:"primary",variant:"regular"})})})}),helpTip:p,helpTipPlacement:"right"})}},95189:(e,t,n)=>{"use strict";var o=n(94702).CopyToClipboard;o.CopyToClipboard=o,e.exports=o}}]); ================================================ FILE: web-app/build/static/js/1621.35fa42d6.chunk.js ================================================ /*! For license information please see 1621.35fa42d6.chunk.js.LICENSE.txt */ (self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[1621],{2241:t=>{"use strict";var e=function(){};t.exports=e},8661:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>s});const n=["onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onFocus","onBlur","onInput","onInvalid","onReset","onSubmit","onLoad","onError","onKeyDown","onKeyPress","onKeyUp","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionEnd","onChange","onToggle"];function s(t,e){const i={};for(const s of n){const n=t[s];n&&(i[s]=e?t=>n(t,e(s)):n)}return i}},28097:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var n=i(9950);function s(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function o(){return(0,n.useReducer)(s,{value:void 0,error:void 0})}},32878:(t,e,i)=>{"use strict";function n(t,e,i){e||(e=[]);var n=e.length++;return Object.defineProperty({},"_",{set:function(s){e[n]=s,t.apply(i,e)}})}i.d(e,{dU:()=>lp,ng:()=>H,EA:()=>Pl,Tm:()=>ch,D6:()=>Gc,YE:()=>eh});var s=i(89379);function o(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function r(t,e){o(t,e),e.add(t)}function a(t,e,i){o(t,e),e.set(t,i)}function l(t,e,i){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:i;throw new TypeError("Private element is not present on this object")}function c(t,e,i){return i(l(t,e))}function h(t,e){return t.get(l(t,e))}function d(t,e,i){return t.set(l(t,e),i),i}var u,p,f,m,g,v,w,b,y,x,_,A,S,C,k,M,E,T,R=i(64467);function P(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then(function(t){return{value:t,done:e}})}return P=function(t){this.s=t,this.n=t.next},P.prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var i=this.s.return;return void 0===i?Promise.resolve({value:t,done:!0}):e(i.apply(this.s,arguments))},throw:function(t){var i=this.s.return;return void 0===i?Promise.reject(t):e(i.apply(this.s,arguments))}},new P(t)}e={};const I="object"===typeof process&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),D=[.001,0,0,.001,0,0],L=1.35,O=1,F=2,z=4,N=16,B=32,W=64,j=128,G=256,H={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},U="pdfjs_internal_editor_",V={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},q={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},X=0,K=1,Y=2,J=3,Q=3,Z=4,$={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},tt={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},et=1,it=2,nt=3,st=4,ot=5,rt={ERRORS:0,WARNINGS:1,INFOS:5},at={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},lt=0,ct=1,ht=2,dt=3;let ut=rt.WARNINGS;function pt(t){Number.isInteger(t)&&(ut=t)}function ft(){return ut}function mt(t){ut>=rt.INFOS&&console.info("Info: ".concat(t))}function gt(t){ut>=rt.WARNINGS&&console.warn("Warning: ".concat(t))}function vt(t){throw new Error(t)}function wt(t,e){t||vt(e)}function bt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;if(i&&"string"===typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);(null===e||void 0===e?void 0:e.length)>=2&&(t="http://".concat(t))}if(i.tryConvertEncoding)try{t=decodeURIComponent(escape(t))}catch(s){}}const n=e?URL.parse(t,e):URL.parse(t);return function(t){switch(null===t||void 0===t?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n)?n:null}function yt(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=URL.parse(t);return n?(n.hash=e,n.href):i&&bt(t,"http://example.com")?t.split("#",1)[0]+"".concat(e?"#".concat(e):""):""}function xt(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(t,e,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}const _t=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=new Error,t.constructor=t,t}();class At extends _t{constructor(t,e){super(t,"PasswordException"),this.code=e}}class St extends _t{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class Ct extends _t{constructor(t){super(t,"InvalidPDFException")}}class kt extends _t{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}}class Mt extends _t{constructor(t){super(t,"FormatError")}}class Et extends _t{constructor(t){super(t,"AbortException")}}function Tt(t){"object"===typeof t&&void 0!==(null===t||void 0===t?void 0:t.length)||vt("Invalid argument for bytesToString");const e=t.length,i=8192;if(et.toString(16).padStart(2,"0"));class Dt{static makeHexColor(t,e,i){return"#".concat(It[t]).concat(It[e]).concat(It[i])}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=t[i],s=t[i+1];t[i]=n*e[0]+s*e[2]+e[4],t[i+1]=n*e[1]+s*e[3]+e[5]}static applyTransformToBezier(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=e[0],s=e[1],o=e[2],r=e[3],a=e[4],l=e[5];for(let c=0;c<6;c+=2){const e=t[i+c],h=t[i+c+1];t[i+c]=e*n+h*o+a,t[i+c+1]=e*s+h*r+l}}static applyInverseTransform(t,e){const i=t[0],n=t[1],s=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-n*e[2]+e[2]*e[5]-e[4]*e[3])/s,t[1]=(-i*e[1]+n*e[0]+e[4]*e[1]-e[5]*e[0])/s}static axialAlignedBoundingBox(t,e,i){const n=e[0],s=e[1],o=e[2],r=e[3],a=e[4],l=e[5],c=t[0],h=t[1],d=t[2],u=t[3];let p=n*c+a,f=p,m=n*d+a,g=m,v=r*h+l,w=v,b=r*u+l,y=b;if(0!==s||0!==o){const t=s*c,e=s*d,i=o*h,n=o*u;p+=i,g+=i,m+=n,f+=n,v+=t,y+=t,b+=e,w+=e}i[0]=Math.min(i[0],p,m,f,g),i[1]=Math.min(i[1],v,b,w,y),i[2]=Math.max(i[2],p,m,f,g),i[3]=Math.max(i[3],v,b,w,y)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const i=t[0],n=t[1],s=t[2],o=t[3],r=i**2+n**2,a=i*s+n*o,l=s**2+o**2,c=(r+l)/2,h=Math.sqrt(c**2-(r*l-a**2));e[0]=Math.sqrt(c+h||1),e[1]=Math.sqrt(c-h||1)}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>n)return null;const s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),o=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return s>o?null:[i,s,n,o]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,n,s){s[0]=Math.min(s[0],t,i),s[1]=Math.min(s[1],e,n),s[2]=Math.max(s[2],t,i),s[3]=Math.max(s[3],e,n)}static bezierBoundingBox(t,e,i,n,s,o,r,a,c){c[0]=Math.min(c[0],t,r),c[1]=Math.min(c[1],e,a),c[2]=Math.max(c[2],t,r),c[3]=Math.max(c[3],e,a),l(Dt,this,Ot).call(this,t,i,s,r,e,n,o,a,3*(3*(i-s)-t+r),6*(t-2*i+s),3*(i-t),c),l(Dt,this,Ot).call(this,t,i,s,r,e,n,o,a,3*(3*(n-o)-e+a),6*(e-2*n+o),3*(n-e),c)}}function Lt(t,e,i,n,s,o,r,a,l,c){if(l<=0||l>=1)return;const h=1-l,d=l*l,u=d*l,p=h*(h*(h*t+3*l*e)+3*d*i)+u*n,f=h*(h*(h*s+3*l*o)+3*d*r)+u*a;c[0]=Math.min(c[0],p),c[1]=Math.min(c[1],f),c[2]=Math.max(c[2],p),c[3]=Math.max(c[3],f)}function Ot(t,e,i,n,s,o,r,a,c,h,d,p){if(Math.abs(c)<1e-12)return void(Math.abs(h)>=1e-12&&l(u,this,Lt).call(this,t,e,i,n,s,o,r,a,-d/h,p));const f=h**2-4*d*c;if(f<0)return;const m=Math.sqrt(f),g=2*c;l(u,this,Lt).call(this,t,e,i,n,s,o,r,a,(-h+m)/g,p),l(u,this,Lt).call(this,t,e,i,n,s,o,r,a,(-h-m)/g,p)}u=Dt;let Ft=null,zt=null;function Nt(){if("function"===typeof crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),Tt(t)}const Bt="pdfjs_internal_id_";function Wt(t,e,i){return Math.min(Math.max(t,e),i)}function jt(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(Tt(t))}"function"!==typeof Promise.try&&(Promise.try=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n{e(t(...i))})}),"function"!==typeof Math.sumPrecise&&(Math.sumPrecise=function(t){return t.reduce((t,e)=>t+e,0)});class Gt{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function t(i){var n;if(!i)return;let s=null;const o=i.name;if("#text"===o)s=i.value;else{if(!Gt.shouldBuildText(o))return;null!==i&&void 0!==i&&null!==(n=i.attributes)&&void 0!==n&&n.textContent?s=i.attributes.textContent:i.value&&(s=i.value)}if(null!==s&&e.push({str:s}),i.children)for(const e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}class Ht{static setupStorage(t,e,i,n,s){const o=n.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==o.value&&(t.textContent=o.value),"print"===s)break;t.addEventListener("input",t=>{n.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(o.value===i.attributes.xfaOn?t.setAttribute("checked",!0):o.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===s)break;t.addEventListener("change",t=>{n.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==o.value&&t.setAttribute("value",o.value),"print"===s)break;t.addEventListener("input",t=>{n.setValue(e,{value:t.target.value})})}break;case"select":if(null!==o.value){t.setAttribute("value",o.value);for(const t of i.children)t.attributes.value===o.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",t=>{const i=t.target.options,s=-1===i.selectedIndex?"":i[i.selectedIndex].value;n.setValue(e,{value:s})})}}static setAttributes(t){let{html:e,element:i,storage:n=null,intent:s,linkService:o}=t;const{attributes:r}=i,a=e instanceof HTMLAnchorElement;"radio"===r.type&&(r.name="".concat(r.name,"-").concat(s));for(const[l,c]of Object.entries(r))if(null!==c&&void 0!==c)switch(l){case"class":c.length&&e.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",c);break;case"style":Object.assign(e.style,c);break;case"textContent":e.textContent=c;break;default:(!a||"href"!==l&&"newWindow"!==l)&&e.setAttribute(l,c)}a&&o.addLinkAttributes(e,r.href,r.newWindow),n&&r.dataId&&this.setupStorage(e,r.dataId,i,n)}static render(t){const e=t.annotationStorage,i=t.linkService,n=t.xfaHtml,s=t.intent||"display",o=document.createElement(n.name);n.attributes&&this.setAttributes({html:o,element:n,intent:s,linkService:i});const r="richText"!==s,a=t.div;if(a.append(o),t.viewport){const e="matrix(".concat(t.viewport.transform.join(","),")");a.style.transform=e}r&&a.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===n.children.length){if(n.value){const t=document.createTextNode(n.value);o.append(t),r&&Gt.shouldBuildText(n.name)&&l.push(t)}return{textDivs:l}}const c=[[n,-1,o]];for(;c.length>0;){var h,d;const[t,n,o]=c.at(-1);if(n+1===t.children.length){c.pop();continue}const a=t.children[++c.at(-1)[1]];if(null===a)continue;const{name:u}=a;if("#text"===u){const t=document.createTextNode(a.value);l.push(t),o.append(t);continue}const p=null!==a&&void 0!==a&&null!==(h=a.attributes)&&void 0!==h&&h.xmlns?document.createElementNS(a.attributes.xmlns,u):document.createElement(u);if(o.append(p),a.attributes&&this.setAttributes({html:p,element:a,storage:e,intent:s,linkService:i}),(null===(d=a.children)||void 0===d?void 0:d.length)>0)c.push([a,-1,p]);else if(a.value){const t=document.createTextNode(a.value);r&&Gt.shouldBuildText(u)&&l.push(t),p.append(t)}}for(const u of a.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))u.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const e="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=e,t.div.hidden=!1}}const Ut="http://www.w3.org/2000/svg";class Vt{}async function qt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(Zt(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,n)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType=e,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(200!==s.status&&0!==s.status)n(new Error(s.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void i(s.response)}i(s.responseText)}},s.send(null)})}p=Vt,(0,R.A)(Vt,"CSS",96),(0,R.A)(Vt,"PDF",72),(0,R.A)(Vt,"PDF_TO_CSS_UNITS",p.CSS/p.PDF);class Xt{constructor(t){let{viewBox:e,userUnit:i,scale:n,rotation:s,offsetX:o=0,offsetY:r=0,dontFlip:a=!1}=t;this.viewBox=e,this.userUnit=i,this.scale=n,this.rotation=s,this.offsetX=o,this.offsetY=r,n*=i;const l=(e[2]+e[0])/2,c=(e[3]+e[1])/2;let h,d,u,p,f,m,g,v;switch(s%=360,s<0&&(s+=360),s){case 180:h=-1,d=0,u=0,p=1;break;case 90:h=0,d=1,u=1,p=0;break;case 270:h=0,d=-1,u=-1,p=0;break;case 0:h=1,d=0,u=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(u=-u,p=-p),0===h?(f=Math.abs(c-e[1])*n+o,m=Math.abs(l-e[0])*n+r,g=(e[3]-e[1])*n,v=(e[2]-e[0])*n):(f=Math.abs(l-e[0])*n+o,m=Math.abs(c-e[1])*n+r,g=(e[2]-e[0])*n,v=(e[3]-e[1])*n),this.transform=[h*n,d*n,u*n,p*n,f-h*n*l-u*n*c,m-d*n*l-p*n*c],this.width=g,this.height=v}get rawDims(){const t=this.viewBox;return xt(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Xt({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(t,e){const i=[t,e];return Dt.applyTransform(i,this.transform),i}convertToViewportRectangle(t){const e=[t[0],t[1]];Dt.applyTransform(e,this.transform);const i=[t[2],t[3]];return Dt.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){const i=[t,e];return Dt.applyInverseTransform(i,this.transform),i}}class Kt extends _t{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t,"RenderingCancelledException"),this.extraDelay=e}}function Yt(t){const e=t.length;let i=0;for(;i=1&&n<=12?n-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let o=parseInt(e[4],10);o=o>=0&&o<=23?o:0;let r=parseInt(e[5],10);r=r>=0&&r<=59?r:0;let a=parseInt(e[6],10);a=a>=0&&a<=59?a:0;const c=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===c?(o+=h,r+=d):"+"===c&&(o-=h,r-=d),new Date(Date.UTC(i,n,s,o,r,a))}}var ie={_:void 0};function ne(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(gt('Not a valid color format: "'.concat(t,'"')),[0,0,0])}function se(t){const{a:e,b:i,c:n,d:s,e:o,f:r}=t.getTransform();return[e,i,n,s,o,r]}function oe(t){const{a:e,b:i,c:n,d:s,e:o,f:r}=t.getTransform().invertSelf();return[e,i,n,s,o,r]}function re(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e instanceof Xt){const{pageWidth:n,pageHeight:s}=e.rawDims,{style:o}=t,r=Pt.isCSSRoundSupported,a="var(--total-scale-factor) * ".concat(n,"px"),l="var(--total-scale-factor) * ".concat(s,"px"),c=r?"round(down, ".concat(a,", var(--scale-round-x))"):"calc(".concat(a,")"),h=r?"round(down, ".concat(l,", var(--scale-round-y))"):"calc(".concat(l,")");i&&e.rotation%180!==0?(o.width=h,o.height=c):(o.width=c,o.height=h)}n&&t.setAttribute("data-main-rotation",e.rotation)}class ae{constructor(){const{pixelRatio:t}=ae;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=1/0,r=1/0,a=1/0;(i=ae.capPixels(i,s))>0&&(o=Math.sqrt(i/(t*e))),-1!==n&&(r=n/t,a=n/e);const l=Math.min(o,r,a);return(this.sx>l||this.sy>l)&&(this.sx=l,this.sy=l,!0)}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,i):i}return t}}const le=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class ce{static get isDarkMode(){var t,e;return xt(this,"isDarkMode",!(null===(t=window)||void 0===t||null===(e=t.matchMedia)||void 0===e||!e.call(t,"(prefers-color-scheme: dark)").matches))}}function he(t,e){const i=t[0]/255,n=t[1]/255,s=t[2]/255,o=Math.max(i,n,s),r=Math.min(i,n,s),a=(o+r)/2;if(o===r)e[0]=e[1]=0;else{const t=o-r;switch(e[1]=a<.5?t/(o+r):t/(2-o-r),o){case i:e[0]=60*((n-s)/t+(ns?(n+.05)/(s+.05):(s+.05)/(n+.05)}const fe=new Map;function me(t,e){let{html:i,dir:n,className:s}=t;const o=document.createDocumentFragment();if("string"===typeof i){const t=document.createElement("p");t.dir=n||"auto";const e=i.split(/(?:\r\n?|\n)/);for(let i=0,n=e.length;i{e.delete()},{signal:e._signal}),h(be,this).append(i)}async addAltText(t){const e=await t.render();l(Se,this,Te).call(this,e),h(be,this).append(e,c(Se,this,Re)),d(ye,this,t)}addComment(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(h(xe,this))return;const i=t.renderForToolbar();if(!i)return;l(Se,this,Te).call(this,i);const n=d(_e,this,c(Se,this,Re));e?(h(be,this).insertBefore(i,e),h(be,this).insertBefore(n,e)):h(be,this).append(i,n),d(xe,this,t),t.toolbar=this}addColorPicker(t){if(h(ve,this))return;d(ve,this,t);const e=t.renderButton();l(Se,this,Te).call(this,e),h(be,this).append(e,c(Se,this,Re))}async addEditSignatureButton(t){const e=d(Ae,this,await t.renderEditButton(h(we,this)));l(Se,this,Te).call(this,e),h(be,this).append(e,c(Se,this,Re))}removeButton(t){var e,i;if("comment"===t)null===(e=h(xe,this))||void 0===e||e.removeToolbarCommentButton(),d(xe,this,null),null===(i=h(_e,this))||void 0===i||i.remove(),d(_e,this,null)}async addButton(t,e){switch(t){case"colorPicker":this.addColorPicker(e);break;case"altText":await this.addAltText(e);break;case"editSignature":await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(e)}}async addButtonBefore(t,e,i){const n=h(be,this).querySelector(i);n&&"comment"===t&&this.addComment(e,n)}updateEditSignatureButton(t){h(Ae,this)&&(h(Ae,this).title=t)}remove(){var t;h(ge,this).remove(),null===(t=h(ve,this))||void 0===t||t.destroy(),d(ve,this,null)}}function ke(t){t.stopPropagation()}function Me(t){h(we,this)._focusEventsAllowed=!1,te(t)}function Ee(t){h(we,this)._focusEventsAllowed=!0,te(t)}function Te(t){const e=h(we,this)._uiManager._signal;return e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("focusin",l(Se,this,Me).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",l(Se,this,Ee).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",$t,{signal:e}),!0)}function Re(t){const e=document.createElement("div");return e.className="divider",e}var Pe={_:null},Ie=new WeakMap,De=new WeakMap,Le=new WeakMap,Oe=new WeakSet;class Fe{constructor(t){r(this,Oe),a(this,Ie,null),a(this,De,null),a(this,Le,void 0),d(Le,this,t)}show(t,e,i){const[n,s]=l(Oe,this,Ne).call(this,e,i),{style:o}=h(De,this)||d(De,this,l(Oe,this,ze).call(this));t.append(h(De,this)),o.insetInlineEnd="".concat(100*n,"%"),o.top="calc(".concat(100*s,"% + var(--editor-toolbar-vert-offset))")}hide(){h(De,this).remove()}}function ze(){const t=d(De,this,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");const e=h(Le,this)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",$t,{signal:e});const i=d(Ie,this,document.createElement("div"));return i.className="buttons",t.append(i),h(Le,this).hasCommentManager()&&l(Oe,this,Be).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{h(Le,this).commentSelection("floating_button")}),l(Oe,this,Be).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{h(Le,this).highlightSelection("floating_button")}),t}function Ne(t,e){let i=0,n=0;for(const s of t){const t=s.y+s.height;if(ti?(n=o,i=t):e?o>n&&(n=o):o(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async getFromFile(t){const{lastModified:e,name:i,size:n,type:s}=t;return l(qe,this,Ke).call(this,"".concat(e,"_").concat(i,"_").concat(n,"_").concat(s),t)}async getFromUrl(t){return l(qe,this,Ke).call(this,t,t)}async getFromBlob(t,e){const i=await e;return l(qe,this,Ke).call(this,t,i)}async getFromId(t){h(Ve,this)||d(Ve,this,new Map);const e=h(Ve,this).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){var i,n,s;h(Ve,this)||d(Ve,this,new Map);let o=h(Ve,this).get(t);if(null!==(s=o)&&void 0!==s&&s.bitmap)return o.refCounter+=1,o;const r=new OffscreenCanvas(e.width,e.height);return r.getContext("2d").drawImage(e,0,0),o={bitmap:r.transferToImageBitmap(),id:"image_".concat(h(He,this),"_").concat((d(Ue,this,(i=h(Ue,this),n=i++,i)),n)),refCounter:1,isSvg:!1},h(Ve,this).set(t,o),h(Ve,this).set(o.id,o),o}getSvgUrl(t){const e=h(Ve,this).get(t);return null!==e&&void 0!==e&&e.isSvg?e.svgUrl:null}deleteId(t){var e;h(Ve,this)||d(Ve,this,new Map);const i=h(Ve,this).get(t);if(!i)return;if(i.refCounter-=1,0!==i.refCounter)return;const{bitmap:n}=i;if(!i.url&&!i.file){const t=new OffscreenCanvas(n.width,n.height);t.getContext("bitmaprenderer").transferFromImageBitmap(n),i.blobPromise=t.convertToBlob()}null===(e=n.close)||void 0===e||e.call(n),i.bitmap=null}isValidId(t){return t.startsWith("image_".concat(h(He,this),"_"))}}async function Ke(t,e){var i;h(Ve,this)||d(Ve,this,new Map);let n=h(Ve,this).get(t);if(null===n)return null;if(null!==(i=n)&&void 0!==i&&i.bitmap)return n.refCounter+=1,n;try{var s,o;let t;if(n||(n={bitmap:null,id:"image_".concat(h(He,this),"_").concat((d(Ue,this,(s=h(Ue,this),o=s++,s)),o)),refCounter:0,isSvg:!1}),"string"===typeof e?(n.url=e,t=await qt(e,"blob")):e instanceof File?t=n.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){const e=f._isSVGFittingCanvas,i=new FileReader,s=new Image,o=new Promise((t,o)=>{s.onload=()=>{n.bitmap=s,n.isSvg=!0,t()},i.onload=async()=>{const t=n.svgUrl=i.result;s.src=await e?"".concat(t,"#svgView(preserveAspectRatio(none))"):t},s.onerror=i.onerror=o});i.readAsDataURL(t),await o}else n.bitmap=await createImageBitmap(t);n.refCounter=1}catch(r){gt(r),n=null}return h(Ve,this).set(t,n),n&&h(Ve,this).set(n.id,n),n}f=Xe;var Ye=new WeakMap,Je=new WeakMap,Qe=new WeakMap,Ze=new WeakMap;class $e{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;a(this,Ye,[]),a(this,Je,!1),a(this,Qe,void 0),a(this,Ze,-1),d(Qe,this,t)}add(t){let{cmd:e,undo:i,post:n,mustExec:s,type:o=NaN,overwriteIfSameType:r=!1,keepUndo:a=!1}=t;if(s&&e(),h(Je,this))return;const l={cmd:e,undo:i,post:n,type:o};if(-1===h(Ze,this))return h(Ye,this).length>0&&(h(Ye,this).length=0),d(Ze,this,0),void h(Ye,this).push(l);if(r&&h(Ye,this)[h(Ze,this)].type===o)return a&&(l.undo=h(Ye,this)[h(Ze,this)].undo),void(h(Ye,this)[h(Ze,this)]=l);const c=h(Ze,this)+1;c===h(Qe,this)?h(Ye,this).splice(0,1):(d(Ze,this,c),c=0;e--)if(h(Ye,this)[e].type!==t)return h(Ye,this).splice(e+1,h(Ze,this)-e),void d(Ze,this,e);h(Ye,this).length=0,d(Ze,this,-1)}}destroy(){d(Ye,this,null)}}var ti=new WeakSet;class ei{constructor(t){r(this,ti),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=Pt.platform;for(const[i,n,s={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:n,options:s}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:n,options:s}),this.allKeys.add(t.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(l(ti,this,ii).call(this,e));if(!i)return;const{callback:n,options:{bubbles:s=!1,args:o=[],checker:r=null}}=i;r&&!r(t,e)||(n.bind(t,...o,e)(),s||te(e))}}function ii(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e}class ni{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const i of t.keys()){e.style.color=i;const n=window.getComputedStyle(e).color;t.set(i,ne(n))}e.remove()}(t),xt(this,"_colors",t)}convert(t){const e=ne(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,n]of this._colors)if(n.every((t,i)=>t===e[i]))return ni._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?Dt.makeHexColor(...e):t}}(0,R.A)(ni,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var si=new WeakMap,oi=new WeakMap,ri=new WeakMap,ai=new WeakMap,li=new WeakMap,ci=new WeakMap,hi=new WeakMap,di=new WeakMap,ui=new WeakMap,pi=new WeakMap,fi=new WeakMap,mi=new WeakMap,gi=new WeakMap,vi=new WeakMap,wi=new WeakMap,bi=new WeakMap,yi=new WeakMap,xi=new WeakMap,_i=new WeakMap,Ai=new WeakMap,Si=new WeakMap,Ci=new WeakMap,ki=new WeakMap,Mi=new WeakMap,Ei=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,Pi=new WeakMap,Ii=new WeakMap,Di=new WeakMap,Li=new WeakMap,Oi=new WeakMap,Fi=new WeakMap,zi=new WeakMap,Ni=new WeakMap,Bi=new WeakMap,Wi=new WeakMap,ji=new WeakMap,Gi=new WeakMap,Hi=new WeakMap,Ui=new WeakMap,Vi=new WeakMap,qi=new WeakMap,Xi=new WeakMap,Ki=new WeakMap,Yi=new WeakMap,Ji=new WeakMap,Qi=new WeakMap,Zi=new WeakMap,$i=new WeakSet;class tn{static get _keyboardManager(){const t=tn.prototype,e=t=>h(Yi,t).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,e)=>{let{target:i}=e;if(i instanceof HTMLInputElement){const{type:t}=i;return"text"!==t&&"number"!==t}return!0},n=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return xt(this,"_keyboardManager",new ei([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&h(Yi,t).contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&h(Yi,t).contains(document.activeElement)}}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}]]))}constructor(t,e,i,n,s,o,c,u,p,f,m,g,v,w,b,y){r(this,$i),a(this,si,new AbortController),a(this,oi,null),a(this,ri,null),a(this,ai,new Map),a(this,li,new Map),a(this,ci,null),a(this,hi,null),a(this,di,null),a(this,ui,new $e),a(this,pi,null),a(this,fi,null),a(this,mi,null),a(this,gi,0),a(this,vi,new Set),a(this,wi,null),a(this,bi,null),a(this,yi,new Set),(0,R.A)(this,"_editorUndoBar",null),a(this,xi,!1),a(this,_i,!1),a(this,Ai,!1),a(this,Si,null),a(this,Ci,null),a(this,ki,null),a(this,Mi,null),a(this,Ei,!1),a(this,Ti,null),a(this,Ri,new Ge),a(this,Pi,!1),a(this,Ii,!1),a(this,Di,!1),a(this,Li,null),a(this,Oi,null),a(this,Fi,null),a(this,zi,null),a(this,Ni,null),a(this,Bi,V.NONE),a(this,Wi,new Set),a(this,ji,null),a(this,Gi,null),a(this,Hi,null),a(this,Ui,null),a(this,Vi,null),a(this,qi,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),a(this,Xi,[0,0]),a(this,Ki,null),a(this,Yi,null),a(this,Ji,null),a(this,Qi,null),a(this,Zi,null);const x=this._signal=h(si,this).signal;d(Yi,this,t),d(Ji,this,e),d(Qi,this,i),d(ci,this,n),d(pi,this,s),d(Gi,this,o),d(Vi,this,u),this._eventBus=c,c._on("editingaction",this.onEditingAction.bind(this),{signal:x}),c._on("pagechanging",this.onPageChanging.bind(this),{signal:x}),c._on("scalechanging",this.onScaleChanging.bind(this),{signal:x}),c._on("rotationchanging",this.onRotationChanging.bind(this),{signal:x}),c._on("setpreference",this.onSetPreference.bind(this),{signal:x}),c._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:x}),window.addEventListener("pointerdown",()=>{d(Ii,this,!0)},{capture:!0,signal:x}),window.addEventListener("pointerup",()=>{d(Ii,this,!1)},{capture:!0,signal:x}),l($i,this,an).call(this),l($i,this,fn).call(this),l($i,this,hn).call(this),d(hi,this,u.annotationStorage),d(Si,this,u.filterFactory),d(Hi,this,p),d(Mi,this,f||null),d(xi,this,m),d(_i,this,g),d(Ai,this,v),d(Ni,this,w||null),this.viewParameters={realScale:Vt.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=b||null,this._supportsPinchToZoom=!1!==y,null===s||void 0===s||s.setSidebarUiManager(this)}destroy(){var t,e,i,n,s,o,r,a,l;null===(t=h(Zi,this))||void 0===t||t.resolve(),d(Zi,this,null),null===(e=h(si,this))||void 0===e||e.abort(),d(si,this,null),this._signal=null;for(const c of h(li,this).values())c.destroy();h(li,this).clear(),h(ai,this).clear(),h(yi,this).clear(),null===(i=h(zi,this))||void 0===i||i.clear(),d(oi,this,null),h(Wi,this).clear(),h(ui,this).destroy(),null===(n=h(ci,this))||void 0===n||n.destroy(),null===(s=h(pi,this))||void 0===s||s.destroy(),null===(o=h(Gi,this))||void 0===o||o.destroy(),null===(r=h(Ti,this))||void 0===r||r.hide(),d(Ti,this,null),null===(a=h(Fi,this))||void 0===a||a.destroy(),d(Fi,this,null),d(ri,this,null),h(Ci,this)&&(clearTimeout(h(Ci,this)),d(Ci,this,null)),h(Ki,this)&&(clearTimeout(h(Ki,this)),d(Ki,this,null)),null===(l=this._editorUndoBar)||void 0===l||l.destroy(),d(Vi,this,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return h(Ni,this)}get useNewAltTextFlow(){return h(_i,this)}get useNewAltTextWhenAddingImage(){return h(Ai,this)}get hcmFilter(){return xt(this,"hcmFilter",h(Hi,this)?h(Si,this).addHCMFilter(h(Hi,this).foreground,h(Hi,this).background):"none")}get direction(){return xt(this,"direction",getComputedStyle(h(Yi,this)).direction)}get _highlightColors(){return xt(this,"_highlightColors",h(Mi,this)?new Map(h(Mi,this).split(",").map(t=>((t=t.split("=").map(t=>t.trim()))[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){const{_highlightColors:t}=this;if(!t)return xt(this,"highlightColors",null);const e=new Map,i=!!h(Hi,this);for(const[n,s]of t){const t=n.endsWith("_HCM");i&&t?e.set(n.replace("_HCM",""),s):i||t||e.set(n,s)}return xt(this,"highlightColors",e)}get highlightColorNames(){return xt(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;const e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),d(mi,this,t)}setMainHighlightColorPicker(t){d(Fi,this,t)}editAltText(t){var e;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null===(e=h(ci,this))||void 0===e||e.editAltText(this,t,i)}hasCommentManager(){return!!h(pi,this)}editComment(t,e,i,n){var s;null===(s=h(pi,this))||void 0===s||s.showDialog(this,t,e,i,n)}selectComment(t,e){const i=h(li,this).get(t),n=null===i||void 0===i?void 0:i.getEditorByUID(e);null===n||void 0===n||n.toggleComment(!0,!0)}updateComment(t){var e;null===(e=h(pi,this))||void 0===e||e.updateComment(t.getData())}updatePopupColor(t){var e;null===(e=h(pi,this))||void 0===e||e.updatePopupColor(t)}removeComment(t){var e;null===(e=h(pi,this))||void 0===e||e.removeComments([t.uid])}toggleComment(t,e){var i;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;null===(i=h(pi,this))||void 0===i||i.toggleCommentPopup(t,e,n)}makeCommentColor(t,e){var i;return t&&(null===(i=h(pi,this))||void 0===i?void 0:i.makeCommentColor(t,e))||null}getCommentDialogElement(){var t;return(null===(t=h(pi,this))||void 0===t?void 0:t.dialogElement)||null}async waitForEditorsRendered(t){if(h(li,this).has(t-1))return;const{resolve:e,promise:i}=Promise.withResolvers(),n=i=>{i.pageNumber===t&&(this._eventBus._off("editorsrendered",n),e())};this._eventBus.on("editorsrendered",n),await i}getSignature(t){var e;null===(e=h(Gi,this))||void 0===e||e.getSignature({uiManager:this,editor:t})}get signatureManager(){return h(Gi,this)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference(t){let{name:e,value:i}=t;if("enableNewAltTextWhenAddingImage"===e)d(Ai,this,i)}onPageChanging(t){let{pageNumber:e}=t;d(gi,this,e-1)}focusMainContainer(){h(Yi,this).focus()}findParent(t,e){for(const i of h(li,this).values()){const{x:n,y:s,width:o,height:r}=i.div.getBoundingClientRect();if(t>=n&&t<=n+o&&e>=s&&e<=s+r)return i}return null}disableUserSelect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];h(Ji,this).classList.toggle("noUserSelect",t)}addShouldRescale(t){h(yi,this).add(t)}removeShouldRescale(t){h(yi,this).delete(t)}onScaleChanging(t){var e;let{scale:i}=t;this.commitOrRemove(),this.viewParameters.realScale=i*Vt.PDF_TO_CSS_UNITS;for(const n of h(yi,this))n.onScaleChanging();null===(e=h(mi,this))||void 0===e||e.onScaleChanging()}onRotationChanging(t){let{pagesRotation:e}=t;this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:r}=i,a=i.toString(),c=l($i,this,en).call(this,i).closest(".textLayer"),d=this.getSelectionBoxes(c);if(!d)return;i.empty();const u=l($i,this,nn).call(this,c),p=h(Bi,this)===V.NONE,f=()=>{const i=null===u||void 0===u?void 0:u.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:r,text:a});p&&this.showAllEditors("highlight",!0,!0),e&&(null===i||void 0===i||i.editComment())};p?this.switchToMode(V.HIGHLIGHT,f):f()}commentSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!h(hi,this))return null;const e="".concat(U).concat(t),i=h(hi,this).getRawValue(e);return i&&h(hi,this).remove(e),i}addToAnnotationStorage(t){t.isEmpty()||!h(hi,this)||h(hi,this).has(t.id)||h(hi,this).setValue(t.id,t)}a11yAlert(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=h(Qi,this);i&&(i.setAttribute("data-l10n-id",t),e?i.setAttribute("data-l10n-args",JSON.stringify(e)):i.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,h(Ei,this)&&(d(Ei,this,!1),l($i,this,rn).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of h(Wi,this))if(e.div.contains(t)){d(Oi,this,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!h(Oi,this))return;const[t,e]=h(Oi,this);d(Oi,this,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){l($i,this,hn).call(this),l($i,this,un).call(this)}removeEditListeners(){l($i,this,dn).call(this),l($i,this,pn).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of h(bi,this))if(i.isHandlingMimeForPasting(e))return t.dataTransfer.dropEffect="copy",void t.preventDefault()}drop(t){for(const e of t.dataTransfer.items)for(const i of h(bi,this))if(i.isHandlingMimeForPasting(e.type))return i.paste(e,this.currentLayer),void t.preventDefault()}copy(t){var e;if(t.preventDefault(),null===(e=h(oi,this))||void 0===e||e.commitOrRemove(),!this.hasSelection)return;const i=[];for(const n of h(Wi,this)){const t=n.serialize(!0);t&&i.push(t)}0!==i.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const o of e.items)for(const t of h(bi,this))if(t.isHandlingMimeForPasting(o.type))return void t.paste(o,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(s){return void gt('paste: "'.concat(s.message,'".'))}if(!Array.isArray(i))return;this.unselectAll();const n=this.currentLayer;try{const t=[];for(const o of i){const e=await n.deserialize(o);if(!e)return;t.push(e)}const e=()=>{for(const e of t)l($i,this,bn).call(this,e);l($i,this,_n).call(this,t)},s=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:s,mustExec:!0})}catch(s){gt('paste: "'.concat(s.message,'".'))}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),h(Bi,this)===V.NONE||this.isEditorHandlingKeyboard||tn._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,h(Ei,this)&&(d(Ei,this,!1),l($i,this,rn).call(this,"main_toolbar")))}onEditingAction(t){let{name:e}=t;switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu")}}setEditingState(t){t?(l($i,this,ln).call(this),l($i,this,un).call(this),l($i,this,mn).call(this,{isEditing:h(Bi,this)!==V.NONE,isEmpty:l($i,this,xn).call(this),hasSomethingToUndo:h(ui,this).hasSomethingToUndo(),hasSomethingToRedo:h(ui,this).hasSomethingToRedo(),hasSelectedEditor:!1})):(l($i,this,cn).call(this),l($i,this,pn).call(this),l($i,this,mn).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!h(bi,this)){d(bi,this,t);for(const t of h(bi,this))l($i,this,gn).call(this,t.defaultPropertiesToUpdate)}}getId(){return h(Ri,this).id}get currentLayer(){return h(li,this).get(h(gi,this))}getLayer(t){return h(li,this).get(t)}get currentPageIndex(){return h(gi,this)}addLayer(t){h(li,this).set(t.pageIndex,t),h(Pi,this)?t.enable():t.disable()}removeLayer(t){h(li,this).delete(t.pageIndex)}async updateMode(t){var e,i;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(h(Bi,this)!==t&&(!h(Zi,this)||(await h(Zi,this).promise,h(Zi,this)))){var a,c;if(d(Zi,this,Promise.withResolvers()),null===(e=h(mi,this))||void 0===e||e.commitOrRemove(),h(Bi,this)===V.POPUP)null===(a=h(pi,this))||void 0===a||a.hideSidebar();if(null===(i=h(pi,this))||void 0===i||i.destroyPopup(),d(Bi,this,t),t===V.NONE){var u;this.setEditingState(!1),l($i,this,wn).call(this);for(const t of h(ai,this).values())t.hideStandaloneCommentButton();return null===(u=this._editorUndoBar)||void 0===u||u.hide(),this.toggleComment(null),void h(Zi,this).resolve()}for(const t of h(ai,this).values())t.addStandaloneCommentButton();if(t===V.SIGNATURE)await(null===(c=h(Gi,this))||void 0===c?void 0:c.loadSignatures());this.setEditingState(!0),await l($i,this,vn).call(this),this.unselectAll();for(const e of h(li,this).values())e.updateMode(t);if(t===V.POPUP){var p;h(ri,this)||d(ri,this,await h(Vi,this).getAnnotationsByType(new Set(h(bi,this).map(t=>t._editorType))));const t=new Set,e=[];for(const i of h(ai,this).values()){const{annotationElementId:n,hasComment:s,deleted:o}=i;n&&t.add(n),s&&!o&&e.push(i.getData())}for(const i of h(ri,this)){const{id:n,popupRef:s,contentsObj:o}=i;s&&null!==o&&void 0!==o&&o.str&&!t.has(n)&&!h(vi,this).has(n)&&e.push(i)}null===(p=h(pi,this))||void 0===p||p.showSidebar(e)}if(!n)return s&&this.addNewEditorFromKeyboard(),void h(Zi,this).resolve();for(const t of h(ai,this).values())t.uid===n?(this.setSelected(t),r?t.editComment():o?t.enterInEditMode():t.focus()):t.unselect();h(Zi,this).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==h(Bi,this)&&this._eventBus.dispatch("switchannotationeditormode",(0,s.A)({source:this},t))}updateParams(t,e){if(h(bi,this)){switch(t){case q.CREATE:return void this.currentLayer.addNewEditor(e);case q.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(h(Ui,this)||d(Ui,this,new Map)).set(t,e),this.showAllEditors("highlight",e)}if(this.hasSelection)for(const i of h(Wi,this))i.updateParams(t,e);else for(const i of h(bi,this))i.updateDefaultParams(t,e)}}showAllEditors(t,e){var i,n;for(const s of h(ai,this).values())s.editorType===t&&s.show(e);(null===(i=null===(n=h(Ui,this))||void 0===n?void 0:n.get(q.HIGHLIGHT_SHOW_ALL))||void 0===i||i)!==e&&l($i,this,gn).call(this,[[q.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(h(Di,this)!==t){d(Di,this,t);for(const e of h(li,this).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(const e of h(ai,this).values())e.pageIndex===t&&(yield e)}getEditor(t){return h(ai,this).get(t)}addEditor(t){h(ai,this).set(t.id,t)}removeEditor(t){var e,i;(t.div.contains(document.activeElement)&&(h(Ci,this)&&clearTimeout(h(Ci,this)),d(Ci,this,setTimeout(()=>{this.focusMainContainer(),d(Ci,this,null)},0))),h(ai,this).delete(t.id),t.annotationElementId)&&(null===(e=h(zi,this))||void 0===e||e.delete(t.annotationElementId));(this.unselect(t),t.annotationElementId&&h(vi,this).has(t.annotationElementId))||(null===(i=h(hi,this))||void 0===i||i.remove(t.id))}addDeletedAnnotationElement(t){h(vi,this).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return h(vi,this).has(t)}removeDeletedAnnotationElement(t){h(vi,this).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){h(oi,this)!==t&&(d(oi,this,t),t&&l($i,this,gn).call(this,t.propertiesToUpdate))}updateUI(t){c($i,this,yn)===t&&l($i,this,gn).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){l($i,this,gn).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(h(Wi,this).has(t))return h(Wi,this).delete(t),t.unselect(),void l($i,this,mn).call(this,{hasSelectedEditor:this.hasSelection});h(Wi,this).add(t),t.select(),l($i,this,gn).call(this,t.propertiesToUpdate),l($i,this,mn).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;this.updateToolbar({mode:t.mode,editId:t.id}),null===(e=h(mi,this))||void 0===e||e.commitOrRemove();for(const i of h(Wi,this))i!==t&&i.unselect();h(Wi,this).clear(),h(Wi,this).add(t),t.select(),l($i,this,gn).call(this,t.propertiesToUpdate),l($i,this,mn).call(this,{hasSelectedEditor:!0})}isSelected(t){return h(Wi,this).has(t)}get firstSelectedEditor(){return h(Wi,this).values().next().value}unselect(t){t.unselect(),h(Wi,this).delete(t),l($i,this,mn).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==h(Wi,this).size}get isEnterHandled(){return 1===h(Wi,this).size&&this.firstSelectedEditor.isEnterHandled}undo(){var t;h(ui,this).undo(),l($i,this,mn).call(this,{hasSomethingToUndo:h(ui,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:l($i,this,xn).call(this)}),null===(t=this._editorUndoBar)||void 0===t||t.hide()}redo(){h(ui,this).redo(),l($i,this,mn).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:h(ui,this).hasSomethingToRedo(),isEmpty:l($i,this,xn).call(this)})}addCommands(t){h(ui,this).add(t),l($i,this,mn).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:l($i,this,xn).call(this)})}cleanUndoStack(t){h(ui,this).cleanType(t)}delete(){var t;this.commitOrRemove();const e=null===(t=this.currentLayer)||void 0===t?void 0:t.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const i=e?[e]:[...h(Wi,this)],n=()=>{for(const t of i)l($i,this,bn).call(this,t)};this.addCommands({cmd:()=>{var t;null===(t=this._editorUndoBar)||void 0===t||t.show(n,1===i.length?i[0].editorType:i.length);for(const e of i)e.remove()},undo:n,mustExec:!0})}commitOrRemove(){var t;null===(t=h(oi,this))||void 0===t||t.commitOrRemove()}hasSomethingToControl(){return h(oi,this)||this.hasSelection}selectAll(){for(const t of h(Wi,this))t.commit();l($i,this,_n).call(this,h(ai,this).values())}unselectAll(){var t;if((!h(oi,this)||(h(oi,this).commitOrRemove(),h(Bi,this)===V.NONE))&&(null===(t=h(mi,this))||void 0===t||!t.commitOrRemove())&&this.hasSelection){for(const t of h(Wi,this))t.unselect();h(Wi,this).clear(),l($i,this,mn).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove(),!this.hasSelection)return;h(Xi,this)[0]+=t,h(Xi,this)[1]+=e;const[i,n]=h(Xi,this),s=[...h(Wi,this)];h(Ki,this)&&clearTimeout(h(Ki,this)),d(Ki,this,setTimeout(()=>{d(Ki,this,null),h(Xi,this)[0]=h(Xi,this)[1]=0,this.addCommands({cmd:()=>{for(const t of s)h(ai,this).has(t.id)&&(t.translateInPage(i,n),t.translationDone())},undo:()=>{for(const t of s)h(ai,this).has(t.id)&&(t.translateInPage(-i,-n),t.translationDone())},mustExec:!1})},1e3));for(const o of s)o.translateInPage(t,e),o.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),d(wi,this,new Map);for(const t of h(Wi,this))h(wi,this).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!h(wi,this))return!1;this.disableUserSelect(!1);const t=h(wi,this);d(wi,this,null);let e=!1;for(const[{x:n,y:s,pageIndex:o},r]of t)r.newX=n,r.newY=s,r.newPageIndex=o,e||(e=n!==r.savedX||s!==r.savedY||o!==r.savedPageIndex);if(!e)return!1;const i=(t,e,i,n)=>{if(h(ai,this).has(t.id)){const s=h(li,this).get(n);s?t._setParentAndPosition(s,e,i):(t.pageIndex=n,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(const[e,{newX:n,newY:s,newPageIndex:o}]of t)i(e,n,s,o)},undo:()=>{for(const[e,{savedX:n,savedY:s,savedPageIndex:o}]of t)i(e,n,s,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(h(wi,this))for(const i of h(wi,this).keys())i.drag(t,e)}rebuild(t){if(null===t.parent){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return(null===(t=this.getActive())||void 0===t?void 0:t.shouldGetKeyboardEvents())||1===h(Wi,this).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return h(oi,this)===t}getActive(){return h(oi,this)}getMode(){return h(Bi,this)}isEditingMode(){return h(Bi,this)!==V.NONE}get imageManager(){return xt(this,"imageManager",new Xe)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let l=0,c=e.rangeCount;l({x:(e-n)/o,y:1-(t+r-i)/s,width:a/o,height:r/s});break;case"180":r=(t,e,r,a)=>({x:1-(t+r-i)/s,y:1-(e+a-n)/o,width:r/s,height:a/o});break;case"270":r=(t,e,r,a)=>({x:1-(e+a-n)/o,y:(t-i)/s,width:a/o,height:r/s});break;default:r=(t,e,r,a)=>({x:(t-i)/s,y:(e-n)/o,width:r/s,height:a/o})}const a=[];for(let l=0,c=e.rangeCount;l{"pointerup"===i.type&&0!==i.button||(e.abort(),null===t||void 0===t||t.toggleDrawing(!0),"pointerup"===i.type&&l($i,this,rn).call(this,"main_toolbar"))};window.addEventListener("pointerup",n,{signal:i}),window.addEventListener("blur",n,{signal:i})}else null===t||void 0===t||t.toggleDrawing(!0),l($i,this,rn).call(this,"main_toolbar")}}else h(ji,this)&&(null===(o=h(Ti,this))||void 0===o||o.hide(),d(ji,this,null),l($i,this,mn).call(this,{hasSelectedText:!1}))}function rn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";h(Bi,this)===V.HIGHLIGHT?this.highlightSelection(t):h(xi,this)&&l($i,this,sn).call(this)}function an(){document.addEventListener("selectionchange",l($i,this,on).bind(this),{signal:this._signal})}function ln(){if(h(ki,this))return;d(ki,this,new AbortController);const t=this.combinedSignal(h(ki,this));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}function cn(){var t;null===(t=h(ki,this))||void 0===t||t.abort(),d(ki,this,null)}function hn(){if(h(Li,this))return;d(Li,this,new AbortController);const t=this.combinedSignal(h(Li,this));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}function dn(){var t;null===(t=h(Li,this))||void 0===t||t.abort(),d(Li,this,null)}function un(){if(h(fi,this))return;d(fi,this,new AbortController);const t=this.combinedSignal(h(fi,this));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}function pn(){var t;null===(t=h(fi,this))||void 0===t||t.abort(),d(fi,this,null)}function fn(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}function mn(t){Object.entries(t).some(t=>{let[e,i]=t;return h(qi,this)[e]!==i})&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(h(qi,this),t)}),h(Bi,this)===V.HIGHLIGHT&&!1===t.hasSelectedEditor&&l($i,this,gn).call(this,[[q.HIGHLIGHT_FREE,!0]]))}function gn(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}async function vn(){if(!h(Pi,this)){d(Pi,this,!0);const t=[];for(const e of h(li,this).values())t.push(e.enable());await Promise.all(t);for(const e of h(ai,this).values())e.enable()}}function wn(){if(this.unselectAll(),h(Pi,this)){d(Pi,this,!1);for(const t of h(li,this).values())t.disable();for(const t of h(ai,this).values())t.disable()}}function bn(t){const e=h(li,this).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}function yn(t){let e=null;for(e of h(Wi,t));return e}function xn(){if(0===h(ai,this).size)return!0;if(1===h(ai,this).size)for(const t of h(ai,this).values())return t.isEmpty();return!1}function _n(t){for(const e of h(Wi,this))e.unselect();h(Wi,this).clear();for(const e of t)e.isEmpty()||(h(Wi,this).add(e),e.select());l($i,this,mn).call(this,{hasSelectedEditor:this.hasSelection})}(0,R.A)(tn,"TRANSLATE_SMALL",1),(0,R.A)(tn,"TRANSLATE_BIG",10);var An=new WeakMap,Sn=new WeakMap,Cn=new WeakMap,kn=new WeakMap,Mn=new WeakMap,En=new WeakMap,Tn=new WeakMap,Rn=new WeakMap,Pn=new WeakMap,In=new WeakMap,Dn=new WeakMap,Ln=new WeakMap,On=new WeakSet;class Fn{constructor(t){r(this,On),a(this,An,null),a(this,Sn,!1),a(this,Cn,null),a(this,kn,null),a(this,Mn,null),a(this,En,null),a(this,Tn,!1),a(this,Rn,null),a(this,Pn,null),a(this,In,null),a(this,Dn,null),a(this,Ln,!1),d(Pn,this,t),d(Ln,this,t._uiManager.useNewAltTextFlow),Bn._||(Bn._=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){var e;null!==(e=Fn._l10n)&&void 0!==e||(Fn._l10n=t)}async render(){const t=d(Cn,this,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=d(kn,this,document.createElement("span"));t.append(e),h(Ln,this)?(t.classList.add("new"),t.setAttribute("data-l10n-id",Bn._.missing),e.setAttribute("data-l10n-id",Bn._["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const i=h(Pn,this)._uiManager._signal;t.addEventListener("contextmenu",$t,{signal:i}),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});const n=t=>{t.preventDefault(),h(Pn,this)._uiManager.editAltText(h(Pn,this)),h(Ln,this)&&h(Pn,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:c(On,this,zn)}})};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(d(Tn,this,!0),n(e))},{signal:i}),await l(On,this,Nn).call(this),t}finish(){h(Cn,this)&&(h(Cn,this).focus({focusVisible:h(Tn,this)}),d(Tn,this,!1))}isEmpty(){return h(Ln,this)?null===h(An,this):!h(An,this)&&!h(Sn,this)}hasData(){return h(Ln,this)?null!==h(An,this)||!!h(In,this):this.isEmpty()}get guessedText(){return h(In,this)}async setGuessedText(t){null===h(An,this)&&(d(In,this,t),d(Dn,this,await Fn._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),l(On,this,Nn).call(this))}toggleAltTextBadge(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e;if(!h(Ln,this)||h(An,this))return null===(e=h(Rn,this))||void 0===e||e.remove(),void d(Rn,this,null);if(!h(Rn,this)){const t=d(Rn,this,document.createElement("div"));t.className="noAltTextBadge",h(Pn,this).div.append(t)}h(Rn,this).classList.toggle("hidden",!t)}serialize(t){let e=h(An,this);return t||h(In,this)!==e||(e=h(Dn,this)),{altText:e,decorative:h(Sn,this),guessedText:h(In,this),textWithDisclaimer:h(Dn,this)}}get data(){return{altText:h(An,this),decorative:h(Sn,this)}}set data(t){let{altText:e,decorative:i,guessedText:n,textWithDisclaimer:s,cancel:o=!1}=t;n&&(d(In,this,n),d(Dn,this,s)),h(An,this)===e&&h(Sn,this)===i||(o||(d(An,this,e),d(Sn,this,i)),l(On,this,Nn).call(this))}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];h(Cn,this)&&(!t&&h(En,this)&&(clearTimeout(h(En,this)),d(En,this,null)),h(Cn,this).disabled=!t)}shown(){h(Pn,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:c(On,this,zn)}})}destroy(){var t,e;null===(t=h(Cn,this))||void 0===t||t.remove(),d(Cn,this,null),d(kn,this,null),d(Mn,this,null),null===(e=h(Rn,this))||void 0===e||e.remove(),d(Rn,this,null)}}function zn(t){return(h(An,t)?"added":null===h(An,t)&&t.guessedText&&"review")||"missing"}async function Nn(){const t=h(Cn,this);if(!t)return;if(h(Ln,this)){var e,i;if(t.classList.toggle("done",!!h(An,this)),t.setAttribute("data-l10n-id",Bn._[c(On,this,zn)]),null===(e=h(kn,this))||void 0===e||e.setAttribute("data-l10n-id",Bn._["".concat(c(On,this,zn),"-label")]),!h(An,this))return void(null===(i=h(Mn,this))||void 0===i||i.remove())}else{var n;if(!h(An,this)&&!h(Sn,this))return t.classList.remove("done"),void(null===(n=h(Mn,this))||void 0===n||n.remove());t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let s=h(Mn,this);if(!s){d(Mn,this,s=document.createElement("span")),s.className="tooltip",s.setAttribute("role","tooltip"),s.id="alt-text-tooltip-".concat(h(Pn,this).id);const e=100,i=h(Pn,this)._uiManager._signal;i.addEventListener("abort",()=>{clearTimeout(h(En,this)),d(En,this,null)},{once:!0}),t.addEventListener("mouseenter",()=>{d(En,this,setTimeout(()=>{d(En,this,null),h(Mn,this).classList.add("show"),h(Pn,this)._reportTelemetry({action:"alt_text_tooltip"})},e))},{signal:i}),t.addEventListener("mouseleave",()=>{var t;h(En,this)&&(clearTimeout(h(En,this)),d(En,this,null)),null===(t=h(Mn,this))||void 0===t||t.classList.remove("show")},{signal:i})}h(Sn,this)?s.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(s.removeAttribute("data-l10n-id"),s.textContent=h(An,this)),s.parentNode||t.append(s);const o=h(Pn,this).getElementForAltText();null===o||void 0===o||o.setAttribute("aria-describedby",s.id)}var Bn={_:null};(0,R.A)(Fn,"_l10n",null);var Wn=new WeakMap,jn=new WeakMap,Gn=new WeakMap,Hn=new WeakMap,Un=new WeakMap,Vn=new WeakMap,qn=new WeakMap,Xn=new WeakMap,Kn=new WeakMap,Yn=new WeakMap,Jn=new WeakSet;class Qn{constructor(t){r(this,Jn),a(this,Wn,null),a(this,jn,null),a(this,Gn,!1),a(this,Hn,null),a(this,Un,null),a(this,Vn,null),a(this,qn,null),a(this,Xn,null),a(this,Kn,!1),a(this,Yn,null),d(Hn,this,t)}renderForToolbar(){const t=d(jn,this,document.createElement("button"));return t.className="comment",l(Jn,this,Zn).call(this,t,!1)}renderForStandalone(){const t=d(Wn,this,document.createElement("button"));t.className="annotationCommentButton";const e=h(Hn,this).commentButtonPosition;if(e){const{style:i}=t;i.insetInlineEnd="calc(".concat(100*("ltr"===h(Hn,this)._uiManager.direction?1-e[0]:e[0]),"% - var(--comment-button-dim))"),i.top="calc(".concat(100*e[1],"% - var(--comment-button-dim))");const n=h(Hn,this).commentButtonColor;n&&(i.backgroundColor=n)}return l(Jn,this,Zn).call(this,t,!0)}focusButton(){setTimeout(()=>{var t,e;null===(t=null!==(e=h(Wn,this))&&void 0!==e?e:h(jn,this))||void 0===t||t.focus()},0)}onUpdatedColor(){if(!h(Wn,this))return;const t=h(Hn,this).commentButtonColor;t&&(h(Wn,this).style.backgroundColor=t),h(Hn,this)._uiManager.updatePopupColor(h(Hn,this))}get commentButtonWidth(){var t,e;return(null!==(t=null===(e=h(Wn,this))||void 0===e?void 0:e.getBoundingClientRect().width)&&void 0!==t?t:0)/h(Hn,this).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(h(Yn,this))return h(Yn,this);if(!h(Wn,this))return null;const{x:t,y:e,height:i}=h(Wn,this).getBoundingClientRect(),{x:n,y:s,width:o,height:r}=h(Hn,this).parent.boundingClientRect;return[(t-n)/o,(e+i-s)/r]}set commentPopupPositionInLayer(t){d(Yn,this,t)}hasDefaultPopupPosition(){return null===h(Yn,this)}removeStandaloneCommentButton(){var t;null===(t=h(Wn,this))||void 0===t||t.remove(),d(Wn,this,null)}removeToolbarCommentButton(){var t;null===(t=h(jn,this))||void 0===t||t.remove(),d(jn,this,null)}setCommentButtonStates(t){let{selected:e,hasPopup:i}=t;h(Wn,this)&&(h(Wn,this).classList.toggle("selected",e),h(Wn,this).ariaExpanded=i)}edit(t){const e=this.commentPopupPositionInLayer;let i,n;if(e)[i,n]=e;else{[i,n]=h(Hn,this).commentButtonPosition;const{width:t,height:e,x:s,y:o}=h(Hn,this);i=s+i*t,n=o+n*e}const o=h(Hn,this).parent.boundingClientRect,{x:r,y:a,width:l,height:c}=o;h(Hn,this)._uiManager.editComment(h(Hn,this),r+i*l,a+n*c,(0,s.A)((0,s.A)({},t),{},{parentDimensions:o}))}finish(){h(jn,this)&&(h(jn,this).focus({focusVisible:h(Gn,this)}),d(Gn,this,!1))}isDeleted(){return h(Kn,this)||""===h(qn,this)}isEmpty(){return null===h(qn,this)}hasBeenEdited(){return this.isDeleted()||h(qn,this)!==h(Un,this)}serialize(){return this.data}get data(){return{text:h(qn,this),richText:h(Vn,this),date:h(Xn,this),deleted:this.isDeleted()}}set data(t){if(t!==h(qn,this)&&d(Vn,this,null),null===t)return d(qn,this,""),void d(Kn,this,!0);d(qn,this,t),d(Xn,this,new Date),d(Kn,this,!1)}setInitialText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;d(Un,this,t),this.data=t,d(Xn,this,null),d(Vn,this,e)}shown(){}destroy(){var t,e;null===(t=h(jn,this))||void 0===t||t.remove(),d(jn,this,null),null===(e=h(Wn,this))||void 0===e||e.remove(),d(Wn,this,null),d(qn,this,""),d(Vn,this,null),d(Xn,this,null),d(Hn,this,null),d(Gn,this,!1),d(Kn,this,!1)}}function Zn(t,e){if(!h(Hn,this)._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[h(Hn,this)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button"));const i=h(Hn,this)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",$t,{signal:i}),e&&(t.addEventListener("focusin",t=>{h(Hn,this)._focusEventsAllowed=!1,te(t)},{capture:!0,signal:i}),t.addEventListener("focusout",t=>{h(Hn,this)._focusEventsAllowed=!0,te(t)},{capture:!0,signal:i})),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});const n=e=>{e.preventDefault(),t===h(jn,this)?this.edit():h(Hn,this).toggleComment(!0)};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(d(Gn,this,!0),n(e))},{signal:i}),t.addEventListener("pointerenter",()=>{h(Hn,this).toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{h(Hn,this).toggleComment(!1,!1)},{signal:i}),t}var $n=new WeakMap,ts=new WeakMap,es=new WeakMap,is=new WeakMap,ns=new WeakMap,ss=new WeakMap,os=new WeakMap,rs=new WeakMap,as=new WeakMap,ls=new WeakMap,cs=new WeakMap,hs=new WeakMap,ds=new WeakSet;class us{constructor(t){let{container:e,isPinchingDisabled:i=null,isPinchingStopped:n=null,onPinchStart:s=null,onPinching:o=null,onPinchEnd:c=null,signal:u}=t;r(this,ds),a(this,$n,void 0),a(this,ts,!1),a(this,es,null),a(this,is,void 0),a(this,ns,void 0),a(this,ss,void 0),a(this,os,void 0),a(this,rs,null),a(this,as,void 0),a(this,ls,null),a(this,cs,void 0),a(this,hs,null),d($n,this,e),d(es,this,n),d(is,this,i),d(ns,this,s),d(ss,this,o),d(os,this,c),d(cs,this,new AbortController),d(as,this,AbortSignal.any([u,h(cs,this).signal])),e.addEventListener("touchstart",l(ds,this,ps).bind(this),{passive:!1,signal:h(as,this)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/ae.pixelRatio}destroy(){var t,e;null===(t=h(cs,this))||void 0===t||t.abort(),d(cs,this,null),null===(e=h(rs,this))||void 0===e||e.abort(),d(rs,this,null)}}function ps(t){var e,i;if(null!==(e=h(is,this))&&void 0!==e&&e.call(this))return;if(1===t.touches.length){if(h(rs,this))return;const t=d(rs,this,new AbortController),e=AbortSignal.any([h(as,this),t.signal]),i=h($n,this),n={capture:!0,signal:e,passive:!1},s=t=>{var e;"touch"===t.pointerType&&(null===(e=h(rs,this))||void 0===e||e.abort(),d(rs,this,null))};return i.addEventListener("pointerdown",t=>{"touch"===t.pointerType&&(te(t),s(t))},n),i.addEventListener("pointerup",s,n),void i.addEventListener("pointercancel",s,n)}if(!h(hs,this)){var n;d(hs,this,new AbortController);const t=AbortSignal.any([h(as,this),h(hs,this).signal]),e=h($n,this),i={signal:t,capture:!1,passive:!1};e.addEventListener("touchmove",l(ds,this,fs).bind(this),i);const s=l(ds,this,ms).bind(this);e.addEventListener("touchend",s,i),e.addEventListener("touchcancel",s,i),i.capture=!0,e.addEventListener("pointerdown",te,i),e.addEventListener("pointermove",te,i),e.addEventListener("pointercancel",te,i),e.addEventListener("pointerup",te,i),null===(n=h(ns,this))||void 0===n||n.call(this)}if(te(t),2!==t.touches.length||null!==(i=h(es,this))&&void 0!==i&&i.call(this))return void d(ls,this,null);let[s,o]=t.touches;s.identifier>o.identifier&&([s,o]=[o,s]),d(ls,this,{touch0X:s.screenX,touch0Y:s.screenY,touch1X:o.screenX,touch1Y:o.screenY})}function fs(t){var e;if(!h(ls,this)||2!==t.touches.length)return;te(t);let[i,n]=t.touches;i.identifier>n.identifier&&([i,n]=[n,i]);const{screenX:s,screenY:o}=i,{screenX:r,screenY:a}=n,l=h(ls,this),{touch0X:c,touch0Y:u,touch1X:p,touch1Y:f}=l,g=p-c,v=f-u,w=r-s,b=a-o,y=Math.hypot(w,b)||1,x=Math.hypot(g,v)||1;if(!h(ts,this)&&Math.abs(x-y)<=m.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=s,l.touch0Y=o,l.touch1X=r,l.touch1Y=a,!h(ts,this))return void d(ts,this,!0);const _=[(s+r)/2,(o+a)/2];null===(e=h(ss,this))||void 0===e||e.call(this,_,x,y)}function ms(t){if(!(t.touches.length>=2)){var e;if(h(hs,this))h(hs,this).abort(),d(hs,this,null),null===(e=h(os,this))||void 0===e||e.call(this);h(ls,this)&&(te(t),d(ls,this,null),d(ts,this,!1))}}m=us;var gs=new WeakMap,vs=new WeakMap,ws=new WeakMap,bs=new WeakMap,ys=new WeakMap,xs=new WeakMap,_s=new WeakMap,As=new WeakMap,Ss=new WeakMap,Cs=new WeakMap,ks=new WeakMap,Ms=new WeakMap,Es=new WeakMap,Ts=new WeakMap,Rs=new WeakMap,Ps=new WeakMap,Is=new WeakMap,Ds=new WeakMap,Ls=new WeakMap,Os=new WeakMap,Fs=new WeakMap,zs=new WeakMap,Ns=new WeakMap,Bs=new WeakMap,Ws=new WeakMap,js=new WeakMap,Gs=new WeakSet;class Hs{static get _resizerKeyboardManager(){const t=Hs.prototype._resizeWithKeyboard,e=tn.TRANSLATE_SMALL,i=tn.TRANSLATE_BIG;return xt(this,"_resizerKeyboardManager",new ei([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],Hs.prototype._stopResizingWithKeyboard]]))}constructor(t){r(this,Gs),a(this,gs,null),a(this,vs,null),a(this,ws,null),a(this,bs,null),a(this,ys,null),a(this,xs,!1),a(this,_s,null),a(this,As,""),a(this,Ss,null),a(this,Cs,null),a(this,ks,null),a(this,Ms,null),a(this,Es,null),a(this,Ts,""),a(this,Rs,!1),a(this,Ps,null),a(this,Is,!1),a(this,Ds,!1),a(this,Ls,!1),a(this,Os,null),a(this,Fs,0),a(this,zs,0),a(this,Ns,null),a(this,Bs,null),(0,R.A)(this,"isSelected",!1),(0,R.A)(this,"_isCopy",!1),(0,R.A)(this,"_editToolbar",null),(0,R.A)(this,"_initialOptions",Object.create(null)),(0,R.A)(this,"_initialData",null),(0,R.A)(this,"_isVisible",!0),(0,R.A)(this,"_uiManager",null),(0,R.A)(this,"_focusEventsAllowed",!0),a(this,Ws,!1),a(this,js,Hs._zIndex++),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:n,pageX:s,pageY:o}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,n],this.pageTranslation=[s,o];const[l,c]=this.parentDimensions;this.x=t.x/l,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return xt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new co({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){var i;if(null!==(i=Hs._l10n)&&void 0!==i||(Hs._l10n=t),Hs._l10nResizer||(Hs._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),-1!==Hs._borderLineWidth)return;const n=getComputedStyle(document.documentElement);Hs._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){vt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return h(Ws,this)}set _isDraggable(t){var e;d(Ws,this,t),null===(e=this.div)||void 0===e||e.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=h(js,this)}setParent(t){var e;null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(l(Gs,this,lo).call(this),null===(e=h(Ms,this))||void 0===e||e.remove(),d(Ms,this,null));this.parent=t}focusin(t){this._focusEventsAllowed&&(h(Rs,this)?d(Rs,this,!1):this.parent.setSelected(this))}focusout(t){var e;if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const i=t.relatedTarget;null!==i&&void 0!==i&&i.closest("#".concat(this.id))||(t.preventDefault(),null!==(e=this.parent)&&void 0!==e&&e.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,n){const[s,o]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(t+i)/s,this.y=(e+n)/o,this.fixAndSetPosition()}_moveAfterPaste(t,e){const[i,n]=this.parentDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n),this._onTranslated()}translate(t,e){l(Gs,this,Us).call(this,this.parentDimensions,t,e)}translateInPage(t,e){h(Ps,this)||d(Ps,this,[this.x,this.y,this.width,this.height]),l(Gs,this,Us).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){h(Ps,this)||d(Ps,this,[this.x,this.y,this.width,this.height]);const{div:i,parentDimensions:[n,s]}=this;if(this.x+=t/n,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:o,y:r}=this;const[a,l]=this.getBaseTranslation();o+=a,r+=l;const{style:c}=i;c.left="".concat((100*o).toFixed(2),"%"),c.top="".concat((100*r).toFixed(2),"%"),this._onTranslating(o,r),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!h(Ps,this)&&(h(Ps,this)[0]!==this.x||h(Ps,this)[1]!==this.y)}get _hasBeenResized(){return!!h(Ps,this)&&(h(Ps,this)[2]!==this.width||h(Ps,this)[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=Hs,n=i/t,s=i/e;switch(this.rotation){case 90:return[-n,s];case 180:return[n,s];case 270:return[n,-s];default:return[-n,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const{div:{style:e},pageDimensions:[i,n]}=this;let{x:s,y:o,width:r,height:a}=this;if(r*=i,a*=n,s*=i,o*=n,this._mustFixPosition)switch(t){case 0:s=Wt(s,0,i-r),o=Wt(o,0,n-a);break;case 90:s=Wt(s,0,i-a),o=Wt(o,r,n);break;case 180:s=Wt(s,r,i),o=Wt(o,a,n);break;case 270:s=Wt(s,a,i),o=Wt(o,0,n-r)}this.x=s/=i,this.y=o/=n;const[l,c]=this.getBaseTranslation();s+=l,o+=c,e.left="".concat((100*s).toFixed(2),"%"),e.top="".concat((100*o).toFixed(2),"%"),this.moveInDOM()}screenToPageTranslation(t,e){return Vs.call(Hs,t,e,this.parentRotation)}pageTranslationToScreen(t,e){return Vs.call(Hs,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(){const{div:{style:t},width:e,height:i}=this;t.width="".concat((100*e).toFixed(2),"%"),t.height="".concat((100*i).toFixed(2),"%")}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(1e4*t)/1e4}_onResizing(){}altTextFinish(){var t;null===(t=h(ws,this))||void 0===t||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||h(Ds,this))return this._editToolbar;this._editToolbar=new Ce(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[e,i]of t)await this._editToolbar.addButton(e,i);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var t;null===(t=this._editToolbar)||void 0===t||t.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){var t;null===(t=this._editToolbar)||void 0===t||t.removeButton("comment")}removeEditToolbar(){var t,e;null===(t=this._editToolbar)||void 0===t||t.remove(),this._editToolbar=null,null===(e=h(ws,this))||void 0===e||e.destroy()}addContainer(t){var e;const i=null===(e=this._editToolbar)||void 0===e?void 0:e.div;i?i.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return h(ws,this)||(Fn.initialize(Hs._l10n),d(ws,this,new Fn(this)),h(gs,this)&&(h(ws,this).data=h(gs,this),d(gs,this,null))),h(ws,this)}get altTextData(){var t;return null===(t=h(ws,this))||void 0===t?void 0:t.data}set altTextData(t){h(ws,this)&&(h(ws,this).data=t)}get guessedAltText(){var t;return null===(t=h(ws,this))||void 0===t?void 0:t.guessedText}async setGuessedAltText(t){var e;await(null===(e=h(ws,this))||void 0===e?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return null===(e=h(ws,this))||void 0===e?void 0:e.serialize(t)}hasAltText(){return!!h(ws,this)&&!h(ws,this).isEmpty()}hasAltTextData(){var t,e;return null!==(t=null===(e=h(ws,this))||void 0===e?void 0:e.hasData())&&void 0!==t&&t}focusCommentButton(){var t;null===(t=h(bs,this))||void 0===t||t.focusButton()}addCommentButton(){return h(bs,this)||d(bs,this,new Qn(this))}addStandaloneCommentButton(){h(ys,this)?this._uiManager.isEditingMode()&&h(ys,this).classList.remove("hidden"):this.hasComment&&(d(ys,this,h(bs,this).renderForStandalone()),this.div.append(h(ys,this)))}removeStandaloneCommentButton(){h(bs,this).removeStandaloneCommentButton(),d(ys,this,null)}hideStandaloneCommentButton(){var t;null===(t=h(ys,this))||void 0===t||t.classList.add("hidden")}get comment(){var t;const{data:{richText:e,text:i,date:n,deleted:s}}=h(bs,this);return{text:i,richText:e,date:n,deleted:s,color:this.getNonHCMColor(),opacity:null!==(t=this.opacity)&&void 0!==t?t:1}}set comment(t){h(bs,this)||d(bs,this,new Qn(this)),h(bs,this).data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData(t){let{comment:e,popupRef:i,richText:n}=t;if(!i)return;if(h(bs,this)||d(bs,this,new Qn(this)),h(bs,this).setInitialText(e,n),!this.annotationElementId)return;const s=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);s&&this.updateFromAnnotationLayer(s)}get hasEditedComment(){var t;return null===(t=h(bs,this))||void 0===t?void 0:t.hasBeenEdited()}get hasDeletedComment(){var t;return null===(t=h(bs,this))||void 0===t?void 0:t.isDeleted()}get hasComment(){return!!h(bs,this)&&!h(bs,this).isEmpty()&&!h(bs,this).isDeleted()}async editComment(t){h(bs,this)||d(bs,this,new Qn(this)),h(bs,this).edit(t)}toggleComment(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){h(bs,this).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){const e=180,i=100,[,,,n]=t.rect,[s]=this.pageDimensions,[o]=this.pageTranslation,r=o+s+1,a=n-i,l=r+e;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[r,a,l,n]}}}updateFromAnnotationLayer(t){let{popup:{contents:e,deleted:i}}=t;h(bs,this).data=i?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var t;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=h(xs,this)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),l(Gs,this,no).call(this);const[i,n]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth="".concat((100*n/i).toFixed(2),"%"),e.style.maxHeight="".concat((100*i/n).toFixed(2),"%"));const[s,o]=this.getInitialTranslation();return this.translate(s,o),We(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(h(Bs,this)||d(Bs,this,new us({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:l(Gs,this,Zs).bind(this),onPinching:l(Gs,this,$s).bind(this),onPinchEnd:l(Gs,this,to).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),null===(t=this._uiManager._editorUndoBar)||void 0===t||t.hide(),e}pointerdown(t){const{isMac:e}=Pt.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(d(Rs,this,!0),this._isDraggable?l(Gs,this,io).call(this,t):l(Gs,this,eo).call(this,t))}_onStartDragging(){}_onStopDragging(){}moveInDOM(){h(Os,this)&&clearTimeout(h(Os,this)),d(Os,this,setTimeout(()=>{var t;d(Os,this,null),null===(t=this.parent)||void 0===t||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const n=this.parentScale,[s,o]=this.pageDimensions,[r,a]=this.pageTranslation,l=t/n,c=e/n,h=this.x*s,d=this.y*o,u=this.width*s,p=this.height*o;switch(i){case 0:return[h+l+r,o-d-c-p+a,h+l+u+r,o-d-c+a];case 90:return[h+c+r,o-d+l+a,h+c+p+r,o-d+l+u+a];case 180:return[h-l-u+r,o-d+c+a,h-l+r,o-d+c+p+a];case 270:return[h-c-p+r,o-d-l-u+a,h-c+r,o-d-l+a];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,n,s,o]=t,r=s-i,a=o-n;switch(this.rotation){case 0:return[i,e-o,r,a];case 90:return[i,e-n,a,r];case 180:return[s,e-n,r,a];case 270:return[s,e-o,a,r];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&Hs._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var t;null===(t=h(bs,this))||void 0===t||t.onUpdatedColor()}getData(){const{comment:{text:t,color:e,date:i,opacity:n,deleted:s,richText:o},uid:r,pageIndex:a,creationDate:l,modificationDate:c}=this;return{id:r,pageIndex:a,rect:this.getPDFRect(),richText:o,contentsObj:{str:t},creationDate:l,modificationDate:i||c,popupRef:!s,color:e,opacity:n}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return!this.isInEditMode()&&(this.parent.setEditingState(!1),d(Ds,this,!0),!0)}disableEditMode(){return!!this.isInEditMode()&&(this.parent.setEditingState(!0),d(Ds,this,!1),!0)}isInEditMode(){return h(Ds,this)}shouldGetKeyboardEvents(){return h(Ls,this)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:i,right:n}=this.getClientDimensions(),{innerHeight:s,innerWidth:o}=window;return e0&&t0}rebuild(){l(Gs,this,no).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:(null===(t=this._initialData)||void 0===t?void 0:t.popupRef)||""}}serialize(){var t;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:(null===(t=this._initialData)||void 0===t?void 0:t.popupRef)||""}}static async deserialize(t,e,i){const n=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});n.rotation=t.rotation,d(gs,n,t.accessibilityData),n._isCopy=t.isCopy||!1;const[s,o]=n.pageDimensions,[r,a,l,c]=n.getRectInCurrentCoords(t.rect,o);return n.x=r/s,n.y=a/o,n.width=l/s,n.height=c/o,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){var t,e;if(null===(t=h(Es,this))||void 0===t||t.abort(),d(Es,this,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),h(Os,this)&&(clearTimeout(h(Os,this)),d(Os,this,null)),l(Gs,this,lo).call(this),this.removeEditToolbar(),h(Ns,this)){for(const t of h(Ns,this).values())clearTimeout(t);d(Ns,this,null)}this.parent=null,null===(e=h(Bs,this))||void 0===e||e.destroy(),d(Bs,this,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(l(Gs,this,Xs).call(this),h(Ss,this).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return"ltr"===this._uiManager.direction?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[t,e]}=this,[i,n,s,o]=this.getPDFRect();return[Hs._round(i+(s-i)*t),Hs._round(n+(o-n)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return h(bs,this).commentPopupPositionInLayer}set commentPopupPosition(t){h(bs,this).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return h(bs,this).hasDefaultPopupPosition()}get commentButtonWidth(){return h(bs,this).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){h(bs,this).setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),d(ks,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=h(Ss,this).children;if(!h(vs,this)){d(vs,this,Array.from(e));const t=l(Gs,this,so).bind(this),i=l(Gs,this,oo).bind(this),n=this._uiManager._signal;for(const e of h(vs,this)){const s=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:n}),e.addEventListener("blur",i,{signal:n}),e.addEventListener("focus",l(Gs,this,ro).bind(this,s),{signal:n}),e.setAttribute("data-l10n-id",Hs._l10nResizer[s])}}const i=h(vs,this)[0];let n=0;for(const o of e){if(o===i)break;n++}const s=(360-this.rotation+this.parentRotation)%360/90*(h(vs,this).length/4);if(s!==n){if(sn)for(let e=0;e{var t,e;null!==(t=this.div)&&void 0!==t&&t.classList.contains("selectedEditor")&&(null===(e=this._editToolbar)||void 0===e||e.show())}))}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var t;return null===(t=this.div)||void 0===t?void 0:t.focus({preventScroll:!0})},0)}unselect(){var t,e,i,n,s;this.isSelected&&(this.isSelected=!1,null===(t=h(Ss,this))||void 0===t||t.classList.add("hidden"),null===(e=this.div)||void 0===e||e.classList.remove("selectedEditor"),null!==(i=this.div)&&void 0!==i&&i.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),null===(n=this._editToolbar)||void 0===n||n.hide(),null===(s=h(ws,this))||void 0===s||s.toggleAltTextBadge(!0),this.hasComment&&this._uiManager.toggleComment(this,!1,!1))}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){"BUTTON"!==t.target.nodeName&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return h(Is,this)}set isEditing(t){d(Is,this,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){h(Ns,this)||d(Ns,this,new Map);const{action:e}=t;let i=h(Ns,this).get(e);return i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),h(Ns,this).delete(e),0===h(Ns,this).size&&d(Ns,this,null)},Hs._telemetryTimeout),void h(Ns,this).set(e,i)}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),d(xs,this,!1)}disable(){this.div&&(this.div.tabIndex=-1),d(xs,this,!0)}updateFakeAnnotationElement(t){if(h(Ms,this)||this.deleted)return this.deleted?(h(Ms,this).remove(),void d(Ms,this,null)):void((this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&h(Ms,this).updateEdited({rect:this.getPDFRect(),popup:this.comment}));d(Ms,this,t.addFakeAnnotation(this))}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){const t=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const{firstChild:e}=t.container;"DIV"===(null===e||void 0===e?void 0:e.nodeName)&&e.classList.contains("annotationContent")&&e.remove()}}function Us(t,e,i){let[n,s]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/n,this.y+=i/s,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}function Vs(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}function qs(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}function Xs(){if(h(Ss,this))return;d(Ss,this,document.createElement("div")),h(Ss,this).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const t=document.createElement("div");h(Ss,this).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",l(Gs,this,Ks).bind(this,i),{signal:e}),t.addEventListener("contextmenu",$t,{signal:e}),t.tabIndex=-1}this.div.prepend(h(Ss,this))}function Ks(t,e){var i;e.preventDefault();const{isMac:n}=Pt.platform;if(0!==e.button||e.ctrlKey&&n)return;null===(i=h(ws,this))||void 0===i||i.toggle(!1);const s=this._isDraggable;this._isDraggable=!1,d(Cs,this,[e.screenX,e.screenY]);const o=new AbortController,r=this._uiManager.combinedSignal(o);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",l(Gs,this,Qs).bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("touchmove",te,{passive:!1,signal:r}),window.addEventListener("contextmenu",$t,{signal:r}),d(ks,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const a=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const u=()=>{var t;o.abort(),this.parent.togglePointerEvents(!0),null===(t=h(ws,this))||void 0===t||t.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=a,this.div.style.cursor=c,l(Gs,this,Js).call(this)};window.addEventListener("pointerup",u,{signal:r}),window.addEventListener("blur",u,{signal:r})}function Ys(t,e,i,n){this.width=i,this.height=n,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()}function Js(){if(!h(ks,this))return;const{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=h(ks,this);d(ks,this,null);const s=this.x,o=this.y,r=this.width,a=this.height;s===t&&o===e&&r===i&&a===n||this.addCommands({cmd:l(Gs,this,Ys).bind(this,s,o,r,a),undo:l(Gs,this,Ys).bind(this,t,e,i,n),mustExec:!0})}function Qs(t,e){const[i,n]=this.parentDimensions,s=this.x,o=this.y,r=this.width,a=this.height,c=g.MIN_SIZE/i,u=g.MIN_SIZE/n,p=l(Gs,this,qs).call(this,this.rotation),f=(t,e)=>[p[0]*t+p[2]*e,p[1]*t+p[3]*e],m=l(Gs,this,qs).call(this,360-this.rotation);let v,w,b=!1,y=!1;switch(t){case"topLeft":b=!0,v=(t,e)=>[0,0],w=(t,e)=>[t,e];break;case"topMiddle":v=(t,e)=>[t/2,0],w=(t,e)=>[t/2,e];break;case"topRight":b=!0,v=(t,e)=>[t,0],w=(t,e)=>[0,e];break;case"middleRight":y=!0,v=(t,e)=>[t,e/2],w=(t,e)=>[0,e/2];break;case"bottomRight":b=!0,v=(t,e)=>[t,e],w=(t,e)=>[0,0];break;case"bottomMiddle":v=(t,e)=>[t/2,e],w=(t,e)=>[t/2,0];break;case"bottomLeft":b=!0,v=(t,e)=>[0,e],w=(t,e)=>[t,0];break;case"middleLeft":y=!0,v=(t,e)=>[0,e/2],w=(t,e)=>[t,e/2]}const x=v(r,a),_=w(r,a);let A=f(..._);const S=g._round(s+A[0]),C=g._round(o+A[1]);let k,M,E=1,T=1;if(e.fromKeyboard)({deltaX:k,deltaY:M}=e);else{const{screenX:t,screenY:i}=e,[n,s]=h(Cs,this);[k,M]=this.screenToPageTranslation(t-n,i-s),h(Cs,this)[0]=t,h(Cs,this)[1]=i}var R,P;if([k,M]=(R=k/i,P=M/n,[m[0]*R+m[2]*P,m[1]*R+m[3]*P]),b){const t=Math.hypot(r,a);E=T=Math.max(Math.min(Math.hypot(_[0]-x[0]-k,_[1]-x[1]-M)/t,1/r,1/a),c/r,u/a)}else y?E=Wt(Math.abs(_[0]-x[0]-k),c,1)/r:T=Wt(Math.abs(_[1]-x[1]-M),u,1)/a;const I=g._round(r*E),D=g._round(a*T);A=f(...w(I,D));const L=S-A[0],O=C-A[1];h(Ps,this)||d(Ps,this,[this.x,this.y,this.width,this.height]),this.width=I,this.height=D,this.x=L,this.y=O,this.setDims(),this.fixAndSetPosition(),this._onResizing()}function Zs(){var t;d(ks,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),null===(t=h(ws,this))||void 0===t||t.toggle(!1),this.parent.togglePointerEvents(!1)}function $s(t,e,i){let n=i/e*.7+1-.7;if(1===n)return;const s=l(Gs,this,qs).call(this,this.rotation),o=(t,e)=>[s[0]*t+s[2]*e,s[1]*t+s[3]*e],[r,a]=this.parentDimensions,c=this.x,u=this.y,p=this.width,f=this.height,m=g.MIN_SIZE/r,v=g.MIN_SIZE/a;n=Math.max(Math.min(n,1/p,1/f),m/p,v/f);const w=g._round(p*n),b=g._round(f*n);if(w===p&&b===f)return;h(Ps,this)||d(Ps,this,[c,u,p,f]);const y=o(p/2,f/2),x=g._round(c+y[0]),_=g._round(u+y[1]),A=o(w/2,b/2);this.x=x-A[0],this.y=_-A[1],this.width=w,this.height=b,this.setDims(),this.fixAndSetPosition(),this._onResizing()}function to(){var t;null===(t=h(ws,this))||void 0===t||t.toggle(!0),this.parent.togglePointerEvents(!0),l(Gs,this,Js).call(this)}function eo(t){const{isMac:e}=Pt.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}function io(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1;const n=new AbortController,s=this._uiManager.combinedSignal(n),o={capture:!0,passive:!1,signal:s},r=t=>{n.abort(),d(_s,this,null),d(Rs,this,!1),this._uiManager.endDragSession()||l(Gs,this,eo).call(this,t),i&&this._onStopDragging()};e&&(d(Fs,this,t.clientX),d(zs,this,t.clientY),d(_s,this,t.pointerId),d(As,this,t.pointerType),window.addEventListener("pointermove",t=>{i||(i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:e,clientY:n,pointerId:s}=t;if(s!==h(_s,this))return void te(t);const[o,r]=this.screenToPageTranslation(e-h(Fs,this),n-h(zs,this));d(Fs,this,e),d(zs,this,n),this._uiManager.dragSelectedEditors(o,r)},o),window.addEventListener("touchmove",te,o),window.addEventListener("pointerdown",t=>{t.pointerType===h(As,this)&&(h(Bs,this)||t.isPrimary)&&r(t),te(t)},o));const a=t=>{h(_s,this)&&h(_s,this)!==t.pointerId?te(t):r(t)};window.addEventListener("pointerup",a,{signal:s}),window.addEventListener("blur",a,{signal:s})}function no(){if(h(Es,this)||!this.div)return;d(Es,this,new AbortController);const t=this._uiManager.combinedSignal(h(Es,this));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}function so(t){g._resizerKeyboardManager.exec(this,t)}function oo(t){var e;h(Ls,this)&&(null===(e=t.relatedTarget)||void 0===e?void 0:e.parentNode)!==h(Ss,this)&&l(Gs,this,lo).call(this)}function ro(t){d(Ts,this,h(Ls,this)?t:"")}function ao(t){if(h(vs,this))for(const e of h(vs,this))e.tabIndex=t}function lo(){d(Ls,this,!1),l(Gs,this,ao).call(this,-1),l(Gs,this,Js).call(this)}g=Hs,(0,R.A)(Hs,"_l10n",null),(0,R.A)(Hs,"_l10nResizer",null),(0,R.A)(Hs,"_borderLineWidth",-1),(0,R.A)(Hs,"_colorManager",new ni),(0,R.A)(Hs,"_zIndex",1),(0,R.A)(Hs,"_telemetryTimeout",1e3);class co extends Hs{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const ho=3285377520,uo=4294901760,po=65535;class fo{constructor(t){this.h1=t?4294967295&t:ho,this.h2=t?4294967295&t:ho}update(t){let e,i;if("string"===typeof t){e=new Uint8Array(2*t.length),i=0;for(let n=0,s=t.length;n>>8,e[i++]=255&s)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const n=i>>2,s=i-4*n,o=new Uint32Array(e.buffer,0,n);let r=0,a=0,l=this.h1,c=this.h2;const h=3432918353,d=461845907,u=11601,p=13715;for(let f=0;f>>17,r=r*d&uo|r*p&po,l^=r,l=l<<13|l>>>19,l=5*l+3864292196):(a=o[f],a=a*h&uo|a*u&po,a=a<<15|a>>>17,a=a*d&uo|a*p&po,c^=a,c=c<<13|c>>>19,c=5*c+3864292196);switch(r=0,s){case 3:r^=e[4*n+2]<<16;case 2:r^=e[4*n+1]<<8;case 1:r^=e[4*n],r=r*h&uo|r*u&po,r=r<<15|r>>>17,r=r*d&uo|r*p&po,1&n?l^=r:c^=r}this.h1=l,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&uo|36045*t&po,e=4283543511*e&uo|(2950163797*(e<<16|t>>>16)&uo)>>>16,t^=e>>>1,t=444984403*t&uo|60499*t&po,e=3301882366*e&uo|(3120437893*(e<<16|t>>>16)&uo)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const mo=Object.freeze({map:null,hash:"",transfer:void 0});var go=new WeakMap,vo=new WeakMap,wo=new WeakMap,bo=new WeakMap,yo=new WeakSet;class xo{constructor(){r(this,yo),a(this,go,!1),a(this,vo,null),a(this,wo,null),a(this,bo,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=h(bo,this).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return h(bo,this).get(t)}remove(t){const e=h(bo,this).get(t);if(void 0!==e&&(e instanceof Hs&&h(wo,this).delete(e.annotationElementId),h(bo,this).delete(t),0===h(bo,this).size&&this.resetModified(),"function"===typeof this.onAnnotationEditor)){for(const t of h(bo,this).values())if(t instanceof Hs)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=h(bo,this).get(t);let n=!1;if(void 0!==i)for(const[s,o]of Object.entries(e))i[s]!==o&&(n=!0,i[s]=o);else n=!0,h(bo,this).set(t,e);n&&l(yo,this,_o).call(this),e instanceof Hs&&((h(wo,this)||d(wo,this,new Map)).set(e.annotationElementId,e),"function"===typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type))}has(t){return h(bo,this).has(t)}get size(){return h(bo,this).size}resetModified(){h(go,this)&&(d(go,this,!1),"function"===typeof this.onResetModified&&this.onResetModified())}get print(){return new So(this)}get serializable(){if(0===h(bo,this).size)return mo;const t=new Map,e=new fo,i=[],n=Object.create(null);let s=!1;for(const[o,r]of h(bo,this)){const i=r instanceof Hs?r.serialize(!1,n):r;i&&(t.set(o,i),e.update("".concat(o,":").concat(JSON.stringify(i))),s||(s=!!i.bitmap))}if(s)for(const o of t.values())o.bitmap&&i.push(o.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:mo}get editorStats(){let t=null;const e=new Map;let i=0,n=0;for(const r of h(bo,this).values()){var s;if(!(r instanceof Hs)){r.popup&&(r.popup.deleted?n+=1:i+=1);continue}r.isCommentDeleted?n+=1:r.hasEditedComment&&(i+=1);const a=r.telemetryFinalData;if(!a)continue;const{type:l}=a;e.has(l)||e.set(l,Object.getPrototypeOf(r).constructor),t||(t=Object.create(null));const c=(s=t)[l]||(s[l]=new Map);for(const[t,e]of Object.entries(a)){var o;if("type"===t)continue;let i=c.get(t);i||(i=new Map,c.set(t,i));const n=null!==(o=i.get(e))&&void 0!==o?o:0;i.set(e,n+1)}}if((n>0||i>0)&&(t||(t=Object.create(null)),t.comments={deleted:n,edited:i}),!t)return null;for(const[r,a]of e)t[r]=a.computeTelemetryFinalData(t[r]);return t}resetModifiedIds(){d(vo,this,null)}updateEditor(t,e){var i;const n=null===(i=h(wo,this))||void 0===i?void 0:i.get(t);return!!n&&(n.updateFromAnnotationLayer(e),!0)}getEditor(t){var e;return(null===(e=h(wo,this))||void 0===e?void 0:e.get(t))||null}get modifiedIds(){if(h(vo,this))return h(vo,this);const t=[];if(h(wo,this))for(const e of h(wo,this).values())e.serialize()&&t.push(e.annotationElementId);return d(vo,this,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return h(bo,this).entries()}}function _o(){h(go,this)||(d(go,this,!0),"function"===typeof this.onSetModified&&this.onSetModified())}var Ao=new WeakMap;class So extends xo{constructor(t){super(),a(this,Ao,void 0);const{map:e,hash:i,transfer:n}=t.serializable,s=structuredClone(e,n?{transfer:n}:null);d(Ao,this,{map:s,hash:i,transfer:n})}get print(){vt("Should not call PrintAnnotationStorage.print")}get serializable(){return h(Ao,this)}get modifiedIds(){return xt(this,"modifiedIds",{ids:new Set,hash:""})}}var Co=new WeakMap;class ko{constructor(t){let{ownerDocument:e=globalThis.document,styleElement:i=null}=t;a(this,Co,new Set),this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),h(Co,this).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,disableFontFace:i,_inspectFont:n}=t;if(e&&!h(Co,this).has(e.loadedName)){if(wt(!i,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:t,src:i,style:o}=e,r=new FontFace(t,i,o);this.addNativeFontFace(r);try{await r.load(),h(Co,this).add(t),null===n||void 0===n||n(e)}catch(s){gt("Cannot load system font: ".concat(e.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(r)}return}vt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw gt("Failed to load font '".concat(e.family,"': '").concat(i,"'.")),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{const i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var t;return xt(this,"isFontLoadingAPISupported",!(null===(t=this._document)||void 0===t||!t.fonts))}get isSyncFontLoadingSupported(){return xt(this,"isSyncFontLoadingSupported",I||Pt.platform.isFirefox)}_queueLoadingCallback(t){const{loadingRequests:e}=this,i={done:!1,complete:function(){for(wt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(i),i}get _loadTestFont(){return xt(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function i(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function n(t,e,i,n){return t.substring(0,e)+n+t.substring(e+i)}let s,o;const r=this._document.createElement("canvas");r.width=1,r.height=1;const a=r.getContext("2d");let l=0;const c="lt".concat(Date.now()).concat(this.loadTestFontId++);let h=this._loadTestFont;h=n(h,976,c.length,c);const d=1482184792;let u=i(h,16);for(s=0,o=c.length-3;s>24&255,p>>16&255,p>>8&255,255&p)));const f="url(data:font/opentype;base64,".concat(btoa(h),");"),m='@font-face {font-family:"'.concat(c,'";src:').concat(f,"}");this.insertRule(m);const g=this._document.createElement("div");g.style.visibility="hidden",g.style.width=g.style.height="10px",g.style.position="absolute",g.style.top=g.style.left="0px";for(const v of[t.loadedName,c]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=v,g.append(t)}this._document.body.append(g),function t(e,i){if(++l>30)return gt("Load test font never loaded."),void i();a.font="30px "+e,a.fillText(".",0,20),a.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i))}(c,()=>{g.remove(),e.complete()})}}var Mo=new WeakMap;class Eo{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;a(this,Mo,void 0),this.compiledGlyphs=Object.create(null),d(Mo,this,t),this._inspectFont=e,i&&Object.assign(this,i),n&&(this.charProcOperatorList=n)}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return null===(t=this._inspectFont)||void 0===t||t.call(this,this),e}createFontFaceRule(){var t;if(!this.data||this.disableFontFace)return null;const e="url(data:".concat(this.mimetype,";base64,").concat(jt(this.data),");");let i;if(this.cssFontInfo){let t="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(t+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),i='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(t,"src:").concat(e,"}")}else i='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(e,"}");return null===(t=this._inspectFont)||void 0===t||t.call(this,this,e),i}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];const i=this.loadedName+"_path_"+e;let n;try{n=t.get(i)}catch(o){gt('getPathGenerator - ignoring character: "'.concat(o,'".'))}const s=new Path2D(n||"");return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=s}get black(){return h(Mo,this).black}get bold(){return h(Mo,this).bold}get disableFontFace(){var t;return null!==(t=h(Mo,this).disableFontFace)&&void 0!==t&&t}get fontExtraProperties(){var t;return null!==(t=h(Mo,this).fontExtraProperties)&&void 0!==t&&t}get isInvalidPDFjsFont(){return h(Mo,this).isInvalidPDFjsFont}get isType3Font(){return h(Mo,this).isType3Font}get italic(){return h(Mo,this).italic}get missingFile(){return h(Mo,this).missingFile}get remeasure(){return h(Mo,this).remeasure}get vertical(){return h(Mo,this).vertical}get ascent(){return h(Mo,this).ascent}get defaultWidth(){return h(Mo,this).defaultWidth}get descent(){return h(Mo,this).descent}get bbox(){return h(Mo,this).bbox}get fontMatrix(){return h(Mo,this).fontMatrix}get fallbackName(){return h(Mo,this).fallbackName}get loadedName(){return h(Mo,this).loadedName}get mimetype(){return h(Mo,this).mimetype}get name(){return h(Mo,this).name}get data(){return h(Mo,this).data}clearData(){h(Mo,this).clearData()}get cssFontInfo(){return h(Mo,this).cssFontInfo}get systemFontInfo(){return h(Mo,this).systemFontInfo}get defaultVMetrics(){return h(Mo,this).defaultVMetrics}}function To(t){if("string"!==typeof t)return null;if(t.endsWith("/"))return t;throw new Error('Invalid factory url: "'.concat(t,'" must include trailing slash.'))}const Ro=t=>"object"===typeof t&&Number.isInteger(null===t||void 0===t?void 0:t.num)&&t.num>=0&&Number.isInteger(null===t||void 0===t?void 0:t.gen)&&t.gen>=0,Po=function(t,e,i){if(!Array.isArray(i)||i.length<2)return!1;const[n,s,...o]=i;if(!t(n)&&!Number.isInteger(n))return!1;if(!e(s))return!1;const r=o.length;let a=!0;switch(s.name){case"XYZ":if(r<2||r>3)return!1;break;case"Fit":case"FitB":return 0===r;case"FitH":case"FitBH":case"FitV":case"FitBV":if(r>1)return!1;break;case"FitR":if(4!==r)return!1;a=!1;break;default:return!1}for(const l of o)if(!("number"===typeof l||a&&null===l))return!1;return!0}.bind(null,Ro,t=>"object"===typeof t&&"string"===typeof(null===t||void 0===t?void 0:t.name));var Io=new WeakMap,Do=new WeakMap;class Lo{constructor(){a(this,Io,new Map),a(this,Do,Promise.resolve())}postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};h(Do,this).then(()=>{for(const[t]of h(Io,this))t.call(this,i)})}addEventListener(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=null;if((null===i||void 0===i?void 0:i.signal)instanceof AbortSignal){const{signal:s}=i;if(s.aborted)return void gt("LoopbackPort - cannot use an `aborted` signal.");const o=()=>this.removeEventListener(t,e);n=()=>s.removeEventListener("abort",o),s.addEventListener("abort",o)}h(Io,this).set(e,n)}removeEventListener(t,e){const i=h(Io,this).get(e);null===i||void 0===i||i(),h(Io,this).delete(e)}terminate(){for(const[,t]of h(Io,this))null===t||void 0===t||t();h(Io,this).clear()}}const Oo=1,Fo=2,zo=1,No=2,Bo=3,Wo=4,jo=5,Go=6,Ho=7,Uo=8;function Vo(){}function qo(t){if(t instanceof Et||t instanceof Ct||t instanceof At||t instanceof kt||t instanceof St)return t;switch(t instanceof Error||"object"===typeof t&&null!==t||vt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new Et(t.message);case"InvalidPDFException":return new Ct(t.message);case"PasswordException":return new At(t.message,t.code);case"ResponseException":return new kt(t.message,t.status,t.missing);case"UnknownErrorException":return new St(t.message,t.details)}return new St(t.message,t.toString())}var Xo=new WeakMap,Ko=new WeakSet;class Yo{constructor(t,e,i){r(this,Ko),a(this,Xo,new AbortController),this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",l(Ko,this,Jo).bind(this),{signal:h(Xo,this).signal})}on(t,e){const i=this.actionHandler;if(i[t])throw new Error('There is already an actionName called "'.concat(t,'"'));i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const n=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[n]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:n,data:e},i)}catch(o){s.reject(o)}return s.promise}sendWithStream(t,e,i,n){const s=this.streamId++,o=this.sourceName,r=this.targetName,a=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();return this.streamControllers[s]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},a.postMessage({sourceName:o,targetName:r,action:t,streamId:s,data:e,desiredSize:i.desiredSize},n),l.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[s].pullCall=e,a.postMessage({sourceName:o,targetName:r,stream:Go,streamId:s,desiredSize:t.desiredSize}),e.promise},cancel:t=>{wt(t instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[s].cancelCall=e,this.streamControllers[s].isClosed=!0,a.postMessage({sourceName:o,targetName:r,stream:zo,streamId:s,reason:qo(t)}),e.promise}},i)}destroy(){var t;null===(t=h(Xo,this))||void 0===t||t.abort(),d(Xo,this,null)}}function Jo(t){let{data:e}=t;if(e.targetName!==this.sourceName)return;if(e.stream)return void l(Ko,this,Zo).call(this,e);if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error("Cannot resolve callback ".concat(t));if(delete this.callbackCapabilities[t],e.callback===Oo)i.resolve(e.data);else{if(e.callback!==Fo)throw new Error("Unexpected callback case");i.reject(qo(e.reason))}return}const i=this.actionHandler[e.action];if(!i)throw new Error("Unknown action from worker: ".concat(e.action));if(e.callbackId){const t=this.sourceName,n=e.sourceName,s=this.comObj;return void Promise.try(i,e.data).then(function(i){s.postMessage({sourceName:t,targetName:n,callback:Oo,callbackId:e.callbackId,data:i})},function(i){s.postMessage({sourceName:t,targetName:n,callback:Fo,callbackId:e.callbackId,reason:qo(i)})})}e.streamId?l(Ko,this,Qo).call(this,e):i(e.data)}function Qo(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,o=this,r=this.actionHandler[t.action],a={enqueue(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const a=this.desiredSize;this.desiredSize-=o,a>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:i,targetName:n,stream:Wo,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Bo,streamId:e}),delete o.streamSinks[e])},error(t){wt(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:jo,streamId:e,reason:qo(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};a.sinkCapability.resolve(),a.ready=a.sinkCapability.promise,this.streamSinks[e]=a,Promise.try(r,t.data,a).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Uo,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:n,stream:Uo,streamId:e,reason:qo(t)})})}function Zo(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,o=this.streamControllers[e],r=this.streamSinks[e];switch(t.stream){case Uo:t.success?o.startCall.resolve():o.startCall.reject(qo(t.reason));break;case Ho:t.success?o.pullCall.resolve():o.pullCall.reject(qo(t.reason));break;case Go:if(!r){s.postMessage({sourceName:i,targetName:n,stream:Ho,streamId:e,success:!0});break}r.desiredSize<=0&&t.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=t.desiredSize,Promise.try(r.onPull||Vo).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ho,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:n,stream:Ho,streamId:e,reason:qo(t)})});break;case Wo:if(wt(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(t.chunk);break;case Bo:if(wt(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),l(Ko,this,$o).call(this,o,e);break;case jo:wt(o,"error should have stream controller"),o.controller.error(qo(t.reason)),l(Ko,this,$o).call(this,o,e);break;case No:t.success?o.cancelCall.resolve():o.cancelCall.reject(qo(t.reason)),l(Ko,this,$o).call(this,o,e);break;case zo:if(!r)break;const a=qo(t.reason);Promise.try(r.onCancel||Vo,a).then(function(){s.postMessage({sourceName:i,targetName:n,stream:No,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:n,stream:No,streamId:e,reason:qo(t)})}),r.sinkCapability.reject(a),r.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async function $o(t,e){var i,n,s;await Promise.allSettled([null===(i=t.startCall)||void 0===i?void 0:i.promise,null===(n=t.pullCall)||void 0===n?void 0:n.promise,null===(s=t.cancelCall)||void 0===s?void 0:s.promise]),delete this.streamControllers[e]}var tr=new WeakMap;class er{constructor(t){let{enableHWA:e=!1}=t;a(this,tr,!1),d(tr,this,e)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!h(tr,this)})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){vt("Abstract method `_createCanvas` called.")}}class ir extends er{constructor(t){let{ownerDocument:e=globalThis.document,enableHWA:i=!1}=t;super({enableHWA:i}),this._document=e}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}class nr{constructor(t){let{baseUrl:e=null,isCompressed:i=!0}=t;this.baseUrl=e,this.isCompressed=i}async fetch(t){let{name:e}=t;if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(i).then(t=>({cMapData:t,isCompressed:this.isCompressed})).catch(t=>{throw new Error("Unable to load ".concat(this.isCompressed?"binary ":"","CMap at: ").concat(i))})}async _fetch(t){vt("Abstract method `_fetch` called.")}}class sr extends nr{async _fetch(t){const e=await qt(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Rt(e)}}class or{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,n,s){return"none"}destroy(){}}var rr=new WeakMap,ar=new WeakMap,lr=new WeakMap,cr=new WeakMap,hr=new WeakMap,dr=new WeakMap,ur=new WeakMap,pr=new WeakSet;class fr extends or{constructor(t){let{docId:e,ownerDocument:i=globalThis.document}=t;super(),r(this,pr),a(this,rr,void 0),a(this,ar,void 0),a(this,lr,void 0),a(this,cr,void 0),a(this,hr,void 0),a(this,dr,void 0),a(this,ur,0),d(cr,this,e),d(hr,this,i)}addFilter(t){var e,i;if(!t)return"none";let n=c(pr,this,mr).get(t);if(n)return n;const[s,o,r]=l(pr,this,wr).call(this,t),a=1===t.length?s:"".concat(s).concat(o).concat(r);if(n=c(pr,this,mr).get(a),n)return c(pr,this,mr).set(t,n),n;const u="g_".concat(h(cr,this),"_transfer_map_").concat((d(ur,this,(e=h(ur,this),i=e++,e)),i)),p=l(pr,this,br).call(this,u);c(pr,this,mr).set(t,p),c(pr,this,mr).set(a,p);const f=l(pr,this,_r).call(this,u);return l(pr,this,Sr).call(this,s,o,r,f),p}addHCMFilter(t,e){var i;const n="".concat(t,"-").concat(e),s="base";let o=c(pr,this,gr).get(s);if((null===(i=o)||void 0===i?void 0:i.key)===n)return o.url;var r;o?(null===(r=o.filter)||void 0===r||r.remove(),o.key=n,o.url="none",o.filter=null):(o={key:n,url:"none",filter:null},c(pr,this,gr).set(s,o));if(!t||!e)return o.url;const a=l(pr,this,kr).call(this,t);t=Dt.makeHexColor(...a);const d=l(pr,this,kr).call(this,e);if(e=Dt.makeHexColor(...d),c(pr,this,vr).style.color="","#000000"===t&&"#ffffff"===e||t===e)return o.url;const u=new Array(256);for(let l=0;l<=255;l++){const t=l/255;u[l]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const p=u.join(","),f="g_".concat(h(cr,this),"_hcm_filter"),m=o.filter=l(pr,this,_r).call(this,f);l(pr,this,Sr).call(this,p,p,p,m),l(pr,this,xr).call(this,m);const g=(t,e)=>{const i=a[t]/255,n=d[t]/255,s=new Array(e+1);for(let o=0;o<=e;o++)s[o]=i+o/e*(n-i);return s.join(",")};return l(pr,this,Sr).call(this,g(0,5),g(1,5),g(2,5),m),o.url=l(pr,this,br).call(this,f),o.url}addAlphaFilter(t){var e,i;let n=c(pr,this,mr).get(t);if(n)return n;const[s]=l(pr,this,wr).call(this,[t]),o="alpha_".concat(s);if(n=c(pr,this,mr).get(o),n)return c(pr,this,mr).set(t,n),n;const r="g_".concat(h(cr,this),"_alpha_map_").concat((d(ur,this,(e=h(ur,this),i=e++,e)),i)),a=l(pr,this,br).call(this,r);c(pr,this,mr).set(t,a),c(pr,this,mr).set(o,a);const u=l(pr,this,_r).call(this,r);return l(pr,this,Cr).call(this,s,u),a}addLuminosityFilter(t){var e,i;let n,s,o=c(pr,this,mr).get(t||"luminosity");if(o)return o;if(t?([n]=l(pr,this,wr).call(this,[t]),s="luminosity_".concat(n)):s="luminosity",o=c(pr,this,mr).get(s),o)return c(pr,this,mr).set(t,o),o;const r="g_".concat(h(cr,this),"_luminosity_map_").concat((d(ur,this,(e=h(ur,this),i=e++,e)),i)),a=l(pr,this,br).call(this,r);c(pr,this,mr).set(t,a),c(pr,this,mr).set(s,a);const u=l(pr,this,_r).call(this,r);return l(pr,this,yr).call(this,u),t&&l(pr,this,Cr).call(this,n,u),a}addHighlightHCMFilter(t,e,i,n,s){var o;const r="".concat(e,"-").concat(i,"-").concat(n,"-").concat(s);let a=c(pr,this,gr).get(t);if((null===(o=a)||void 0===o?void 0:o.key)===r)return a.url;var d;a?(null===(d=a.filter)||void 0===d||d.remove(),a.key=r,a.url="none",a.filter=null):(a={key:r,url:"none",filter:null},c(pr,this,gr).set(t,a));if(!e||!i)return a.url;const[u,p]=[e,i].map(l(pr,this,kr).bind(this));let f=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),m=Math.round(.2126*p[0]+.7152*p[1]+.0722*p[2]),[g,v]=[n,s].map(l(pr,this,kr).bind(this));m{const n=new Array(256),s=(m-f)/i,o=t/255,r=(e-t)/(255*i);let a=0;for(let l=0;l<=i;l++){const t=Math.round(f+l*s),e=o+l*r;for(let i=a;i<=t;i++)n[i]=e;a=t+1}for(let l=a;l<256;l++)n[l]=n[a-1];return n.join(",")},b="g_".concat(h(cr,this),"_hcm_").concat(t,"_filter"),y=a.filter=l(pr,this,_r).call(this,b);return l(pr,this,xr).call(this,y),l(pr,this,Sr).call(this,w(g[0],v[0],5),w(g[1],v[1],5),w(g[2],v[2],5),y),a.url=l(pr,this,br).call(this,b),a.url}destroy(){var t,e,i,n;arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&null!==(t=h(dr,this))&&void 0!==t&&t.size||(null===(e=h(lr,this))||void 0===e||e.parentNode.parentNode.remove(),d(lr,this,null),null===(i=h(ar,this))||void 0===i||i.clear(),d(ar,this,null),null===(n=h(dr,this))||void 0===n||n.clear(),d(dr,this,null),d(ur,this,0))}}function mr(t){return h(ar,t)||d(ar,t,new Map)}function gr(t){return h(dr,t)||d(dr,t,new Map)}function vr(t){if(!h(lr,t)){const e=h(hr,t).createElement("div"),{style:i}=e;i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;const n=h(hr,t).createElementNS(Ut,"svg");n.setAttribute("width",0),n.setAttribute("height",0),d(lr,t,h(hr,t).createElementNS(Ut,"defs")),e.append(n),n.append(h(lr,t)),h(hr,t).body.append(e)}return h(lr,t)}function wr(t){if(1===t.length){const e=t[0],i=new Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;const n=i.join(",");return[n,n,n]}const[e,i,n]=t,s=new Array(256),o=new Array(256),r=new Array(256);for(let a=0;a<256;a++)s[a]=e[a]/255,o[a]=i[a]/255,r[a]=n[a]/255;return[s.join(","),o.join(","),r.join(",")]}function br(t){if(void 0===h(rr,this)){d(rr,this,"");const t=h(hr,this).URL;t!==h(hr,this).baseURI&&(Yt(t)?gt('#createUrl: ignore "data:"-URL for performance reasons.'):d(rr,this,yt(t,"")))}return"url(".concat(h(rr,this),"#").concat(t,")")}function yr(t){const e=h(hr,this).createElementNS(Ut,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}function xr(t){const e=h(hr,this).createElementNS(Ut,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}function _r(t){const e=h(hr,this).createElementNS(Ut,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),c(pr,this,vr).append(e),e}function Ar(t,e,i){const n=h(hr,this).createElementNS(Ut,e);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),t.append(n)}function Sr(t,e,i,n){const s=h(hr,this).createElementNS(Ut,"feComponentTransfer");n.append(s),l(pr,this,Ar).call(this,s,"feFuncR",t),l(pr,this,Ar).call(this,s,"feFuncG",e),l(pr,this,Ar).call(this,s,"feFuncB",i)}function Cr(t,e){const i=h(hr,this).createElementNS(Ut,"feComponentTransfer");e.append(i),l(pr,this,Ar).call(this,i,"feFuncA",t)}function kr(t){return c(pr,this,vr).style.color=t,ne(getComputedStyle(c(pr,this,vr)).getPropertyValue("color"))}class Mr{constructor(t){let{baseUrl:e=null}=t;this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const i="".concat(this.baseUrl).concat(e);return this._fetch(i).catch(t=>{throw new Error("Unable to load font data at: ".concat(i))})}async _fetch(t){vt("Abstract method `_fetch` called.")}}class Er extends Mr{async _fetch(t){const e=await qt(t,"arraybuffer");return new Uint8Array(e)}}class Tr{constructor(t){let{baseUrl:e=null}=t;this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const i="".concat(this.baseUrl).concat(e);return this._fetch(i).catch(t=>{throw new Error("Unable to load wasm data at: ".concat(i))})}async _fetch(t){vt("Abstract method `_fetch` called.")}}class Rr extends Tr{async _fetch(t){const e=await qt(t,"arraybuffer");return new Uint8Array(e)}}async function Pr(t){const e=process.getBuiltinModule("fs"),i=await e.promises.readFile(t);return new Uint8Array(i)}I&>("Please use the `legacy` build in Node.js environments.");class Ir extends or{}class Dr extends er{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire("file:///var/home/georg/Projekte/Sonstiges/MinIO/console/web-app/node_modules/pdfjs-dist/build/pdf.mjs")("@napi-rs/canvas").createCanvas(t,e)}}class Lr extends nr{async _fetch(t){return Pr(t)}}class Or extends Mr{async _fetch(t){return Pr(t)}}class Fr extends Tr{async _fetch(t){return Pr(t)}}const zr="__forcedDependency",{floor:Nr,ceil:Br}=Math;function Wr(t,e,i,n,s,o){t[4*e+0]=Math.min(t[4*e+0],i),t[4*e+1]=Math.min(t[4*e+1],n),t[4*e+2]=Math.max(t[4*e+2],s),t[4*e+3]=Math.max(t[4*e+3],o)}const jr=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var Gr=new WeakMap,Hr=new WeakMap;class Ur{constructor(t,e){a(this,Gr,void 0),a(this,Hr,void 0),d(Gr,this,t),d(Hr,this,e)}get length(){return h(Gr,this).length}isEmpty(t){return h(Gr,this)[t]===jr}minX(t){return h(Hr,this)[4*t+0]/256}minY(t){return h(Hr,this)[4*t+1]/256}maxX(t){return(h(Hr,this)[4*t+2]+1)/256}maxY(t){return(h(Hr,this)[4*t+3]+1)/256}}const Vr=(t,e)=>{if(!t)return;let i=t.get(e);return i||(i={dependencies:new Set,isRenderingOperation:!1},t.set(e,i)),i};var qr=new WeakMap,Xr=new WeakMap,Kr=new WeakMap,Yr=new WeakMap,Jr=new WeakMap,Qr=new WeakMap,Zr=new WeakMap,$r=new WeakMap,ta=new WeakMap,ea=new WeakMap,ia=new WeakMap,na=new WeakMap,sa=new WeakMap,oa=new WeakMap,ra=new WeakMap,aa=new WeakMap,la=new WeakMap,ca=new WeakSet;class ha{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];r(this,ca),a(this,qr,{__proto__:null}),a(this,Xr,{__proto__:null,transform:[],moveText:[],sameLineText:[],[zr]:[]}),a(this,Kr,new Map),a(this,Yr,[]),a(this,Jr,[]),a(this,Qr,[[1,0,0,1,0,0]]),a(this,Zr,[-1/0,-1/0,1/0,1/0]),a(this,$r,new Float64Array([1/0,1/0,-1/0,-1/0])),a(this,ta,-1),a(this,ea,new Set),a(this,ia,new Map),a(this,na,new Map),a(this,sa,void 0),a(this,oa,void 0),a(this,ra,void 0),a(this,aa,void 0),a(this,la,void 0),d(sa,this,t.width),d(oa,this,t.height),l(ca,this,da).call(this,e),i&&d(la,this,new Map)}growOperationsCount(t){t>=h(aa,this).length&&l(ca,this,da).call(this,t,h(aa,this))}save(t){return d(qr,this,{__proto__:h(qr,this)}),d(Xr,this,{__proto__:h(Xr,this),transform:{__proto__:h(Xr,this).transform},moveText:{__proto__:h(Xr,this).moveText},sameLineText:{__proto__:h(Xr,this).sameLineText},[zr]:{__proto__:h(Xr,this)[zr]}}),d(Zr,this,{__proto__:h(Zr,this)}),h(Yr,this).push(t),this}restore(t){const e=Object.getPrototypeOf(h(qr,this));if(null===e)return this;d(qr,this,e),d(Xr,this,Object.getPrototypeOf(h(Xr,this))),d(Zr,this,Object.getPrototypeOf(h(Zr,this)));const i=h(Yr,this).pop();var n;void 0!==i&&(null===(n=Vr(h(la,this),t))||void 0===n||n.dependencies.add(i),h(aa,this)[t]=h(aa,this)[i]);return this}recordOpenMarker(t){return h(Yr,this).push(t),this}getOpenMarker(){return 0===h(Yr,this).length?null:h(Yr,this).at(-1)}recordCloseMarker(t){const e=h(Yr,this).pop();var i;void 0!==e&&(null===(i=Vr(h(la,this),t))||void 0===i||i.dependencies.add(e),h(aa,this)[t]=h(aa,this)[e]);return this}beginMarkedContent(t){return h(Jr,this).push(t),this}endMarkedContent(t){const e=h(Jr,this).pop();var i;void 0!==e&&(null===(i=Vr(h(la,this),t))||void 0===i||i.dependencies.add(e),h(aa,this)[t]=h(aa,this)[e]);return this}pushBaseTransform(t){return h(Qr,this).push(Dt.multiplyByDOMMatrix(h(Qr,this).at(-1),t.getTransform())),this}popBaseTransform(){return h(Qr,this).length>1&&h(Qr,this).pop(),this}recordSimpleData(t,e){return h(qr,this)[t]=e,this}recordIncrementalData(t,e){return h(Xr,this)[t].push(e),this}resetIncrementalData(t,e){return h(Xr,this)[t].length=0,this}recordNamedData(t,e){return h(Kr,this).set(t,e),this}recordSimpleDataFromNamed(t,e,i){var n;h(qr,this)[t]=null!==(n=h(Kr,this).get(e))&&void 0!==n?n:i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(zr,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(const e of t)e in h(qr,this)&&this.recordFutureForcedDependency(e,h(qr,this)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const t of h(ea,this))this.recordFutureForcedDependency(zr,t);return this}resetBBox(t){return h(ta,this)!==t&&(d(ta,this,t),h($r,this)[0]=1/0,h($r,this)[1]=1/0,h($r,this)[2]=-1/0,h($r,this)[3]=-1/0),this}recordClipBox(t,e,i,n,s,o){const r=Dt.multiplyByDOMMatrix(h(Qr,this).at(-1),e.getTransform()),a=[1/0,1/0,-1/0,-1/0];Dt.axialAlignedBoundingBox([i,s,n,o],r,a);const l=Dt.intersect(h(Zr,this),a);return l?(h(Zr,this)[0]=l[0],h(Zr,this)[1]=l[1],h(Zr,this)[2]=l[2],h(Zr,this)[3]=l[3]):(h(Zr,this)[0]=h(Zr,this)[1]=1/0,h(Zr,this)[2]=h(Zr,this)[3]=-1/0),this}recordBBox(t,e,i,n,s,o){const r=h(Zr,this);if(r[0]===1/0)return this;const a=Dt.multiplyByDOMMatrix(h(Qr,this).at(-1),e.getTransform());if(r[0]===-1/0)return Dt.axialAlignedBoundingBox([i,s,n,o],a,h($r,this)),this;const l=[1/0,1/0,-1/0,-1/0];return Dt.axialAlignedBoundingBox([i,s,n,o],a,l),h($r,this)[0]=Math.min(h($r,this)[0],Math.max(l[0],r[0])),h($r,this)[1]=Math.min(h($r,this)[1],Math.max(l[1],r[1])),h($r,this)[2]=Math.max(h($r,this)[2],Math.min(l[2],r[2])),h($r,this)[3]=Math.max(h($r,this)[3],Math.min(l[3],r[3])),this}recordCharacterBBox(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6?arguments[6]:void 0;const a=i.bbox;let l,c;if(a&&(l=a[2]!==a[0]&&a[3]!==a[1]&&h(na,this).get(i),!1!==l&&(c=[0,0,0,0],Dt.axialAlignedBoundingBox(a,i.fontMatrix,c),1===n&&0===s&&0===o||Dt.scaleMinMax([n,0,0,-n,s,o],c),l)))return this.recordBBox(t,e,c[0],c[2],c[1],c[3]);if(!r)return this.recordFullPageBBox(t);const d=r();return a&&c&&void 0===l&&(l=c[0]<=s-d.actualBoundingBoxLeft&&c[2]>=s+d.actualBoundingBoxRight&&c[1]<=o-d.actualBoundingBoxAscent&&c[3]>=o+d.actualBoundingBoxDescent,h(na,this).set(i,l),l)?this.recordBBox(t,e,c[0],c[2],c[1],c[3]):this.recordBBox(t,e,s-d.actualBoundingBoxLeft,s+d.actualBoundingBoxRight,o-d.actualBoundingBoxAscent,o+d.actualBoundingBoxDescent)}recordFullPageBBox(t){return h($r,this)[0]=Math.max(0,h(Zr,this)[0]),h($r,this)[1]=Math.max(0,h(Zr,this)[1]),h($r,this)[2]=Math.min(h(sa,this),h(Zr,this)[2]),h($r,this)[3]=Math.min(h(oa,this),h(Zr,this)[3]),this}getSimpleIndex(t){return h(qr,this)[t]}recordDependencies(t,e){const i=h(ea,this),n=h(qr,this),s=h(Xr,this);for(const o of e)o in h(qr,this)?i.add(n[o]):o in s&&s[o].forEach(i.add,i);return this}recordNamedDependency(t,e){return h(Kr,this).has(e)&&h(ea,this).add(h(Kr,this).get(e)),this}recordOperation(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.recordDependencies(t,[zr]),h(la,this)){const e=Vr(h(la,this),t),{dependencies:i}=e;h(ea,this).forEach(i.add,i),h(Yr,this).forEach(i.add,i),h(Jr,this).forEach(i.add,i),i.delete(t),e.isRenderingOperation=!0}if(h(ta,this)===t){const i=Nr(256*h($r,this)[0]/h(sa,this)),n=Nr(256*h($r,this)[1]/h(oa,this)),s=Br(256*h($r,this)[2]/h(sa,this)),o=Br(256*h($r,this)[3]/h(oa,this));Wr(h(ra,this),t,i,n,s,o);for(const e of h(ea,this))e!==t&&Wr(h(ra,this),e,i,n,s,o);for(const e of h(Yr,this))e!==t&&Wr(h(ra,this),e,i,n,s,o);for(const e of h(Jr,this))e!==t&&Wr(h(ra,this),e,i,n,s,o);e||(h(ea,this).clear(),d(ta,this,-1))}return this}recordShowTextOperation(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=Array.from(h(ea,this));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(const n of i)this.recordIncrementalData("sameLineText",n);return this}bboxToClipBoxDropOperation(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return h(ta,this)===t&&(d(ta,this,-1),h(Zr,this)[0]=Math.max(h(Zr,this)[0],h($r,this)[0]),h(Zr,this)[1]=Math.max(h(Zr,this)[1],h($r,this)[1]),h(Zr,this)[2]=Math.min(h(Zr,this)[2],h($r,this)[2]),h(Zr,this)[3]=Math.min(h(Zr,this)[3],h($r,this)[3]),e||h(ea,this).clear()),this}_takePendingDependencies(){const t=h(ea,this);return d(ea,this,new Set),t}_extractOperation(t){const e=h(ia,this).get(t);return h(ia,this).delete(t),e}_pushPendingDependencies(t){for(const e of t)h(ea,this).add(e)}take(){return h(na,this).clear(),new Ur(h(aa,this),h(ra,this))}takeDebugMetadata(){return h(la,this)}}function da(t,e){const i=new ArrayBuffer(4*t);d(ra,this,new Uint8ClampedArray(i)),d(aa,this,new Uint32Array(i)),e&&e.length>0?(h(aa,this).set(e),h(aa,this).fill(jr,e.length)):h(aa,this).fill(jr)}var ua=new WeakMap,pa=new WeakMap,fa=new WeakMap,ma=new WeakMap,ga=new WeakMap;class va{constructor(t,e,i){if(a(this,ua,void 0),a(this,pa,void 0),a(this,fa,void 0),a(this,ma,0),a(this,ga,0),t instanceof va&&h(fa,t)===!!i)return t;d(ua,this,t),d(pa,this,e),d(fa,this,!!i)}growOperationsCount(){throw new Error("Unreachable")}save(t){var e;return d(ga,this,(e=h(ga,this),e++,e)),h(ua,this).save(h(pa,this)),this}restore(t){var e;h(ga,this)>0&&(h(ua,this).restore(h(pa,this)),d(ga,this,(e=h(ga,this),e--,e)));return this}recordOpenMarker(t){var e;return d(ma,this,(e=h(ma,this),e++,e)),this}getOpenMarker(){return h(ma,this)>0?h(pa,this):h(ua,this).getOpenMarker()}recordCloseMarker(t){var e;return d(ma,this,(e=h(ma,this),e--,e)),this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return h(ua,this).pushBaseTransform(t),this}popBaseTransform(){return h(ua,this).popBaseTransform(),this}recordSimpleData(t,e){return h(ua,this).recordSimpleData(t,h(pa,this)),this}recordIncrementalData(t,e){return h(ua,this).recordIncrementalData(t,h(pa,this)),this}resetIncrementalData(t,e){return h(ua,this).resetIncrementalData(t,h(pa,this)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return h(ua,this).recordSimpleDataFromNamed(t,e,h(pa,this)),this}recordFutureForcedDependency(t,e){return h(ua,this).recordFutureForcedDependency(t,h(pa,this)),this}inheritSimpleDataAsFutureForcedDependencies(t){return h(ua,this).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return h(ua,this).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return h(fa,this)||h(ua,this).resetBBox(h(pa,this)),this}recordClipBox(t,e,i,n,s,o){return h(fa,this)||h(ua,this).recordClipBox(h(pa,this),e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return h(fa,this)||h(ua,this).recordBBox(h(pa,this),e,i,n,s,o),this}recordCharacterBBox(t,e,i,n,s,o,r){return h(fa,this)||h(ua,this).recordCharacterBBox(h(pa,this),e,i,n,s,o,r),this}recordFullPageBBox(t){return h(fa,this)||h(ua,this).recordFullPageBBox(h(pa,this)),this}getSimpleIndex(t){return h(ua,this).getSimpleIndex(t)}recordDependencies(t,e){return h(ua,this).recordDependencies(h(pa,this),e),this}recordNamedDependency(t,e){return h(ua,this).recordNamedDependency(h(pa,this),e),this}recordOperation(t){return h(ua,this).recordOperation(h(pa,this),!0),this}recordShowTextOperation(t){return h(ua,this).recordShowTextOperation(h(pa,this),!0),this}bboxToClipBoxDropOperation(t){return h(fa,this)||h(ua,this).bboxToClipBoxDropOperation(h(pa,this),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}}const wa=["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],ba=["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],ya=["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],xa=["filter","fillColor","fillAlpha"],_a=["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],Aa=["transform"],Sa=["transform","fillColor"],Ca="Fill",ka="Stroke",Ma="Shading";function Ea(t,e){if(!e)return;const i=e[2]-e[0],n=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],i,n),t.clip(s)}class Ta{isModifyingCurrentTransform(){return!1}getPattern(){vt("Abstract method `getPattern` called.")}}class Ra extends Ta{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,n){let s;if(n===ka||n===Ca){const o=e.current.getClippedPathBoundingBox(n,se(t))||[0,0,0,0],r=Math.ceil(o[2]-o[0])||1,a=Math.ceil(o[3]-o[1])||1,l=e.cachedCanvases.getCanvas("pattern",r,a),c=l.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-o[0],-o[1]),i=Dt.transform(i,[1,0,0,1,o[0],o[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix),Ea(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),s=t.createPattern(l.canvas,"no-repeat");const h=new DOMMatrix(i);s.setTransform(h)}else Ea(t,this._bbox),s=this._createGradient(t);return s}}function Pa(t,e,i,n,s,o,r,a){const l=e.coords,c=e.colors,h=t.data,d=4*t.width;let u;l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=o,o=r,r=u),l[n+1]>l[s+1]&&(u=n,n=s,s=u,u=r,r=a,a=u),l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=o,o=r,r=u);const p=(l[i]+e.offsetX)*e.scaleX,f=(l[i+1]+e.offsetY)*e.scaleY,m=(l[n]+e.offsetX)*e.scaleX,g=(l[n+1]+e.offsetY)*e.scaleY,v=(l[s]+e.offsetX)*e.scaleX,w=(l[s+1]+e.offsetY)*e.scaleY;if(f>=w)return;const b=c[o],y=c[o+1],x=c[o+2],_=c[r],A=c[r+1],S=c[r+2],C=c[a],k=c[a+1],M=c[a+2],E=Math.round(f),T=Math.round(w);let R,P,I,D,L,O,F,z;for(let N=E;N<=T;N++){if(Nw?1:g===w?0:(g-N)/(g-w),R=m-(m-v)*t,P=_-(_-C)*t,I=A-(A-k)*t,D=S-(S-M)*t}let t;t=Nw?1:(f-N)/(f-w),L=p-(p-v)*t,O=b-(b-C)*t,F=y-(y-k)*t,z=x-(x-M)*t;const e=Math.round(Math.min(R,L)),i=Math.round(Math.max(R,L));let n=d*N+4*e;for(let s=e;s<=i;s++)t=(R-s)/(R-L),t<0?t=0:t>1&&(t=1),h[n++]=P-(P-O)*t|0,h[n++]=I-(I-F)*t|0,h[n++]=D-(D-z)*t|0,h[n++]=255}}function Ia(t,e,i){const n=e.coords,s=e.colors;let o,r;switch(e.type){case"lattice":const a=e.verticesPerRow,l=Math.floor(n.length/a)-1,c=a-1;for(o=0;o=Math.ceil(g*x)?A=h:C=!0,E>=Math.ceil(v*_)?S=d:k=!0;const T=this.getSizeAndScale(A,this.ctx.canvas.width,x),R=this.getSizeAndScale(S,this.ctx.canvas.height,_),P=t.cachedCanvases.getCanvas("pattern",T.size,R.size),I=P.context,D=c.createCanvasGraphics(I,e);if(D.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(D,r,l),I.translate(-T.scale*u,-R.scale*p),D.transform(0,T.scale,0,0,R.scale,0,0),I.save(),null===(i=D.dependencyTracker)||void 0===i||i.save(),this.clipBbox(D,u,p,f,m),D.baseTransform=se(D.ctx),D.executeOperatorList(o),D.endDrawing(),null===(n=D.dependencyTracker)||void 0===n||n.restore(),I.restore(),C||k){const e=P.canvas;C&&(A=h),k&&(S=d);const i=this.getSizeAndScale(A,this.ctx.canvas.width,x),n=this.getSizeAndScale(S,this.ctx.canvas.height,_),s=i.size,o=n.size,r=t.cachedCanvases.getCanvas("pattern-workaround",s,o),a=r.context,l=C?Math.floor(g/h):0,c=k?Math.floor(v/d):0;for(let t=0;t<=l;t++)for(let i=0;i<=c;i++)a.drawImage(e,s*t,o*i,s,o,0,0,s,o);return{canvas:r.canvas,scaleX:i.scale,scaleY:n.scale,offsetX:u,offsetY:p}}return{canvas:P.canvas,scaleX:T.scale,scaleY:R.scale,offsetX:u,offsetY:p}}getSizeAndScale(t,e,i){const n=Math.max(za.MAX_PATTERN_SIZE,e);let s=Math.ceil(t*i);return s>=n?s=n:i=s/t,{scale:i,size:s}}clipBbox(t,e,i,n,s){const o=n-e,r=s-i;t.ctx.rect(e,i,o,r),Dt.axialAlignedBoundingBox([e,i,n,s],se(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const n=t.ctx,s=t.current;switch(e){case Oa:const{fillStyle:t,strokeStyle:o}=this.ctx;n.fillStyle=s.fillColor=t,n.strokeStyle=s.strokeColor=o;break;case Fa:n.fillStyle=n.strokeStyle=i,s.fillColor=s.strokeColor=i;break;default:throw new Mt("Unsupported paint type: ".concat(e))}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,n,s){let o=i;n!==Ma&&(o=Dt.transform(o,e.baseTransform),this.matrix&&(o=Dt.transform(o,this.matrix)));const r=this.createPatternCanvas(e,s);let a=new DOMMatrix(o);a=a.translate(r.offsetX,r.offsetY),a=a.scale(1/r.scaleX,1/r.scaleY);const l=t.createPattern(r.canvas,"repeat");return l.setTransform(a),l}}function Na(t){let{src:e,srcPos:i=0,dest:n,width:s,height:o,nonBlackColor:r=4294967295,inverseDecode:a=!1}=t;const l=Pt.isLittleEndian?4278190080:255,[c,h]=a?[r,l]:[l,r],d=s>>3,u=7&s,p=e.length;n=new Uint32Array(n.buffer);let f=0;for(let m=0;m0&&void 0!==arguments[0]?arguments[0]:Ca,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=this.minMax.slice();if(t===ka){e||vt("Stroke bounding box must include transform."),Dt.singularValueDecompose2dScale(e,ja);const t=ja[0]*this.lineWidth/2,n=ja[1]*this.lineWidth/2;i[0]-=t,i[1]-=n,i[2]+=t,i[3]+=n}return i}updateClipFromPath(){const t=Dt.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(Ga,0)}getClippedPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ca,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Dt.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function qa(t,e){if(e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,n=e.width,s=i%Ba,o=(i-s)/Ba,r=0===s?o:o+1,a=t.createImageData(n,Ba);let l,c=0;const h=e.data,d=a.data;let u,p,f,m;if(e.kind===$.GRAYSCALE_1BPP){const e=h.byteLength,i=new Uint32Array(d.buffer,0,d.byteLength>>2),m=i.length,g=n+7>>3,v=4294967295,w=Pt.isLittleEndian?4278190080:255;for(u=0;ug?n:8*t-7,r=-8&o;let a=0,d=0;for(;s>=1}for(;l=o&&(f=s,m=n*f),l=0,p=m;p--;)d[l++]=h[c++],d[l++]=h[c++],d[l++]=h[c++],d[l++]=255;t.putImageData(a,0,u*Ba)}}}function Xa(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,n=e.width,s=i%Ba,o=(i-s)/Ba,r=0===s?o:o+1,a=t.createImageData(n,Ba);let l=0;const c=e.data,h=a.data;for(let d=0;d2&&void 0!==arguments[2]?arguments[2]:null;var n;return"string"===typeof e?(null===(n=this.dependencyTracker)||void 0===n||n.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):i}beginDrawing(t){let{transform:e,viewport:i,transparency:n=!1,background:s=null}=t;const o=this.ctx.canvas.width,r=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,o,r),this.ctx.fillStyle=a,n){const t=this.cachedCanvases.getCanvas("transparent",o,r);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...se(this.compositeCtx))}this.ctx.save(),Ya(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=se(this.ctx)}executeOperatorList(t,e,i,n,s){const o=t.argsArray,r=t.fnArray;let a=e||0;const l=o.length;if(l===a)return a;const c=l-a>10&&"function"===typeof i,h=c?Date.now()+15:0;let d=0;const u=this.commonObjs,p=this.objs;let f,m;for(;;){if(void 0!==n&&a===n.nextBreakPoint)return n.breakIt(a,i),a;var g;if(!s||s(a))if(f=r[a],m=null!==(g=o[a])&&void 0!==g?g:null,f!==at.dependency)null===m?this[f](a):this[f](a,...m);else for(const t of m){var v;null===(v=this.dependencyTracker)||void 0===v||v.recordNamedData(t,a);const e=t.startsWith("g_")?u:p;if(!e.has(t))return e.get(t,i),a}if(a++,a===l)return a;if(c&&++d>10){if(Date.now()>h)return i(),a;d=0}}}endDrawing(){l(el,this,nl).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),l(el,this,sl).call(this)}_scaleImage(t,e){var i,n;const s=null!==(i=t.width)&&void 0!==i?i:t.displayWidth,o=null!==(n=t.height)&&void 0!==n?n:t.displayHeight;let r,a,l=Math.max(Math.hypot(e[0],e[1]),1),c=Math.max(Math.hypot(e[2],e[3]),1),h=s,d=o,u="prescale1";for(;l>2&&h>1||c>2&&d>1;){let e=h,i=d;l>2&&h>1&&(e=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h/2),l/=h/e),c>2&&d>1&&(i=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,c/=d/i),r=this.cachedCanvases.getCanvas(u,e,i),a=r.context,a.clearRect(0,0,e,i),a.drawImage(t,0,0,h,d,0,0,e,i),t=r.canvas,h=e,d=i,u="prescale1"===u?"prescale2":"prescale1"}return{img:t,paintWidth:h,paintHeight:d}}_createMaskCanvas(t,e){var i;const n=this.ctx,{width:s,height:o}=e,r=this.current.fillColor,a=this.current.patternFill,l=se(n);let c,h,d,u;if((e.bitmap||e.data)&&e.count>1){const i=e.bitmap||e.data.buffer;h=JSON.stringify(a?l:[l.slice(0,4),r]),c=this._cachedBitmapsMap.get(i),c||(c=new Map,this._cachedBitmapsMap.set(i,c));const n=c.get(h);if(n&&!a){var p;const e=Math.round(Math.min(l[0],l[2])+l[4]),i=Math.round(Math.min(l[1],l[3])+l[5]);return null===(p=this.dependencyTracker)||void 0===p||p.recordDependencies(t,Sa),{canvas:n,offsetX:e,offsetY:i}}d=n}d||(u=this.cachedCanvases.getCanvas("maskCanvas",s,o),Xa(u.context,e));let f=Dt.transform(l,[1/s,0,0,-1/o,0,0]);f=Dt.transform(f,[1,0,0,1,0,-o]);const m=Ga.slice();Dt.axialAlignedBoundingBox([0,0,s,o],f,m);const[g,v,w,b]=m,y=Math.round(w-g)||1,x=Math.round(b-v)||1,_=this.cachedCanvases.getCanvas("fillCanvas",y,x),A=_.context,S=g,C=v;A.translate(-S,-C),A.transform(...f),d||(d=this._scaleImage(u.canvas,oe(A)),d=d.img,c&&a&&c.set(h,d)),A.imageSmoothingEnabled=Ja(se(A),e.interpolate),Ua(A,d,0,0,d.width,d.height,0,0,s,o),A.globalCompositeOperation="source-in";const k=Dt.transform(oe(A),[1,0,0,1,-S,-C]);return A.fillStyle=a?r.getPattern(n,this,k,Ca,t):r,A.fillRect(0,0,s,o),c&&!a&&(this.cachedCanvases.delete("fillCanvas"),c.set(h,_.canvas)),null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,Sa),{canvas:_.canvas,offsetX:Math.round(S),offsetY:Math.round(C)}}setLineWidth(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("lineCap",t),this.ctx.lineCap=Qa[e]}setLineJoin(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("lineJoin",t),this.ctx.lineJoin=Za[e]}setMiterLimit(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,i){var n;null===(n=this.dependencyTracker)||void 0===n||n.recordSimpleData("dash",t);const s=this.ctx;void 0!==s.setLineDash&&(s.setLineDash(e),s.lineDashOffset=i)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){var i,n,s,o,r;for(const[a,l]of e)switch(a){case"LW":this.setLineWidth(t,l);break;case"LC":this.setLineCap(t,l);break;case"LJ":this.setLineJoin(t,l);break;case"ML":this.setMiterLimit(t,l);break;case"D":this.setDash(t,l[0],l[1]);break;case"RI":this.setRenderingIntent(t,l);break;case"FL":this.setFlatness(t,l);break;case"Font":this.setFont(t,l[0],l[1]);break;case"CA":null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=l;break;case"ca":null===(n=this.dependencyTracker)||void 0===n||n.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=l;break;case"BM":null===(s=this.dependencyTracker)||void 0===s||s.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=l;break;case"SMask":null===(o=this.dependencyTracker)||void 0===o||o.recordSimpleData("SMask",t),this.current.activeSMask=l?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":null===(r=this.dependencyTracker)||void 0===r||r.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(l)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,i=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(n,e,i);this.suspendedCtx=this.ctx;const o=this.ctx=s.context;o.setTransform(this.suspendedCtx.getTransform()),Ka(this.suspendedCtx,o),function(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,n,s,o,r){e.transform(t,i,n,s,o,r),this.__originalTransform(t,i,n,s,o,r)},t.setTransform=function(t,i,n,s,o,r){e.setTransform(t,i,n,s,o,r),this.__originalSetTransform(t,i,n,s,o,r)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,n,s,o,r){e.bezierCurveTo(t,i,n,s,o,r),this.__originalBezierCurveTo(t,i,n,s,o,r)},t.rect=function(t,i,n,s){e.rect(t,i,n,s),this.__originalRect(t,i,n,s)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(o,this.suspendedCtx),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Ka(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,i,n){const s=n[0],o=n[1],r=n[2]-s,a=n[3]-o;0!==r&&0!==a&&(this.genericComposeSMask(e.context,i,r,a,e.subtype,e.backdrop,e.transferMap,s,o,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,n,s,o,r,a,l,c,h){let d=t.canvas,u=a-c,p=l-h;if(o)if(u<0||p<0||u+i>d.width||p+n>d.height){const t=this.cachedCanvases.getCanvas("maskExtension",i,n),e=t.context;e.drawImage(d,-u,-p),e.globalCompositeOperation="destination-atop",e.fillStyle=o,e.fillRect(0,0,i,n),e.globalCompositeOperation="source-over",d=t.canvas,u=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const e=new Path2D;e.rect(u,p,i,n),t.clip(e),t.globalCompositeOperation="destination-atop",t.fillStyle=o,t.fillRect(u,p,i,n),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===s&&r?e.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===s&&(e.filter=this.filterFactory.addLuminosityFilter(r));const f=new Path2D;f.rect(a,l,i,n),e.clip(f),e.globalCompositeOperation="destination-in",e.drawImage(d,u,p,i,n,a,l,i,n),e.restore()}save(t){var e;this.inSMaskMode&&Ka(this.ctx,this.suspendedCtx),this.ctx.save();const i=this.current;this.stateStack.push(i),this.current=i.clone(),null===(e=this.dependencyTracker)||void 0===e||e.save(t)}restore(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.restore(t),0!==this.stateStack.length?(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&Ka(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null):this.inSMaskMode&&this.endSMaskMode()}transform(t,e,i,n,s,o,r){var a;null===(a=this.dependencyTracker)||void 0===a||a.recordIncrementalData("transform",t),this.ctx.transform(e,i,n,s,o,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i,n){let[s]=i;if(!n)return s||(s=i[0]=new Path2D),void this[e](t,s);if(null!==this.dependencyTracker){const i=e===at.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,n[0]-i,n[2]+i,n[1]-i,n[3]+i).recordDependencies(t,["transform"])}if(!(s instanceof Path2D)){const t=i[0]=new Path2D;for(let e=0,i=s.length;e2&&void 0!==arguments[2])||arguments[2];const s=this.ctx,o=this.current.strokeColor;if(s.globalAlpha=this.current.strokeAlpha,this.contentVisible)if("object"===typeof o&&null!==o&&void 0!==o&&o.getPattern){const i=o.isModifyingCurrentTransform()?s.getTransform():null;if(s.save(),s.strokeStyle=o.getPattern(s,this,oe(s),ka,t),i){const t=new Path2D;t.addPath(e,s.getTransform().invertSelf().multiplySelf(i)),e=t}this.rescaleAndStroke(e,!1),s.restore()}else this.rescaleAndStroke(e,!0);null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,wa),n&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(ka,se(this.ctx))),s.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e){var i;let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.ctx,o=this.current.fillColor;let r=!1;if(this.current.patternFill){var a;const i=o.isModifyingCurrentTransform()?s.getTransform():null;if(null===(a=this.dependencyTracker)||void 0===a||a.save(t),s.save(),s.fillStyle=o.getPattern(s,this,oe(s),Ca,t),i){const t=new Path2D;t.addPath(e,s.getTransform().invertSelf().multiplySelf(i)),e=t}r=!0}const l=this.current.getClippedPathBoundingBox();var c;(this.contentVisible&&null!==l&&(this.pendingEOFill?(s.fill(e,"evenodd"),this.pendingEOFill=!1):s.fill(e)),null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,ba),r)&&(s.restore(),null===(c=this.dependencyTracker)||void 0===c||c.restore(t));n&&this.consumePath(t,e,l)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){var i;this.ctx.fill(e),null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,xa).recordOperation(t)}clip(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=$a}eoClip(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=tl}beginText(t){var e;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,null===(e=this.dependencyTracker)||void 0===e||e.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){const e=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;void 0!==e&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(void 0!==e){const t=new Path2D,n=i.getTransform().invertSelf();for(const{transform:i,x:s,y:o,fontSize:r,path:a}of e)a&&t.addPath(a,new DOMMatrix(i).preMultiplySelf(n).translate(s,o).scale(r,-r));i.clip(t)}delete this.pendingTextPaths}setCharSpacing(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,i){var n,s;null===(n=this.dependencyTracker)||void 0===n||n.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);const o=this.commonObjs.get(e),r=this.current;if(!o)throw new Error("Can't find font for ".concat(e));if(r.fontMatrix=o.fontMatrix||D,0!==r.fontMatrix[0]&&0!==r.fontMatrix[3]||gt("Invalid font matrix for font "+e),i<0?(i=-i,r.fontDirection=-1):r.fontDirection=1,this.current.font=o,this.current.fontSize=i,o.isType3Font)return;const a=o.loadedName||"sans-serif",l=(null===(s=o.systemFontInfo)||void 0===s?void 0:s.css)||'"'.concat(a,'", ').concat(o.fallbackName);let c="normal";o.black?c="900":o.bold&&(c="bold");const h=o.italic?"italic":"normal";let d=i;i<16?d=16:i>100&&(d=100),this.current.fontSizeScale=i/d,this.ctx.font="".concat(h," ").concat(c," ").concat(d,"px ").concat(l)}setTextRenderingMode(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,i){var n;null===(n=this.dependencyTracker)||void 0===n||n.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(t,e,i){this.setLeading(t,-i),this.moveText(t,e,i)}setTextMatrix(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("textMatrix",t);const{current:n}=this;n.textMatrix=e,n.textMatrixScale=Math.hypot(e[0],e[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(t){var e,i;this.moveText(t,0,this.current.leading),null===(e=this.dependencyTracker)||void 0===e||e.recordIncrementalData("moveText",null!==(i=this.dependencyTracker.getSimpleIndex("leading"))&&void 0!==i?i:t)}paintChar(t,e,i,n,s,o){const r=this.ctx,a=this.current,c=a.font,h=a.textRenderingMode,d=a.fontSize/a.fontSizeScale,u=h&Q,p=!!(h&Z),f=a.patternFill&&!c.missingFile,m=a.patternStroke&&!c.missingFile;let g;if((c.disableFontFace||p||f||m)&&!c.missingFile&&(g=c.getPathGenerator(this.commonObjs,e)),g&&(c.disableFontFace||f||m)){var v;let e;if(r.save(),r.translate(i,n),r.scale(d,-d),null===(v=this.dependencyTracker)||void 0===v||v.recordCharacterBBox(t,r,c),u===X||u===Y)if(s){e=r.getTransform(),r.setTransform(...s);const t=l(el,this,ol).call(this,g,e,s);r.fill(t)}else r.fill(g);if(u===K||u===Y)if(o){e||(e=r.getTransform()),r.setTransform(...o);const{a:t,b:i,c:n,d:s}=e,a=Dt.inverseTransform(o),c=Dt.transform([t,i,n,s,0,0],a);Dt.singularValueDecompose2dScale(c,ja),r.lineWidth*=Math.max(ja[0],ja[1])/d,r.stroke(l(el,this,ol).call(this,g,e,o))}else r.lineWidth/=d,r.stroke(g);r.restore()}else{var w;if(u===X||u===Y)r.fillText(e,i,n),null===(w=this.dependencyTracker)||void 0===w||w.recordCharacterBBox(t,r,c,d,i,n,()=>r.measureText(e));if(u===K||u===Y){var b;if(this.dependencyTracker)null===(b=this.dependencyTracker)||void 0===b||b.recordCharacterBBox(t,r,c,d,i,n,()=>r.measureText(e)).recordDependencies(t,wa);r.strokeText(e,i,n)}}if(p){var y;(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:se(r),x:i,y:n,fontSize:d,path:g}),null===(y=this.dependencyTracker)||void 0===y||y.recordCharacterBBox(t,r,c,d,i,n)}}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let i=!1;for(let n=3;n0&&e[n]<255){i=!0;break}return xt(this,"isFontSubpixelAAEnabled",i)}showText(t,e){var i;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,_a).resetBBox(t),this.current.textRenderingMode&Z&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());const n=this.current,s=n.font;var o;if(s.isType3Font)return this.showType3Text(t,e),void(null===(o=this.dependencyTracker)||void 0===o||o.recordShowTextOperation(t));const r=n.fontSize;var a;if(0===r)return void(null===(a=this.dependencyTracker)||void 0===a||a.recordOperation(t));const l=this.ctx,c=n.fontSizeScale,h=n.charSpacing,d=n.wordSpacing,u=n.fontDirection,p=n.textHScale*u,f=e.length,m=s.vertical,g=m?1:-1,v=s.defaultVMetrics,w=r*n.fontMatrix[0],b=n.textRenderingMode===X&&!s.disableFontFace&&!n.patternFill;let y,x;if(l.save(),n.textMatrix&&l.transform(...n.textMatrix),l.translate(n.x,n.y+n.textRise),u>0?l.scale(p,-1):l.scale(p,1),n.patternFill){l.save();const e=n.fillColor.getPattern(l,this,oe(l),Ca,t);y=se(l),l.restore(),l.fillStyle=e}if(n.patternStroke){l.save();const e=n.strokeColor.getPattern(l,this,oe(l),ka,t);x=se(l),l.restore(),l.strokeStyle=e}let _=n.lineWidth;const A=n.textMatrixScale;if(0===A||0===_){const t=n.textRenderingMode&Q;t!==K&&t!==Y||(_=this.getSinglePixelWidth())}else _/=A;if(1!==c&&(l.scale(c,c),_/=c),l.lineWidth=_,s.isInvalidPDFjsFont){const i=[];let s=0;for(const t of e)i.push(t.unicode),s+=t.width;const o=i.join("");if(l.fillText(o,0,0),null!==this.dependencyTracker){const e=l.measureText(o);this.dependencyTracker.recordBBox(t,this.ctx,-e.actualBoundingBoxLeft,e.actualBoundingBoxRight,-e.actualBoundingBoxAscent,e.actualBoundingBoxDescent).recordShowTextOperation(t)}return n.x+=s*w*p,l.restore(),void this.compose()}let S,C=0;for(S=0;S0){A=l.measureText(a);const t=1e3*A.width/r*c;if(Mnull!==A&&void 0!==A?A:l.measureText(a));else if(this.paintChar(t,a,f,_,y,x),p){const e=f+r*p.offset.x/c,i=_-r*p.offset.y/c;this.paintChar(t,p.fontChar,e,i,y,x)}C+=m?M*w-o*u:M*w+o*u,n&&l.restore()}m?n.y-=C:n.x+=C*p,l.restore(),this.compose(),null===(i=this.dependencyTracker)||void 0===i||i.recordShowTextOperation(t)}showType3Text(t,e){const i=this.ctx,n=this.current,s=n.font,o=n.fontSize,r=n.fontDirection,a=s.vertical?1:-1,l=n.charSpacing,c=n.wordSpacing,h=n.textHScale*r,d=n.fontMatrix||D,u=e.length;let p,f,m,g;if(n.textRenderingMode===J||0===o)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),n.textMatrix&&i.transform(...n.textMatrix),i.translate(n.x,n.y+n.textRise),i.scale(h,r);const v=this.dependencyTracker;for(this.dependencyTracker=v?new va(v,t):null,p=0;pnew il(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new va(this.dependencyTracker,e,!0):null)};i=new za(e,this.ctx,n,t)}else i=this._getPattern(t,e[1],e[2]);return i}setStrokeColorN(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordSimpleData("strokeColor",t);for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;s1?i-1:0),s=1;s2&&void 0!==arguments[2]?arguments[2]:null;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=function(t){switch(t[0]){case"RadialAxial":return new Ra(t);case"Mesh":return new Da(t);case"Dummy":return new La}throw new Error("Unknown IR type: ".concat(t[0]))}(this.getObject(t,e)),this.cachedPatterns.set(e,i)),n&&(i.matrix=n),i}shadingFill(t,e){var i;if(!this.contentVisible)return;const n=this.ctx;this.save(t);const s=this._getPattern(t,e);n.fillStyle=s.getPattern(n,this,oe(n),Ma,t);const o=oe(n);if(o){const{width:t,height:e}=n.canvas,i=Ga.slice();Dt.axialAlignedBoundingBox([0,0,t,e],o,i);const[s,r,a,l]=i;this.ctx.fillRect(s,r,a-s,l-r)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);null===(i=this.dependencyTracker)||void 0===i||i.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,Aa).recordDependencies(t,ba).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){vt("Should not call beginInlineImage")}beginImageData(){vt("Should not call beginImageData")}paintFormXObjectBegin(t,e,i){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=se(this.ctx),i)){var n;Dt.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);const[e,s,o,r]=i,a=new Path2D;a.rect(e,s,o-e,r-s),this.ctx.clip(a),null===(n=this.dependencyTracker)||void 0===n||n.recordClipBox(t,this.ctx,e,o,s,r),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){var i;if(!this.contentVisible)return;this.save(t),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const n=this.ctx;e.isolated||mt("TODO: Support non-isolated groups."),e.knockout&>("Knockout groups not supported.");const s=se(n);if(e.matrix&&n.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let o=Ga.slice();Dt.axialAlignedBoundingBox(e.bbox,se(n),o);const r=[0,0,n.canvas.width,n.canvas.height];o=Dt.intersect(o,r)||[0,0,0,0];const a=Math.floor(o[0]),l=Math.floor(o[1]),c=Math.max(Math.ceil(o[2])-a,1),h=Math.max(Math.ceil(o[3])-l,1);this.current.startNewPathAndClipBox([0,0,c,h]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(d,c,h),p=u.context;p.translate(-a,-l),p.transform(...s);let f=new Path2D;const[m,g,v,w]=e.bbox;if(f.rect(m,g,v-m,w-g),e.matrix){const t=new Path2D;t.addPath(f,new DOMMatrix(e.matrix)),f=t}p.clip(f),e.smask&&this.smaskStack.push({canvas:u.canvas,context:p,offsetX:a,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}),e.smask&&!this.dependencyTracker||(n.setTransform(1,0,0,1,0,0),n.translate(a,l),n.save()),Ka(n,p),this.ctx=p,null===(i=this.dependencyTracker)||void 0===i||i.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(n),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(n),this.groupLevel++}endGroup(t,e){var i;if(!this.contentVisible)return;this.groupLevel--;const n=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,null===(i=this.dependencyTracker)||void 0===i||i.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();const e=se(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...e);const i=Ga.slice();Dt.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],e,i),this.ctx.drawImage(n.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,n,s,o){if(l(el,this,nl).call(this),Ya(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){const s=i[2]-i[0],r=i[3]-i[1];if(o&&this.annotationCanvasMap){(n=n.slice())[4]-=i[0],n[5]-=i[1],(i=i.slice())[0]=i[1]=0,i[2]=s,i[3]=r,Dt.singularValueDecompose2dScale(se(this.ctx),ja);const{viewportScale:t}=this,o=Math.ceil(s*this.outputScaleX*t),a=Math.ceil(r*this.outputScaleY*t);this.annotationCanvas=this.canvasFactory.create(o,a);const{canvas:l,context:c}=this.annotationCanvas;this.annotationCanvasMap.set(e,l),this.annotationCanvas.savedCtx=this.ctx,this.ctx=c,this.ctx.save(),this.ctx.setTransform(ja[0],0,0,-ja[1],0,r*ja[1]),Ya(this.ctx)}else{Ya(this.ctx),this.endPath(t);const e=new Path2D;e.rect(i[0],i[1],s,r),this.ctx.clip(e)}}this.current=new Va(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...n),this.transform(t,...s)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),l(el,this,sl).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){var i;if(!this.contentVisible)return;const n=e.count;(e=this.getObject(t,e.data,e)).count=n;const s=this.ctx,o=this._createMaskCanvas(t,e),r=o.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(r,o.offsetX,o.offsetY),null===(i=this.dependencyTracker)||void 0===i||i.resetBBox(t).recordBBox(t,this.ctx,o.offsetX,o.offsetX+r.width,o.offsetY,o.offsetY+r.height).recordOperation(t),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i){var n,s;let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5?arguments[5]:void 0,l=arguments.length>6?arguments[6]:void 0;if(!this.contentVisible)return;e=this.getObject(t,e.data,e);const c=this.ctx;c.save();const h=se(c);c.transform(i,o,r,a,0,0);const d=this._createMaskCanvas(t,e);c.setTransform(1,0,0,1,d.offsetX-h[4],d.offsetY-h[5]),null===(n=this.dependencyTracker)||void 0===n||n.resetBBox(t);for(let p=0,f=l.length;pe?c/e:1,r=l>e?l/e:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=r}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:i,current:{lineWidth:n}}=this,[s,o]=this.getScaleForStroking();if(s===o)return i.lineWidth=(n||1)*s,void i.stroke(t);const r=i.getLineDash();e&&i.save(),i.scale(s,o),Wa.a=1/s,Wa.d=1/o;const a=new Path2D;if(a.addPath(t,Wa),r.length>0){const t=Math.max(s,o);i.setLineDash(r.map(e=>e/t)),i.lineDashOffset/=t}i.lineWidth=n||1,i.stroke(a),e&&i.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}function nl(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}function sl(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}function ol(t,e,i){const n=new Path2D;return n.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),n}for(const Iv in at)void 0!==il.prototype[Iv]&&(il.prototype[at[Iv]]=il.prototype[Iv]);var rl=new WeakMap,al=new WeakMap,ll=new WeakMap,cl=new WeakSet;class hl{static write(t){const e=new TextEncoder,i={};let n=0;for(const l of hl.strings){const s=e.encode(t[l]);i[l]=s,n+=4+s.length}const s=new ArrayBuffer(n),o=new Uint8Array(s),r=new DataView(s);let a=0;for(const l of hl.strings){const t=i[l],e=t.length;r.setUint32(a,e),o.set(t,a+4),a+=4+e}return wt(a===s.byteLength,"CssFontInfo.write: Buffer overflow"),s}constructor(t){r(this,cl),a(this,rl,void 0),a(this,al,void 0),a(this,ll,void 0),d(rl,this,t),d(al,this,new DataView(h(rl,this))),d(ll,this,new TextDecoder)}get fontFamily(){return l(cl,this,dl).call(this,0)}get fontWeight(){return l(cl,this,dl).call(this,1)}get italicAngle(){return l(cl,this,dl).call(this,2)}}function dl(t){wt(t>i&3;return 0===n?void 0:2===n}function Sl(t){return wt(t2&&void 0!==arguments[2]&&arguments[2];t!==zl&&vt("Internal method `_setVisible` called."),d(Wl,this,i),d(jl,this,e)}}var Hl=new WeakMap,Ul=new WeakMap,Vl=new WeakMap,ql=new WeakMap,Xl=new WeakSet;class Kl{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F;if(r(this,Xl),a(this,Hl,null),a(this,Ul,new Map),a(this,Vl,null),a(this,ql,null),this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,d(ql,this,t.order);for(const i of t.groups)h(Ul,this).set(i.id,new Gl(e,i));if("OFF"===t.baseState)for(const t of h(Ul,this).values())t._setVisible(zl,!1);for(const e of t.on)h(Ul,this).get(e)._setVisible(zl,!0);for(const e of t.off)h(Ul,this).get(e)._setVisible(zl,!1);d(Vl,this,this.getHash())}}isVisible(t){if(0===h(Ul,this).size)return!0;if(!t)return mt("Optional content group not defined."),!0;if("OCG"===t.type)return h(Ul,this).has(t.id)?h(Ul,this).get(t.id).visible:(gt("Optional content group not found: ".concat(t.id)),!0);if("OCMD"===t.type){if(t.expression)return l(Xl,this,Yl).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!h(Ul,this).has(e))return gt("Optional content group not found: ".concat(e)),!0;if(h(Ul,this).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!h(Ul,this).has(e))return gt("Optional content group not found: ".concat(e)),!0;if(!h(Ul,this).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!h(Ul,this).has(e))return gt("Optional content group not found: ".concat(e)),!0;if(!h(Ul,this).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!h(Ul,this).has(e))return gt("Optional content group not found: ".concat(e)),!0;if(h(Ul,this).get(e).visible)return!1}return!0}return gt("Unknown optional content policy ".concat(t.policy,".")),!0}return gt("Unknown group type ".concat(t.type,".")),!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=h(Ul,this).get(t);if(n){if(i&&e&&n.rbGroups.length)for(const e of n.rbGroups)for(const i of e){var s;if(i!==t)null===(s=h(Ul,this).get(i))||void 0===s||s._setVisible(zl,!1,!0)}n._setVisible(zl,!!e,!0),d(Hl,this,null)}else gt("Optional content group not found: ".concat(t))}setOCGState(t){let e,{state:i,preserveRB:n}=t;for(const s of i){switch(s){case"ON":case"OFF":case"Toggle":e=s;continue}const t=h(Ul,this).get(s);if(t)switch(e){case"ON":this.setVisibility(s,!0,n);break;case"OFF":this.setVisibility(s,!1,n);break;case"Toggle":this.setVisibility(s,!t.visible,n)}}d(Hl,this,null)}get hasInitialVisibility(){return null===h(Vl,this)||this.getHash()===h(Vl,this)}getOrder(){return h(Ul,this).size?h(ql,this)?h(ql,this).slice():[...h(Ul,this).keys()]:null}getGroup(t){return h(Ul,this).get(t)||null}getHash(){if(null!==h(Hl,this))return h(Hl,this);const t=new fo;for(const[e,i]of h(Ul,this))t.update("".concat(e,":").concat(i.visible));return d(Hl,this,t.hexdigest())}[Symbol.iterator](){return h(Ul,this).entries()}}function Yl(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let n=1;n0){const t=o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!n,this._isRangeSupported=!i,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),t.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),t.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData(t){let{begin:e,chunk:i}=t;const n=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{wt(this._rangeReaders.some(function(t){return t._begin===e&&(t._enqueue(n),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}_onProgress(t){var e,i,n,s;void 0===t.total?null===(e=this._rangeReaders[0])||void 0===e||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded}):null===(n=this._fullRequestReader)||void 0===n||null===(s=n.onProgress)||void 0===s||s.call(n,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;null===(t=this._fullRequestReader)||void 0===t||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){wt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new Ql(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Zl(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeReaders.slice(0))i.cancel(t);this._pdfDataRangeTransport.abort()}}class Ql{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=t,this._done=i||!1,this._filename=Jt(n)?n:null,this._queuedChunks=e||[],this._loaded=0;for(const s of this._queuedChunks)this._loaded+=s.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunks.push(t);this._loaded+=t.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Zl{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function $l(t,e){const i=new Headers;if(!t||!e||"object"!==typeof e)return i;for(const n in e){const t=e[n];void 0!==t&&i.append(n,t)}return i}function tc(t){var e,i;return null!==(e=null===(i=URL.parse(t))||void 0===i?void 0:i.origin)&&void 0!==e?e:null}function ec(t){let{responseHeaders:e,isHttp:i,rangeChunkSize:n,disableRange:s}=t;const o={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e.get("Content-Length"),10);if(!Number.isInteger(r))return o;if(o.suggestedLength=r,r<=2*n)return o;if(s||!i)return o;if("bytes"!==e.get("Accept-Ranges"))return o;return"identity"!==(e.get("Content-Encoding")||"identity")||(o.allowRangeRequests=!0),o}function ic(t){const e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=n("filename\\*","i").exec(t);if(i){i=i[1];let t=r(i);return t=unescape(t),t=a(t),t=l(t),o(t)}if(i=function(t){const e=[];let i;const s=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=s.exec(t));){let[,t,n,s]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[n,s]}const o=[];for(let n=0;n{if(t._responseOrigin=tc(e.url),!sc(e.status))throw nc(e.status,n);this._reader=e.body.getReader(),this._headersCapability.resolve();const i=e.headers,{allowRangeRequests:s,suggestedLength:o}=ec({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=o||this._contentLength,this._filename=ic(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Et("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:rc(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class cc{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const n=t.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const s=new Headers(t.headers);s.append("Range","bytes=".concat(e,"-").concat(i-1));const o=n.url;fetch(o,oc(s,this._withCredentials,this._abortController)).then(e=>{const i=tc(e.url);if(i!==t._responseOrigin)throw new Error('Expected range response-origin "'.concat(i,'" to match "').concat(t._responseOrigin,'".'));if(!sc(e.status))throw nc(e.status,o);this._readCapability.resolve(),this._reader=e.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),{value:rc(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class hc{constructor(t){let{url:e,httpHeaders:i,withCredentials:n}=t;(0,R.A)(this,"_responseOrigin",null),this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=$l(this.isHttp,i),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,n=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[s,o]of this.headers)e.setRequestHeader(s,o);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range","bytes=".concat(t.begin,"-").concat(t.end-1)),n.expectedStatus=206):n.expectedStatus=200,e.responseType="arraybuffer",wt(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{t.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),n.onHeadersReceived=t.onHeadersReceived,n.onDone=t.onDone,n.onError=t.onError,n.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;const n=this.pendingRequests[t];n&&(null===(i=n.onProgress)||void 0===i||i.call(n,e))}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const n=i.xhr;if(n.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==n.readyState)return;if(!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===n.status&&this.isHttp)return void i.onError(n.status);const s=n.status||200;if(!(200===s&&206===i.expectedStatus)&&s!==i.expectedStatus)return void i.onError(n.status);const o=function(t){const e=t.response;return"string"!==typeof e?e:Rt(e).buffer}(n);if(206===s){const t=n.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);e?i.onDone({begin:parseInt(e[1],10),chunk:o}):(gt('Missing or invalid "Content-Range" header.'),i.onError(0))}else o?i.onDone({begin:0,chunk:o}):i.onError(n.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class dc{constructor(t){this._source=t,this._manager=new hc(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return wt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new uc(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new pc(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class uc{constructor(t,e){this._manager=t,this._url=e.url,this._fullRequestId=t.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t);this._manager._responseOrigin=tc(e.responseURL);const i=e.getAllResponseHeaders(),n=new Headers(i?i.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(t=>{const[e,...i]=t.split(": ");return[e,i.join(": ")]}):[]),{allowRangeRequests:s,suggestedLength:o}=ec({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=ic(n),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t)if(this._requests.length>0){this._requests.shift().resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);if(this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=nc(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class pc{constructor(t,e,i){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:i,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var t;const e=tc(null===(t=this._manager.getRequestXhr(this._requestId))||void 0===t?void 0:t.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error('Expected range response-origin "'.concat(e,'" to match "').concat(this._manager._responseOrigin,'".')),this._onError(0))}_close(){var t;null===(t=this.onClosed)||void 0===t||t.call(this,this)}_onDone(t){const e=t.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunk=e;this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){var e;null!==(e=this._storedError)&&void 0!==e||(this._storedError=nc(t,this._url));for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded}))}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const fc=/^[a-z][a-z0-9\-+.]+:/i;class mc{constructor(t){this.source=t,this.url=function(t){if(fc.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}(t.url),wt("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return wt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new gc(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new vc(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class gc{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const i=process.getBuiltinModule("fs");i.promises.lstat(this._url).then(t=>{this._contentLength=t.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=nc(0,this._url.href)),this._storedError=t,this._headersCapability.reject(t)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Et("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class vc{constructor(t,e,i){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const n=t.source;this._isStreamingSupported=!n.disableStream;const s=process.getBuiltinModule("fs");this._setReadableStream(s.createReadStream(this._url,{start:e,end:i-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const wc=Symbol("INITIAL_DATA");var bc=new WeakMap,yc=new WeakSet;class xc{constructor(){r(this,yc),a(this,bc,Object.create(null))}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const i=l(yc,this,_c).call(this,t);return i.promise.then(()=>e(i.data)),null}const i=h(bc,this)[t];if(!i||i.data===wc)throw new Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){const e=h(bc,this)[t];return!!e&&e.data!==wc}delete(t){const e=h(bc,this)[t];return!(!e||e.data===wc)&&(delete h(bc,this)[t],!0)}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=l(yc,this,_c).call(this,t);i.data=e,i.resolve()}clear(){for(const e in h(bc,this)){var t;const{data:i}=h(bc,this)[e];null===i||void 0===i||null===(t=i.bitmap)||void 0===t||t.close()}d(bc,this,Object.create(null))}*[Symbol.iterator](){for(const t in h(bc,this)){const{data:e}=h(bc,this)[t];e!==wc&&(yield[t,e])}}}function _c(t){var e;return(e=h(bc,this))[t]||(e[t]=(0,s.A)((0,s.A)({},Promise.withResolvers()),{},{data:wc}))}var Ac=new WeakMap,Sc=new WeakMap,Cc=new WeakMap,kc=new WeakMap,Mc=new WeakMap,Ec=new WeakMap,Tc=new WeakMap,Rc=new WeakMap,Pc=new WeakMap,Ic=new WeakMap,Dc=new WeakMap,Lc=new WeakMap,Oc=new WeakMap,Fc=new WeakMap,zc=new WeakMap,Nc=new WeakMap,Bc=new WeakMap,Wc=new WeakMap,jc=new WeakSet;class Gc{constructor(t){var e;let{textContentSource:i,container:n,viewport:s}=t;if(r(this,jc),a(this,Ac,Promise.withResolvers()),a(this,Sc,null),a(this,Cc,!1),a(this,kc,!(null===(e=globalThis.FontInspector)||void 0===e||!e.enabled)),a(this,Mc,null),a(this,Ec,null),a(this,Tc,0),a(this,Rc,0),a(this,Pc,null),a(this,Ic,null),a(this,Dc,0),a(this,Lc,0),a(this,Oc,Object.create(null)),a(this,Fc,[]),a(this,zc,null),a(this,Nc,[]),a(this,Bc,new WeakMap),a(this,Wc,null),i instanceof ReadableStream)d(zc,this,i);else{if("object"!==typeof i)throw new Error('No "textContentSource" parameter specified.');d(zc,this,new ReadableStream({start(t){t.enqueue(i),t.close()}}))}d(Sc,this,d(Ic,this,n)),d(Lc,this,s.scale*ae.pixelRatio),d(Dc,this,s.rotation),d(Ec,this,{div:null,properties:null,ctx:null});const{pageWidth:o,pageHeight:l,pageX:c,pageY:u}=s.rawDims;d(Wc,this,[1,0,0,-1,-c,u+l]),d(Rc,this,o),d(Tc,this,l),Kc.call(Gc),re(n,s),h(Ac,this).promise.finally(()=>{th._.delete(this),d(Ec,this,null),d(Oc,this,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=Pt.platform;return xt(this,"fontFamilyMap",new Map([["sans-serif","".concat(t&&e?"Calibri, ":"","sans-serif")],["monospace","".concat(t&&e?"Lucida Console, ":"","monospace")]]))}render(){const t=()=>{h(Pc,this).read().then(e=>{var i;let{value:n,done:s}=e;s?h(Ac,this).resolve():(null!==(i=h(Mc,this))&&void 0!==i||d(Mc,this,n.lang),Object.assign(h(Oc,this),n.styles),l(jc,this,Hc).call(this,n.items),t())},h(Ac,this).reject)};return d(Pc,this,h(zc,this).getReader()),th._.add(this),t(),h(Ac,this).promise}update(t){let{viewport:e,onBefore:i=null}=t;const n=e.scale*ae.pixelRatio,s=e.rotation;if(s!==h(Dc,this)&&(null===i||void 0===i||i(),d(Dc,this,s),re(h(Ic,this),{rotation:s})),n!==h(Lc,this)){null===i||void 0===i||i(),d(Lc,this,n);const t={div:null,properties:null,ctx:qc.call(Gc,h(Mc,this))};for(const e of h(Nc,this))t.properties=h(Bc,this).get(e),t.div=e,l(jc,this,Vc).call(this,t)}}cancel(){var t;const e=new Et("TextLayer task cancelled.");null===(t=h(Pc,this))||void 0===t||t.cancel(e).catch(()=>{}),d(Pc,this,null),h(Ac,this).reject(e)}get textDivs(){return h(Nc,this)}get textContentItemsStr(){return h(Fc,this)}static cleanup(){if(!(l(Gc,this,th)._.size>0)){l(Gc,this,Jc)._.clear();for(const{canvas:t}of l(Gc,this,Qc)._.values())t.remove();l(Gc,this,Qc)._.clear()}}}function Hc(t){var e,i;if(h(Cc,this))return;null!==(i=(e=h(Ec,this)).ctx)&&void 0!==i||(e.ctx=qc.call(y,h(Mc,this)));const n=h(Nc,this),s=h(Fc,this);for(const o of t){if(n.length>1e5)return gt("Ignoring additional textDivs for performance reasons."),void d(Cc,this,!0);if(void 0!==o.str)s.push(o.str),l(jc,this,Uc).call(this,o);else if("beginMarkedContentProps"===o.type||"beginMarkedContent"===o.type){const t=h(Sc,this);d(Sc,this,document.createElement("span")),h(Sc,this).classList.add("markedContent"),o.id&&h(Sc,this).setAttribute("id","".concat(o.id)),t.append(h(Sc,this))}else"endMarkedContent"===o.type&&d(Sc,this,h(Sc,this).parentNode)}}function Uc(t){const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};h(Nc,this).push(e);const n=Dt.transform(h(Wc,this),t.transform);let s=Math.atan2(n[1],n[0]);const o=h(Oc,this)[t.fontName];o.vertical&&(s+=Math.PI/2);let r=h(kc,this)&&o.fontSubstitution||o.fontFamily;r=y.fontFamilyMap.get(r)||r;const a=Math.hypot(n[2],n[3]),c=a*Yc.call(y,r,o,h(Mc,this));let d,u;0===s?(d=n[4],u=n[5]-c):(d=n[4]+c*Math.sin(s),u=n[5]-c*Math.cos(s));const p="calc(var(--total-scale-factor) *",f=e.style;h(Sc,this)===h(Ic,this)?(f.left="".concat((100*d/h(Rc,this)).toFixed(2),"%"),f.top="".concat((100*u/h(Tc,this)).toFixed(2),"%")):(f.left="".concat(p).concat(d.toFixed(2),"px)"),f.top="".concat(p).concat(u.toFixed(2),"px)")),f.fontSize="".concat(p).concat(($c._*a).toFixed(2),"px)"),f.fontFamily=r,i.fontSize=a,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,h(kc,this)&&(e.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),0!==s&&(i.angle=s*(180/Math.PI));let m=!1;if(t.str.length>1)m=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(m=!0)}if(m&&(i.canvasWidth=o.vertical?t.height:t.width),h(Bc,this).set(e,i),h(Ec,this).div=e,h(Ec,this).properties=i,l(jc,this,Vc).call(this,h(Ec,this)),i.hasText&&h(Sc,this).append(e),i.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),h(Sc,this).append(t)}}function Vc(t){const{div:e,properties:i,ctx:n}=t,{style:s}=e;let o="";if($c._>1&&(o="scale(".concat(1/$c._,")")),0!==i.canvasWidth&&i.hasText){const{fontFamily:t}=s,{canvasWidth:r,fontSize:a}=i;Xc.call(y,n,a*h(Lc,this),t);const{width:l}=n.measureText(e.textContent);l>0&&(o="scaleX(".concat(r*h(Lc,this)/l,") ").concat(o))}0!==i.angle&&(o="rotate(".concat(i.angle,"deg) ").concat(o)),o.length>0&&(s.transform=o)}function qc(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=l(y,this,Qc)._.get(t||(t=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),l(y,this,Qc)._.set(t,e),l(y,this,Zc)._.set(e,{size:0,family:""})}return e}function Xc(t,e,i){const n=l(y,this,Zc)._.get(t);e===n.size&&i===n.family||(t.font="".concat(e,"px ").concat(i),n.size=e,n.family=i)}function Kc(){if(null!==l(y,this,$c)._)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),$c._=l(y,this,t.getBoundingClientRect().height),t.remove()}function Yc(t,e,i){const n=l(y,this,Jc)._.get(t);if(n)return n;const s=l(y,this,qc).call(this,i);s.canvas.width=s.canvas.height=30,l(y,this,Xc).call(this,s,30,t);const o=s.measureText(""),r=o.fontBoundingBoxAscent,a=Math.abs(o.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let c=.8;return r?c=r/(r+a):(Pt.platform.isFirefox&>("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?c=e.ascent:e.descent&&(c=1+e.descent)),l(y,this,Jc)._.set(t,c),c}y=Gc;var Jc={_:new Map},Qc={_:new Map},Zc={_:new WeakMap},$c={_:null},th={_:new Set};function eh(){var t,e;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"===typeof i||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i});const n=new ih,{docId:s}=n,o=i.url?function(t){if(t instanceof URL)return t.href;if("string"===typeof t){if(I)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(i.url):null,r=i.data?function(t){if(I&&"undefined"!==typeof Buffer&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"===typeof t)return Rt(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"===typeof t&&!isNaN(null===t||void 0===t?void 0:t.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(i.data):null,a=i.httpHeaders||null,l=!0===i.withCredentials,c=null!==(t=i.password)&&void 0!==t?t:null,h=i.range instanceof ch?i.range:null,d=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:65536;let u=i.worker instanceof yh?i.worker:null;const p=i.verbosity,f="string"!==typeof i.docBaseUrl||Yt(i.docBaseUrl)?null:i.docBaseUrl,m=To(i.cMapUrl),g=!1!==i.cMapPacked,v=i.CMapReaderFactory||(I?Lr:sr),w=To(i.iccUrl),b=To(i.standardFontDataUrl),y=i.StandardFontDataFactory||(I?Or:Er),x=To(i.wasmUrl),_=i.WasmFactory||(I?Fr:Rr),A=!0!==i.stopAtErrors,S=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,C=!1!==i.isEvalSupported,k="boolean"===typeof i.isOffscreenCanvasSupported?i.isOffscreenCanvasSupported:!I,M="boolean"===typeof i.isImageDecoderSupported?i.isImageDecoderSupported:!I&&(Pt.platform.isFirefox||!globalThis.chrome),E=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,T="boolean"===typeof i.disableFontFace?i.disableFontFace:I,R=!0===i.fontExtraProperties,P=!0===i.enableXfa,D=i.ownerDocument||globalThis.document,L=!0===i.disableRange,O=!0===i.disableStream,F=!0===i.disableAutoFetch,z=!0===i.pdfBug,N=i.CanvasFactory||(I?Dr:ir),B=i.FilterFactory||(I?Ir:fr),W=!0===i.enableHWA,j=!1!==i.useWasm,G=h?h.length:null!==(e=i.length)&&void 0!==e?e:NaN,H="boolean"===typeof i.useSystemFonts?i.useSystemFonts:!I&&!T,U="boolean"===typeof i.useWorkerFetch?i.useWorkerFetch:!!(v===sr&&y===Er&&_===Rr&&m&&b&&x&&Zt(m,document.baseURI)&&Zt(b,document.baseURI)&&Zt(x,document.baseURI));pt(p);const V={canvasFactory:new N({ownerDocument:D,enableHWA:W}),filterFactory:new B({docId:s,ownerDocument:D}),cMapReaderFactory:U?null:new v({baseUrl:m,isCompressed:g}),standardFontDataFactory:U?null:new y({baseUrl:b}),wasmFactory:U?null:new _({baseUrl:x})};u||(u=yh.create({verbosity:p,port:Pl.workerPort}),n._worker=u);const q={docId:s,apiVersion:"5.4.296",data:r,password:c,disableAutoFetch:F,rangeChunkSize:d,length:G,docBaseUrl:f,enableXfa:P,evaluatorOptions:{maxImageSize:S,disableFontFace:T,ignoreErrors:A,isEvalSupported:C,isOffscreenCanvasSupported:k,isImageDecoderSupported:M,canvasMaxAreaInBytes:E,fontExtraProperties:R,useSystemFonts:H,useWasm:j,useWorkerFetch:U,cMapUrl:m,iccUrl:w,standardFontDataUrl:b,wasmUrl:x}},X={ownerDocument:D,pdfBug:z,styleElement:null,loadingParams:{disableAutoFetch:F,enableXfa:P}};return u.promise.then(function(){if(n.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const t=u.messageHandler.sendWithPromise("GetDocRequest",q,r?[r.buffer]:null);let e;if(h)e=new Jl(h,{disableRange:L,disableStream:O});else if(!r){if(!o)throw new Error("getDocument - no `url` parameter provided.");const t=Zt(o)?ac:I?mc:dc;e=new t({url:o,length:G,httpHeaders:a,withCredentials:l,rangeChunkSize:d,disableRange:L,disableStream:O})}return t.then(t=>{if(n.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const i=new Yo(s,t,u.port),o=new Oh(i,n,e,X,V,W);n._transport=o,i.send("Ready",null)})}).catch(n._capability.reject),n}class ih{constructor(){(0,R.A)(this,"_capability",Promise.withResolvers()),(0,R.A)(this,"_transport",null),(0,R.A)(this,"_worker",null),(0,R.A)(this,"docId","d".concat((nh._=(x=nh._,_=x++,x),_))),(0,R.A)(this,"destroyed",!1),(0,R.A)(this,"onPassword",null),(0,R.A)(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t;this.destroyed=!0;try{var e,i;null!==(e=this._worker)&&void 0!==e&&e.port&&(this._worker._pendingDestroy=!0),await(null===(i=this._transport)||void 0===i?void 0:i.destroy())}catch(s){var n;throw null!==(n=this._worker)&&void 0!==n&&n.port&&delete this._worker._pendingDestroy,s}this._transport=null,null===(t=this._worker)||void 0===t||t.destroy(),this._worker=null}async getData(){return this._transport.getData()}}var nh={_:0},sh=new WeakMap,oh=new WeakMap,rh=new WeakMap,ah=new WeakMap,lh=new WeakMap;class ch{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;a(this,sh,Promise.withResolvers()),a(this,oh,[]),a(this,rh,[]),a(this,ah,[]),a(this,lh,[]),this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n}addRangeListener(t){h(lh,this).push(t)}addProgressListener(t){h(ah,this).push(t)}addProgressiveReadListener(t){h(rh,this).push(t)}addProgressiveDoneListener(t){h(oh,this).push(t)}onDataRange(t,e){for(const i of h(lh,this))i(t,e)}onDataProgress(t,e){h(sh,this).promise.then(()=>{for(const i of h(ah,this))i(t,e)})}onDataProgressiveRead(t){h(sh,this).promise.then(()=>{for(const e of h(rh,this))e(t)})}onDataProgressiveDone(){h(sh,this).promise.then(()=>{for(const t of h(oh,this))t()})}transportReady(){h(sh,this).resolve()}requestDataRange(t,e){vt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class hh{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return xt(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var dh=new WeakMap,uh=new WeakSet;class ph{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];r(this,uh),a(this,dh,!1),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=n?new Qt:null,this._pdfBug=n,this.commonObjs=i.commonObjs,this.objs=new xc,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Xt({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return xt(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null}render(t){var e,i,n;let{canvasContext:s,canvas:o=s.canvas,viewport:r,intent:a="display",annotationMode:c=H.ENABLE,transform:h=null,background:u=null,optionalContentConfigPromise:p=null,annotationCanvasMap:f=null,pageColors:m=null,printAnnotationStorage:g=null,isEditing:v=!1,recordOperations:w=!1,operationsFilter:b=null}=t;null===(e=this._stats)||void 0===e||e.time("Overall");const y=this._transport.getRenderingIntent(a,c,g,v),{renderingIntent:x,cacheKey:_}=y;d(dh,this,!1),p||(p=this._transport.getOptionalContentConfig(x));let A=this._intentStates.get(_);A||(A=Object.create(null),this._intentStates.set(_,A)),A.streamReaderCancelTimeout&&(clearTimeout(A.streamReaderCancelTimeout),A.streamReaderCancelTimeout=null);const S=!!(x&z);var C;A.displayReadyCapability||(A.displayReadyCapability=Promise.withResolvers(),A.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(C=this._stats)||void 0===C||C.time("Page Request"),this._pumpOperatorList(y));const k=Boolean(this._pdfBug&&(null===(i=globalThis.StepperManager)||void 0===i?void 0:i.enabled)),M=!this.recordedBBoxes&&(w||k),E=t=>{if(A.renderTasks.delete(T),M){var e;const t=null===(e=T.gfx)||void 0===e?void 0:e.dependencyTracker.take();t&&(T.stepper&&T.stepper.setOperatorBBoxes(t,T.gfx.dependencyTracker.takeDebugMetadata()),w&&(this.recordedBBoxes=t))}var i;(S&&d(dh,this,!0),l(uh,this,fh).call(this),t?(T.capability.reject(t),this._abortOperatorList({intentState:A,reason:t instanceof Error?t:new Error(t)})):T.capability.resolve(),this._stats)&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),null!==(i=globalThis.Stats)&&void 0!==i&&i.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},T=new Wh({callback:E,params:{canvas:o,canvasContext:s,dependencyTracker:M?new ha(o,A.operatorList.length,k):null,viewport:r,transform:h,background:u},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:f,operatorList:A.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!S,pdfBug:this._pdfBug,pageColors:m,enableHWA:this._transport.enableHWA,operationsFilter:b});((n=A).renderTasks||(n.renderTasks=new Set)).add(T);const R=T.task;return Promise.all([A.displayReadyCapability.promise,p]).then(t=>{var e;let[i,n]=t;if(this.destroyed)E();else{if(null===(e=this._stats)||void 0===e||e.time("Rendering"),!(n.renderingIntent&x))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");T.initializeGraphics({transparency:i,optionalContentConfig:n}),T.operatorListChanged()}}).catch(E),R}getOperatorList(){let{intent:t="display",annotationMode:e=H.ENABLE,printAnnotationStorage:i=null,isEditing:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this._transport.getRenderingIntent(t,e,i,n,!0);let o,r=this._intentStates.get(s.cacheKey);var a,l;(r||(r=Object.create(null),this._intentStates.set(s.cacheKey,r)),r.opListReadCapability)||(o=Object.create(null),o.operatorListChanged=function(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(o))},r.opListReadCapability=Promise.withResolvers(),((a=r).renderTasks||(a.renderTasks=new Set)).add(o),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(l=this._stats)||void 0===l||l.time("Page Request"),this._pumpOperatorList(s));return r.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:t=!1,disableNormalization:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then(t=>Gt.textContent(t));const e=this.streamTextContent(t);return new Promise(function(t,i){const n=e.getReader(),s={items:[],styles:Object.create(null),lang:null};!function e(){n.read().then(function(i){var n;let{value:o,done:r}=i;r?t(s):(null!==(n=s.lang)&&void 0!==n||(s.lang=o.lang),Object.assign(s.styles,o.styles),s.items.push(...o.items),e())},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),d(dh,this,!1),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];d(dh,this,!0);const e=l(uh,this,fh).call(this);return t&&e&&this._stats&&(this._stats=new Qt),e}_startRenderPage(t,e){var i,n;const s=this._intentStates.get(e);s&&(null===(i=this._stats)||void 0===i||i.timeEnd("Page Request"),null===(n=s.displayReadyCapability)||void 0===n||n.resolve(t))}_renderPageChunk(t,e){for(let i=0,n=t.length;i{a.read().then(t=>{let{value:e,done:i}=t;i?c.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,c),h())},t=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(const t of c.renderTasks)t.operatorListChanged();l(uh,this,fh).call(this)}if(c.displayReadyCapability)c.displayReadyCapability.reject(t);else{if(!c.opListReadCapability)throw t;c.opListReadCapability.reject(t)}}})};h()}_abortOperatorList(t){let{intentState:e,reason:i,force:n=!1}=t;if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(i instanceof Kt){let t=100;return i.extraDelay>0&&i.extraDelay<1e3&&(t+=i.extraDelay),void(e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},t))}}if(e.streamReader.cancel(new Et(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}function fh(){if(!h(dh,this)||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),d(dh,this,!1),!0}var mh=new WeakMap,gh=new WeakMap,vh=new WeakMap,wh=new WeakMap,bh=new WeakSet;class yh{constructor(){let{name:t=null,port:e=null,verbosity:i=ft()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(r(this,bh),a(this,mh,Promise.withResolvers()),a(this,gh,null),a(this,vh,null),a(this,wh,null),this.name=t,this.destroyed=!1,this.verbosity=i,e){if(Eh._.has(e))throw new Error("Cannot use more than one PDFWorker per port.");Eh._.set(e,this),l(bh,this,_h).call(this,e)}else l(bh,this,Ah).call(this)}get promise(){return h(mh,this).promise}get port(){return h(vh,this)}get messageHandler(){return h(gh,this)}destroy(){var t,e;this.destroyed=!0,null===(t=h(wh,this))||void 0===t||t.terminate(),d(wh,this,null),Eh._.delete(h(vh,this)),d(vh,this,null),null===(e=h(gh,this))||void 0===e||e.destroy(),d(gh,this,null)}static create(t){const e=l(yh,this,Eh)._.get(null===t||void 0===t?void 0:t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new yh(t)}static get workerSrc(){if(Pl.workerSrc)return Pl.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return xt(this,"_setupFakeWorkerGlobal",(async()=>{if(c(yh,this,Ch))return c(yh,this,Ch);return(await import(this.workerSrc)).WorkerMessageHandler})())}}function xh(){h(mh,this).resolve(),h(gh,this).send("configure",{verbosity:this.verbosity})}function _h(t){d(vh,this,t),d(gh,this,new Yo("main","worker",t)),h(gh,this).on("ready",()=>{}),l(bh,this,xh).call(this)}function Ah(){if(Mh._||Ch(A))return void l(bh,this,Sh).call(this);let{workerSrc:t}=A;try{A._isSameOrigin(window.location,t)||(t=A._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new Yo("main","worker",e),n=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?h(mh,this).reject(new Error("Worker was destroyed")):l(bh,this,Sh).call(this)},s=new AbortController;e.addEventListener("error",()=>{h(wh,this)||n()},{signal:s.signal}),i.on("test",t=>{s.abort(),!this.destroyed&&t?(d(gh,this,i),d(vh,this,e),d(wh,this,e),l(bh,this,xh).call(this)):n()}),i.on("ready",t=>{if(s.abort(),this.destroyed)n();else try{o()}catch(e){l(bh,this,Sh).call(this)}});const o=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void o()}catch(e){mt("The worker has been disabled.")}l(bh,this,Sh).call(this)}function Sh(){Mh._||(gt("Setting up fake worker."),Mh._=!0),A._setupFakeWorkerGlobal.then(t=>{var e,i;if(this.destroyed)return void h(mh,this).reject(new Error("Worker was destroyed"));const n=new Lo;d(vh,this,n);const s="fake".concat((kh._=(e=kh._,i=e++,e),i)),o=new Yo(s+"_worker",s,n);t.setup(o,n),d(gh,this,new Yo(s,s+"_worker",n)),l(bh,this,xh).call(this)}).catch(t=>{h(mh,this).reject(new Error('Setting up fake worker failed: "'.concat(t.message,'".')))})}function Ch(t){try{var e;return(null===(e=globalThis.pdfjsWorker)||void 0===e?void 0:e.WorkerMessageHandler)||null}catch(i){return null}}A=yh;var kh={_:0},Mh={_:!1},Eh={_:new WeakMap};I&&(Mh._=l(A,A,!0),Pl.workerSrc||(Pl.workerSrc="./pdf.worker.mjs")),A._isSameOrigin=(t,e)=>{const i=URL.parse(t);if(null===i||void 0===i||!i.origin||"null"===i.origin)return!1;const n=new URL(e,i);return i.origin===n.origin},A._createCDNWrapper=t=>{const e='await import("'.concat(t,'");');return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},A.fromPort=t=>{var e;if(e="`PDFWorker.fromPort` - please use `PDFWorker.create` instead.",console.log("Deprecated API usage: "+e),null===t||void 0===t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return A.create(t)};var Th=new WeakMap,Rh=new WeakMap,Ph=new WeakMap,Ih=new WeakMap,Dh=new WeakMap,Lh=new WeakSet;class Oh{constructor(t,e,i,n,s,o){r(this,Lh),a(this,Th,new Map),a(this,Rh,new Map),a(this,Ph,new Map),a(this,Ih,new Map),a(this,Dh,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new xc,this.fontLoader=new ko({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.wasmFactory=s.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=o,this.setupMessageHandler()}get annotationStorage(){return xt(this,"annotationStorage",new xo)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:H.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=F,r=mo;switch(t){case"any":o=O;break;case"display":break;case"print":o=z;break;default:gt("getRenderingIntent - invalid intent: ".concat(t))}const a=o&z&&i instanceof So?i:this.annotationStorage;switch(e){case H.DISABLE:o+=W;break;case H.ENABLE:break;case H.ENABLE_FORMS:o+=N;break;case H.ENABLE_STORAGE:o+=B,r=a.serializable;break;default:gt("getRenderingIntent - invalid annotationMode: ".concat(e))}n&&(o+=j),s&&(o+=G);const{ids:l,hash:c}=a.modifiedIds;return{renderingIntent:o,cacheKey:[o,r.hash,c].join("_"),annotationStorageSerializable:r,modifiedIds:l}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null===(t=h(Dh,this))||void 0===t||t.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const n of h(Rh,this).values())e.push(n._destroy());h(Rh,this).clear(),h(Ph,this).clear(),h(Ih,this).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{var t,e;this.commonObjs.clear(),this.fontLoader.clear(),h(Th,this).clear(),this.filterFactory.destroy(),Gc.cleanup(),null===(t=this._networkStream)||void 0===t||t.cancelAllRequests(new Et("Worker was terminated.")),null===(e=this.messageHandler)||void 0===e||e.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{wt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function(t){let{value:i,done:n}=t;n?e.close():(wt(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",async t=>{await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:s}=this._fullReader;if(!i||!n){var o;if(this._lastProgress)null===(o=e.onProgress)||void 0===o||o.call(e,this._lastProgress);this._fullReader.onProgress=t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}}return{isStreamingSupported:i,isRangeSupported:n,contentLength:s}}),t.on("GetRangeReader",(t,e)=>{wt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then(function(t){let{value:i,done:n}=t;n?e.close():(wt(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}):e.close()}),t.on("GetDoc",t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new hh(i,this))}),t.on("DocException",t=>{e._capability.reject(qo(t))}),t.on("PasswordRequest",t=>{d(Dh,this,Promise.withResolvers());try{if(!e.onPassword)throw qo(t);const i=t=>{t instanceof Error?h(Dh,this).reject(t):h(Dh,this).resolve({password:t})};e.onPassword(i,t.code)}catch(i){h(Dh,this).reject(i)}return h(Dh,this).promise}),t.on("DataLoaded",t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{if(this.destroyed)return;h(Rh,this).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",e=>{var i;let[n,s,o]=e;if(this.destroyed)return null;if(this.commonObjs.has(n))return null;switch(s){case"Font":if("error"in o){const t=o.error;gt("Error during font loading: ".concat(t)),this.commonObjs.resolve(n,t);break}const e=new _l(o),r=this._params.pdfBug&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,a=new Eo(e,r,o.extra,o.charProcOperatorList);this.fontLoader.bind(a).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{!a.fontExtraProperties&&a.data&&a.clearData(),this.commonObjs.resolve(n,a)});break;case"CopyLocalImage":const{imageRef:l}=o;wt(l,"The imageRef must be defined.");for(const t of h(Rh,this).values())for(const[,e]of t.objs)if((null===e||void 0===e?void 0:e.ref)===l)return e.dataLen?(this.commonObjs.resolve(n,structuredClone(e)),e.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,o);break;default:throw new Error("Got unknown common object type ".concat(s))}return null}),t.on("obj",t=>{let[e,i,n,s]=t;if(this.destroyed)return;const o=h(Rh,this).get(i);var r;if(!o.objs.has(e))if(0!==o._intentStates.size)switch(n){case"Image":case"Pattern":o.objs.resolve(e,s);break;default:throw new Error("Got unknown object type ".concat(n))}else null===s||void 0===s||null===(r=s.bitmap)||void 0===r||r.close()}),t.on("DocProgress",t=>{var i;this.destroyed||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}),t.on("FetchBinaryData",async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");const e=this[t.type];if(!e)throw new Error("".concat(t.type," not initialized, see the `useWorkerFetch` parameter."));return e.fetch(t)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t,e;this.annotationStorage.size<=0&>("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:i,transfer:n}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:i,filename:null!==(t=null===(e=this._fullReader)||void 0===e?void 0:e.filename)&&void 0!==t?t:null},n).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,i=h(Ph,this).get(e);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&h(Ih,this).set(i.refStr,t);const n=new ph(e,i,this,this._params.pdfBug);return h(Rh,this).set(e,n),n});return h(Ph,this).set(e,n),n}getPageIndex(t){return Ro(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return l(Lh,this,Fh).call(this,"GetFieldObjects")}hasJSActions(){return l(Lh,this,Fh).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!==typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return l(Lh,this,Fh).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return l(Lh,this,Fh).call(this,"GetOptionalContentConfig").then(e=>new Kl(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=h(Th,this).get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then(t=>{var e,i,n,s;return{info:t[0],metadata:t[1]?new Fl(t[1]):null,contentDispositionFilename:null!==(e=null===(i=this._fullReader)||void 0===i?void 0:i.filename)&&void 0!==e?e:null,contentLength:null!==(n=null===(s=this._fullReader)||void 0===s?void 0:s.contentLength)&&void 0!==n?n:null}});return h(Th,this).set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of h(Rh,this).values()){if(!t.cleanup())throw new Error("startCleanup: Page ".concat(t.pageNumber," is currently rendering."))}this.commonObjs.clear(),t||this.fontLoader.clear(),h(Th,this).clear(),this.filterFactory.destroy(!0),Gc.cleanup()}}cachedPageNumber(t){var e;if(!Ro(t))return null;const i=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return null!==(e=h(Ih,this).get(i))&&void 0!==e?e:null}}function Fh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=h(Th,this).get(t);if(i)return i;const n=this.messageHandler.sendWithPromise(t,e);return h(Th,this).set(t,n),n}var zh=new WeakMap;class Nh{constructor(t){a(this,zh,null),(0,R.A)(this,"onContinue",null),(0,R.A)(this,"onError",null),d(zh,this,t)}get promise(){return h(zh,this).capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;h(zh,this).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=h(zh,this).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=h(zh,this);return t.form||t.canvas&&(null===e||void 0===e?void 0:e.size)>0}}var Bh=new WeakMap;class Wh{constructor(t){let{callback:e,params:i,objs:n,commonObjs:s,annotationCanvasMap:o,operatorList:r,pageIndex:l,canvasFactory:c,filterFactory:h,useRequestAnimationFrame:d=!1,pdfBug:u=!1,pageColors:p=null,enableHWA:f=!1,operationsFilter:m=null}=t;a(this,Bh,null),this.callback=e,this.params=i,this.objs=n,this.commonObjs=s,this.annotationCanvasMap=o,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=h,this._pdfBug=u,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===d&&"undefined"!==typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Nh(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=i.canvas,this._canvasContext=i.canvas?null:i.canvasContext,this._enableHWA=f,this._dependencyTracker=i.dependencyTracker,this._operationsFilter=m}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics(t){var e,i;let{transparency:n=!1,optionalContentConfig:s}=t;if(this.cancelled)return;if(this._canvas){if(jh._.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");jh._.add(this._canvas)}this._pdfBug&&null!==(e=globalThis.StepperManager)&&void 0!==e&&e.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:o,transform:r,background:a,dependencyTracker:l}=this.params,c=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new il(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:s},this.annotationCanvasMap,this.pageColors,l),this.gfx.beginDrawing({transform:r,viewport:o,transparency:n,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,null===(i=this.graphicsReadyCallback)||void 0===i||i.call(this)}cancel(){var t,e,i;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,null===(t=this.gfx)||void 0===t||t.endDrawing(),h(Bh,this)&&(window.cancelAnimationFrame(h(Bh,this)),d(Bh,this,null)),jh._.delete(this._canvas),n||(n=new Kt("Rendering cancelled, page ".concat(this._pageIndex+1),s)),this.callback(n),null===(e=(i=this.task).onError)||void 0===e||e.call(i,n)}operatorListChanged(){var t,e;this.graphicsReady?(null===(t=this.gfx.dependencyTracker)||void 0===t||t.growOperationsCount(this.operatorList.fnArray.length),null===(e=this.stepper)||void 0===e||e.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?d(Bh,this,window.requestAnimationFrame(()=>{d(Bh,this,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),jh._.delete(this._canvas),this.callback())))}}var jh={_:new WeakSet};var Gh=new WeakMap,Hh=new WeakMap,Uh=new WeakMap,Vh=new WeakMap,qh=new WeakMap,Xh=new WeakMap,Kh=new WeakMap,Yh=new WeakMap,Jh=new WeakMap,Qh=new WeakMap,Zh=new WeakSet;class $h{static get _keyboardManager(){return xt(this,"_keyboardManager",new ei([[["Escape","mac+Escape"],$h.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],$h.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],$h.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],$h.prototype._moveToPrevious],[["Home","mac+Home"],$h.prototype._moveToBeginning],[["End","mac+End"],$h.prototype._moveToEnd]]))}constructor(t){var e,i;let{editor:n=null,uiManager:s=null}=t;r(this,Zh),a(this,Gh,null),a(this,Hh,null),a(this,Uh,void 0),a(this,Vh,null),a(this,qh,!1),a(this,Xh,!1),a(this,Kh,null),a(this,Yh,void 0),a(this,Jh,null),a(this,Qh,null),n?(d(Xh,this,!1),d(Kh,this,n)):d(Xh,this,!0),d(Qh,this,(null===n||void 0===n?void 0:n._uiManager)||s),d(Yh,this,h(Qh,this)._eventBus),d(Uh,this,(null===n||void 0===n||null===(e=n.color)||void 0===e?void 0:e.toUpperCase())||(null===(i=h(Qh,this))||void 0===i?void 0:i.highlightColors.values().next().value)||"#FFFF98"),rd._||(rd._=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}renderButton(){const t=d(Gh,this,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",h(Kh,this)&&(t.ariaControls="".concat(h(Kh,this).id,"_colorpicker_dropdown"));const e=h(Qh,this)._signal;t.addEventListener("click",l(Zh,this,nd).bind(this),{signal:e}),t.addEventListener("keydown",l(Zh,this,id).bind(this),{signal:e});const i=d(Hh,this,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=h(Uh,this),t.append(i),t}renderMainDropdown(){const t=d(Vh,this,l(Zh,this,td).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===h(Gh,this))return void l(Zh,this,nd).call(this,t);const e=t.target.getAttribute("data-color");e&&l(Zh,this,ed).call(this,e,t)}_moveToNext(t){var e,i;c(Zh,this,od)?t.target!==h(Gh,this)?null===(e=t.target.nextSibling)||void 0===e||e.focus():null===(i=h(Vh,this).firstChild)||void 0===i||i.focus():l(Zh,this,nd).call(this,t)}_moveToPrevious(t){var e,i;t.target!==(null===(e=h(Vh,this))||void 0===e?void 0:e.firstChild)&&t.target!==h(Gh,this)?(c(Zh,this,od)||l(Zh,this,nd).call(this,t),null===(i=t.target.previousSibling)||void 0===i||i.focus()):c(Zh,this,od)&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){var e;c(Zh,this,od)?null===(e=h(Vh,this).firstChild)||void 0===e||e.focus():l(Zh,this,nd).call(this,t)}_moveToEnd(t){var e;c(Zh,this,od)?null===(e=h(Vh,this).lastChild)||void 0===e||e.focus():l(Zh,this,nd).call(this,t)}hideDropdown(){var t,e;null===(t=h(Vh,this))||void 0===t||t.classList.add("hidden"),h(Gh,this).ariaExpanded="false",null===(e=h(Jh,this))||void 0===e||e.abort(),d(Jh,this,null)}_hideDropdownFromKeyboard(){var t;h(Xh,this)||(c(Zh,this,od)?(this.hideDropdown(),h(Gh,this).focus({preventScroll:!0,focusVisible:h(qh,this)})):null===(t=h(Kh,this))||void 0===t||t.unselect())}updateColor(t){if(h(Hh,this)&&(h(Hh,this).style.backgroundColor=t),!h(Vh,this))return;const e=h(Qh,this).highlightColors.values();for(const i of h(Vh,this).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){var t,e;null===(t=h(Gh,this))||void 0===t||t.remove(),d(Gh,this,null),d(Hh,this,null),null===(e=h(Vh,this))||void 0===e||e.remove(),d(Vh,this,null)}}function td(){const t=document.createElement("div"),e=h(Qh,this)._signal;t.addEventListener("contextmenu",$t,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),h(Kh,this)&&(t.id="".concat(h(Kh,this).id,"_colorpicker_dropdown"));for(const[i,n]of h(Qh,this).highlightColors){const s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",n),s.title=i,s.setAttribute("data-l10n-id",rd._[i]);const o=document.createElement("span");s.append(o),o.className="swatch",o.style.backgroundColor=n,s.ariaSelected=n===h(Uh,this),s.addEventListener("click",l(Zh,this,ed).bind(this,n),{signal:e}),t.append(s)}return t.addEventListener("keydown",l(Zh,this,id).bind(this),{signal:e}),t}function ed(t,e){e.stopPropagation(),h(Yh,this).dispatch("switchannotationeditorparams",{source:this,type:q.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)}function id(t){S._keyboardManager.exec(this,t)}function nd(t){if(c(Zh,this,od))return void this.hideDropdown();if(d(qh,this,0===t.detail),h(Jh,this)||(d(Jh,this,new AbortController),window.addEventListener("pointerdown",l(Zh,this,sd).bind(this),{signal:h(Qh,this).combinedSignal(h(Jh,this))})),h(Gh,this).ariaExpanded="true",h(Vh,this))return void h(Vh,this).classList.remove("hidden");const e=d(Vh,this,l(Zh,this,td).call(this));h(Gh,this).append(e)}function sd(t){var e;null!==(e=h(Vh,this))&&void 0!==e&&e.contains(t.target)||this.hideDropdown()}function od(t){return h(Vh,t)&&!h(Vh,t).classList.contains("hidden")}S=$h;var rd={_:null},ad=new WeakMap,ld=new WeakMap,cd=new WeakMap;class hd{constructor(t){a(this,ad,null),a(this,ld,null),a(this,cd,null),d(ld,this,t),d(cd,this,t._uiManager),dd._||(dd._=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(h(ad,this))return h(ad,this);const{editorType:t,colorType:e,colorValue:i}=h(ld,this),n=d(ad,this,document.createElement("input"));return n.type="color",n.value=i||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",dd._[t]),n.addEventListener("input",()=>{h(cd,this).updateParams(e,n.value)},{signal:h(cd,this)._signal}),n}update(t){h(ad,this)&&(h(ad,this).value=t)}destroy(){var t;null===(t=h(ad,this))||void 0===t||t.remove(),d(ad,this,null)}hideDropdown(){}}var dd={_:null};function ud(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function pd(t){return Math.max(0,Math.min(255,255*t))}class fd{static CMYK_G(t){let[e,i,n,s]=t;return["G",1-Math.min(1,.3*e+.59*n+.11*i+s)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_rgb(t){let[e]=t;return e=pd(e),[e,e,e]}static G_HTML(t){let[e]=t;const i=ud(e);return"#".concat(i).concat(i).concat(i)}static RGB_G(t){let[e,i,n]=t;return["G",.3*e+.59*i+.11*n]}static RGB_rgb(t){return t.map(pd)}static RGB_HTML(t){return"#".concat(t.map(ud).join(""))}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(t){let[e,i,n,s]=t;return["RGB",1-Math.min(1,e+s),1-Math.min(1,n+s),1-Math.min(1,i+s)]}static CMYK_rgb(t){let[e,i,n,s]=t;return[pd(1-Math.min(1,e+s)),pd(1-Math.min(1,n+s)),pd(1-Math.min(1,i+s))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,n]=t;const s=1-e,o=1-i,r=1-n;return["CMYK",s,o,r,Math.min(s,o,r)]}}class md{create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width","".concat(t,"px")),n.setAttribute("height","".concat(e,"px"))),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),n}createElement(t){if("string"!==typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){vt("Abstract method `_createSVG` called.")}}class gd extends md{_createSVG(t){return document.createElementNS(Ut,t)}}const vd=new WeakSet,wd=60*(new Date).getTimezoneOffset()*1e3;class bd{static create(t){switch(t.data.annotationType){case tt.LINK:return new Ed(t);case tt.TEXT:return new Id(t);case tt.WIDGET:switch(t.data.fieldType){case"Tx":return new Ld(t);case"Btn":return t.data.radioButton?new zd(t):t.data.checkBox?new Fd(t):new Nd(t);case"Ch":return new Bd(t);case"Sig":return new Od(t)}return new Dd(t);case tt.POPUP:return new jd(t);case tt.FREETEXT:return new Ru(t);case tt.LINE:return new Iu(t);case tt.SQUARE:return new Lu(t);case tt.CIRCLE:return new Fu(t);case tt.POLYLINE:return new Nu(t);case tt.CARET:return new Wu(t);case tt.INK:return new Uu(t);case tt.POLYGON:return new Bu(t);case tt.HIGHLIGHT:return new qu(t);case tt.UNDERLINE:return new Xu(t);case tt.SQUIGGLY:return new Ku(t);case tt.STRIKEOUT:return new Yu(t);case tt.STAMP:return new Ju(t);case tt.FILEATTACHMENT:return new $u(t);default:return new Sd(t)}}}var yd=new WeakMap,xd=new WeakMap,_d=new WeakMap,Ad=new WeakSet;class Sd{constructor(t){let{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,Ad),a(this,yd,null),a(this,xd,!1),a(this,_d,null),this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),n&&this._createQuadrilaterals()}static _hasPopupData(t){let{contentsObj:e,richText:i}=t;return!!(null!==e&&void 0!==e&&e.str||null!==i&&void 0!==i&&i.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Sd._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var t;const{data:e}=this,i=null===(t=this.annotationStorage)||void 0===t?void 0:t.getEditor(e.id);return i?i.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){var t;const e=null===(t=this.annotationStorage)||void 0===t?void 0:t.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:i,inkLists:n,rect:s}=this.data;let o=-1/0,r=-1/0;if((null===i||void 0===i?void 0:i.length)>=8){for(let t=0;tr?(r=i[t+1],o=i[t+2]):i[t+1]===r&&(o=Math.max(o,i[t+2]));return[o,r]}if((null===n||void 0===n?void 0:n.length)>=1){for(const t of n)for(let e=0,i=t.length;er?(r=t[e+1],o=t[e]):t[e+1]===r&&(o=Math.max(o,t[e]));if(o!==1/0)return[o,r]}return s?[s[2],s[3]]:null}_normalizePoint(t){const{page:{view:e},viewport:{rawDims:{pageWidth:i,pageHeight:n,pageX:s,pageY:o}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-s)/i,t[1]=100*(t[1]-o)/n,t}get commentText(){var t,e;const{data:i}=this;return(null===(t=this.annotationStorage.getRawValue("".concat(U).concat(i.id)))||void 0===t||null===(t=t.popup)||void 0===t?void 0:t.contents)||(null===(e=i.contentsObj)||void 0===e?void 0:e.str)||""}set commentText(t){const{data:e}=this,i={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:i})||this.annotationStorage.setValue("".concat(U).concat(e.id),{id:e.id,annotationType:e.annotationType,pageIndex:this.parent.page._pageIndex,popup:i,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){var t,e;null===(t=(null===(e=h(_d,this))||void 0===e?void 0:e.popup)||this.popup)||void 0===t||t.remove(),d(_d,this,this.popup=null)}updateEdited(t){var e;if(!this.container)return;t.rect&&(h(yd,this)||d(yd,this,{rect:this.data.rect.slice(0)}));const{rect:i,popup:n}=t;i&&l(Ad,this,Cd).call(this,i);let s=(null===(e=h(_d,this))||void 0===e?void 0:e.popup)||this.popup;!s&&null!==n&&void 0!==n&&n.text&&(this._createPopup(n),s=h(_d,this).popup),s&&(s.updateEdited(t),null!==n&&void 0!==n&&n.deleted&&(s.remove(),d(_d,this,null),this.popup=null))}resetEdited(){var t;h(yd,this)&&(l(Ad,this,Cd).call(this,h(yd,this).rect),null===(t=h(_d,this))||void 0===t||t.popup.resetEdited(),d(yd,this,null))}_createContainer(t){const{data:e,parent:{page:i,viewport:n}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",e.id),this instanceof Dd||this instanceof Ed||(s.tabIndex=0);const{style:o}=s;if(o.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(s.title=e.alternativeText),e.noRotate&&s.classList.add("norotate"),!e.rect||this instanceof jd){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,s),s}const{width:r,height:a}=this;if(!t&&e.borderStyle.width>0){o.borderWidth="".concat(e.borderStyle.width,"px");const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){const e="calc(".concat(t,"px * var(--total-scale-factor)) / calc(").concat(i,"px * var(--total-scale-factor))");o.borderRadius=e}else if(this instanceof zd){const t="calc(".concat(r,"px * var(--total-scale-factor)) / calc(").concat(a,"px * var(--total-scale-factor))");o.borderRadius=t}switch(e.borderStyle.style){case et:o.borderStyle="solid";break;case it:o.borderStyle="dashed";break;case nt:gt("Unimplemented border style: beveled");break;case st:gt("Unimplemented border style: inset");break;case ot:o.borderBottomStyle="solid"}const n=e.borderColor||null;n?(d(xd,this,!0),o.borderColor=Dt.makeHexColor(0|n[0],0|n[1],0|n[2])):o.borderWidth=0}const l=Dt.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:c,pageHeight:h,pageX:u,pageY:p}=n.rawDims;o.left="".concat(100*(l[0]-u)/c,"%"),o.top="".concat(100*(l[1]-p)/h,"%");const{rotation:f}=e;return e.hasOwnCanvas||0===f?(o.width="".concat(100*r/c,"%"),o.height="".concat(100*a/h,"%")):this.setRotation(f,s),s}setRotation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;const{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims;let{width:s,height:o}=this;t%180!==0&&([s,o]=[o,s]),e.style.width="".concat(100*s/i,"%"),e.style.height="".concat(100*o/n,"%"),e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const n=i.detail[t],s=n[0],o=n.slice(1);i.target.style[e]=fd["".concat(s,"_HTML")](o),this.annotationStorage.setValue(this.data.id,{[e]:fd["".concat(s,"_rgb")](o)})};return xt(this,"_commonActions",{display:t=>{const{display:e}=t.detail,i=e%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const n of Object.keys(e.detail)){const s=t[n]||i[n];null===s||void 0===s||s(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[n,s]of Object.entries(e)){const o=i[n];if(o){o({detail:{[n]:s},target:t}),delete e[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,n,s]=this.data.rect.map(t=>Math.fround(t));if(8===t.length){const[o,r,a,l]=t.subarray(2,6);if(n===o&&s===r&&e===a&&i===l)return}const{style:o}=this.container;let r;if(h(xd,this)){const{borderColor:t,borderWidth:e}=o;o.borderWidth=0,r=["url('data:image/svg+xml;utf8,",'','')],this.container.classList.add("hasBorder")}const a=n-e,l=s-i,{svgFactory:c}=this,d=c.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";const u=c.createElement("defs");d.append(u);const p=c.createElement("clipPath"),f="clippath_".concat(this.data.id);p.setAttribute("id",f),p.setAttribute("clipPathUnits","objectBoundingBox"),u.append(p);for(let h=2,g=t.length;h'))}h(xd,this)&&(r.push("')"),o.backgroundImage=r.join("")),this.container.append(d),this.container.style.clipPath="url(#".concat(f,")")}_createPopup(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const{data:e}=this;let i,n;t?(i={str:t.text},n=t.date):(i=e.contentsObj,n=e.modificationDate);const s=d(_d,this,new jd({data:{color:e.color,titleObj:e.titleObj,modificationDate:n,contentsObj:i,richText:e.richText,parentRect:e.rect,borderStyle:0,id:"popup_".concat(e.id),rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}));this.parent._commentManager||this.parent.div.append(s.render())}get hasPopupElement(){return!!(h(_d,this)||this.popup||this.data.popupRef)}get extraPopupElement(){return h(_d,this)}render(){vt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const n=this._fieldObjects[t];if(n)for(const{page:t,id:s,exportValues:o}of n){if(-1===t)continue;if(s===e)continue;const n="string"===typeof o?o:null,r=document.querySelector('[data-element-id="'.concat(s,'"]'));!r||vd.has(r)?i.push({id:s,exportValue:n,domElement:r}):gt("_getElementsByName - element not allowed: ".concat(s))}return i}for(const n of document.getElementsByName(t)){const{exportValue:t}=n,s=n.getAttribute("data-element-id");s!==e&&(vd.has(n)&&i.push({id:s,exportValue:t,domElement:n}))}return i}show(){var t;this.container&&(this.container.hidden=!1),null===(t=this.popup)||void 0===t||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),null===(t=this.popup)||void 0===t||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var i;null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}function Cd(t){const{container:{style:e},data:{rect:i,rotation:n},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:o,pageX:r,pageY:a}}}}=this;null===i||void 0===i||i.splice(0,4,...t),e.left="".concat(100*(t[0]-r)/s,"%"),e.top="".concat(100*(o-t[3]+a)/o,"%"),0===n?(e.width="".concat(100*(t[2]-t[0])/s,"%"),e.height="".concat(100*(t[3]-t[1])/o,"%")):this.setRotation(n)}class kd extends Sd{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:t}=this;t.hasComment&&(this._createPopup(t.comment),this.extraPopupElement.popup.renderCommentButton())}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.container.remove(),this.container=null,this.removePopup()}}var Md=new WeakSet;class Ed extends Sd{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(t,{isRenderable:!0,ignoreBorder:!(null===e||void 0===e||!e.ignoreBorder),createQuadrilaterals:!0}),r(this,Md),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action,t.overlaidText),n=!0):t.attachment?(l(Md,this,Rd).call(this,i,t.attachment,t.overlaidText,t.attachmentDest),n=!0):t.setOCGState?(l(Md,this,Pd).call(this,i,t.setOCGState,t.overlaidText),n=!0):t.dest?(this._bindLink(i,t.dest,t.overlaidText),n=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}_bindLink(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&l(Md,this,Td).call(this),i&&(t.title=i)}_bindNamedAction(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),i&&(t.title=i),l(Md,this,Td).call(this)}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(e.actions)){const s=i.get(n);s&&(t[s]=()=>{var t;return null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:n}}),!1})}e.overlaidText&&(t.title=e.overlaidText),t.onclick||(t.onclick=()=>!1),l(Md,this,Td).call(this)}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),l(Md,this,Td).call(this),!this._fieldObjects)return gt('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{null===i||void 0===i||i();const{fields:t,refs:n,include:s}=e,o=[];if(0!==t.length||0!==n.length){const e=new Set(n);for(const i of t){const t=this._fieldObjects[i]||[];for(const{id:i}of t)e.add(i)}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===s&&o.push(i)}else for(const e of Object.values(this._fieldObjects))o.push(...e);const r=this.annotationStorage,a=[];for(const e of o){const{id:t}=e;switch(a.push(t),e.type){case"text":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;r.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}default:continue}const i=document.querySelector('[data-element-id="'.concat(t,'"]'));i&&(vd.has(i)?i.dispatchEvent(new Event("resetform")):gt("_bindResetFormAction - element not allowed: ".concat(t)))}var l;this.enableScripting&&(null===(l=this.linkService.eventBus)||void 0===l||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:a,name:"ResetForm"}}));return!1}}}function Td(){this.container.setAttribute("data-internal-link","")}function Rd(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;t.href=this.linkService.getAnchorUrl(""),e.description?t.title=e.description:i&&(t.title=i),t.onclick=()=>{var t;return null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(e.content,e.filename,n),!1},l(Md,this,Td).call(this)}function Pd(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),i&&(t.title=i),l(Md,this,Td).call(this)}class Id extends Sd{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class Dd extends Sd{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&("CANVAS"===(null===(e=t.previousSibling)||void 0===e?void 0:e.nodeName)&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Pt.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,n,s){i.includes("mouse")?t.addEventListener(i,t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{var o;if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}s&&(null===(o=this.linkService.eventBus)||void 0===o||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(t)}}))})}_setEventListeners(t,e,i,n){for(const[a,l]of i){var s,o,r;if("Action"===l||null!==(s=this.data.actions)&&void 0!==s&&s[l])"Focus"!==l&&"Blur"!==l||e||(e={focused:!1}),this._setEventListener(t,e,a,l,n),"Focus"!==l||null!==(o=this.data.actions)&&void 0!==o&&o.Blur?"Blur"!==l||null!==(r=this.data.actions)&&void 0!==r&&r.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null)}}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":Dt.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,s=t.style;let o;const r=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),e=t/(Math.round(t/(L*n))||1);o=Math.min(n,r(e/L))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);o=Math.min(n,r(t/L))}s.fontSize="calc(".concat(o,"px * var(--total-scale-factor))"),s.color=Dt.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(s.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Ld extends Dd{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,n){const s=this.annotationStorage;for(const o of this._getElementsByName(t.name,t.id))o.domElement&&(o.domElement[e]=i),s.setValue(o.id,{[n]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){var n;const o=t.getValue(e,{value:this.data.fieldValue});let r=o.value||"";const a=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;a&&r.length>a&&(r=r.slice(0,a));let l=o.formattedValue||(null===(n=this.data.textContent)||void 0===n?void 0:n.join("\n"))||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const c={userValue:r,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=null!==l&&void 0!==l?l:r,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type=this.data.password?"password":"text",i.setAttribute("value",null!==l&&void 0!==l?l:r),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),vd.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;const{datetimeFormat:h,datetimeType:d,timeStep:u}=this.data,p=!!d&&this.enableScripting;h&&(i.title=h),this._setRequired(i,this.data.required),a&&(i.maxLength=a),i.addEventListener("input",n=>{t.setValue(e,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",t=>{var e;const n=null!==(e=this.data.defaultFieldValue)&&void 0!==e?e:"";i.value=c.userValue=n,c.formattedValue=null});let f=t=>{const{formattedValue:e}=c;null!==e&&void 0!==e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var s;i.addEventListener("focus",t=>{var e;if(c.focused)return;const{target:i}=t;if(p&&(i.type=d,u&&(i.step=u)),c.userValue){const t=c.userValue;if(p)if("time"===d){const e=new Date(t),n=[e.getHours(),e.getMinutes(),e.getSeconds()];i.value=n.map(t=>t.toString().padStart(2,"0")).join(":")}else i.value=new Date(t-wd).toISOString().split("date"===d?"T":".",1)[0];else i.value=t}c.lastCommittedValue=i.value,c.commitKey=1,null!==(e=this.data.actions)&&void 0!==e&&e.Focus||(c.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target);const n={value(i){var n;c.userValue=null!==(n=i.detail.value)&&void 0!==n?n:"",p||t.setValue(e,{value:c.userValue.toString()}),i.target.value=c.userValue},formattedValue(i){const{formattedValue:n}=i.detail;c.formattedValue=n,null!==n&&void 0!==n&&i.target!==document.activeElement&&(i.target.value=n);const s={formattedValue:n};p&&(s.value=n),t.setValue(e,s)},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{var n;const{charLimit:s}=i.detail,{target:o}=i;if(0===s)return void o.removeAttribute("maxLength");o.setAttribute("maxLength",s);let r=c.userValue;!r||r.length<=s||(r=r.slice(0,s),o.value=c.userValue=r,t.setValue(e,{value:r}),null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:o.selectionStart,selEnd:o.selectionEnd}}))}};this._dispatchEventFromSandbox(n,i)}),i.addEventListener("keydown",t=>{var i;c.commitKey=1;let n=-1;if("Escape"===t.key?n=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(c.commitKey=3):n=2,-1===n)return;const{value:s}=t.target;c.lastCommittedValue!==s&&(c.lastCommittedValue=s,c.userValue=s,null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,willCommit:!0,commitKey:n,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});const n=f;f=null,i.addEventListener("blur",t=>{var i;if(!c.focused||!t.relatedTarget)return;null!==(i=this.data.actions)&&void 0!==i&&i.Blur||(c.focused=!1);const{target:s}=t;let{value:o}=s;if(p){if(o&&"time"===d){const t=o.split(":").map(t=>parseInt(t,10));o=new Date(2e3,0,1,t[0],t[1],t[2]||0).valueOf(),s.step=""}else o.includes("T")||(o="".concat(o,"T00:00")),o=new Date(o).valueOf();s.type="text"}var r;(c.userValue=o,c.lastCommittedValue!==o)&&(null===(r=this.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,willCommit:!0,commitKey:c.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}));n(t)}),null!==(s=this.data.actions)&&void 0!==s&&s.Keystroke&&i.addEventListener("beforeinput",t=>{var i;c.lastCommittedValue=null;const{data:n,target:s}=t,{value:o,selectionStart:r,selectionEnd:a}=s;let l=r,h=a;switch(t.inputType){case"deleteWordBackward":{const t=o.substring(0,r).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{const t=o.substring(r).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":r===a&&(l-=1);break;case"deleteContentForward":r===a&&(h+=1)}t.preventDefault(),null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:n||"",willCommit:!1,selStart:l,selEnd:h}})}),this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(f&&i.addEventListener("blur",f),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/a;i.classList.add("comb"),i.style.letterSpacing="calc(".concat(t,"px * var(--total-scale-factor) - 1ch)")}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Od extends Dd{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Fd extends Dd{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"===typeof n&&(n="Off"!==n,t.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return vd.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",e.exportValue),s.tabIndex=0,s.addEventListener("change",n=>{const{name:s,checked:o}=n.target;for(const r of this._getElementsByName(s,i)){const i=o&&r.exportValue===e.exportValue;r.domElement&&(r.domElement.checked=i),t.setValue(r.id,{value:i})}t.setValue(i,{value:o})}),s.addEventListener("resetform",t=>{const i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",e=>{const n={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}};this._dispatchEventFromSandbox(n,e)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class zd extends Dd{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"===typeof n&&(n=n!==e.buttonValue,t.setValue(i,{value:n})),n)for(const o of this._getElementsByName(e.fieldName,i))t.setValue(o.id,{value:!1});const s=document.createElement("input");if(vd.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=0,s.addEventListener("change",e=>{const{name:n,checked:s}=e.target;for(const o of this._getElementsByName(n,i))t.setValue(o.id,{value:!1});t.setValue(i,{value:s})}),s.addEventListener("resetform",t=>{const i=e.defaultFieldValue;t.target.checked=null!==i&&void 0!==i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){const n=e.buttonValue;s.addEventListener("updatefromsandbox",e=>{const s={value:e=>{const s=n===e.detail.value;for(const n of this._getElementsByName(e.target.name)){const e=s&&n.id===i;n.domElement&&(n.domElement.checked=e),t.setValue(n.id,{value:e})}}};this._dispatchEventFromSandbox(s,e)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Nd extends Ed{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class Bd extends Dd{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),n=document.createElement("select");vd.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",t=>{const e=this.data.defaultFieldValue;for(const i of n.options)i.selected=i.value===e});for(const c of this.data.options){const t=document.createElement("option");t.textContent=c.displayValue,t.value=c.exportValue,i.value.includes(c.exportValue)&&(t.setAttribute("selected",!0),s=!1),n.append(t)}let o=null;if(s){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),n.prepend(t),o=()=>{t.remove(),n.removeEventListener("input",o),o=null},n.addEventListener("input",o)}const r=t=>{const e=t?"value":"textContent",{options:i,multiple:s}=n;return s?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]};let a=r(!1);const l=t=>{const e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",i=>{const s={value(i){var s;null===(s=o)||void 0===s||s();const l=i.detail.value,c=new Set(Array.isArray(l)?l:[l]);for(const t of n.options)t.selected=c.has(t.value);t.setValue(e,{value:r(!0)}),a=r(!1)},multipleSelection(t){n.multiple=!0},remove(i){const s=n.options,o=i.detail.remove;if(s[o].selected=!1,n.remove(o),s.length>0){-1===Array.prototype.findIndex.call(s,t=>t.selected)&&(s[0].selected=!0)}t.setValue(e,{value:r(!0),items:l(i)}),a=r(!1)},clear(i){for(;0!==n.length;)n.remove(0);t.setValue(e,{value:null,items:[]}),a=r(!1)},insert(i){const{index:s,displayValue:o,exportValue:c}=i.detail.insert,h=n.children[s],d=document.createElement("option");d.textContent=o,d.value=c,h?h.before(d):n.append(d),t.setValue(e,{value:r(!0),items:l(i)}),a=r(!1)},items(i){const{items:s}=i.detail;for(;0!==n.length;)n.remove(0);for(const t of s){const{displayValue:e,exportValue:i}=t,s=document.createElement("option");s.textContent=e,s.value=i,n.append(s)}n.options.length>0&&(n.options[0].selected=!0),t.setValue(e,{value:r(!0),items:l(i)}),a=r(!1)},indices(i){const n=new Set(i.detail.indices);for(const t of i.target.options)t.selected=n.has(t.index);t.setValue(e,{value:r(!0)}),a=r(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(s,i)}),n.addEventListener("input",i=>{var n;const s=r(!0),o=r(!1);t.setValue(e,{value:s}),i.preventDefault(),null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,change:o,changeEx:s,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):n.addEventListener("input",function(i){t.setValue(e,{value:r(!0)})}),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}var Wd=new WeakSet;class jd extends Sd{constructor(t){const{data:e,elements:i,parent:n}=t,s=!!n._commentManager;if(super(t,{isRenderable:!s&&Sd._hasPopupData(e)}),r(this,Wd),this.elements=i,s&&Sd._hasPopupData(e)){const t=this.popup=l(Wd,this,Gd).call(this);for(const e of i)e.popup=t}else this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";const e=this.popup=l(Wd,this,Gd).call(this),i=[];for(const n of this.elements)n.popup=e,n.container.ariaHasPopup="dialog",i.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(t=>"".concat(Bt).concat(t)).join(",")),this.container}}function Gd(){return new gu({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}var Hd=new WeakMap,Ud=new WeakMap,Vd=new WeakMap,qd=new WeakMap,Xd=new WeakMap,Kd=new WeakMap,Yd=new WeakMap,Jd=new WeakMap,Qd=new WeakMap,Zd=new WeakMap,$d=new WeakMap,tu=new WeakMap,eu=new WeakMap,iu=new WeakMap,nu=new WeakMap,su=new WeakMap,ou=new WeakMap,ru=new WeakMap,au=new WeakMap,lu=new WeakMap,cu=new WeakMap,hu=new WeakMap,du=new WeakMap,uu=new WeakMap,pu=new WeakMap,fu=new WeakMap,mu=new WeakSet;class gu{constructor(t){let{container:e,color:i,elements:n,titleObj:s,modificationDate:o,contentsObj:c,richText:u,parent:p,rect:f,parentRect:m,open:g,commentManager:v=null}=t;r(this,mu),a(this,Hd,null),a(this,Ud,l(mu,this,Cu).bind(this)),a(this,Vd,l(mu,this,Tu).bind(this)),a(this,qd,l(mu,this,Eu).bind(this)),a(this,Xd,l(mu,this,Mu).bind(this)),a(this,Kd,null),a(this,Yd,null),a(this,Jd,null),a(this,Qd,null),a(this,Zd,null),a(this,$d,null),a(this,tu,null),a(this,eu,!1),a(this,iu,null),a(this,nu,null),a(this,su,null),a(this,ou,null),a(this,ru,null),a(this,au,null),a(this,lu,null),a(this,cu,null),a(this,hu,null),a(this,du,null),a(this,uu,!1),a(this,pu,null),a(this,fu,null),d(Yd,this,e),d(hu,this,s),d(Jd,this,c),d(cu,this,u),d($d,this,p),d(Kd,this,i),d(lu,this,f),d(tu,this,m),d(Zd,this,n),d(Hd,this,v),d(pu,this,n[0]),d(Qd,this,ee.toDateObject(o)),this.trigger=n.flatMap(t=>t.getElementsToTriggerPopup()),v?this.renderCommentButton():(l(mu,this,vu).call(this),h(Yd,this).hidden=!0,g&&l(mu,this,Mu).call(this))}renderCommentButton(){if(h(ou,this))return;if(h(ru,this)||l(mu,this,wu).call(this),!h(ru,this))return;const{signal:t}=d(nu,this,new AbortController),e=!!h(pu,this).extraPopupElement,i=()=>{h(Hd,this).toggleCommentPopup(this,!0,void 0,!e)},n=()=>{h(Hd,this).toggleCommentPopup(this,!1,!0,!e)},s=()=>{h(Hd,this).toggleCommentPopup(this,!1,!1)};if(e){d(ou,this,h(pu,this).container);for(const e of this.trigger)e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.addEventListener("keydown",h(Ud,this),{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",n,{signal:t}),e.addEventListener("pointerleave",s,{signal:t}),e.classList.add("popupTriggerArea")}else{const e=d(ou,this,document.createElement("button"));e.className="annotationCommentButton";const o=h(pu,this).container;e.style.zIndex=o.style.zIndex+1,e.tabIndex=0,e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button"),l(mu,this,yu).call(this),l(mu,this,bu).call(this),e.addEventListener("keydown",h(Ud,this),{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",n,{signal:t}),e.addEventListener("pointerleave",s,{signal:t}),o.after(e)}}get commentButtonColor(){const{color:t,opacity:e}=h(pu,this).commentData;return t?h($d,this)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{var t;null===(t=h(ou,this))||void 0===t||t.focus()},0)}getData(){const{richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}=h(pu,this).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}}get elementBeforePopup(){return h(ou,this)}get comment(){return h(fu,this)||d(fu,this,h(pu,this).commentText),h(fu,this)}set comment(t){t!==this.comment&&(h(pu,this).commentText=d(fu,this,t))}get parentBoundingClientRect(){return h(pu,this).layer.getBoundingClientRect()}setCommentButtonStates(t){let{selected:e,hasPopup:i}=t;h(ou,this)&&(h(ou,this).classList.toggle("selected",e),h(ou,this).ariaExpanded=i)}setSelectedCommentButton(t){h(ou,this).classList.toggle("selected",t)}get commentPopupPosition(){if(h(au,this))return h(au,this);const{x:t,y:e,height:i}=h(ou,this).getBoundingClientRect(),{x:n,y:s,width:o,height:r}=h(pu,this).layer.getBoundingClientRect();return[(t-n)/o,(e+i-s)/r]}set commentPopupPosition(t){d(au,this,t)}hasDefaultPopupPosition(){return null===h(au,this)}get commentButtonPosition(){return h(ru,this)}get commentButtonWidth(){return h(ou,this).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){const[e,i]=h(au,this)||this.commentButtonPosition.map(t=>t/100),n=this.parentBoundingClientRect,{x:o,y:r,width:a,height:l}=n;h(Hd,this).showDialog(null,this,o+e*a,r+i*l,(0,s.A)((0,s.A)({},t),{},{parentDimensions:n}))}render(){var t,e;if(h(iu,this))return;const i=d(iu,this,document.createElement("div"));if(i.className="popup",h(Kd,this)){const t=i.style.outlineColor=Dt.makeHexColor(...h(Kd,this));i.style.backgroundColor="color-mix(in srgb, ".concat(t," 30%, white)")}const n=document.createElement("span");if(n.className="header",null!==(t=h(hu,this))&&void 0!==t&&t.str){const t=document.createElement("span");t.className="title",n.append(t),({dir:t.dir,str:t.textContent}=h(hu,this))}if(i.append(n),h(Qd,this)){const t=document.createElement("time");t.className="popupDate",t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:h(Qd,this).valueOf()})),t.dateTime=h(Qd,this).toISOString(),n.append(t)}me({html:c(mu,this,xu)||h(Jd,this).str,dir:null===(e=h(Jd,this))||void 0===e?void 0:e.dir,className:"popupContent"},i),h(Yd,this).append(i)}updateEdited(t){var e;let{rect:i,popup:n,deleted:s}=t;if(h(Hd,this))return s?(this.remove(),d(fu,this,null)):n&&(n.deleted?this.remove():(l(mu,this,yu).call(this),d(fu,this,n.text))),void(i&&(d(ru,this,null),l(mu,this,wu).call(this),l(mu,this,bu).call(this)));s||null!==n&&void 0!==n&&n.deleted?this.remove():(l(mu,this,vu).call(this),h(du,this)||d(du,this,{contentsObj:h(Jd,this),richText:h(cu,this)}),i&&d(su,this,null),n&&n.text&&(d(cu,this,l(mu,this,Su).call(this,n.text)),d(Qd,this,ee.toDateObject(n.date)),d(Jd,this,null)),null===(e=h(iu,this))||void 0===e||e.remove(),d(iu,this,null))}resetEdited(){var t;h(du,this)&&(({contentsObj:n(d,[Jd,this])._,richText:n(d,[cu,this])._}=h(du,this)),d(du,this,null),null===(t=h(iu,this))||void 0===t||t.remove(),d(iu,this,null),d(su,this,null))}remove(){var t,e,i;if(null===(t=h(nu,this))||void 0===t||t.abort(),d(nu,this,null),null===(e=h(iu,this))||void 0===e||e.remove(),d(iu,this,null),d(uu,this,!1),d(eu,this,!1),null===(i=h(ou,this))||void 0===i||i.remove(),d(ou,this,null),this.trigger)for(const n of this.trigger)n.classList.remove("popupTriggerArea")}forceHide(){d(uu,this,this.isVisible),h(uu,this)&&(h(Yd,this).hidden=!0)}maybeShow(){h(Hd,this)||(l(mu,this,vu).call(this),h(uu,this)&&(h(iu,this)||l(mu,this,Eu).call(this),d(uu,this,!1),h(Yd,this).hidden=!1))}get isVisible(){return!h(Hd,this)&&!1===h(Yd,this).hidden}}function vu(){if(h(nu,this))return;d(nu,this,new AbortController);const{signal:t}=h(nu,this);for(const i of this.trigger)i.addEventListener("click",h(Xd,this),{signal:t}),i.addEventListener("pointerenter",h(qd,this),{signal:t}),i.addEventListener("pointerleave",h(Vd,this),{signal:t}),i.classList.add("popupTriggerArea");for(const i of h(Zd,this)){var e;null===(e=i.container)||void 0===e||e.addEventListener("keydown",h(Ud,this),{signal:t})}}function wu(){const t=h(Zd,this).find(t=>t.hasCommentButton);t&&d(ru,this,t._normalizePoint(t.commentButtonPosition))}function bu(){if(h(pu,this).extraPopupElement&&!h(pu,this).editor)return;this.renderCommentButton();const[t,e]=h(ru,this),{style:i}=h(ou,this);i.left="calc(".concat(t,"%)"),i.top="calc(".concat(e,"% - var(--comment-button-dim))")}function yu(){h(pu,this).extraPopupElement||(this.renderCommentButton(),h(ou,this).style.backgroundColor=this.commentButtonColor||"")}function xu(t){const e=h(cu,t),i=h(Jd,t);return null===e||void 0===e||!e.str||null!==i&&void 0!==i&&i.str&&i.str!==e.str?null:h(cu,t).html||null}function _u(t){var e;return(null===(e=c(mu,t,xu))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.fontSize)||0}function Au(t){var e;return(null===(e=c(mu,t,xu))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.color)||null}function Su(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:c(mu,this,Au),fontSize:c(mu,this,_u)?"calc(".concat(c(mu,this,_u),"px * var(--total-scale-factor))"):""}};for(const s of t.split("\n"))e.push({name:"span",value:s,attributes:n});return i}function Cu(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&h(eu,this))&&l(mu,this,Mu).call(this)}function ku(){if(null!==h(su,this))return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:s}}}=h($d,this);let o=!!h(tu,this),r=h(o?tu:lu,this);for(const d of h(Zd,this))if(!r||null!==Dt.intersect(d.data.rect,r)){r=d.data.rect,o=!0;break}const a=Dt.normalizeRect([r[0],t[3]-r[1]+t[1],r[2],t[3]-r[3]+t[1]]),l=o?r[2]-r[0]+5:0,c=a[0]+l,u=a[1];d(su,this,[100*(c-n)/e,100*(u-s)/i]);const{style:p}=h(Yd,this);p.left="".concat(h(su,this)[0],"%"),p.top="".concat(h(su,this)[1],"%")}function Mu(){h(Hd,this)?h(Hd,this).toggleCommentPopup(this,!1):(d(eu,this,!h(eu,this)),h(eu,this)?(l(mu,this,Eu).call(this),h(Yd,this).addEventListener("click",h(Xd,this)),h(Yd,this).addEventListener("keydown",h(Ud,this))):(l(mu,this,Tu).call(this),h(Yd,this).removeEventListener("click",h(Xd,this)),h(Yd,this).removeEventListener("keydown",h(Ud,this))))}function Eu(){h(iu,this)||this.render(),this.isVisible?h(eu,this)&&h(Yd,this).classList.add("focused"):(l(mu,this,ku).call(this),h(Yd,this).hidden=!1,h(Yd,this).style.zIndex=parseInt(h(Yd,this).style.zIndex)+1e3)}function Tu(){h(Yd,this).classList.remove("focused"),!h(eu,this)&&this.isVisible&&(h(Yd,this).hidden=!0,h(Yd,this).style.zIndex=parseInt(h(Yd,this).style.zIndex)-1e3)}class Ru extends Sd{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=V.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Pu=new WeakMap;class Iu extends Sd{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),a(this,Pu,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),s=d(Pu,this,this.svgFactory.createElement("svg:line"));return s.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),s.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),s.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),s.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return h(Pu,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Du=new WeakMap;class Lu extends Sd{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),a(this,Du,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,o=d(Du,this,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",s/2),o.setAttribute("y",s/2),o.setAttribute("width",e-s),o.setAttribute("height",i-s),o.setAttribute("stroke-width",s||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return h(Du,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Ou=new WeakMap;class Fu extends Sd{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),a(this,Ou,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,o=d(Ou,this,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",e/2),o.setAttribute("cy",i/2),o.setAttribute("rx",e/2-s/2),o.setAttribute("ry",i/2-s/2),o.setAttribute("stroke-width",s||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return h(Ou,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var zu=new WeakMap;class Nu extends Sd{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),a(this,zu,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:i,popupRef:n},width:s,height:o}=this;if(!e)return this.container;const r=this.svgFactory.create(s,o,!0);let a=[];for(let c=0,h=e.length;c=0&&s.setAttribute("stroke-width",e||1),i)for(let o=0,r=h(Gu,this).length;o{"Enter"===t.key&&(n?t.metaKey:t.ctrlKey)&&l(Zu,this,tp).call(this)}),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return h(Qu,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function tp(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.content,this.filename)}var ep=new WeakMap,ip=new WeakMap,np=new WeakMap,sp=new WeakMap,op=new WeakMap,rp=new WeakMap,ap=new WeakSet;class lp{constructor(t){let{div:e,accessibilityManager:i,annotationCanvasMap:n,annotationEditorUIManager:s,page:o,viewport:l,structTreeLayer:c,commentManager:h,linkService:u,annotationStorage:p}=t;r(this,ap),a(this,ep,null),a(this,ip,null),a(this,np,null),a(this,sp,new Map),a(this,op,null),a(this,rp,null),this.div=e,d(ep,this,i),d(ip,this,n),d(op,this,c||null),d(rp,this,u||null),d(np,this,p||new xo),this.page=o,this.viewport=l,this.zIndex=0,this._annotationEditorUIManager=s,this._commentManager=h||null}hasEditableAnnotations(){return h(sp,this).size>0}async render(t){const{annotations:e}=t,i=this.div;re(i,this.viewport);const n=new Map,s={data:null,layer:i,linkService:h(rp,this),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new gd,annotationStorage:h(np,this),enableComment:!0===t.enableComment,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const a of e){var o;if(a.noHTML)continue;const t=a.annotationType===tt.POPUP;if(t){const t=n.get(a.id);if(!t)continue;s.elements=t}else if(a.rect[2]===a.rect[0]||a.rect[3]===a.rect[1])continue;s.data=a;const e=bd.create(s);if(!e.isRenderable)continue;if(!t&&a.popupRef){const t=n.get(a.popupRef);t?t.push(e):n.set(a.popupRef,[e])}const i=e.render();var r;if(a.hidden&&(i.style.visibility="hidden"),await l(ap,this,cp).call(this,i,a.id,s.elements),null===(o=e.extraPopupElement)||void 0===o||null===(o=o.popup)||void 0===o||o.renderCommentButton(),e._isEditable)h(sp,this).set(e.data.id,e),null===(r=this._annotationEditorUIManager)||void 0===r||r.renderAnnotationElement(e)}l(ap,this,hp).call(this)}async addLinkAnnotations(t){const e={data:null,layer:this.div,linkService:h(rp,this),svgFactory:new gd,parent:this};for(const i of t){i.borderStyle||(i.borderStyle=lp._defaultBorderStyle),e.data=i;const t=bd.create(e);if(!t.isRenderable)continue;const n=t.render();await l(ap,this,cp).call(this,n,i.id,null)}}update(t){let{viewport:e}=t;const i=this.div;this.viewport=e,re(i,{rotation:e.rotation}),l(ap,this,hp).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from(h(sp,this).values())}getEditableAnnotation(t){return h(sp,this).get(t)}addFakeAnnotation(t){var e;const{div:i}=this,{id:n,rotation:s}=t,o=new kd({data:{id:n,rect:t.getPDFRect(),rotation:s},editor:t,layer:i,parent:this,enableComment:!!this._commentManager,linkService:h(rp,this),annotationStorage:h(np,this)}),r=o.render();return i.append(r),null===(e=h(ep,this))||void 0===e||e.moveElementInDOM(i,r,r,!1),o.createOrUpdatePopup(),o}static get _defaultBorderStyle(){return xt(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:et,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}async function cp(t,e,i){var n;const s=t.firstChild||t,o=s.id="".concat(Bt).concat(e),r=await(null===(n=h(op,this))||void 0===n?void 0:n.getAriaAttributes(o));if(r)for(const[l,c]of r)s.setAttribute(l,c);var a;i?i.at(-1).container.after(t):(this.div.append(t),null===(a=h(ep,this))||void 0===a||a.moveElementInDOM(this.div,t,s,!1))}function hp(){if(!h(ip,this))return;const t=this.div;for(const[i,n]of h(ip,this)){const s=t.querySelector('[data-annotation-id="'.concat(i,'"]'));if(!s)continue;n.className="annotationContent";const{firstChild:o}=s;o?"CANVAS"===o.nodeName?o.replaceWith(n):o.classList.contains("annotationContent")?o.after(n):o.before(n):s.append(n);const r=h(sp,this).get(i);var e;if(r)if(r._hasNoCanvas)null===(e=this._annotationEditorUIManager)||void 0===e||e.setMissingCanvas(i,s.id,n),r._hasNoCanvas=!1;else r.canvas=n}h(ip,this).clear()}const dp=/\r\n?|\n/g;var up=new WeakMap,pp=new WeakMap,fp=new WeakMap,mp=new WeakMap,gp=new WeakSet;class vp extends Hs{static get _keyboardManager(){const t=vp.prototype,e=t=>t.isEmpty(),i=tn.TRANSLATE_SMALL,n=tn.TRANSLATE_BIG;return xt(this,"_keyboardManager",new ei([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,n],checker:e}]]))}constructor(t){super((0,s.A)((0,s.A)({},t),{},{name:"freeTextEditor"})),r(this,gp),a(this,up,""),a(this,pp,"".concat(this.id,"-editor")),a(this,fp,null),a(this,mp,void 0),(0,R.A)(this,"_colorPicker",null),this.color=t.color||vp._defaultColor||Hs._defaultLineColor,d(mp,this,t.fontSize||vp._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static initialize(t,e){Hs.initialize(t,e);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case q.FREETEXT_SIZE:vp._defaultFontSize=e;break;case q.FREETEXT_COLOR:vp._defaultColor=e}}updateParams(t,e){switch(t){case q.FREETEXT_SIZE:l(gp,this,wp).call(this,e);break;case q.FREETEXT_COLOR:l(gp,this,bp).call(this,e)}}static get defaultPropertiesToUpdate(){return[[q.FREETEXT_SIZE,vp._defaultFontSize],[q.FREETEXT_COLOR,vp._defaultColor||Hs._defaultLineColor]]}get propertiesToUpdate(){return[[q.FREETEXT_SIZE,h(mp,this)],[q.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new hd(this)),[["colorPicker",this._colorPicker]]}get colorType(){return q.FREETEXT_COLOR}onUpdatedColor(){var t;this.editorDiv.style.color=this.color,null===(t=this._colorPicker)||void 0===t||t.update(this.color),super.onUpdatedColor()}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-vp._internalPadding*t,-(vp._internalPadding+h(mp,this))*t]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),d(fp,this,new AbortController);const t=this._uiManager.combinedSignal(h(fp,this));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return!!super.disableEditMode()&&(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",h(pp,this)),this._isDraggable=!0,null===(t=h(fp,this))||void 0===t||t.abort(),d(fp,this,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0)}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var e;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),null!==(e=this._initialOptions)&&void 0!==e&&e.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=h(up,this),e=d(up,this,l(gp,this,yp).call(this).trimEnd());if(t===e)return;const i=t=>{d(up,this,t),t?(l(gp,this,Ap).call(this),this._uiManager.rebuild(this),l(gp,this,xp).call(this)):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),l(gp,this,xp).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){vp._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let t,e;(this._isCopy||this.annotationElementId)&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",h(pp,this)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize="calc(".concat(h(mp,this),"px * var(--total-scale-factor))"),i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[i,n]=this.parentDimensions;if(this.annotationElementId){const{position:s}=this._initialData;let[o,r]=this.getInitialTranslation();[o,r]=this.pageTranslationToScreen(o,r);const[a,l]=this.pageDimensions,[c,h]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=t+(s[0]-c)/a,u=e+this.height-(s[1]-h)/l;break;case 90:d=t+(s[0]-c)/a,u=e-(s[1]-h)/l,[o,r]=[r,-o];break;case 180:d=t-this.width+(s[0]-c)/a,u=e-(s[1]-h)/l,[o,r]=[-o,-r];break;case 270:d=t+(s[0]-c-this.height*l)/a,u=e+(s[1]-h-this.width*a)/l,[o,r]=[-r,o]}this.setAt(d*i,u*n,o,r)}else this._moveAfterPaste(t,e);l(gp,this,Ap).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();const n=Cp.call(vp,e.getData("text")||"").replaceAll(dp,"\n");if(!n)return;const s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize(),s.deleteFromDocument();const o=s.getRangeAt(0);if(!n.includes("\n"))return o.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),void s.collapseToStart();const{startContainer:r,startOffset:a}=o,c=[],h=[];if(r.nodeType===Node.TEXT_NODE){const t=r.parentElement;if(h.push(r.nodeValue.slice(a).replaceAll(dp,"")),t!==this.editorDiv){let e=c;for(const i of this.editorDiv.childNodes)i!==t?e.push(_p.call(vp,i)):e=h}c.push(r.nodeValue.slice(0,a).replaceAll(dp,""))}else if(r===this.editorDiv){let t=c,e=0;for(const i of this.editorDiv.childNodes)e++===a&&(t=h),t.push(_p.call(vp,i))}d(up,this,"".concat(c.join("\n")).concat(n).concat(h.join("\n"))),l(gp,this,Ap).call(this);const u=new Range;let p=Math.sumPrecise(c.map(t=>t.length));for(const{firstChild:l}of this.editorDiv.childNodes)if(l.nodeType===Node.TEXT_NODE){const t=l.nodeValue.length;if(p<=t){u.setStart(l,p),u.setEnd(l,p);break}p-=t}s.removeAllRanges(),s.addRange(u)}get contentDiv(){return this.editorDiv}getPDFRect(){const t=vp._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,i){let n=null;if(t instanceof Ru){const{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:s,rotation:o,id:r,popupRef:a,richText:l,contentsObj:c,creationDate:h,modificationDate:d},textContent:u,textPosition:p,parent:{page:{pageNumber:f}}}=t;if(!u||0===u.length)return null;n=t={annotationType:V.FREETEXT,color:Array.from(i),fontSize:e,value:u.join("\n"),position:p,pageIndex:f-1,rect:s.slice(0),rotation:o,annotationElementId:r,id:r,deleted:!1,popupRef:a,comment:(null===c||void 0===c?void 0:c.str)||null,richText:l,creationDate:h,modificationDate:d}}const s=await super.deserialize(t,e,i);return d(mp,s,t.fontSize),s.color=Dt.makeHexColor(...t.color),d(up,s,Cp.call(vp,t.value)),s._initialData=n,t.comment&&s.setCommentData(t),s}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=Hs._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(t),{color:e,fontSize:h(mp,this),value:l(gp,this,Sp).call(this)});return this.addComment(i),t?(i.isCopy=!0,i):this.annotationElementId&&!l(gp,this,kp).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(!e)return null;const{style:i}=e;i.fontSize="calc(".concat(h(mp,this),"px * var(--total-scale-factor))"),i.color=this.color,e.replaceChildren();for(const n of h(up,this).split("\n")){const t=document.createElement("div");t.append(n?document.createTextNode(n):document.createElement("br")),e.append(t)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:h(up,this)}}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}function wp(t){const e=t=>{this.editorDiv.style.fontSize="calc(".concat(t,"px * var(--total-scale-factor))"),this.translate(0,-(t-h(mp,this))*this.parentScale),d(mp,this,t),l(gp,this,xp).call(this)},i=h(mp,this);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function bp(t){const e=t=>{this.color=t,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function yp(){const t=[];this.editorDiv.normalize();let e=null;for(const n of this.editorDiv.childNodes){var i;(null===(i=e)||void 0===i?void 0:i.nodeType)===Node.TEXT_NODE&&"BR"===n.nodeName||(t.push(_p.call(C,n)),e=n)}return t.join("\n")}function xp(){const[t,e]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,n=e.style.display,s=e.classList.contains("hidden");e.classList.remove("hidden"),e.style.display="hidden",t.div.append(this.div),i=e.getBoundingClientRect(),e.remove(),e.style.display=n,e.classList.toggle("hidden",s)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()}function _p(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(dp,"")}function Ap(){if(this.editorDiv.replaceChildren(),h(up,this))for(const t of h(up,this).split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}function Sp(){return h(up,this).replaceAll("\xa0"," ")}function Cp(t){return t.replaceAll(" ","\xa0")}function kp(t){const{value:e,fontSize:i,color:n,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==n[e])||t.pageIndex!==s}C=vp,(0,R.A)(vp,"_freeTextDefaultContent",""),(0,R.A)(vp,"_internalPadding",0),(0,R.A)(vp,"_defaultColor",null),(0,R.A)(vp,"_defaultFontSize",10),(0,R.A)(vp,"_type","freetext"),(0,R.A)(vp,"_editorType",V.FREETEXT);class Mp{toSVGPath(){vt("Abstract method `toSVGPath` must be implemented.")}get box(){vt("Abstract getter `box` must be implemented.")}serialize(t,e){vt("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,n,s,o){o||(o=new Float32Array(t.length));for(let r=0,a=t.length;r5&&void 0!==arguments[5]?arguments[5]:0;r(this,jp),a(this,Ep,void 0),a(this,Tp,[]),a(this,Rp,void 0),a(this,Pp,void 0),a(this,Ip,[]),a(this,Dp,new Float32Array(18)),a(this,Lp,void 0),a(this,Op,void 0),a(this,Fp,void 0),a(this,zp,void 0),a(this,Np,void 0),a(this,Bp,void 0),a(this,Wp,[]),d(Ep,this,e),d(Bp,this,n*i),d(Pp,this,s),h(Dp,this).set([NaN,NaN,NaN,NaN,o,l],6),d(Rp,this,c),d(zp,this,Jp._*i),d(Fp,this,Qp._*i),d(Np,this,i),h(Wp,this).push(o,l)}isEmpty(){return isNaN(h(Dp,this)[8])}add(t){var e;let{x:i,y:n}=t;d(Lp,this,i),d(Op,this,n);const[s,o,r,a]=h(Ep,this);let[l,c,u,p]=h(Dp,this).subarray(8,12);const f=i-u,m=n-p,g=Math.hypot(f,m);if(g=6;n-=6)isNaN(e[n])?i.push("L".concat(e[n+4]," ").concat(e[n+5])):i.push("C".concat(e[n]," ").concat(e[n+1]," ").concat(e[n+2]," ").concat(e[n+3]," ").concat(e[n+4]," ").concat(e[n+5]));return l(jp,this,Vp).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,n,s,o){return new af(t,e,i,n,s,o)}getOutlines(){var t,e;const i=h(Ip,this),n=h(Tp,this),s=h(Dp,this),[o,r,a,c]=h(Ep,this),d=new Float32Array((null!==(t=null===(e=h(Wp,this))||void 0===e?void 0:e.length)&&void 0!==t?t:0)+2);for(let l=0,f=d.length-2;l=6;l-=6)for(let t=0;t<6;t+=2)isNaN(n[l+t])?(u[p]=u[p+1]=NaN,p+=2):(u[p]=n[l+t],u[p+1]=n[l+t+1],p+=2);return l(jp,this,Kp).call(this,u,p),this.newFreeDrawOutline(u,d,h(Ep,this),h(Np,this),h(Rp,this),h(Pp,this))}}function Hp(){const t=h(Dp,this).subarray(4,6),e=h(Dp,this).subarray(16,18),[i,n,s,o]=h(Ep,this);return[(h(Lp,this)+(t[0]-e[0])/2-i)/s,(h(Op,this)+(t[1]-e[1])/2-n)/o,(h(Lp,this)+(e[0]-t[0])/2-i)/s,(h(Op,this)+(e[1]-t[1])/2-n)/o]}function Up(){const[t,e,i,n]=h(Ep,this),[s,o,r,a]=l(jp,this,Hp).call(this);return"M".concat((h(Dp,this)[2]-t)/i," ").concat((h(Dp,this)[3]-e)/n," L").concat((h(Dp,this)[4]-t)/i," ").concat((h(Dp,this)[5]-e)/n," L").concat(s," ").concat(o," L").concat(r," ").concat(a," L").concat((h(Dp,this)[16]-t)/i," ").concat((h(Dp,this)[17]-e)/n," L").concat((h(Dp,this)[14]-t)/i," ").concat((h(Dp,this)[15]-e)/n," Z")}function Vp(t){const e=h(Tp,this);t.push("L".concat(e[4]," ").concat(e[5]," Z"))}function qp(t){const[e,i,n,s]=h(Ep,this),o=h(Dp,this).subarray(4,6),r=h(Dp,this).subarray(16,18),[a,c,d,u]=l(jp,this,Hp).call(this);t.push("L".concat((o[0]-e)/n," ").concat((o[1]-i)/s," L").concat(a," ").concat(c," L").concat(d," ").concat(u," L").concat((r[0]-e)/n," ").concat((r[1]-i)/s))}function Xp(t){const e=h(Dp,this),[i,n,s,o]=h(Ep,this),[r,a,c,d]=l(jp,this,Hp).call(this),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-i)/s,(e[3]-n)/o,NaN,NaN,NaN,NaN,(e[4]-i)/s,(e[5]-n)/o,NaN,NaN,NaN,NaN,r,a,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,(e[16]-i)/s,(e[17]-n)/o,NaN,NaN,NaN,NaN,(e[14]-i)/s,(e[15]-n)/o],0),this.newFreeDrawOutline(u,t,h(Ep,this),h(Np,this),h(Rp,this),h(Pp,this))}function Kp(t,e){const i=h(Tp,this);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6}function Yp(t,e){const i=h(Dp,this).subarray(4,6),n=h(Dp,this).subarray(16,18),[s,o,r,a]=h(Ep,this),[c,d,u,p]=l(jp,this,Hp).call(this);return t.set([NaN,NaN,NaN,NaN,(i[0]-s)/r,(i[1]-o)/a,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,u,p,NaN,NaN,NaN,NaN,(n[0]-s)/r,(n[1]-o)/a],e),e+24}var Jp={_:8},Qp={_:Jp._+2},Zp=new WeakMap,$p=new WeakMap,tf=new WeakMap,ef=new WeakMap,nf=new WeakMap,sf=new WeakMap,of=new WeakMap,rf=new WeakSet;class af extends Mp{constructor(t,e,i,n,s,o){super(),r(this,rf),a(this,Zp,void 0),a(this,$p,new Float32Array(4)),a(this,tf,void 0),a(this,ef,void 0),a(this,nf,void 0),a(this,sf,void 0),a(this,of,void 0),d(of,this,t),d(nf,this,e),d(Zp,this,i),d(sf,this,n),d(tf,this,s),d(ef,this,o),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],l(rf,this,lf).call(this,o);const[c,u,p,f]=h($p,this);for(let r=0,a=t.length;r5&&void 0!==arguments[5]?arguments[5]:0)}getNewOutline(t,e){const[i,n,s,o]=h($p,this),[r,a,l,c]=h(Zp,this),d=s*l,u=o*c,p=i*l+r,f=n*c+a,m=this.newOutliner({x:h(nf,this)[0]*d+p,y:h(nf,this)[1]*u+f},h(Zp,this),h(sf,this),t,h(ef,this),null!==e&&void 0!==e?e:h(tf,this));for(let g=2;gu?(o=t,r=u):r===u&&(o=c(o,t)),ld[1]?(o=d[0],r=d[1]):r===d[1]&&(o=c(o,d[0])),l1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];r(this,ff),a(this,cf,void 0),a(this,hf,void 0),a(this,df,void 0),a(this,uf,[]),a(this,pf,[]);const s=[1/0,1/0,-1/0,-1/0],o=1e-4;for(const{x:r,y:a,width:d,height:w}of t){const t=Math.floor((r-e)/o)*o,i=Math.ceil((r+d+e)/o)*o,n=Math.floor((a-e)/o)*o,l=Math.ceil((a+w+e)/o)*o,c=[t,n,l,!0],u=[i,n,l,!1];h(uf,this).push(c,u),Dt.rectBoundingBox(t,n,i,l,s)}const l=s[2]-s[0]+2*i,c=s[3]-s[1]+2*i,u=s[0]-i,p=s[1]-i;let f=n?-1/0:1/0,m=1/0;const g=h(uf,this).at(n?-1:-2),v=[g[0],g[2]];for(const r of h(uf,this)){const[t,e,i,s]=r;!s&&n?et[0]-e[0]||t[1]-e[1]||t[2]-e[2]);const t=[];for(const e of h(uf,this))e[3]?(t.push(...l(ff,this,yf).call(this,e)),l(ff,this,wf).call(this,e)):(l(ff,this,bf).call(this,e),t.push(...l(ff,this,yf).call(this,e)));return l(ff,this,gf).call(this,t)}}function gf(t){const e=[],i=new Set;for(const o of t){const[t,i,n]=o;e.push([t,i,o],[t,n,o])}e.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let o=0,r=e.length;o0;){const t=i.values().next().value;let[e,o,r,a,l]=t;i.delete(t);let c=e,h=o;for(s=[e,r],n.push(s);;){let t;if(i.has(a))t=a;else{if(!i.has(l))break;t=l}i.delete(t),[e,o,r,a,l]=t,c!==e&&(s.push(c,h,e,h===o?o:r),c=e),h=h===o?r:o}s.push(c,h)}return new Af(n,h(cf,this),h(hf,this),h(df,this))}function vf(t){const e=h(pf,this);let i=0,n=e.length-1;for(;i<=n;){const s=i+n>>1,o=e[s][0];if(o===t)return s;o=0;s--){const[t,n]=h(pf,this)[s];if(t!==e)break;if(t===e&&n===i)return void h(pf,this).splice(s,1)}}function yf(t){const[e,i,n]=t,s=[[e,i,n]],o=l(ff,this,vf).call(this,n);for(let r=0;r=t)if(a>i)s[n][1]=i;else{if(1===o)return[];s.splice(n,1),n--,o--}else s[n][2]=t,a>i&&s.push([e,i,a])}}return s}var xf=new WeakMap,_f=new WeakMap;class Af extends Mp{constructor(t,e,i,n){super(),a(this,xf,void 0),a(this,_f,void 0),d(_f,this,t),d(xf,this,e),this.firstPoint=i,this.lastPoint=n}toSVGPath(){const t=[];for(const e of h(_f,this)){let[i,n]=e;t.push("M".concat(i," ").concat(n));for(let s=2;s5&&void 0!==arguments[5]?arguments[5]:0)}}var kf=new WeakMap,Mf=new WeakMap,Ef=new WeakMap,Tf=new WeakMap,Rf=new WeakMap,Pf=new WeakMap,If=new WeakMap,Df=new WeakMap,Lf=new WeakMap,Of=new WeakMap,Ff=new WeakMap,zf=new WeakMap,Nf=new WeakMap,Bf=new WeakMap,Wf=new WeakMap,jf=new WeakMap,Gf=new WeakMap,Hf=new WeakMap,Uf=new WeakSet;class Vf extends Hs{static get _keyboardManager(){const t=Vf.prototype;return xt(this,"_keyboardManager",new ei([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super((0,s.A)((0,s.A)({},t),{},{name:"highlightEditor"})),r(this,Uf),a(this,kf,null),a(this,Mf,0),a(this,Ef,void 0),a(this,Tf,null),a(this,Rf,null),a(this,Pf,null),a(this,If,null),a(this,Df,0),a(this,Lf,null),a(this,Of,null),a(this,Ff,null),a(this,zf,!1),a(this,Nf,null),a(this,Bf,null),a(this,Wf,null),a(this,jf,""),a(this,Gf,void 0),a(this,Hf,""),this.color=t.color||Vf._defaultColor,d(Gf,this,t.thickness||Vf._defaultThickness),this.opacity=t.opacity||Vf._defaultOpacity,d(Ef,this,t.boxes||null),d(Hf,this,t.methodOfCreation||""),d(jf,this,t.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(d(zf,this,!0),l(Uf,this,Xf).call(this,t),l(Uf,this,Zf).call(this)):h(Ef,this)&&(d(kf,this,t.anchorNode),d(Mf,this,t.anchorOffset),d(If,this,t.focusNode),d(Df,this,t.focusOffset),l(Uf,this,qf).call(this),l(Uf,this,Zf).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:h(zf,this)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:h(Gf,this),methodOfCreation:h(Hf,this)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,e){var i;Hs.initialize(t,e),Vf._defaultColor||(Vf._defaultColor=(null===(i=e.highlightColors)||void 0===i?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case q.HIGHLIGHT_COLOR:Vf._defaultColor=e;break;case q.HIGHLIGHT_THICKNESS:Vf._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return h(Bf,this)}get commentButtonPosition(){return h(Nf,this)}updateParams(t,e){switch(t){case q.HIGHLIGHT_COLOR:l(Uf,this,Kf).call(this,e);break;case q.HIGHLIGHT_THICKNESS:l(Uf,this,Yf).call(this,e)}}static get defaultPropertiesToUpdate(){return[[q.HIGHLIGHT_COLOR,Vf._defaultColor],[q.HIGHLIGHT_THICKNESS,Vf._defaultThickness]]}get propertiesToUpdate(){return[[q.HIGHLIGHT_COLOR,this.color||Vf._defaultColor],[q.HIGHLIGHT_THICKNESS,h(Gf,this)||Vf._defaultThickness],[q.HIGHLIGHT_FREE,h(zf,this)]]}onUpdatedColor(){var t,e;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(h(Ff,this),{root:{fill:this.color,"fill-opacity":this.opacity}}),null===(e=h(Rf,this))||void 0===e||e.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){if(this._uiManager.highlightColors){return[["colorPicker",d(Rf,this,new $h({editor:this}))]]}return super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(l(Uf,this,im).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,l(Uf,this,im).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){l(Uf,this,Qf).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(l(Uf,this,Zf).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)l(Uf,this,Qf).call(this);else if(t){var i;l(Uf,this,Zf).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),this.show(this._isVisible),e&&this.select()}rotate(t){const{drawLayer:e}=this.parent;let i;h(zf,this)?(t=(t-this.rotation+360)%360,i=$f.call(Vf,h(Of,this).box,t)):i=$f.call(Vf,[this.x,this.y,this.width,this.height],t),e.updateProperties(h(Ff,this),{bbox:i,root:{"data-main-rotation":t}}),e.updateProperties(h(Wf,this),{bbox:$f.call(Vf,h(Pf,this).box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;const t=super.render();h(jf,this)&&(t.setAttribute("aria-label",h(jf,this)),t.setAttribute("role","mark")),h(zf,this)?t.classList.add("free"):this.div.addEventListener("keydown",l(Uf,this,tm).bind(this),{signal:this._uiManager._signal});const e=d(Lf,this,document.createElement("div"));return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=h(Tf,this),this.setDims(this.width,this.height),We(this,h(Lf,this),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(h(Wf,this),{rootClass:{hovered:!0}}))}pointerleave(){var t;this.isSelected||(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(h(Wf,this),{rootClass:{hovered:!1}}))}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:l(Uf,this,em).call(this,!0);break;case 1:case 3:l(Uf,this,em).call(this,!1)}}select(){var t;super.select(),h(Wf,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(h(Wf,this),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),h(Wf,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(h(Wf,this),{rootClass:{selected:!1}}),h(zf,this)||l(Uf,this,em).call(this,!1))}get _mustFixPosition(){return!h(zf,this)}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(h(Ff,this),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(h(Wf,this),{rootClass:{hidden:!t}}))}static startHighlighting(t,e,i){let{target:n,x:s,y:o}=i;const{x:r,y:a,width:c,height:h}=n.getBoundingClientRect(),d=new AbortController,u=t.combinedSignal(d),p=e=>{d.abort(),l(Vf,this,rm).call(this,t,e)};window.addEventListener("blur",p,{signal:u}),window.addEventListener("pointerup",p,{signal:u}),window.addEventListener("pointerdown",te,{capture:!0,passive:!1,signal:u}),window.addEventListener("contextmenu",$t,{signal:u}),n.addEventListener("pointermove",l(Vf,this,om).bind(this,t),{signal:u}),this._freeHighlight=new Sf({x:s,y:o},[r,a,c,h],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0))}static async deserialize(t,e,i){let n=null;if(t instanceof qu){const{data:{quadPoints:e,rect:i,rotation:s,id:o,color:r,opacity:a,popupRef:l,richText:c,contentsObj:h,creationDate:d,modificationDate:u},parent:{page:{pageNumber:p}}}=t;n=t={annotationType:V.HIGHLIGHT,color:Array.from(r),opacity:a,quadPoints:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:s,annotationElementId:o,id:o,deleted:!1,popupRef:l,richText:c,comment:(null===h||void 0===h?void 0:h.str)||null,creationDate:d,modificationDate:u}}else if(t instanceof Uu){const{data:{inkLists:e,rect:i,rotation:s,id:o,color:r,borderStyle:{rawWidth:a},popupRef:l,richText:c,contentsObj:h,creationDate:d,modificationDate:u},parent:{page:{pageNumber:p}}}=t;n=t={annotationType:V.HIGHLIGHT,color:Array.from(r),thickness:a,inkLists:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:s,annotationElementId:o,id:o,deleted:!1,popupRef:l,richText:c,comment:(null===h||void 0===h?void 0:h.str)||null,creationDate:d,modificationDate:u}}const{color:s,quadPoints:o,inkLists:r,opacity:a}=t,c=await super.deserialize(t,e,i);c.color=Dt.makeHexColor(...s),c.opacity=a||1,r&&d(Gf,c,t.thickness),c._initialData=n,t.comment&&c.setCommentData(t);const[u,p]=c.pageDimensions,[f,m]=c.pageTranslation;if(o){const t=d(Ef,c,[]);for(let e=0;e0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const e=Hs._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(t);return Object.assign(i,{color:e,opacity:this.opacity,thickness:h(Gf,this),quadPoints:l(Uf,this,nm).call(this),outlines:l(Uf,this,sm).call(this,i.rect)}),this.addComment(i),this.annotationElementId&&!l(Uf,this,am).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}}function qf(){const t=new mf(h(Ef,this),.001);d(Of,this,t.getOutlines()),[this.x,this.y,this.width,this.height]=h(Of,this).box;const e=new mf(h(Ef,this),.0025,.001,"ltr"===this._uiManager.direction);d(Pf,this,e.getOutlines());const{firstPoint:i}=h(Of,this);d(Nf,this,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]);const{lastPoint:n}=h(Pf,this);d(Bf,this,[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height])}function Xf(t){let{highlightOutlines:e,highlightId:i,clipPathId:n}=t;d(Of,this,e);if(d(Pf,this,e.getNewOutline(h(Gf,this)/2+1.5,.0025)),i>=0)d(Ff,this,i),d(Tf,this,n),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),d(Wf,this,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:h(Pf,this).box,path:{d:h(Pf,this).toSVGPath()}},!0));else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(h(Ff,this),{bbox:$f.call(k,h(Of,this).box,(t-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(h(Wf,this),{bbox:$f.call(k,h(Pf,this).box,t),path:{d:h(Pf,this).toSVGPath()}})}const[s,o,r,a]=e.box;switch(this.rotation){case 0:this.x=s,this.y=o,this.width=r,this.height=a;break;case 90:{const[t,e]=this.parentDimensions;this.x=o,this.y=1-s,this.width=r*e/t,this.height=a*t/e;break}case 180:this.x=1-s,this.y=1-o,this.width=r,this.height=a;break;case 270:{const[t,e]=this.parentDimensions;this.x=1-o,this.y=s,this.width=r*e/t,this.height=a*t/e;break}}const{firstPoint:l}=e;d(Nf,this,[(l[0]-s)/r,(l[1]-o)/a]);const{lastPoint:c}=h(Pf,this);d(Bf,this,[(c[0]-s)/r,(c[1]-o)/a])}function Kf(t){const e=(t,e)=>{this.color=t,this.opacity=e,this.onUpdatedColor()},i=this.color,n=this.opacity;this.addCommands({cmd:e.bind(this,t,k._defaultOpacity),undo:e.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}function Yf(t){const e=h(Gf,this),i=t=>{d(Gf,this,t),l(Uf,this,Jf).call(this,t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}function Jf(t){h(zf,this)&&(l(Uf,this,Xf).call(this,{highlightOutlines:h(Of,this).getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims(this.width,this.height))}function Qf(){null!==h(Ff,this)&&this.parent&&(this.parent.drawLayer.remove(h(Ff,this)),d(Ff,this,null),this.parent.drawLayer.remove(h(Wf,this)),d(Wf,this,null))}function Zf(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null===h(Ff,this)&&(({id:n(d,[Ff,this])._,clipPathId:n(d,[Tf,this])._}=t.drawLayer.draw({bbox:h(Of,this).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:h(zf,this)},path:{d:h(Of,this).toSVGPath()}},!1,!0)),d(Wf,this,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:h(zf,this)},bbox:h(Pf,this).box,path:{d:h(Pf,this).toSVGPath()}},h(zf,this))),h(Lf,this)&&(h(Lf,this).style.clipPath=h(Tf,this)))}function $f(t,e){let[i,n,s,o]=t;switch(e){case 90:return[1-n-o,i,o,s];case 180:return[1-i-s,1-n-o,s,o];case 270:return[n,1-i-s,o,s]}return[i,n,s,o]}function tm(t){k._keyboardManager.exec(this,t)}function em(t){if(!h(kf,this))return;const e=window.getSelection();t?e.setPosition(h(kf,this),h(Mf,this)):e.setPosition(h(If,this),h(Df,this))}function im(){return h(zf,this)?this.rotation:0}function nm(){if(h(zf,this))return null;const[t,e]=this.pageDimensions,[i,n]=this.pageTranslation,s=h(Ef,this),o=new Float32Array(8*s.length);let r=0;for(const{x:a,y:l,width:c,height:h}of s){const s=a*t+i,d=(1-l)*e+n;o[r]=o[r+4]=s,o[r+1]=o[r+3]=d,o[r+2]=o[r+6]=s+c*t,o[r+5]=o[r+7]=d-h*e,r+=8}return o}function sm(t){return h(Of,this).serialize(t,l(Uf,this,im).call(this))}function om(t,e){this._freeHighlight.add(e)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}function rm(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}function am(t){const{color:e}=this._initialData;return this.hasEditedComment||t.color.some((t,i)=>t!==e[i])}k=Vf,(0,R.A)(Vf,"_defaultColor",null),(0,R.A)(Vf,"_defaultOpacity",1),(0,R.A)(Vf,"_defaultThickness",12),(0,R.A)(Vf,"_type","highlight"),(0,R.A)(Vf,"_editorType",V.HIGHLIGHT),(0,R.A)(Vf,"_freeHighlightId",-1),(0,R.A)(Vf,"_freeHighlight",null),(0,R.A)(Vf,"_freeHighlightClipId","");var lm=new WeakMap;class cm{constructor(){a(this,lm,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,i]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,i)}updateSVGProperty(t,e){h(lm,this)[t]=e}toSVGProperties(){const t=h(lm,this);return d(lm,this,Object.create(null)),{root:t}}reset(){d(lm,this,Object.create(null))}updateAll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;this.updateProperties(t)}clone(){vt("Not implemented")}}var hm=new WeakMap,dm=new WeakMap,um=new WeakSet;class pm extends Hs{constructor(t){super(t),r(this,um),a(this,hm,null),a(this,dm,void 0),(0,R.A)(this,"_colorPicker",null),(0,R.A)(this,"_drawId",null),d(dm,this,t.mustBeCommitted||!1),this._addOutlines(t)}onUpdatedColor(){var t;null===(t=this._colorPicker)||void 0===t||t.update(this.color),super.onUpdatedColor()}_addOutlines(t){t.drawOutlines&&(l(um,this,fm).call(this,t),l(um,this,vm).call(this))}static _mergeSVGProperties(t,e){const i=new Set(Object.keys(t));for(const[n,s]of Object.entries(e))i.has(n)?Object.assign(t[n],s):t[n]=s;return t}static getDefaultDrawingOptions(t){vt("Not implemented")}static get typesMap(){vt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){const i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,e),this._currentParent&&(_m._.updateProperty(i,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){const i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,e)}static get defaultPropertiesToUpdate(){const t=[],e=this._defaultDrawingOptions;for(const[i,n]of this.typesMap)t.push([i,e[n]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:e}=this;for(const[i,n]of this.constructor.typesMap)t.push([i,e[n]]);return t}_updateProperty(t,e,i){const n=this._drawingOptions,s=n[e],o=i=>{var s;n.updateProperty(e,i);const o=h(hm,this).updateProperty(e,i);o&&l(um,this,ym).call(this,o),null===(s=this.parent)||void 0===s||s.drawLayer.updateProperties(this._drawId,n.toSVGProperties()),t===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:o.bind(this,i),undo:o.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,pm._mergeSVGProperties(h(hm,this).getPathResizingSVGProperties(l(um,this,bm).call(this)),{bbox:l(um,this,xm).call(this)}))}_onResized(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,pm._mergeSVGProperties(h(hm,this).getPathResizedSVGProperties(l(um,this,bm).call(this)),{bbox:l(um,this,xm).call(this)}))}_onTranslating(t,e){var i;null===(i=this.parent)||void 0===i||i.drawLayer.updateProperties(this._drawId,{bbox:l(um,this,xm).call(this)})}_onTranslated(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,pm._mergeSVGProperties(h(hm,this).getPathTranslatedSVGProperties(l(um,this,bm).call(this),this.parentDimensions),{bbox:l(um,this,xm).call(this)}))}_onStartDragging(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,h(dm,this)&&(d(dm,this,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){l(um,this,gm).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(l(um,this,vm).call(this),l(um,this,ym).call(this,h(hm,this).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)this._uiManager.removeShouldRescale(this),l(um,this,gm).call(this);else if(t){var i;this._uiManager.addShouldRescale(this),l(um,this,vm).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),e&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,pm._mergeSVGProperties({bbox:l(um,this,xm).call(this)},h(hm,this).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&l(um,this,ym).call(this,h(hm,this).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,e;this._isCopy&&(t=this.x,e=this.y);const i=super.render();i.classList.add("draw");const n=document.createElement("div");return i.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),i}static createDrawerInstance(t,e,i,n,s){vt("Not implemented")}static startDrawing(t,e,i,n){var s,o;const{target:r,offsetX:a,offsetY:l,pointerId:c,pointerType:h}=n;if(km._&&km._!==h)return;const{viewport:{rotation:d}}=t,{width:u,height:p}=r.getBoundingClientRect(),f=Am._=new AbortController,m=t.combinedSignal(f);Cm._||(Cm._=c),null!==(s=km._)&&void 0!==s||(km._=h),window.addEventListener("pointerup",t=>{var e;Cm._===t.pointerId?this._endDraw(t):null===(e=Mm._)||void 0===e||e.delete(t.pointerId)},{signal:m}),window.addEventListener("pointercancel",t=>{var e;Cm._===t.pointerId?this._currentParent.endDrawingSession():null===(e=Mm._)||void 0===e||e.delete(t.pointerId)},{signal:m}),window.addEventListener("pointerdown",t=>{km._===t.pointerType&&((Mm._||(Mm._=new Set)).add(t.pointerId),_m._.isCancellable()&&(_m._.removeLastElement(),_m._.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",$t,{signal:m}),r.addEventListener("pointermove",this._drawMove.bind(this),{signal:m}),r.addEventListener("touchmove",t=>{t.timeStamp===Em._&&te(t)},{signal:m}),t.toggleDrawing(),null===(o=e._editorUndoBar)||void 0===o||o.hide(),_m._?t.drawLayer.updateProperties(this._currentDrawId,_m._.startNew(a,l,u,p,d)):(e.updateUIForDefaultProperties(this),_m._=this.createDrawerInstance(a,l,u,p,d),Sm._=this.getDefaultDrawingOptions(),this._currentParent=t,({id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(Sm._.toSVGProperties(),_m._.defaultSVGProperties),!0,!1)))}static _drawMove(t){var e;if(Em._=-1,!_m._)return;const{offsetX:i,offsetY:n,pointerId:s}=t;Cm._===s&&((null===(e=Mm._)||void 0===e?void 0:e.size)>=1?this._endDraw(t):(this._currentParent.drawLayer.updateProperties(this._currentDrawId,_m._.add(i,n)),Em._=t.timeStamp,te(t)))}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,_m._=null,Sm._=null,km._=null,Em._=NaN),Am._&&(Am._.abort(),Am._=null,Cm._=NaN,Mm._=null)}static _endDraw(t){const e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),(null===t||void 0===t?void 0:t.target)===e.div&&e.drawLayer.updateProperties(this._currentDrawId,_m._.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const t=_m._,i=this._currentDrawId,n=t.getLastElement();return void e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,t.setLastElement(n))},undo:()=>{e.drawLayer.updateProperties(i,t.removeLastElement())},mustExec:!1,type:q.DRAW_STEP})}this.endDrawing(!1)}}static endDrawing(t){const e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(q.DRAW_STEP),!_m._.isEmpty()){const{pageDimensions:[i,n],scale:s}=e,o=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:_m._.getOutlines(i*s,n*s,s,this._INNER_MARGIN),drawingOptions:Sm._,mustBeCommitted:!t});return this._cleanup(!0),o}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,i,n,s,o){vt("Not implemented")}static async deserialize(t,e,i){const{rawDims:{pageWidth:n,pageHeight:s,pageX:o,pageY:r}}=e.viewport,a=this.deserializeDraw(o,r,n,s,this._INNER_MARGIN,t),c=await super.deserialize(t,e,i);return c.createDrawingOptions(t),l(um,c,fm).call(c,{drawOutlines:a}),l(um,c,vm).call(c),c.onScaleChanging(),c.rotate(),c}serializeDraw(t){const[e,i]=this.pageTranslation,[n,s]=this.pageDimensions;return h(hm,this).serialize([e,i,n,s],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}function fm(t){let{drawOutlines:e,drawId:i,drawingOptions:n}=t;d(hm,this,e),this._drawingOptions||(this._drawingOptions=n),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-".concat(this.editorType,"-added-alert")),i>=0?(this._drawId=i,this.parent.drawLayer.finalizeDraw(i,e.defaultProperties)):this._drawId=l(um,this,mm).call(this,e,this.parent),l(um,this,ym).call(this,e.box)}function mm(t,e){const{id:i}=e.drawLayer.draw(M._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return i}function gm(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}function vm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null!==this._drawId&&this.parent===t||(null===this._drawId?(this._drawingOptions.updateAll(),this._drawId=l(um,this,mm).call(this,h(hm,this),t)):this.parent.drawLayer.updateParent(this._drawId,t.drawLayer))}function wm(t){let[e,i,n,s]=t;const{parentDimensions:[o,r],rotation:a}=this;switch(a){case 90:return[i,1-e,n*(r/o),s*(o/r)];case 180:return[1-e,1-i,n,s];case 270:return[1-i,e,n*(r/o),s*(o/r)];default:return[e,i,n,s]}}function bm(){const{x:t,y:e,width:i,height:n,parentDimensions:[s,o],rotation:r}=this;switch(r){case 90:return[1-e,t,i*(s/o),n*(o/s)];case 180:return[1-t,1-e,i,n];case 270:return[e,1-t,i*(s/o),n*(o/s)];default:return[t,e,i,n]}}function ym(t){[this.x,this.y,this.width,this.height]=l(um,this,wm).call(this,t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}function xm(){const{x:t,y:e,width:i,height:n,rotation:s,parentRotation:o,parentDimensions:[r,a]}=this;switch((4*s+o)/90){case 1:return[1-e-n,t,n,i];case 2:return[1-t-i,1-e-n,i,n];case 3:return[e,1-t-i,n,i];case 4:return[t,e-i*(r/a),n*(a/r),i*(r/a)];case 5:return[1-e,t,i*(r/a),n*(a/r)];case 6:return[1-t-n*(a/r),1-e,n*(a/r),i*(r/a)];case 7:return[e-i*(r/a),1-t-n*(a/r),i*(r/a),n*(a/r)];case 8:return[t-i,e-n,i,n];case 9:return[1-e,t-i,n,i];case 10:return[1-t,1-e,i,n];case 11:return[e-n,1-t,n,i];case 12:return[t-n*(a/r),e,n*(a/r),i*(r/a)];case 13:return[1-e-i*(r/a),t-n*(a/r),i*(r/a),n*(a/r)];case 14:return[1-t,1-e-i*(r/a),n*(a/r),i*(r/a)];case 15:return[e,1-t,i*(r/a),n*(a/r)];default:return[t,e,i,n]}}M=pm,(0,R.A)(pm,"_currentDrawId",-1),(0,R.A)(pm,"_currentParent",null);var _m={_:null},Am={_:null},Sm={_:null},Cm={_:NaN},km={_:null},Mm={_:null},Em={_:NaN};(0,R.A)(pm,"_INNER_MARGIN",3);var Tm=new WeakMap,Rm=new WeakMap,Pm=new WeakMap,Im=new WeakMap,Dm=new WeakMap,Lm=new WeakMap,Om=new WeakMap,Fm=new WeakMap,zm=new WeakMap,Nm=new WeakMap,Bm=new WeakMap,Wm=new WeakSet;class jm{constructor(t,e,i,n,s,o){r(this,Wm),a(this,Tm,new Float64Array(6)),a(this,Rm,void 0),a(this,Pm,void 0),a(this,Im,void 0),a(this,Dm,void 0),a(this,Lm,void 0),a(this,Om,""),a(this,Fm,0),a(this,zm,new $m),a(this,Nm,void 0),a(this,Bm,void 0),d(Nm,this,i),d(Bm,this,n),d(Im,this,s),d(Dm,this,o),[t,e]=l(Wm,this,Gm).call(this,t,e);const c=d(Rm,this,[NaN,NaN,NaN,NaN,t,e]);d(Lm,this,[t,e]),d(Pm,this,[{line:c,points:h(Lm,this)}]),h(Tm,this).set(c,0)}updateProperty(t,e){"stroke-width"===t&&d(Dm,this,e)}isEmpty(){return!h(Pm,this)||0===h(Pm,this).length}isCancellable(){return h(Lm,this).length<=10}add(t,e){[t,e]=l(Wm,this,Gm).call(this,t,e);const[i,n,s,o]=h(Tm,this).subarray(2,6),r=t-s,a=e-o;return Math.hypot(h(Nm,this)*r,h(Bm,this)*a)<=2?null:(h(Lm,this).push(t,e),isNaN(i)?(h(Tm,this).set([s,o,t,e],2),h(Rm,this).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(h(Tm,this)[0])&&h(Rm,this).splice(6,6),h(Tm,this).set([i,n,s,o,t,e],0),h(Rm,this).push(...Mp.createBezierPoints(i,n,s,o,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){const i=this.add(t,e);return i||(2===h(Lm,this).length?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,n,s){d(Nm,this,i),d(Bm,this,n),d(Im,this,s),[t,e]=l(Wm,this,Gm).call(this,t,e);const o=d(Rm,this,[NaN,NaN,NaN,NaN,t,e]);d(Lm,this,[t,e]);const r=h(Pm,this).at(-1);return r&&(r.line=new Float32Array(r.line),r.points=new Float32Array(r.points)),h(Pm,this).push({line:o,points:h(Lm,this)}),h(Tm,this).set(o,0),d(Fm,this,0),this.toSVGPath(),null}getLastElement(){return h(Pm,this).at(-1)}setLastElement(t){return h(Pm,this)?(h(Pm,this).push(t),d(Rm,this,t.line),d(Lm,this,t.points),d(Fm,this,0),{path:{d:this.toSVGPath()}}):h(zm,this).setLastElement(t)}removeLastElement(){if(!h(Pm,this))return h(zm,this).removeLastElement();h(Pm,this).pop(),d(Om,this,"");for(let t=0,e=h(Pm,this).length;tnull!==t&&void 0!==t?t:NaN),d,u,p,f),points:m(a[v].map(t=>null!==t&&void 0!==t?t:NaN),d,u,p,f)});const g=new this.prototype.constructor;return g.build(h,i,n,1,l,c,s),g}get box(){return h(Hm,this)}updateProperty(t,e){return"stroke-width"===t?l(Zm,this,ng).call(this,e):null}updateParentDimensions(t,e){let[i,n]=t;const[s,o]=l(Zm,this,tg).call(this);d(Xm,this,i),d(Km,this,n),d(Ym,this,e);const[r,a]=l(Zm,this,tg).call(this),c=r-s,u=a-o,p=h(Hm,this);return p[0]-=c,p[1]-=u,p[2]+=2*c,p[3]+=2*u,p}updateRotation(t){return d(Um,this,t),{path:{transform:this.rotationTransform}}}get viewBox(){return h(Hm,this).map(Mp.svgRound).join(" ")}get defaultProperties(){const[t,e]=h(Hm,this);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(Mp.svgRound(t)," ").concat(Mp.svgRound(e))}}}get rotationTransform(){const[,,t,e]=h(Hm,this);let i=0,n=0,s=0,o=0,r=0,a=0;switch(h(Um,this)){case 90:n=e/t,s=-t/e,r=t;break;case 180:i=-1,o=-1,r=t,a=e;break;case 270:n=-e/t,s=t/e,a=e;break;default:return""}return"matrix(".concat(i," ").concat(n," ").concat(s," ").concat(o," ").concat(Mp.svgRound(r)," ").concat(Mp.svgRound(a),")")}getPathResizingSVGProperties(t){let[e,i,n,s]=t;const[o,r]=l(Zm,this,tg).call(this),[a,c,d,u]=h(Hm,this);if(Math.abs(d-o)<=Mp.PRECISION||Math.abs(u-r)<=Mp.PRECISION){const t=e+n/2-(a+d/2),o=i+s/2-(c+u/2);return{path:{"transform-origin":"".concat(Mp.svgRound(e)," ").concat(Mp.svgRound(i)),transform:"".concat(this.rotationTransform," translate(").concat(t," ").concat(o,")")}}}const p=(n-2*o)/(d-2*o),f=(s-2*r)/(u-2*r),m=d/n,g=u/s;return{path:{"transform-origin":"".concat(Mp.svgRound(a)," ").concat(Mp.svgRound(c)),transform:"".concat(this.rotationTransform," scale(").concat(m," ").concat(g,") ")+"translate(".concat(Mp.svgRound(o)," ").concat(Mp.svgRound(r),") scale(").concat(p," ").concat(f,") ")+"translate(".concat(Mp.svgRound(-o)," ").concat(Mp.svgRound(-r),")")}}}getPathResizedSVGProperties(t){let[e,i,n,s]=t;const[o,r]=l(Zm,this,tg).call(this),a=h(Hm,this),[c,d,u,p]=a;if(a[0]=e,a[1]=i,a[2]=n,a[3]=s,Math.abs(u-o)<=Mp.PRECISION||Math.abs(p-r)<=Mp.PRECISION){const t=e+n/2-(c+u/2),o=i+s/2-(d+p/2);for(const{line:e,points:i}of h(qm,this))Mp._translate(e,t,o,e),Mp._translate(i,t,o,i);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(Mp.svgRound(e)," ").concat(Mp.svgRound(i)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}const f=(n-2*o)/(u-2*o),m=(s-2*r)/(p-2*r),g=-f*(c+o)+e+o,v=-m*(d+r)+i+r;if(1!==f||1!==m||0!==g||0!==v)for(const{line:l,points:w}of h(qm,this))Mp._rescale(l,g,v,f,m,l),Mp._rescale(w,g,v,f,m,w);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(Mp.svgRound(e)," ").concat(Mp.svgRound(i)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties(t,e){let[i,n]=t;const[s,o]=e,r=h(Hm,this),a=i-r[0],l=n-r[1];if(h(Xm,this)===s&&h(Km,this)===o)for(const{line:c,points:d}of h(qm,this))Mp._translate(c,a,l,c),Mp._translate(d,a,l,d);else{const t=h(Xm,this)/s,e=h(Km,this)/o;d(Xm,this,s),d(Km,this,o);for(const{line:i,points:n}of h(qm,this))Mp._rescale(i,a,l,t,e,i),Mp._rescale(n,a,l,t,e,n);r[2]*=t,r[3]*=e}return r[0]=i,r[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":"".concat(Mp.svgRound(i)," ").concat(Mp.svgRound(n))}}}get defaultSVGProperties(){const t=h(Hm,this);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":"".concat(Mp.svgRound(t[0])," ").concat(Mp.svgRound(t[1])),transform:this.rotationTransform||null},bbox:t}}}function tg(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h(Qm,this);const e=h(Vm,this)+t/2*h(Ym,this);return h(Jm,this)%180===0?[e/h(Xm,this),e/h(Km,this)]:[e/h(Km,this),e/h(Xm,this)]}function eg(){const[t,e,i,n]=h(Hm,this),[s,o]=l(Zm,this,tg).call(this,0);return[t+s,e+o,i-2*s,n-2*o]}function ig(){const t=d(Hm,this,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:n}of h(qm,this)){if(n.length<=12){for(let e=4,i=n.length;e0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{stroke:n,"stroke-opacity":s,"stroke-width":o}}=this,r=Object.assign(super.serialize(t),{color:Hs._colorManager.convert(n),opacity:s,thickness:o,paths:{lines:e,points:i}});return this.addComment(r),t?(r.isCopy=!0,r):this.annotationElementId&&!l(og,this,ag).call(this,r)?null:(r.id=this.annotationElementId,r)}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;const{points:e,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}}function ag(t){const{color:e,thickness:i,opacity:n,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((t,i)=>t!==e[i])||t.thickness!==i||t.opacity!==n||t.pageIndex!==s}(0,R.A)(rg,"_type","ink"),(0,R.A)(rg,"_editorType",V.INK),(0,R.A)(rg,"_defaultDrawingOptions",null);class lg extends $m{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}class cg{static extractContoursFromText(t,e,i,n,s,o){let{fontFamily:r,fontStyle:a,fontWeight:c}=e,h=new OffscreenCanvas(1,1),d=h.getContext("2d",{alpha:!1});const u=d.font="".concat(a," ").concat(c," ").concat(200,"px ").concat(r),{actualBoundingBoxLeft:p,actualBoundingBoxRight:f,actualBoundingBoxAscent:m,actualBoundingBoxDescent:g,fontBoundingBoxAscent:v,fontBoundingBoxDescent:w,width:b}=d.measureText(t),y=1.5,x=Math.ceil(Math.max(Math.abs(p)+Math.abs(f)||0,b)*y),_=Math.ceil(Math.max(Math.abs(m)+Math.abs(g)||200,Math.abs(v)+Math.abs(w)||200)*y);h=new OffscreenCanvas(x,_),d=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),d.font=u,d.filter="grayscale(1)",d.fillStyle="white",d.fillRect(0,0,x,_),d.fillStyle="black",d.fillText(t,.5*x/2,1.5*_/2);const A=l(cg,this,wg).call(this,d.getImageData(0,0,x,_).data),S=l(cg,this,vg).call(this,A),C=l(cg,this,bg).call(this,S),k=l(cg,this,pg).call(this,A,x,_,C);return this.processDrawnLines({lines:{curves:k,width:x,height:_},pageWidth:i,pageHeight:n,rotation:s,innerMargin:o,mustSmooth:!0,areContours:!0})}static process(t,e,i,n,s){const[o,r,a]=l(cg,this,yg).call(this,t),[c,h]=l(cg,this,gg).call(this,o,r,a,Math.hypot(r,a)*l(cg,this,xg)._.sigmaSFactor,l(cg,this,xg)._.sigmaR,l(cg,this,xg)._.kernelSize),d=l(cg,this,bg).call(this,h),u=l(cg,this,pg).call(this,c,r,a,d);return this.processDrawnLines({lines:{curves:u,width:r,height:a},pageWidth:e,pageHeight:i,rotation:n,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines(t){var e;let{lines:i,pageWidth:n,pageHeight:s,rotation:o,innerMargin:r,mustSmooth:a,areContours:c}=t;o%180!==0&&([n,s]=[s,n]);const{curves:h,width:d,height:u}=i,p=null!==(e=i.thickness)&&void 0!==e?e:0,f=[],m=Math.min(n/d,s/u),g=m/n,v=m/s,w=[];for(const{points:y}of h){const t=a?l(cg,this,mg).call(this,y):y;if(!t)continue;w.push(t);const e=t.length,i=new Float32Array(e),n=new Float32Array(3*(2===e?2:e-2));if(f.push({line:n,points:i}),2===e){i[0]=t[0]*g,i[1]=t[1]*v,n.set([NaN,NaN,NaN,NaN,i[0],i[1]],0);continue}let[s,o,r,c]=t;s*=g,o*=v,r*=g,c*=v,i.set([s,o,r,c],0),n.set([NaN,NaN,NaN,NaN,s,o],0);for(let a=4;a=-128&&l<=127?Int8Array:a>=-32768&&l<=32767?Int16Array:Int32Array;const h=i.length,d=8+3*h,u=new Uint32Array(d);let p=0;u[p++]=d*Uint32Array.BYTES_PER_ELEMENT+(c-2*h)*e.BYTES_PER_ELEMENT,u[p++]=0,u[p++]=o,u[p++]=r,u[p++]=n?0:1,u[p++]=Math.max(0,Math.floor(null!==s&&void 0!==s?s:0)),u[p++]=h,u[p++]=e.BYTES_PER_ELEMENT;for(const w of i)u[p++]=w.length-2,u[p++]=w[0],u[p++]=w[1];const f=new CompressionStream("deflate-raw"),m=f.writable.getWriter();await m.ready,m.write(u);const g=e.prototype.constructor;for(const w of i){const t=new g(w.length-2);for(let e=2,i=w.length;e{await d.ready,await d.close()}).catch(()=>{});let u=null,p=0;var e,i=!1,n=!1;try{for(var s,o=function(t){var e,i,n,s=2;for("undefined"!=typeof Symbol&&(i=Symbol.asyncIterator,n=Symbol.iterator);s--;){if(i&&null!=(e=t[i]))return e.call(t);if(n&&null!=(e=t[n]))return new P(e.call(t));i="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}(c);i=!(s=await o.next()).done;i=!1){const t=s.value;u||(u=new Uint8Array(new Uint32Array(t.buffer,0,4)[0])),u.set(t,p),p+=t.length}}catch(a){n=!0,e=a}finally{try{i&&null!=o.return&&await o.return()}finally{if(n)throw e}}const f=new Uint32Array(u.buffer,0,u.length>>2),m=f[1];if(0!==m)throw new Error("Invalid version: ".concat(m));const g=f[2],v=f[3],w=0===f[4],b=f[5],y=f[6],x=f[7],_=[],A=(8+3*y)*Uint32Array.BYTES_PER_ELEMENT;let S;switch(x){case Int8Array.BYTES_PER_ELEMENT:S=new Int8Array(u.buffer,A);break;case Int16Array.BYTES_PER_ELEMENT:S=new Int16Array(u.buffer,A);break;case Int32Array.BYTES_PER_ELEMENT:S=new Int32Array(u.buffer,A)}p=0;for(let t=0;t0?0:4:1===i?n+6:2-n}function dg(t,e,i,n,s,o,r){const a=l(E,this,hg).call(this,i,n,s,o);for(let c=0;c<8;c++){const s=(-c+a-r+16)%8;if(0!==t[(i+l(E,this,_g)._[2*s])*e+(n+l(E,this,_g)._[2*s+1])])return s}return-1}function ug(t,e,i,n,s,o,r){const a=l(E,this,hg).call(this,i,n,s,o);for(let c=0;c<8;c++){const s=(c+a+r+16)%8;if(0!==t[(i+l(E,this,_g)._[2*s])*e+(n+l(E,this,_g)._[2*s+1])])return s}return-1}function pg(t,e,i,n){const s=t.length,o=new Int32Array(s);for(let l=0;l=1&&0===o[i+1])){1!==n&&(r=Math.abs(n));continue}a+=1,d+=1,n>1&&(r=n)}const u=[t,h],p=d===t+1,f={isHole:p,points:u,id:a,parent:0};let m;c.push(f);for(const t of c)if(t.id===r){m=t;break}m?m.isHole?f.parent=p?m.parent:r:f.parent=p?r:m.parent:f.parent=p?r:0;const g=l(E,this,dg).call(this,o,e,h,t,s,d,0);if(-1===g){o[i]=-a,1!==o[i]&&(r=Math.abs(o[i]));continue}let v=l(E,this,_g)._[2*g],w=l(E,this,_g)._[2*g+1];const b=h+v,y=t+w;s=b,d=y;let x=h,_=t;for(;;){const n=l(E,this,ug).call(this,o,e,x,_,s,d,1);v=l(E,this,_g)._[2*n],w=l(E,this,_g)._[2*n+1];const c=x+v,p=_+w;u.push(p,c);const f=x*e+_;if(0===o[f+1]?o[f]=-a:1===o[f]&&(o[f]=a),c===h&&p===t&&x===b&&_===y){1!==o[i]&&(r=Math.abs(o[i]));break}s=x,d=_,x=c,_=p}}}return c}function fg(t,e,i,n){if(i-e<=4){for(let s=e;sx&&(_=l,x=e)}x>(c*y)**2?(l(E,this,fg).call(this,t,e,_+2,n),l(E,this,fg).call(this,t,_,i,n)):n.push(s,o)}function mg(t){const e=[],i=t.length;return l(E,this,fg).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e}function gg(t,e,i,n,s,o){const r=new Float32Array(o**2),a=-2*n**2,l=o>>1;for(let f=0;f=i))for(let i=0;i=e)continue;const f=t[s*e+p],m=r[u*o+i]*c[Math.abs(f-a)];h+=f*m,d+=m}}p[u[s]=Math.round(h/d)]++}return[u,p]}function vg(t){const e=new Uint32Array(256);for(const i of t)e[i]++;return e}function wg(t){const e=t.length,i=new Uint8ClampedArray(e>>2);let n=-1/0,s=1/0;for(let r=0,a=i.length;r0!==t);let o=s,r=s;for(e=s;e<256;e++){const s=t[e];s>i&&(e-o>n&&(n=e-o,r=e-1),i=s,o=e)}for(e=r-1;e>=0&&!(t[e]>t[e+1]);e--);return e}function yg(t){const e=t,{width:i,height:n}=t,{maxDim:s}=l(E,this,xg)._;let o=i,r=n;if(i>s||n>s){let a=i,l=n,c=Math.log2(Math.max(i,n)/s);const h=Math.floor(c);c=c===h?h-1:h;for(let i=0;i{null===e||void 0===e||e.updateEditSignatureButton(t)}))}getSignaturePreview(){const{newCurves:t,areContours:e,thickness:i,width:n,height:s}=h(Mg,this),o=Math.max(n,s);return{areContours:e,outline:cg.processDrawnLines({lines:{curves:t.map(t=>({points:t})),thickness:i,width:n,height:s},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,e,i,n){const{x:s,y:o}=this,{outline:r}=d(Mg,this,t);let a;d(Cg,this,r instanceof lg),this.description=i,h(Cg,this)?a=Tg.getDefaultDrawingOptions():(a=Tg._defaultDrawnSignatureOptions.clone(),a.updateProperties({"stroke-width":r.thickness})),this._addOutlines({drawOutlines:r,drawingOptions:a});const[,l]=this.pageDimensions;let c=e/l;c=c>=1?.5:c,this.width*=c/this.height,this.width>=1&&(c*=.9/this.width,this.width=.9),this.height=c,this.setDims(),this.x=s,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:e,pageHeight:i},rotation:n}=this.parent.viewport;return cg.process(t,e,i,n,Tg._INNER_MARGIN)}getFromText(t,e){const{rawDims:{pageWidth:i,pageHeight:n},rotation:s}=this.parent.viewport;return cg.extractContoursFromText(t,e,i,n,s,Tg._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:e,pageHeight:i},rotation:n}=this.parent.viewport;return cg.processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:n,innerMargin:Tg._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions(t){let{areContours:e,thickness:i}=t;e?this._drawingOptions=Tg.getDefaultDrawingOptions():(this._drawingOptions=Tg._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":i}))}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;const{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":n}}=this,s=Object.assign(super.serialize(t),{isSignature:!0,areContours:h(Cg,this),color:[0,0,0],thickness:h(Cg,this)?0:n});return this.addComment(s),t?(s.paths={lines:e,points:i},s.uuid=h(Eg,this),s.isCopy=!0):s.lines=e,h(kg,this)&&(s.accessibilityData={type:"Figure",alt:h(kg,this)}),s}static deserializeDraw(t,e,i,n,s,o){return o.areContours?lg.deserialize(t,e,i,n,s,o):$m.deserialize(t,e,i,n,s,o)}static async deserialize(t,e,i){var n;const s=await super.deserialize(t,e,i);return d(Cg,s,t.areContours),s.description=(null===(n=t.accessibilityData)||void 0===n?void 0:n.alt)||"",d(Eg,s,t.uuid),s}}(0,R.A)(Tg,"_type","signature"),(0,R.A)(Tg,"_editorType",V.SIGNATURE),(0,R.A)(Tg,"_defaultDrawingOptions",null);var Rg=new WeakMap,Pg=new WeakMap,Ig=new WeakMap,Dg=new WeakMap,Lg=new WeakMap,Og=new WeakMap,Fg=new WeakMap,zg=new WeakMap,Ng=new WeakMap,Bg=new WeakMap,Wg=new WeakMap,jg=new WeakSet;class Gg extends Hs{constructor(t){super((0,s.A)((0,s.A)({},t),{},{name:"stampEditor"})),r(this,jg),a(this,Rg,null),a(this,Pg,null),a(this,Ig,null),a(this,Dg,null),a(this,Lg,null),a(this,Og,""),a(this,Fg,null),a(this,zg,!1),a(this,Ng,null),a(this,Bg,!1),a(this,Wg,!1),d(Dg,this,t.bitmapUrl),d(Lg,this,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){Hs.initialize(t,e)}static isHandlingMimeForPasting(t){return le.includes(t)}static paste(t,e){e.pasteEditor({mode:V.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!(null===(t=this.altTextData)||void 0===t||!t.altText)}}static computeTelemetryFinalData(t){var e,i;const n=t.get("hasAltText");return{hasAltText:null!==(e=n.get(!0))&&void 0!==e?e:0,hasNoAltText:null!==(i=n.get(!1))&&void 0!==i?i:0}}async mlGuessAltText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:s,height:o}=t||this.copyCanvas(null,null,!0).imageData,r=await i.guess({name:"altText",request:{data:n,width:s,height:o,channels:n.length/(s*o)}});if(!r)throw new Error("No response from the AI service.");if(r.error)throw new Error("Error from the AI service.");if(r.cancel)return null;if(!r.output)throw new Error("No valid response from the AI service.");const a=r.output;return await this.setGuessedAltText(a),e&&!this.hasAltTextData()&&(this.altTextData={alt:a,decorative:!1}),a}remove(){var t;h(Pg,this)&&(d(Rg,this,null),this._uiManager.imageManager.deleteId(h(Pg,this)),null===(t=h(Fg,this))||void 0===t||t.remove(),d(Fg,this,null),h(Ng,this)&&(clearTimeout(h(Ng,this)),d(Ng,this,null)));super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(h(Pg,this)&&null===h(Fg,this)&&l(jg,this,Vg).call(this),this.isAttachedToDOM||this.parent.add(this))):h(Pg,this)&&l(jg,this,Vg).call(this)}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(h(Ig,this)||h(Rg,this)||h(Dg,this)||h(Lg,this)||h(Pg,this)||h(zg,this))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;return this._isCopy&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),h(zg,this)||(h(Rg,this)?l(jg,this,qg).call(this):l(jg,this,Vg).call(this)),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,e){const{id:i,bitmap:n}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(d(Pg,this,i),n&&d(Rg,this,n),d(zg,this,!1),l(jg,this,qg).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;null!==h(Ng,this)&&clearTimeout(h(Ng,this));d(Ng,this,setTimeout(()=>{d(Ng,this,null),l(jg,this,Kg).call(this)},200))}copyCanvas(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||(t=224);const{width:n,height:s}=h(Rg,this),o=new ae;let r=h(Rg,this),a=n,c=s,d=null;if(e){if(n>e||s>e){const t=Math.min(e/n,e/s);a=Math.floor(n*t),c=Math.floor(s*t)}d=document.createElement("canvas");const t=d.width=Math.ceil(a*o.sx),i=d.height=Math.ceil(c*o.sy);h(Bg,this)||(r=l(jg,this,Xg).call(this,t,i));const u=d.getContext("2d");u.filter=this._uiManager.hcmFilter;let p="white",f="#cfcfd8";"none"!==this._uiManager.hcmFilter?f="black":ce.isDarkMode&&(p="#8f8f9d",f="#42414d");const m=15,g=m*o.sx,v=m*o.sy,w=new OffscreenCanvas(2*g,2*v),b=w.getContext("2d");b.fillStyle=p,b.fillRect(0,0,2*g,2*v),b.fillStyle=f,b.fillRect(0,0,g,v),b.fillRect(g,v,g,v),u.fillStyle=u.createPattern(w,"repeat"),u.fillRect(0,0,t,i),u.drawImage(r,0,0,r.width,r.height,0,0,t,i)}let u=null;if(i){let e,i;if(o.symmetric&&r.widtht||s>t){const o=Math.min(t/n,t/s);e=Math.floor(n*o),i=Math.floor(s*o),h(Bg,this)||(r=l(jg,this,Xg).call(this,e,i))}const a=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});a.drawImage(r,0,0,r.width,r.height,0,0,e,i),u={width:e,height:i,data:a.getImageData(0,0,e,i).data}}return{canvas:d,width:a,height:c,imageData:u}}static async deserialize(t,e,i){let n=null,s=!1;if(t instanceof Ju){var o;const{data:{rect:r,rotation:a,id:l,structParent:c,popupRef:h,richText:d,contentsObj:u,creationDate:p,modificationDate:f},container:m,parent:{page:{pageNumber:g}},canvas:v}=t;let w,b;v?(delete t.canvas,({id:w,bitmap:b}=i.imageManager.getFromCanvas(m.id,v)),v.remove()):(s=!0,t._hasNoCanvas=!0);const y=(null===(o=await e._structTree.getAriaAttributes("".concat(Bt).concat(l)))||void 0===o?void 0:o.get("aria-label"))||"";n=t={annotationType:V.STAMP,bitmapId:w,bitmap:b,pageIndex:g-1,rect:r.slice(0),rotation:a,annotationElementId:l,id:l,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:c,popupRef:h,richText:d,comment:(null===u||void 0===u?void 0:u.str)||null,creationDate:p,modificationDate:f}}const r=await super.deserialize(t,e,i),{rect:a,bitmap:l,bitmapUrl:c,bitmapId:h,isSvg:u,accessibilityData:p}=t;s?(i.addMissingCanvas(t.id,r),d(zg,r,!0)):h&&i.imageManager.isValidId(h)?(d(Pg,r,h),l&&d(Rg,r,l)):d(Dg,r,c),d(Bg,r,u);const[f,m]=r.pageDimensions;return r.width=(a[2]-a[0])/f,r.height=(a[3]-a[1])/m,p&&(r.altTextData=p),r._initialData=n,t.comment&&r.setCommentData(t),d(Wg,r,!!n),r}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=Object.assign(super.serialize(t),{bitmapId:h(Pg,this),isSvg:h(Bg,this)});if(this.addComment(i),t)return i.bitmapUrl=l(jg,this,Yg).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:n,altText:s}=this.serializeAltText(!1);if(!n&&s&&(i.accessibilityData={type:"Figure",alt:s}),this.annotationElementId){const t=l(jg,this,Jg).call(this,i);if(t.isSame)return null;var o;if(t.isSameAltText)delete i.accessibilityData;else i.accessibilityData.structParent=null!==(o=this._initialData.structParent)&&void 0!==o?o:-1;return i.id=this.annotationElementId,delete i.bitmapId,i}if(null===e)return i;e.stamps||(e.stamps=new Map);const r=h(Bg,this)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(h(Pg,this))){if(h(Bg,this)){const t=e.stamps.get(h(Pg,this));r>t.area&&(t.area=r,t.serialized.bitmap.close(),t.serialized.bitmap=l(jg,this,Yg).call(this,!1))}}else e.stamps.set(h(Pg,this),{area:r,serialized:i}),i.bitmap=l(jg,this,Yg).call(this,!1);return i}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}function Hg(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?(d(Rg,this,t.bitmap),e||(d(Pg,this,t.id),d(Bg,this,t.isSvg)),t.file&&d(Og,this,t.file.name),l(jg,this,qg).call(this)):this.remove()}function Ug(){if(d(Ig,this,null),this._uiManager.enableWaiting(!1),h(Fg,this))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&h(Rg,this))this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&h(Rg,this)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch(t){}}this.div.focus()}}function Vg(){if(h(Pg,this))return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(h(Pg,this)).then(t=>l(jg,this,Hg).call(this,t,!0)).finally(()=>l(jg,this,Ug).call(this));if(h(Dg,this)){const t=h(Dg,this);return d(Dg,this,null),this._uiManager.enableWaiting(!0),void d(Ig,this,this._uiManager.imageManager.getFromUrl(t).then(t=>l(jg,this,Hg).call(this,t)).finally(()=>l(jg,this,Ug).call(this)))}if(h(Lg,this)){const t=h(Lg,this);return d(Lg,this,null),this._uiManager.enableWaiting(!0),void d(Ig,this,this._uiManager.imageManager.getFromFile(t).then(t=>l(jg,this,Hg).call(this,t)).finally(()=>l(jg,this,Ug).call(this)))}const t=document.createElement("input");t.type="file",t.accept=le.join(",");const e=this._uiManager._signal;d(Ig,this,new Promise(i=>{t.addEventListener("change",async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),l(jg,this,Hg).call(this,e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>l(jg,this,Ug).call(this))),t.click()}function qg(){var t;const{div:e}=this;let{width:i,height:n}=h(Rg,this);const[s,o]=this.pageDimensions,r=.75;if(this.width)i=this.width*s,n=this.height*o;else if(i>r*s||n>r*o){const t=Math.min(r*s/i,r*o/n);i*=t,n*=t}this._uiManager.enableWaiting(!1);const a=d(Fg,this,document.createElement("canvas"));a.setAttribute("role","img"),this.addContainer(a),this.width=i/s,this.height=n/o,this.setDims(),null!==(t=this._initialOptions)&&void 0!==t&&t.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),l(jg,this,Kg).call(this),h(Wg,this)||(this.parent.addUndoableEditor(this),d(Wg,this,!0)),this._reportTelemetry({action:"inserted_image"}),h(Og,this)&&this.div.setAttribute("aria-description",h(Og,this)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}function Xg(t,e){const{width:i,height:n}=h(Rg,this);let s=i,o=n,r=h(Rg,this);for(;s>2*t||o>2*e;){const i=s,n=o;s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),o>2*e&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const a=new OffscreenCanvas(s,o);a.getContext("2d").drawImage(r,0,0,i,n,0,0,s,o),r=a.transferToImageBitmap()}return r}function Kg(){const[t,e]=this.parentDimensions,{width:i,height:n}=this,s=new ae,o=Math.ceil(i*t*s.sx),r=Math.ceil(n*e*s.sy),a=h(Fg,this);if(!a||a.width===o&&a.height===r)return;a.width=o,a.height=r;const c=h(Bg,this)?h(Rg,this):l(jg,this,Xg).call(this,o,r),d=a.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(c,0,0,c.width,c.height,0,0,o,r)}function Yg(t){if(t){if(h(Bg,this)){const t=this._uiManager.imageManager.getSvgUrl(h(Pg,this));if(t)return t}const t=document.createElement("canvas");({width:t.width,height:t.height}=h(Rg,this));return t.getContext("2d").drawImage(h(Rg,this),0,0),t.toDataURL()}if(h(Bg,this)){const[t,e]=this.pageDimensions,i=Math.round(this.width*t*Vt.PDF_TO_CSS_UNITS),n=Math.round(this.height*e*Vt.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,n);return s.getContext("2d").drawImage(h(Rg,this),0,0,h(Rg,this).width,h(Rg,this).height,0,0,i,n),s.transferToImageBitmap()}return structuredClone(h(Rg,this))}function Jg(t){var e;const{pageIndex:i,accessibilityData:{altText:n}}=this._initialData,s=t.pageIndex===i,o=((null===(e=t.accessibilityData)||void 0===e?void 0:e.alt)||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&s&&o,isSameAltText:o}}(0,R.A)(Gg,"_type","stamp"),(0,R.A)(Gg,"_editorType",V.STAMP);var Qg=new WeakMap,Zg=new WeakMap,$g=new WeakMap,tv=new WeakMap,ev=new WeakMap,iv=new WeakMap,nv=new WeakMap,sv=new WeakMap,ov=new WeakMap,rv=new WeakMap,av=new WeakMap,lv=new WeakMap,cv=new WeakMap,hv=new WeakMap,dv=new WeakMap,uv=new WeakMap,pv=new WeakSet;class fv{constructor(t){let{uiManager:e,pageIndex:i,div:n,structTreeLayer:s,accessibilityManager:o,annotationLayer:l,drawLayer:c,textLayer:u,viewport:p,l10n:f}=t;r(this,pv),a(this,Qg,void 0),a(this,Zg,!1),a(this,$g,null),a(this,tv,null),a(this,ev,null),a(this,iv,new Map),a(this,nv,!1),a(this,sv,!1),a(this,ov,!1),a(this,rv,null),a(this,av,null),a(this,lv,null),a(this,cv,null),a(this,hv,null),a(this,dv,-1),a(this,uv,void 0);const m=[...xv._.values()];if(!fv._initialized){fv._initialized=!0;for(const t of m)t.initialize(f,e)}e.registerEditorTypes(m),d(uv,this,e),this.pageIndex=i,this.div=n,d(Qg,this,o),d($g,this,l),this.viewport=p,d(lv,this,u),this.drawLayer=c,this._structTree=s,h(uv,this).addLayer(this)}get isEmpty(){return 0===h(iv,this).size}get isInvisible(){return this.isEmpty&&h(uv,this).getMode()===V.NONE}updateToolbar(t){h(uv,this).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h(uv,this).getMode();switch(l(pv,this,yv).call(this),t){case V.NONE:return this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case V.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case V.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===V.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(const i of xv._.values())e.toggle("".concat(i._type,"Editing"),t===i._editorType)}this.div.hidden=!1}hasTextLayer(t){var e;return t===(null===(e=h(lv,this))||void 0===e?void 0:e.div)}setEditingState(t){h(uv,this).setEditingState(t)}addCommands(t){h(uv,this).addCommands(t)}cleanUndoStack(t){h(uv,this).cleanUndoStack(t)}toggleDrawing(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("drawing",!t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(t=h($g,this))||void 0===t||t.div.classList.toggle("disabled",!e)}async enable(){var t;d(ov,this,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),null===(t=h(hv,this))||void 0===t||t.abort(),d(hv,this,null);const e=new Set;for(const n of c(pv,this,mv))n.enableEditing(),n.show(!0),n.annotationElementId&&(h(uv,this).removeChangedExistingAnnotation(n),e.add(n.annotationElementId));const i=h($g,this);if(i)for(const n of i.getEditableAnnotations()){if(n.hide(),h(uv,this).isDeletedAnnotationElement(n.data.id))continue;if(e.has(n.data.id))continue;const t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}d(ov,this,!1),h(uv,this)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(d(sv,this,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),h(lv,this)&&!h(hv,this)){d(hv,this,new AbortController);const t=h(uv,this).combinedSignal(h(hv,this));h(lv,this).div.addEventListener("pointerdown",t=>{const{clientX:e,clientY:i,timeStamp:n}=t;if(n-h(dv,this)>500)return void d(dv,this,n);d(dv,this,-1);const{classList:s}=this.div;s.toggle("getElements",!0);const o=document.elementsFromPoint(e,i);if(s.toggle("getElements",!1),!this.div.contains(o[0]))return;let r;const a=new RegExp("^".concat(U,"[0-9]+$"));for(const c of o)if(a.test(c.id)){r=c.id;break}if(!r)return;const l=h(iv,this).get(r);null===(null===l||void 0===l?void 0:l.annotationElementId)&&(t.stopPropagation(),t.preventDefault(),l.dblclick(t))},{signal:t,capture:!0})}const t=h($g,this);if(t){const i=new Map,n=new Map;for(const o of c(pv,this,mv)){var e;o.disableEditing(),o.annotationElementId?null===o.serialize()?(n.set(o.annotationElementId,o),null===(e=this.getEditableAnnotation(o.annotationElementId))||void 0===e||e.show(),o.remove()):i.set(o.annotationElementId,o):o.updateFakeAnnotationElement(t)}const s=t.getEditableAnnotations();for(const t of s){const{id:e}=t.data;if(h(uv,this).isDeletedAnnotationElement(e)){t.updateEdited({deleted:!0});continue}let s=n.get(e);s?(s.resetAnnotationElement(t),s.show(!1),t.show()):(s=i.get(e),s&&(h(uv,this).addChangedExistingAnnotation(s),s.renderAnnotationElement(t)&&s.show(!1)),t.show())}}l(pv,this,yv).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:i}=this.div;for(const n of xv._.values())i.remove("".concat(n._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),d(sv,this,!1)}getEditableAnnotation(t){var e;return(null===(e=h($g,this))||void 0===e?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){h(uv,this).getActive()!==t&&h(uv,this).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,null!==(t=h(lv,this))&&void 0!==t&&t.div&&!h(cv,this)){d(cv,this,new AbortController);const t=h(uv,this).combinedSignal(h(cv,this));h(lv,this).div.addEventListener("pointerdown",l(pv,this,gv).bind(this),{signal:t}),h(lv,this).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,null!==(t=h(lv,this))&&void 0!==t&&t.div&&h(cv,this)&&(h(cv,this).abort(),d(cv,this,null),h(lv,this).div.classList.remove("highlighting"))}enableClick(){if(h(tv,this))return;d(tv,this,new AbortController);const t=h(uv,this).combinedSignal(h(tv,this));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;null===(t=h(tv,this))||void 0===t||t.abort(),d(tv,this,null)}attach(t){h(iv,this).set(t.id,t);const{annotationElementId:e}=t;e&&h(uv,this).isDeletedAnnotationElement(e)&&h(uv,this).removeDeletedAnnotationElement(t)}detach(t){var e;h(iv,this).delete(t.id),null===(e=h(Qg,this))||void 0===e||e.removePointerInTextLayer(t.contentDiv),!h(sv,this)&&t.annotationElementId&&h(uv,this).addDeletedAnnotationElement(t)}remove(t){this.detach(t),h(uv,this).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(h(uv,this).addDeletedAnnotationElement(t.annotationElementId),Hs.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),null===(e=t.parent)||void 0===e||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),h(uv,this).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!h(ov,this)),h(uv,this).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var e;if(!t.isAttachedToDOM)return;const{activeElement:i}=document;t.div.contains(i)&&!h(ev,this)&&(t._focusEventsAllowed=!1,d(ev,this,setTimeout(()=>{d(ev,this,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:h(uv,this)._signal}),i.focus())},0))),t._structTreeParentId=null===(e=h(Qg,this))||void 0===e?void 0:e.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getEditorByUID(t){for(const e of h(iv,this).values())if(e.uid===t)return e;return null}getNextId(){return h(uv,this).getId()}combinedSignal(t){return h(uv,this).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return null===(t=c(pv,this,vv))||void 0===t?void 0:t.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await h(uv,this).updateMode(t.mode);const{offsetX:i,offsetY:n}=l(pv,this,bv).call(this),o=this.getNextId(),r=l(pv,this,wv).call(this,(0,s.A)({parent:this,id:o,x:i,y:n,uiManager:h(uv,this),isCentered:!0},e));r&&this.add(r)}async deserialize(t){var e,i;return await(null===(e=xv._.get(null!==(i=t.annotationType)&&void 0!==i?i:t.annotationEditorType))||void 0===e?void 0:e.deserialize(t,this,h(uv,this)))||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getNextId(),o=l(pv,this,wv).call(this,(0,s.A)({parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:h(uv,this),isCentered:e},i));return o&&this.add(o),o}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.createAndAddNewEditor(l(pv,this,bv).call(this),!0,t)}setSelected(t){h(uv,this).setSelected(t)}toggleSelected(t){h(uv,this).toggleSelected(t)}unselect(t){h(uv,this).unselect(t)}pointerup(t){var e;const{isMac:i}=Pt.platform;if(0!==t.button||t.ctrlKey&&i)return;if(t.target!==this.div)return;if(!h(nv,this))return;if(d(nv,this,!1),null!==(e=c(pv,this,vv))&&void 0!==e&&e.isDrawer&&c(pv,this,vv).supportMultipleDrawings)return;if(!h(Zg,this))return void d(Zg,this,!0);const n=h(uv,this).getMode();n!==V.STAMP&&n!==V.SIGNATURE?this.createAndAddNewEditor(t,!1):h(uv,this).unselectAll()}pointerdown(t){var e;if(h(uv,this).getMode()===V.HIGHLIGHT&&this.enableTextSelection(),h(nv,this))return void d(nv,this,!1);const{isMac:i}=Pt.platform;if(0!==t.button||t.ctrlKey&&i)return;if(t.target!==this.div)return;if(d(nv,this,!0),null!==(e=c(pv,this,vv))&&void 0!==e&&e.isDrawer)return void this.startDrawingSession(t);const n=h(uv,this).getActive();d(Zg,this,!n||n.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),h(rv,this))return void c(pv,this,vv).startDrawing(this,h(uv,this),!1,t);h(uv,this).setCurrentDrawingSession(this),d(rv,this,new AbortController);const e=h(uv,this).combinedSignal(h(rv,this));this.div.addEventListener("blur",t=>{let{relatedTarget:e}=t;e&&!this.div.contains(e)&&(d(av,this,null),this.commitOrRemove())},{signal:e}),c(pv,this,vv).startDrawing(this,h(uv,this),!1,t)}pause(t){if(t){const{activeElement:t}=document;return void(this.div.contains(t)&&d(av,this,t))}h(av,this)&&setTimeout(()=>{var t;null===(t=h(av,this))||void 0===t||t.focus(),d(av,this,null)},0)}endDrawingSession(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return h(rv,this)?(h(uv,this).setCurrentDrawingSession(null),h(rv,this).abort(),d(rv,this,null),d(av,this,null),c(pv,this,vv).endDrawing(t)):null}findNewParent(t,e,i){const n=h(uv,this).findParent(e,i);return null!==n&&n!==this&&(n.changeParent(t),!0)}commitOrRemove(){return!!h(rv,this)&&(this.endDrawingSession(),!0)}onScaleChanging(){h(rv,this)&&c(pv,this,vv).onScaleChangingWhenDrawing(this)}destroy(){var t;this.commitOrRemove(),(null===(t=h(uv,this).getActive())||void 0===t?void 0:t.parent)===this&&(h(uv,this).commitOrRemove(),h(uv,this).setActiveEditor(null)),h(ev,this)&&(clearTimeout(h(ev,this)),d(ev,this,null));for(const i of h(iv,this).values()){var e;null===(e=h(Qg,this))||void 0===e||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove()}this.div=null,h(iv,this).clear(),h(uv,this).removeLayer(this)}render(t){let{viewport:e}=t;this.viewport=e,re(this.div,e);for(const i of h(uv,this).getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update(t){let{viewport:e}=t;h(uv,this).commitOrRemove(),l(pv,this,yv).call(this);const i=this.viewport.rotation,n=e.rotation;if(this.viewport=e,re(this.div,{rotation:n}),i!==n)for(const s of h(iv,this).values())s.rotate(n)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return h(uv,this).viewParameters.realScale}}function mv(t){return 0!==h(iv,t).size?h(iv,t).values():h(uv,t).getEditors(t.pageIndex)}function gv(t){h(uv,this).unselectAll();const{target:e}=t;if(e===h(lv,this).div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&h(lv,this).div.contains(e)){const{isMac:e}=Pt.platform;if(0!==t.button||t.ctrlKey&&e)return;h(uv,this).showAllEditors("highlight",!0,!0),h(lv,this).div.classList.add("free"),this.toggleDrawing(),Vf.startHighlighting(this,"ltr"===h(uv,this).direction,{target:h(lv,this).div,x:t.x,y:t.y}),h(lv,this).div.addEventListener("pointerup",()=>{h(lv,this).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:h(uv,this)._signal}),t.preventDefault()}}function vv(t){return xv._.get(h(uv,t).getMode())}function wv(t){const e=c(pv,this,vv);return e?new e.prototype.constructor(t):null}function bv(){const{x:t,y:e,width:i,height:n}=this.boundingClientRect,s=Math.max(0,t),o=Math.max(0,e),r=(s+Math.min(window.innerWidth,t+i))/2-t,a=(o+Math.min(window.innerHeight,e+n))/2-e,[l,c]=this.viewport.rotation%180===0?[r,a]:[a,r];return{offsetX:l,offsetY:c}}function yv(){for(const t of h(iv,this).values())t.isEmpty()&&t.remove()}(0,R.A)(fv,"_initialized",!1);var xv={_:new Map([vp,rg,Gg,Vf,Tg].map(t=>[t._editorType,t]))},_v=new WeakMap,Av=new WeakMap,Sv=new WeakMap,Cv=new WeakSet;class kv{constructor(t){let{pageIndex:e}=t;r(this,Cv),a(this,_v,null),a(this,Av,new Map),a(this,Sv,new Map),this.pageIndex=e}setParent(t){if(h(_v,this)){if(h(_v,this)!==t){if(h(Av,this).size>0)for(const e of h(Av,this).values())e.remove(),t.append(e);d(_v,this,t)}}else d(_v,this,t)}static get _svgFactory(){return xt(this,"_svgFactory",new gd)}draw(t){var e,i;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=(Pv._=(e=Pv._,i=e++,e),i),r=l(Cv,this,Ev).call(this),a=kv._svgFactory.createElement("defs");r.append(a);const c=kv._svgFactory.createElement("path");a.append(c);const d="path_p".concat(this.pageIndex,"_").concat(o);c.setAttribute("id",d),c.setAttribute("vector-effect","non-scaling-stroke"),n&&h(Sv,this).set(o,c);const u=s?l(Cv,this,Tv).call(this,a,d):null,p=kv._svgFactory.createElement("use");return r.append(p),p.setAttribute("href","#".concat(d)),this.updateProperties(r,t),h(Av,this).set(o,r),{id:o,clipPathId:"url(#".concat(u,")")}}drawOutline(t,e){var i,n;const s=(Pv._=(i=Pv._,n=i++,i),n),o=l(Cv,this,Ev).call(this),r=kv._svgFactory.createElement("defs");o.append(r);const a=kv._svgFactory.createElement("path");r.append(a);const c="path_p".concat(this.pageIndex,"_").concat(s);let d;if(a.setAttribute("id",c),a.setAttribute("vector-effect","non-scaling-stroke"),e){const t=kv._svgFactory.createElement("mask");r.append(t),d="mask_p".concat(this.pageIndex,"_").concat(s),t.setAttribute("id",d),t.setAttribute("maskUnits","objectBoundingBox");const e=kv._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");const i=kv._svgFactory.createElement("use");t.append(i),i.setAttribute("href","#".concat(c)),i.setAttribute("stroke","none"),i.setAttribute("fill","black"),i.setAttribute("fill-rule","nonzero"),i.classList.add("mask")}const u=kv._svgFactory.createElement("use");o.append(u),u.setAttribute("href","#".concat(c)),d&&u.setAttribute("mask","url(#".concat(d,")"));const p=u.cloneNode();return o.append(p),u.classList.add("mainOutline"),p.classList.add("secondaryOutline"),this.updateProperties(o,t),h(Av,this).set(s,o),s}finalizeDraw(t,e){h(Sv,this).delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;const{root:i,bbox:n,rootClass:s,path:o}=e,r="number"===typeof t?h(Av,this).get(t):t;if(r){if(i&&l(Cv,this,Rv).call(this,r,i),n&&Mv.call(kv,r,n),s){const{classList:t}=r;for(const[e,i]of Object.entries(s))t.toggle(e,i)}if(o){const t=r.firstChild.firstChild;l(Cv,this,Rv).call(this,t,o)}}}updateParent(t,e){if(e===this)return;const i=h(Av,this).get(t);i&&(h(_v,e).append(i),h(Av,this).delete(t),h(Av,e).set(t,i))}remove(t){h(Sv,this).delete(t),null!==h(_v,this)&&(h(Av,this).get(t).remove(),h(Av,this).delete(t))}destroy(){d(_v,this,null);for(const t of h(Av,this).values())t.remove();h(Av,this).clear(),h(Sv,this).clear()}}function Mv(t,e){let[i,n,s,o]=e;const{style:r}=t;r.top="".concat(100*n,"%"),r.left="".concat(100*i,"%"),r.width="".concat(100*s,"%"),r.height="".concat(100*o,"%")}function Ev(){const t=T._svgFactory.create(1,1,!0);return h(_v,this).append(t),t.setAttribute("aria-hidden",!0),t}function Tv(t,e){const i=T._svgFactory.createElement("clipPath");t.append(i);const n="clip_".concat(e);i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");const s=T._svgFactory.createElement("use");return i.append(s),s.setAttribute("href","#".concat(e)),s.classList.add("clip"),n}function Rv(t,e){for(const[i,n]of Object.entries(e))null===n?t.removeAttribute(i):t.setAttribute(i,n)}T=kv;var Pv={_:0};globalThis._pdfjsTestingUtils={HighlightOutliner:mf},globalThis.pdfjsLib={AbortException:Et,AnnotationEditorLayer:fv,AnnotationEditorParamsType:q,AnnotationEditorType:V,AnnotationEditorUIManager:tn,AnnotationLayer:lp,AnnotationMode:H,AnnotationType:tt,applyOpacity:function(t,e,i,n){const s=255*(1-(n=Math.min(Math.max(null!==n&&void 0!==n?n:1,0),1)));return[t=Math.round(t*n+s),e=Math.round(e*n+s),i=Math.round(i*n+s)]},build:"f56dc8601",ColorPicker:$h,createValidAbsoluteUrl:bt,CSSConstants:class{static get commentForegroundColor(){const t=document.createElement("span");t.classList.add("comment","sidebar");const{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);const{color:i}=window.getComputedStyle(t);return t.remove(),xt(this,"commentForegroundColor",ne(i))}},DOMSVGFactory:gd,DrawLayer:kv,FeatureTest:Pt,fetchData:qt,findContrastColor:function(t,e){const i=t[0]+256*t[1]+65536*t[2]+16777216*e[0]+4294967296*e[1]+1099511627776*e[2];let n=fe.get(i);if(n)return n;const s=new Float32Array(9),o=s.subarray(0,3),r=s.subarray(3,6);he(t,r);const a=s.subarray(6,9);he(e,a);const l=a[2]<.5,c=l?12:4.5;if(r[2]=l?Math.sqrt(r[2]):1-Math.sqrt(1-r[2]),pe(r,a,o)i;){const i=r[2]=(t+e)/2;l===pe(r,a,o)1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!==typeof t)return e;if(Yt(t))return gt('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=(t=>{try{return new URL(t)}catch(e){try{return new URL(decodeURIComponent(t))}catch(i){try{return new URL(t,"https://foo.bar")}catch(n){try{return new URL(decodeURIComponent(t),"https://foo.bar")}catch(s){return null}}}}})(t);if(!i)return e;const n=t=>{try{let e=decodeURIComponent(t);return e.includes("/")?(e=e.split("/").at(-1),e.test(/^\.pdf$/i)?e:t):e}catch(e){return t}},s=/\.pdf$/i,o=i.pathname.split("/").at(-1);if(s.test(o))return n(o);if(i.searchParams.size>0){const t=Array.from(i.searchParams.values()).reverse();for(const i of t)if(s.test(i))return n(i);const e=Array.from(i.searchParams.keys()).reverse();for(const i of e)if(s.test(i))return n(i)}if(i.hash){const t=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(t)return n(t[0])}return e},getRGB:ne,getUuid:Nt,getXfaPageViewport:function(t,e){let{scale:i=1,rotation:n=0}=e;const{width:s,height:o}=t.attributes.style,r=[0,0,parseInt(s),parseInt(o)];return new Xt({viewBox:r,userUnit:1,scale:i,rotation:n})},GlobalWorkerOptions:Pl,ImageKind:$,InvalidPDFException:Ct,isDataScheme:Yt,isPdfFile:Jt,isValidExplicitDest:Po,MathClamp:Wt,noContextMenu:$t,normalizeUnicode:function(t){return Ft||(Ft=/([\xA0\xB5\u037E\u0EB3\u2000-\u200A\u202F\u2126\uFB00-\uFB04\uFB06\uFB20-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBA1\uFBA4-\uFBA9\uFBAE-\uFBB1\uFBD3-\uFBDC\uFBDE-\uFBE7\uFBEA-\uFBF8\uFBFC\uFBFD\uFC00-\uFC5D\uFC64-\uFCF1\uFCF5-\uFD3D\uFD88\uFDF4\uFDFA\uFDFB\uFE71\uFE77\uFE79\uFE7B\uFE7D]+)|(\uFB05+)/g,zt=new Map([["\ufb05","\u017ft"]])),t.replaceAll(Ft,(t,e,i)=>e?e.normalize("NFKC"):zt.get(i))},OPS:at,OutputScale:ae,PasswordResponses:{NEED_PASSWORD:1,INCORRECT_PASSWORD:2},PDFDataRangeTransport:ch,PDFDateString:ee,PDFWorker:yh,PermissionFlag:{PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},PixelsPerInch:Vt,RenderingCancelledException:Kt,renderRichText:me,ResponseException:kt,setLayerDimensions:re,shadow:xt,SignatureExtractor:cg,stopEvent:te,SupportedImageMimeTypes:le,TextLayer:Gc,TouchManager:us,updateUrlHash:yt,Util:Dt,VerbosityLevel:rt,version:"5.4.296",XfaLayer:Ht}},38342:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var n=i(44414);function s(t){let{children:e,type:i}=t;return(0,n.jsx)("div",{className:"react-pdf__message react-pdf__message--".concat(i),children:e})}},49910:(t,e,i)=>{"use strict";i.d(e,{A:()=>F});var n=i(80045),s=i(89379),o=i(44414),r=i(9950),a=i(72004),l=i(58386),c=i(8661);function h(){for(var t=[],e=0;e in a or pass explicit `pdf` prop."),(0,d.A)(x,"Attempted to load page annotations, but no page was specified."),(0,d.A)(c,"Attempted to load page annotations, but no linkService was specified.");const[k,M]=(0,b.A)(),{value:E,error:T}=k,R=(0,r.useRef)(null);u(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),(0,r.useEffect)(function(){M({type:"RESET"})},[M,x]),(0,r.useEffect)(function(){if(!x)return;const t=(0,l.A)(x.getAnnotations()),e=t;return t.promise.then(t=>{M({type:"RESOLVE",value:t})}).catch(t=>{M({type:"REJECT",error:t})}),()=>{(0,y.xL)(e)}},[M,x]),(0,r.useEffect)(()=>{void 0!==E&&(!1!==E?E&&p&&p(E):T&&(u(!1,T.toString()),h&&h(T)))},[E]);const P=(0,r.useMemo)(()=>x.getViewport({scale:C,rotation:S}),[x,S,C]);return(0,r.useEffect)(function(){if(!_||!x||!c||!E)return;const{current:t}=R;if(!t)return;const e=P.clone({dontFlip:!0}),i={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:_.annotationStorage,commentManager:null,div:t,l10n:null,linkService:c,page:x,structTreeLayer:null,viewport:e},s={annotations:E,annotationStorage:_.annotationStorage,div:t,imageResourcesPath:n,linkService:c,page:x,renderForms:A,viewport:e};t.innerHTML="";try{new f.dU(i).render(s),v&&v()}catch(o){!function(t){u(!1,"".concat(t)),m&&m(t)}(o)}return()=>{}},[E,n,c,x,_,A,P]),(0,o.jsx)("div",{className:(0,a.A)("react-pdf__Page__annotations","annotationLayer"),ref:R})}const _={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},A=/^H(\d+)$/;function S(t){return"children"in t}function C(t){return!!S(t)&&(1===t.children.length&&0 in t.children&&"id"in t.children[0])}function k(t){const e={};if(S(t)){const{role:i}=t,n=i.match(A);if(n)e.role="heading",e["aria-level"]=Number(n[1]);else if(function(t){return t in _}(i)){const t=_[i];t&&(e.role=t)}}return e}function M(t){const e={};if(S(t)){if(void 0!==t.alt&&(e["aria-label"]=t.alt),void 0!==t.lang&&(e.lang=t.lang),C(t)){const[i]=t.children;if(i){const t=M(i);return(0,s.A)((0,s.A)({},e),t)}}}else"id"in t&&(e["aria-owns"]=t.id);return e}function E(t){return t?(0,s.A)((0,s.A)({},k(t)),M(t)):null}function T(t){let{className:e,node:i}=t;const n=(0,r.useMemo)(()=>E(i),[i]),a=(0,r.useMemo)(()=>S(i)?C(i)?null:i.children.map((t,e)=>(0,o.jsx)(T,{node:t},e)):null,[i]);return(0,o.jsx)("span",(0,s.A)((0,s.A)({className:e},n),{},{children:a}))}function R(){const t=w();(0,d.A)(t,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:i}=t,[n,s]=(0,b.A)(),{value:a,error:c}=n,{customTextRenderer:h,page:p}=t;return(0,r.useEffect)(function(){s({type:"RESET"})},[s,p]),(0,r.useEffect)(function(){if(h)return;if(!p)return;const t=(0,l.A)(p.getStructTree()),e=t;return t.promise.then(t=>{s({type:"RESOLVE",value:t})}).catch(t=>{s({type:"REJECT",error:t})}),()=>(0,y.xL)(e)},[h,p,s]),(0,r.useEffect)(()=>{void 0!==a&&(!1!==a?a&&i&&i(a):c&&(u(!1,c.toString()),e&&e(c)))},[a]),a?(0,o.jsx)(T,{className:"react-pdf__Page__structTree structTree",node:a}):null}const P=f.ng;function I(t){const e=w();(0,d.A)(e,"Unable to find Page context.");const i=(0,s.A)((0,s.A)({},e),t),{_className:n,canvasBackground:a,devicePixelRatio:l=(0,y.mZ)(),onRenderError:c,onRenderSuccess:p,page:f,renderForms:m,renderTextLayer:g,rotate:v,scale:b}=i,{canvasRef:x}=t;(0,d.A)(f,"Attempted to render page canvas, but no page was specified.");const _=(0,r.useRef)(null);function A(t){(0,y.UT)(t)||(u(!1,t.toString()),c&&c(t))}const S=(0,r.useMemo)(()=>f.getViewport({scale:b*l,rotation:v}),[l,f,v,b]),C=(0,r.useMemo)(()=>f.getViewport({scale:b,rotation:v}),[f,v,b]);(0,r.useEffect)(function(){if(!f)return;f.cleanup();const{current:t}=_;if(!t)return;t.width=S.width,t.height=S.height,t.style.width="".concat(Math.floor(C.width),"px"),t.style.height="".concat(Math.floor(C.height),"px"),t.style.visibility="hidden";const e={annotationMode:m?P.ENABLE_FORMS:P.ENABLE,canvas:t,canvasContext:t.getContext("2d",{alpha:!1}),viewport:S};a&&(e.background=a);const i=f.render(e),n=i;return i.promise.then(()=>{t.style.visibility="",f&&p&&p((0,y.vS)(f,b))}).catch(A),()=>(0,y.xL)(n)},[a,f,m,S,C]);const k=(0,r.useCallback)(()=>{const{current:t}=_;t&&(t.width=0,t.height=0)},[]);return(0,r.useEffect)(()=>k,[k]),(0,o.jsx)("canvas",{className:"".concat(n,"__canvas"),dir:"ltr",ref:h(x,_),style:{display:"block",userSelect:"none"},children:g?(0,o.jsx)(R,{}):null})}function D(){const t=w();(0,d.A)(t,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:i,onGetTextSuccess:n,onRenderTextLayerError:c,onRenderTextLayerSuccess:h,page:p,pageIndex:m,pageNumber:g,rotate:v,scale:x}=t;(0,d.A)(p,"Attempted to load page text content, but no page was specified.");const[_,A]=(0,b.A)(),{value:S,error:C}=_,k=(0,r.useRef)(null);u(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),(0,r.useEffect)(function(){A({type:"RESET"})},[p,A]),(0,r.useEffect)(function(){if(!p)return;const t=(0,l.A)(p.getTextContent()),e=t;return t.promise.then(t=>{A({type:"RESOLVE",value:t})}).catch(t=>{A({type:"REJECT",error:t})}),()=>(0,y.xL)(e)},[p,A]),(0,r.useEffect)(()=>{void 0!==S&&(!1!==S?S&&n&&n(S):C&&(u(!1,C.toString()),i&&i(C)))},[S]);const M=(0,r.useCallback)(()=>{h&&h()},[h]),E=(0,r.useCallback)(t=>{u(!1,t.toString()),c&&c(t)},[c]);const T=(0,r.useMemo)(()=>p.getViewport({scale:x,rotation:v}),[p,v,x]);return(0,r.useLayoutEffect)(function(){if(!p||!S)return;const{current:t}=k;if(!t)return;t.innerHTML="";const i=p.streamTextContent({includeMarkedContent:!0}),n={container:t,textContentSource:i,viewport:T},o=new f.D6(n),r=o;return o.render().then(()=>{const i=document.createElement("div");i.className="endOfContent",t.append(i);const n=t.querySelectorAll('[role="presentation"]');if(e){let t=0;S.items.forEach((i,o)=>{if(!function(t){return"str"in t}(i))return;const r=n[t];if(!r)return;const a=e((0,s.A)({pageIndex:m,pageNumber:g,itemIndex:o},i));r.innerHTML=a,t+=i.str&&i.hasEOL?2:1})}M()}).catch(E),()=>(0,y.xL)(r)},[e,E,M,p,m,g,S,T]),(0,o.jsx)("div",{className:(0,a.A)("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const t=k.current;t&&t.classList.remove("selecting")},onMouseDown:function(){const t=k.current;t&&t.classList.add("selecting")},ref:k})}const L=["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"],O=1;function F(t){const e=g(),i=(0,s.A)((0,s.A)({},e),t),{_className:f="react-pdf__Page",_enableRegisterUnregisterPage:m=!0,canvasBackground:w,canvasRef:_,children:A,className:S,customRenderer:C,customTextRenderer:k,devicePixelRatio:M,error:E="Failed to load the page.",height:T,inputRef:R,loading:P="Loading page\u2026",noData:F="No page specified.",onGetAnnotationsError:z,onGetAnnotationsSuccess:N,onGetStructTreeError:B,onGetStructTreeSuccess:W,onGetTextError:j,onGetTextSuccess:G,onLoadError:H,onLoadSuccess:U,onRenderAnnotationLayerError:V,onRenderAnnotationLayerSuccess:q,onRenderError:X,onRenderSuccess:K,onRenderTextLayerError:Y,onRenderTextLayerSuccess:J,pageIndex:Q,pageNumber:Z,pdf:$,registerPage:tt,renderAnnotationLayer:et=!0,renderForms:it=!1,renderMode:nt="canvas",renderTextLayer:st=!0,rotate:ot,scale:rt=O,unregisterPage:at,width:lt}=i,ct=(0,n.A)(i,L),[ht,dt]=(0,b.A)(),{value:ut,error:pt}=ht,ft=(0,r.useRef)(null);(0,d.A)($,"Attempted to load a page, but no document was specified. Wrap in a or pass explicit `pdf` prop.");const mt=(0,y.ci)(Z)?Z-1:null!==Q&&void 0!==Q?Q:null,gt=null!==Z&&void 0!==Z?Z:(0,y.ci)(Q)?Q+1:null,vt=null!==ot&&void 0!==ot?ot:ut?ut.rotate:null,wt=(0,r.useMemo)(()=>{if(!ut)return null;let t=1;const e=null!==rt&&void 0!==rt?rt:O;if(lt||T){const e=ut.getViewport({scale:1,rotation:vt});lt?t=lt/e.width:T&&(t=T/e.height)}return e*t},[T,ut,vt,rt,lt]);(0,r.useEffect)(function(){return()=>{(0,y.ci)(mt)&&m&&at&&at(mt)}},[m,$,mt,at]),(0,r.useEffect)(function(){dt({type:"RESET"})},[dt,$,mt]),(0,r.useEffect)(function(){if(!$||!gt)return;const t=(0,l.A)($.getPage(gt)),e=t;return t.promise.then(t=>{dt({type:"RESOLVE",value:t})}).catch(t=>{dt({type:"REJECT",error:t})}),()=>(0,y.xL)(e)},[dt,$,gt]),(0,r.useEffect)(()=>{void 0!==ut&&(!1!==ut?function(){if(U){if(!ut||!wt)return;U((0,y.vS)(ut,wt))}if(m&&tt){if(!(0,y.ci)(mt)||!ft.current)return;tt(mt,ft.current)}}():pt&&(u(!1,pt.toString()),H&&H(pt)))},[ut,wt]);const bt=(0,r.useMemo)(()=>(0,y.ci)(mt)&>&&(0,y.ci)(vt)&&(0,y.ci)(wt)?{_className:f,canvasBackground:w,customTextRenderer:k,devicePixelRatio:M,onGetAnnotationsError:z,onGetAnnotationsSuccess:N,onGetStructTreeError:B,onGetStructTreeSuccess:W,onGetTextError:j,onGetTextSuccess:G,onRenderAnnotationLayerError:V,onRenderAnnotationLayerSuccess:q,onRenderError:X,onRenderSuccess:K,onRenderTextLayerError:Y,onRenderTextLayerSuccess:J,page:ut,pageIndex:mt,pageNumber:gt,renderForms:it,renderTextLayer:st,rotate:vt,scale:wt}:null,[f,w,k,M,z,N,B,W,j,G,V,q,X,K,Y,J,ut,mt,gt,it,st,vt,wt]),yt=(0,r.useMemo)(()=>(0,c.Ay)(ct,()=>ut?wt?(0,y.vS)(ut,wt):void 0:ut),[ct,ut,wt]),xt="".concat(mt,"@").concat(wt,"/").concat(vt);function _t(){switch(nt){case"custom":return(0,d.A)(C,'renderMode was set to "custom", but no customRenderer was passed.'),(0,o.jsx)(C,{},"".concat(xt,"_custom"));case"none":return null;default:return(0,o.jsx)(I,{canvasRef:_},"".concat(xt,"_canvas"))}}return(0,o.jsx)("div",(0,s.A)((0,s.A)({className:(0,a.A)(f,S),"data-page-number":gt,ref:h(R,ft),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":"".concat(wt),"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:w||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},yt),{},{children:gt?null===$||void 0===ut||null===ut?(0,o.jsx)(p.A,{type:"loading",children:"function"===typeof P?P():P}):!1===$||!1===ut?(0,o.jsx)(p.A,{type:"error",children:"function"===typeof E?E():E}):function(){if(t=bt,!Boolean(null===t||void 0===t?void 0:t.page))throw new Error("page is undefined");var t;const e="function"===typeof A?A(bt):A;return(0,o.jsxs)(v.Provider,{value:bt,children:[_t(),st?(0,o.jsx)(D,{},"".concat(xt,"_text")):null,et?(0,o.jsx)(x,{},"".concat(xt,"_annotations")):null,e]})}():(0,o.jsx)(p.A,{type:"no-data",children:"function"===typeof F?F():F})}))}},54823:(t,e,i)=>{"use strict";i.d(e,{A:()=>M});var n=i(89379),s=i(80045),o=i(44414),r=i(9950),a=i(72004),l=Object.prototype.hasOwnProperty;function c(t,e,i){for(i of t.keys())if(h(i,e))return i}function h(t,e){var i,n,s;if(t===e)return!0;if(t&&e&&(i=t.constructor)===e.constructor){if(i===Date)return t.getTime()===e.getTime();if(i===RegExp)return t.toString()===e.toString();if(i===Array){if((n=t.length)===e.length)for(;n--&&h(t[n],e[n]););return-1===n}if(i===Set){if(t.size!==e.size)return!1;for(n of t){if((s=n)&&"object"===typeof s&&!(s=c(e,s)))return!1;if(!e.has(s))return!1}return!0}if(i===Map){if(t.size!==e.size)return!1;for(n of t){if((s=n[0])&&"object"===typeof s&&!(s=c(e,s)))return!1;if(!h(n[1],e.get(s)))return!1}return!0}if(i===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(i===DataView){if((n=t.byteLength)===e.byteLength)for(;n--&&t.getInt8(n)===e.getInt8(n););return-1===n}if(ArrayBuffer.isView(t)){if((n=t.byteLength)===e.byteLength)for(;n--&&t[n]===e[n];);return-1===n}if(!i||"object"===typeof t){for(i in n=0,t){if(l.call(t,i)&&++n&&!l.call(e,i))return!1;if(!(i in e)||!h(t[i],e[i]))return!1}return Object.keys(e).length===n}}return t!==t&&e!==e}var d=i(58386),u=i(8661),p=i(32878),f=i(67033),m=i(2241),g=i(76325);class v{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return(0,f.A)(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){(0,f.A)(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}addLinkAttributes(t,e,i){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=i?"_blank":this.externalLinkTarget||""}goToDestination(t){return new Promise(e=>{(0,f.A)(this.pdfDocument,"PDF document not loaded."),(0,f.A)(t,"Destination is not specified."),"string"===typeof t?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(t=>{(0,f.A)(Array.isArray(t),'"'.concat(t,'" is not a valid destination array.'));const e=t[0];new Promise(t=>{(0,f.A)(this.pdfDocument,"PDF document not loaded."),e instanceof Object?this.pdfDocument.getPageIndex(e).then(e=>{t(e)}).catch(()=>{(0,f.A)(!1,'"'.concat(e,'" is not a valid page reference.'))}):"number"===typeof e?t(e):(0,f.A)(!1,'"'.concat(e,'" is not a valid destination reference.'))}).then(e=>{const i=e+1;(0,f.A)(this.pdfViewer,"PDF viewer is not initialized."),(0,f.A)(i>=1&&i<=this.pagesCount,'"'.concat(i,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:e,pageNumber:i})})})}goToPage(t){const e=t-1;(0,f.A)(this.pdfViewer,"PDF viewer is not initialized."),(0,f.A)(t>=1&&t<=this.pagesCount,'"'.concat(t,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(t){this.goToDestination(t)}}var w=i(38342);const b={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};var y=i(28097),x=i(78762);const _=["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate","scale"],A=["url"],{Tm:S}=p,C=(t,e)=>{switch(e){case b.NEED_PASSWORD:t(prompt("Enter the password to open this PDF file."));break;case b.INCORRECT_PASSWORD:t(prompt("Invalid password. Please try again."));break}};function k(t){return"object"===typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}const M=(0,r.forwardRef)(function(t,e){let{children:i,className:l,error:c="Failed to load PDF file.",externalLinkRel:b,externalLinkTarget:M,file:E,inputRef:T,imageResourcesPath:R,loading:P="Loading PDF\u2026",noData:I="No PDF file specified.",onItemClick:D,onLoadError:L,onLoadProgress:O,onLoadSuccess:F,onPassword:z=C,onSourceError:N,onSourceSuccess:B,options:W,renderMode:j,rotate:G,scale:H}=t,U=(0,s.A)(t,_);const[V,q]=(0,y.A)(),{value:X,error:K}=V,[Y,J]=(0,y.A)(),{value:Q,error:Z}=Y,$=(0,r.useRef)(new v),tt=(0,r.useRef)([]),et=(0,r.useRef)(void 0),it=(0,r.useRef)(void 0);E&&E!==et.current&&k(E)&&(m(!h(E,et.current),'File prop passed to changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.'),et.current=E),W&&W!==it.current&&(m(!h(W,it.current),'Options prop passed to changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.'),it.current=W);const nt=(0,r.useRef)({scrollPageIntoView:t=>{const{dest:e,pageNumber:i,pageIndex:n=i-1}=t;if(D)return void D({dest:e,pageIndex:n,pageNumber:i});const s=tt.current[n];s?s.scrollIntoView():m(!1,"An internal link leading to page ".concat(i," was clicked, but neither was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to and handle navigating by yourself or ensure that all pages are rendered within ."))}});(0,r.useImperativeHandle)(e,()=>({linkService:$,pages:tt,viewer:nt}),[]),(0,r.useEffect)(function(){q({type:"RESET"})},[E,q]);const st=(0,r.useCallback)(async()=>{if(!E)return null;if("string"===typeof E){if((0,x.zL)(E)){return{data:(0,x.jA)(E)}}return(0,x.qC)(),{url:E}}if(E instanceof S)return{range:E};if((0,x.mw)(E))return{data:E};if(x.Bd&&(0,x.qf)(E)){return{data:await(0,x.h1)(E)}}if((0,f.A)("object"===typeof E,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),(0,f.A)(k(E),"Invalid parameter object: need either .data, .range or .url"),"url"in E&&"string"===typeof E.url){if((0,x.zL)(E.url)){const{url:t}=E,e=(0,s.A)(E,A),i=(0,x.jA)(t);return(0,n.A)({data:i},e)}(0,x.qC)()}return E},[E]);(0,r.useEffect)(()=>{const t=(0,d.A)(st());return t.promise.then(t=>{q({type:"RESOLVE",value:t})}).catch(t=>{q({type:"REJECT",error:t})}),()=>{(0,x.xL)(t)}},[st,q]),(0,r.useEffect)(()=>{"undefined"!==typeof X&&(!1!==X?B&&B():K&&(m(!1,K.toString()),N&&N(K)))},[X]),(0,r.useEffect)(function(){J({type:"RESET"})},[J,X]),(0,r.useEffect)(function(){if(!X)return;const t=W?(0,n.A)((0,n.A)({},X),W):X,e=p.YE(t);O&&(e.onProgress=O),z&&(e.onPassword=z);const i=e,s=i.promise.then(t=>{J({type:"RESOLVE",value:t})}).catch(t=>{i.destroyed||J({type:"REJECT",error:t})});return()=>{s.finally(()=>i.destroy())}},[W,J,X]),(0,r.useEffect)(()=>{"undefined"!==typeof Q&&(!1!==Q?Q&&(F&&F(Q),tt.current=new Array(Q.numPages),$.current.setDocument(Q)):Z&&(m(!1,Z.toString()),L&&L(Z)))},[Q]),(0,r.useEffect)(function(){$.current.setViewer(nt.current),$.current.setExternalLinkRel(b),$.current.setExternalLinkTarget(M)},[b,M]);const ot=(0,r.useCallback)((t,e)=>{tt.current[t]=e},[]),rt=(0,r.useCallback)(t=>{delete tt.current[t]},[]),at=(0,r.useMemo)(()=>({imageResourcesPath:R,linkService:$.current,onItemClick:D,pdf:Q,registerPage:ot,renderMode:j,rotate:G,scale:H,unregisterPage:rt}),[R,D,Q,ot,j,G,H,rt]),lt=(0,r.useMemo)(()=>(0,u.Ay)(U,()=>Q),[U,Q]);return(0,o.jsx)("div",(0,n.A)((0,n.A)({className:(0,a.A)("react-pdf__Document",l),ref:T},lt),{},{children:E?void 0===Q||null===Q?(0,o.jsx)(w.A,{type:"loading",children:"function"===typeof P?P():P}):!1===Q?(0,o.jsx)(w.A,{type:"error",children:"function"===typeof c?c():c}):function(){if(t=at,!Boolean(null===t||void 0===t?void 0:t.pdf))throw new Error("pdf is undefined");var t;const e="function"===typeof i?i(at):i;return(0,o.jsx)(g.A.Provider,{value:at,children:e})}():(0,o.jsx)(w.A,{type:"no-data",children:"function"===typeof I?I():I})}))})},55044:(t,e,i)=>{"use strict";i.d(e,{VB:()=>ot});var n=i(9950),s=i(11942);function o(t,e,i,n){return new(i||(i=Promise))(function(s,o){function r(t){try{l(n.next(t))}catch(e){o(e)}}function a(t){try{l(n.throw(t))}catch(e){o(e)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,a)}l((n=n.apply(t,e||[])).next())})}Object.create;Object.create;"function"===typeof SuppressedError&&SuppressedError;const r=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function a(t,e,i){const n=function(t){const{name:e}=t;if(e&&-1!==e.lastIndexOf(".")&&!t.type){const i=e.split(".").pop().toLowerCase(),n=r.get(i);n&&Object.defineProperty(t,"type",{value:n,writable:!1,configurable:!1,enumerable:!0})}return t}(t),{webkitRelativePath:s}=t,o="string"===typeof e?e:"string"===typeof s&&s.length>0?s:"./".concat(t.name);return"string"!==typeof n.path&&l(n,"path",o),void 0!==i&&Object.defineProperty(n,"handle",{value:i,writable:!1,configurable:!1,enumerable:!0}),l(n,"relativePath",o),n}function l(t,e,i){Object.defineProperty(t,e,{value:i,writable:!1,configurable:!1,enumerable:!0})}const c=[".DS_Store","Thumbs.db"];function h(t){return"object"===typeof t&&null!==t}function d(t){return t.filter(t=>-1===c.indexOf(t.name))}function u(t){if(null===t)return[];const e=[];for(let i=0;i[...t,...Array.isArray(e)?f(e):[e]],[])}function m(t,e){return o(this,void 0,void 0,function*(){var i;if(globalThis.isSecureContext&&"function"===typeof t.getAsFileSystemHandle){const e=yield t.getAsFileSystemHandle();if(null===e)throw new Error("".concat(t," is not a File"));if(void 0!==e){const t=yield e.getFile();return t.handle=e,a(t)}}const n=t.getAsFile();if(!n)throw new Error("".concat(t," is not a File"));return a(n,null!==(i=null===e||void 0===e?void 0:e.fullPath)&&void 0!==i?i:void 0)})}function g(t){return o(this,void 0,void 0,function*(){return t.isDirectory?v(t):function(t){return o(this,void 0,void 0,function*(){return new Promise((e,i)=>{t.file(i=>{const n=a(i,t.fullPath);e(n)},t=>{i(t)})})})}(t)})}function v(t){const e=t.createReader();return new Promise((t,i)=>{const n=[];!function s(){e.readEntries(e=>o(this,void 0,void 0,function*(){if(e.length){const t=Promise.all(e.map(g));n.push(t),s()}else try{const e=yield Promise.all(n);t(e)}catch(o){i(o)}}),t=>{i(t)})}()})}var w=i(86189);function b(t){return function(t){if(Array.isArray(t))return C(t)}(t)||function(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||S(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function x(t){for(var e=1;et.length)&&(e=t.length);for(var i=0,n=new Array(e);i0&&void 0!==arguments[0]?arguments[0]:"").split(","),e=t.length>1?"one of ".concat(t.join(", ")):t[0];return{code:M,message:"File type must be ".concat(e)}},I=function(t){return{code:E,message:"File is larger than ".concat(t," ").concat(1===t?"byte":"bytes")}},D=function(t){return{code:T,message:"File is smaller than ".concat(t," ").concat(1===t?"byte":"bytes")}},L={code:R,message:"Too many files"};function O(t,e){var i="application/x-moz-file"===t.type||k(t,e);return[i,i?null:P(e)]}function F(t,e,i){if(z(t.size))if(z(e)&&z(i)){if(t.size>i)return[!1,I(i)];if(t.sizei)return[!1,I(i)]}return[!0,null]}function z(t){return void 0!==t&&null!==t}function N(t){return"function"===typeof t.isPropagationStopped?t.isPropagationStopped():"undefined"!==typeof t.cancelBubble&&t.cancelBubble}function B(t){return t.dataTransfer?Array.prototype.some.call(t.dataTransfer.types,function(t){return"Files"===t||"application/x-moz-file"===t}):!!t.target&&!!t.target.files}function W(t){t.preventDefault()}function j(){for(var t=arguments.length,e=new Array(t),i=0;i1?i-1:0),s=1;st.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0||(s[i]=t[i]);return s}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}var it=(0,n.forwardRef)(function(t,e){var i=t.children,s=ot(et(t,U)),o=s.open,r=et(s,V);return(0,n.useImperativeHandle)(e,function(){return{open:o}},[o]),n.createElement(n.Fragment,null,i($($({},r),{},{open:o})))});it.displayName="Dropzone";var nt={disabled:!1,getFilesFromEvent:function(t){return o(this,void 0,void 0,function*(){return h(t)&&h(t.dataTransfer)?function(t,e){return o(this,void 0,void 0,function*(){if(t.items){const i=u(t.items).filter(t=>"file"===t.kind);if("drop"!==e)return i;return d(f(yield Promise.all(i.map(p))))}return d(u(t.files).map(t=>a(t)))})}(t.dataTransfer,t.type):function(t){return h(t)&&h(t.target)}(t)?function(t){return u(t.target.files).map(t=>a(t))}(t):Array.isArray(t)&&t.every(t=>"getFile"in t&&"function"===typeof t.getFile)?function(t){return o(this,void 0,void 0,function*(){return(yield Promise.all(t.map(t=>t.getFile()))).map(t=>a(t))})}(t):[]})},maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};it.defaultProps=nt,it.propTypes={children:s.func,accept:s.objectOf(s.arrayOf(s.string)),multiple:s.bool,preventDropOnDocument:s.bool,noClick:s.bool,noKeyboard:s.bool,noDrag:s.bool,noDragEventsBubbling:s.bool,minSize:s.number,maxSize:s.number,maxFiles:s.number,disabled:s.bool,getFilesFromEvent:s.func,onFileDialogCancel:s.func,onFileDialogOpen:s.func,useFsAccessApi:s.bool,autoFocus:s.bool,onDragEnter:s.func,onDragLeave:s.func,onDragOver:s.func,onDrop:s.func,onDropAccepted:s.func,onDropRejected:s.func,onError:s.func,validator:s.func};var st={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function ot(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=$($({},nt),t),i=e.accept,s=e.disabled,o=e.getFilesFromEvent,r=e.maxSize,a=e.minSize,l=e.multiple,c=e.maxFiles,h=e.onDragEnter,d=e.onDragLeave,u=e.onDragOver,p=e.onDrop,f=e.onDropAccepted,m=e.onDropRejected,g=e.onFileDialogCancel,v=e.onFileDialogOpen,w=e.useFsAccessApi,y=e.autoFocus,S=e.preventDropOnDocument,C=e.noClick,k=e.noKeyboard,M=e.noDrag,E=e.noDragEventsBubbling,T=e.onError,R=e.validator,P=(0,n.useMemo)(function(){return function(t){if(z(t))return Object.entries(t).reduce(function(t,e){var i=A(e,2),n=i[0],s=i[1];return[].concat(b(t),[n],b(s))},[]).filter(function(t){return G(t)||H(t)}).join(",")}(i)},[i]),I=(0,n.useMemo)(function(){return function(t){return z(t)?[{description:"Files",accept:Object.entries(t).filter(function(t){var e=A(t,2),i=e[0],n=e[1],s=!0;return G(i)||(console.warn('Skipped "'.concat(i,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),s=!1),Array.isArray(n)&&n.every(H)||(console.warn('Skipped "'.concat(i,'" because an invalid file extension was provided.')),s=!1),s}).reduce(function(t,e){var i=A(e,2),n=i[0],s=i[1];return x(x({},t),{},_({},n,s))},{})}]:t}(i)},[i]),D=(0,n.useMemo)(function(){return"function"===typeof v?v:at},[v]),U=(0,n.useMemo)(function(){return"function"===typeof g?g:at},[g]),V=(0,n.useRef)(null),J=(0,n.useRef)(null),Q=Y((0,n.useReducer)(rt,st),2),Z=Q[0],it=Q[1],ot=Z.isFocused,lt=Z.isFileDialogActive,ct=(0,n.useRef)("undefined"!==typeof window&&window.isSecureContext&&w&&"showOpenFilePicker"in window),ht=function(){!ct.current&<&&setTimeout(function(){J.current&&(J.current.files.length||(it({type:"closeDialog"}),U()))},300)};(0,n.useEffect)(function(){return window.addEventListener("focus",ht,!1),function(){window.removeEventListener("focus",ht,!1)}},[J,lt,U,ct]);var dt=(0,n.useRef)([]),ut=function(t){V.current&&V.current.contains(t.target)||(t.preventDefault(),dt.current=[])};(0,n.useEffect)(function(){return S&&(document.addEventListener("dragover",W,!1),document.addEventListener("drop",ut,!1)),function(){S&&(document.removeEventListener("dragover",W),document.removeEventListener("drop",ut))}},[V,S]),(0,n.useEffect)(function(){return!s&&y&&V.current&&V.current.focus(),function(){}},[V,y,s]);var pt=(0,n.useCallback)(function(t){T?T(t):console.error(t)},[T]),ft=(0,n.useCallback)(function(t){t.preventDefault(),t.persist(),Mt(t),dt.current=[].concat(K(dt.current),[t.target]),B(t)&&Promise.resolve(o(t)).then(function(e){if(!N(t)||E){var i=e.length,n=i>0&&function(t){var e=t.files,i=t.accept,n=t.minSize,s=t.maxSize,o=t.multiple,r=t.maxFiles,a=t.validator;return!(!o&&e.length>1||o&&r>=1&&e.length>r)&&e.every(function(t){var e=A(O(t,i),1)[0],o=A(F(t,n,s),1)[0],r=a?a(t):null;return e&&o&&!r})}({files:e,accept:P,minSize:a,maxSize:r,multiple:l,maxFiles:c,validator:R});it({isDragAccept:n,isDragReject:i>0&&!n,isDragActive:!0,type:"setDraggedFiles"}),h&&h(t)}}).catch(function(t){return pt(t)})},[o,h,pt,E,P,a,r,l,c,R]),mt=(0,n.useCallback)(function(t){t.preventDefault(),t.persist(),Mt(t);var e=B(t);if(e&&t.dataTransfer)try{t.dataTransfer.dropEffect="copy"}catch(i){}return e&&u&&u(t),!1},[u,E]),gt=(0,n.useCallback)(function(t){t.preventDefault(),t.persist(),Mt(t);var e=dt.current.filter(function(t){return V.current&&V.current.contains(t)}),i=e.indexOf(t.target);-1!==i&&e.splice(i,1),dt.current=e,e.length>0||(it({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),B(t)&&d&&d(t))},[V,d,E]),vt=(0,n.useCallback)(function(t,e){var i=[],n=[];t.forEach(function(t){var e=Y(O(t,P),2),s=e[0],o=e[1],l=Y(F(t,a,r),2),c=l[0],h=l[1],d=R?R(t):null;if(s&&c&&!d)i.push(t);else{var u=[o,h];d&&(u=u.concat(d)),n.push({file:t,errors:u.filter(function(t){return t})})}}),(!l&&i.length>1||l&&c>=1&&i.length>c)&&(i.forEach(function(t){n.push({file:t,errors:[L]})}),i.splice(0)),it({acceptedFiles:i,fileRejections:n,isDragReject:n.length>0,type:"setFiles"}),p&&p(i,n,e),n.length>0&&m&&m(n,e),i.length>0&&f&&f(i,e)},[it,l,P,a,r,c,p,f,m,R]),wt=(0,n.useCallback)(function(t){t.preventDefault(),t.persist(),Mt(t),dt.current=[],B(t)&&Promise.resolve(o(t)).then(function(e){N(t)&&!E||vt(e,t)}).catch(function(t){return pt(t)}),it({type:"reset"})},[o,vt,pt,E]),bt=(0,n.useCallback)(function(){if(ct.current){it({type:"openDialog"}),D();var t={multiple:l,types:I};window.showOpenFilePicker(t).then(function(t){return o(t)}).then(function(t){vt(t,null),it({type:"closeDialog"})}).catch(function(t){var e;(e=t)instanceof DOMException&&("AbortError"===e.name||e.code===e.ABORT_ERR)?(U(t),it({type:"closeDialog"})):!function(t){return t instanceof DOMException&&("SecurityError"===t.name||t.code===t.SECURITY_ERR)}(t)?pt(t):(ct.current=!1,J.current?(J.current.value=null,J.current.click()):pt(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided.")))})}else J.current&&(it({type:"openDialog"}),D(),J.current.value=null,J.current.click())},[it,D,U,w,vt,pt,I,l]),yt=(0,n.useCallback)(function(t){V.current&&V.current.isEqualNode(t.target)&&(" "!==t.key&&"Enter"!==t.key&&32!==t.keyCode&&13!==t.keyCode||(t.preventDefault(),bt()))},[V,bt]),xt=(0,n.useCallback)(function(){it({type:"focus"})},[]),_t=(0,n.useCallback)(function(){it({type:"blur"})},[]),At=(0,n.useCallback)(function(){C||(!function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.navigator.userAgent;return function(t){return-1!==t.indexOf("MSIE")||-1!==t.indexOf("Trident/")}(t)||function(t){return-1!==t.indexOf("Edge/")}(t)}()?bt():setTimeout(bt,0))},[C,bt]),St=function(t){return s?null:t},Ct=function(t){return k?null:St(t)},kt=function(t){return M?null:St(t)},Mt=function(t){E&&t.stopPropagation()},Et=(0,n.useMemo)(function(){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.refKey,i=void 0===e?"ref":e,n=t.role,o=t.onKeyDown,r=t.onFocus,a=t.onBlur,l=t.onClick,c=t.onDragEnter,h=t.onDragOver,d=t.onDragLeave,u=t.onDrop,p=et(t,q);return $($(tt({onKeyDown:Ct(j(o,yt)),onFocus:Ct(j(r,xt)),onBlur:Ct(j(a,_t)),onClick:St(j(l,At)),onDragEnter:kt(j(c,ft)),onDragOver:kt(j(h,mt)),onDragLeave:kt(j(d,gt)),onDrop:kt(j(u,wt)),role:"string"===typeof n&&""!==n?n:"presentation"},i,V),s||k?{}:{tabIndex:0}),p)}},[V,yt,xt,_t,At,ft,mt,gt,wt,k,M,s]),Tt=(0,n.useCallback)(function(t){t.stopPropagation()},[]),Rt=(0,n.useMemo)(function(){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.refKey,i=void 0===e?"ref":e,n=t.onChange,s=t.onClick,o=et(t,X);return $($({},tt({accept:P,multiple:l,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:St(j(n,wt)),onClick:St(j(s,Tt)),tabIndex:-1},i,J)),o)}},[J,i,l,wt,s]);return $($({},Z),{},{isFocused:ot&&!s,getRootProps:Et,getInputProps:Rt,rootRef:V,inputRef:J,open:St(bt)})}function rt(t,e){switch(e.type){case"focus":return $($({},t),{},{isFocused:!0});case"blur":return $($({},t),{},{isFocused:!1});case"openDialog":return $($({},st),{},{isFileDialogActive:!0});case"closeDialog":return $($({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return $($({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return $($({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return $({},st);default:return t}}function at(){}},58386:(t,e,i)=>{"use strict";function n(t){let e=!1;return{promise:new Promise((i,n)=>{t.then(t=>!e&&i(t)).catch(t=>!e&&n(t))}),cancel(){e=!0}}}i.d(e,{A:()=>n})},59660:t=>{t.exports=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,i=[],n=0;n{"use strict";var n=i(59660),s={"text/plain":"Text","text/html":"Url",default:"Text"};t.exports=function(t,e){var i,o,r,a,l,c,h=!1;e||(e={}),i=e.debug||!1;try{if(r=n(),a=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=t,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(n){if(n.stopPropagation(),e.format)if(n.preventDefault(),"undefined"===typeof n.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=s[e.format]||s.default;window.clipboardData.setData(o,t)}else n.clipboardData.clearData(),n.clipboardData.setData(e.format,t);e.onCopy&&(n.preventDefault(),e.onCopy(n.clipboardData))}),document.body.appendChild(c),a.selectNodeContents(c),l.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");h=!0}catch(d){i&&console.error("unable to copy using execCommand: ",d),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),h=!0}catch(d){i&&console.error("unable to copy using clipboardData: ",d),i&&console.error("falling back to prompt"),o=function(t){var e=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}("message"in e?e.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,t)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(a):l.removeAllRanges()),c&&document.body.removeChild(c),r()}return h}},76325:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});const n=(0,i(9950).createContext)(null)},78762:(t,e,i)=>{"use strict";i.d(e,{Bd:()=>o,UT:()=>v,ci:()=>a,h1:()=>w,jA:()=>d,mZ:()=>u,mw:()=>l,qC:()=>f,qf:()=>c,vS:()=>g,xL:()=>m,zL:()=>h});var n=i(67033),s=i(2241);const o="undefined"!==typeof window,r=o&&"file:"===window.location.protocol;function a(t){return function(t){return"undefined"!==typeof t}(t)&&null!==t}function l(t){return t instanceof ArrayBuffer}function c(t){return(0,n.A)(o,"isBlob can only be used in a browser environment"),t instanceof Blob}function h(t){return function(t){return"string"===typeof t}(t)&&/^data:/.test(t)}function d(t){(0,n.A)(h(t),"Invalid data URI.");const[e="",i=""]=t.split(",");return-1!==e.split(";").indexOf("base64")?atob(i):unescape(i)}function u(){return o&&window.devicePixelRatio||1}const p="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function f(){s(!r,"Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ".concat(p))}function m(t){(null===t||void 0===t?void 0:t.cancel)&&t.cancel()}function g(t,e){return Object.defineProperty(t,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.view[3]},configurable:!0}),t}function v(t){return"RenderingCancelledException"===t.name}function w(t){return new Promise((e,i)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return i(new Error("Error while reading a file."));e(n.result)},n.onerror=t=>{if(!t.target)return i(new Error("Error while reading a file."));const{error:e}=t.target;if(!e)return i(new Error("Error while reading a file."));switch(e.code){case e.NOT_FOUND_ERR:return i(new Error("Error while reading a file: File not found."));case e.SECURITY_ERR:return i(new Error("Error while reading a file: Security error."));case e.ABORT_ERR:return i(new Error("Error while reading a file: Aborted."));default:return i(new Error("Error while reading a file."))}},n.readAsArrayBuffer(t)})}},85049:(t,e,i)=>{"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}i.d(e,{B8:()=>At});var s=i(20816);function o(t,e){for(var i=0;i div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',n=e.head||e.getElementsByTagName("head")[0],s=e.createElement("style");s.id="detectElementResize",s.type="text/css",null!=t&&s.setAttribute("nonce",t),s.styleSheet?s.styleSheet.cssText=i:s.appendChild(e.createTextNode(i)),n.appendChild(s)}}(o),e.__resizeLast__={},e.__resizeListeners__=[],(e.__resizeTriggers__=o.createElement("div")).className="resize-triggers";var c=o.createElement("div");c.className="expand-trigger",c.appendChild(o.createElement("div"));var h=o.createElement("div");h.className="contract-trigger",e.__resizeTriggers__.appendChild(c),e.__resizeTriggers__.appendChild(h),e.appendChild(e.__resizeTriggers__),a(e),e.addEventListener("scroll",l,!0),d&&(e.__resizeTriggers__.__animationListener__=function(t){t.animationName==g&&a(e)},e.__resizeTriggers__.addEventListener(d,e.__resizeTriggers__.__animationListener__))}e.__resizeListeners__.push(i)}},removeResizeListener:function(t,e){if(s)t.detachEvent("onresize",e);else if(t.__resizeListeners__.splice(t.__resizeListeners__.indexOf(e),1),!t.__resizeListeners__.length){t.removeEventListener("scroll",l,!0),t.__resizeTriggers__.__animationListener__&&(t.__resizeTriggers__.removeEventListener(d,t.__resizeTriggers__.__animationListener__),t.__resizeTriggers__.__animationListener__=null);try{t.__resizeTriggers__=!t.removeChild(t.__resizeTriggers__)}catch(i){}}}}}function A(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function S(t){for(var e=1;e0&&void 0!==arguments[0])||arguments[0],e={};return function(i){var n=i.callback,s=i.indices,o=Object.keys(s),r=!t||o.every(function(t){var e=s[t];return Array.isArray(e)?e.length>0:e>=0}),a=o.length!==Object.keys(e).length||o.some(function(t){var i=e[t],n=s[t];return Array.isArray(n)?i.join(",")!==n.join(","):i!==n});e=s,r&&a&&n(s)}}const D=!("undefined"===typeof window||!window.document||!window.document.createElement);var L;function O(t){if((!L&&0!==L||t)&&D){var e=document.createElement("div");e.style.position="absolute",e.style.top="-9999px",e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e),L=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return L}function F(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function z(t){for(var e=1;e=0){var h=i.getScrollPositionForCell({align:s,cellIndex:o,height:n,scrollLeft:l,scrollTop:c,width:r});h.scrollLeft===l&&h.scrollTop===c||t._setScrollPosition(h)}}),(0,u.A)(t,"_onScroll",function(e){if(e.target===t._scrollingContainer){t._enablePointerEventsAfterDelay();var i=t.props,n=i.cellLayoutManager,s=i.height,o=i.isScrollingChange,r=i.width,a=t._scrollbarSize,l=n.getTotalSize(),c=l.height,h=l.width,d=Math.max(0,Math.min(h-r+a,e.target.scrollLeft)),u=Math.max(0,Math.min(c-s+a,e.target.scrollTop));if(t.state.scrollLeft!==d||t.state.scrollTop!==u){var p=e.cancelable?B:W;t.state.isScrolling||o(!0),t.setState({isScrolling:!0,scrollLeft:d,scrollPositionChangeReason:p,scrollTop:u})}t._invokeOnScrollMemoizer({scrollLeft:d,scrollTop:u,totalWidth:h,totalHeight:c})}}),t._scrollbarSize=O(),void 0===t._scrollbarSize?(t._scrollbarSizeMeasured=!1,t._scrollbarSize=0):t._scrollbarSizeMeasured=!0,t}return d(e,t),r(e,[{key:"recomputeCellSizesAndPositions",value:function(){this._calculateSizeAndPositionDataOnNextUpdate=!0,this.forceUpdate()}},{key:"componentDidMount",value:function(){var t=this.props,e=t.cellLayoutManager,i=t.scrollLeft,n=t.scrollToCell,s=t.scrollTop;this._scrollbarSizeMeasured||(this._scrollbarSize=O(),this._scrollbarSizeMeasured=!0,this.setState({})),n>=0?this._updateScrollPositionForScrollToCell():(i>=0||s>=0)&&this._setScrollPosition({scrollLeft:i,scrollTop:s}),this._invokeOnSectionRenderedHelper();var o=e.getTotalSize(),r=o.height,a=o.width;this._invokeOnScrollMemoizer({scrollLeft:i||0,scrollTop:s||0,totalHeight:r,totalWidth:a})}},{key:"componentDidUpdate",value:function(t,e){var i=this.props,n=i.height,s=i.scrollToAlignment,o=i.scrollToCell,r=i.width,a=this.state,l=a.scrollLeft,c=a.scrollPositionChangeReason,h=a.scrollTop;c===W&&(l>=0&&l!==e.scrollLeft&&l!==this._scrollingContainer.scrollLeft&&(this._scrollingContainer.scrollLeft=l),h>=0&&h!==e.scrollTop&&h!==this._scrollingContainer.scrollTop&&(this._scrollingContainer.scrollTop=h)),n===t.height&&s===t.scrollToAlignment&&o===t.scrollToCell&&r===t.width||this._updateScrollPositionForScrollToCell(),this._invokeOnSectionRenderedHelper()}},{key:"componentWillUnmount",value:function(){this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId)}},{key:"render",value:function(){var t=this.props,e=t.autoHeight,i=t.cellCount,n=t.cellLayoutManager,s=t.className,o=t.height,r=t.horizontalOverscanSize,a=t.id,l=t.noContentRenderer,c=t.style,h=t.verticalOverscanSize,d=t.width,u=this.state,f=u.isScrolling,m=u.scrollLeft,g=u.scrollTop;(this._lastRenderedCellCount!==i||this._lastRenderedCellLayoutManager!==n||this._calculateSizeAndPositionDataOnNextUpdate)&&(this._lastRenderedCellCount=i,this._lastRenderedCellLayoutManager=n,this._calculateSizeAndPositionDataOnNextUpdate=!1,n.calculateSizeAndPositionData());var v=n.getTotalSize(),w=v.height,b=v.width,y=Math.max(0,m-r),x=Math.max(0,g-h),_=Math.min(b,m+d+r),A=Math.min(w,g+o+h),S=o>0&&d>0?n.cellRenderers({height:A-x,isScrolling:f,width:_-y,x:y,y:x}):[],C={boxSizing:"border-box",direction:"ltr",height:e?"auto":o,position:"relative",WebkitOverflowScrolling:"touch",width:d,willChange:"transform"},k=w>o?this._scrollbarSize:0,M=b>d?this._scrollbarSize:0;return C.overflowX=b+k<=d?"hidden":"auto",C.overflowY=w+M<=o?"hidden":"auto",p.createElement("div",{ref:this._setScrollingContainerRef,"aria-label":this.props["aria-label"],className:P("ReactVirtualized__Collection",s),id:a,onScroll:this._onScroll,role:"grid",style:z(z({},C),c),tabIndex:0},i>0&&p.createElement("div",{className:"ReactVirtualized__Collection__innerScrollContainer",style:{height:w,maxHeight:w,maxWidth:b,overflow:"hidden",pointerEvents:f?"none":"",width:b}},S),0===i&&l())}},{key:"_enablePointerEventsAfterDelay",value:function(){var t=this;this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId),this._disablePointerEventsTimeoutId=setTimeout(function(){(0,t.props.isScrollingChange)(!1),t._disablePointerEventsTimeoutId=null,t.setState({isScrolling:!1})},150)}},{key:"_invokeOnScrollMemoizer",value:function(t){var e=this,i=t.scrollLeft,n=t.scrollTop,s=t.totalHeight,o=t.totalWidth;this._onScrollMemoizer({callback:function(t){var i=t.scrollLeft,n=t.scrollTop,r=e.props,a=r.height;(0,r.onScroll)({clientHeight:a,clientWidth:r.width,scrollHeight:s,scrollLeft:i,scrollTop:n,scrollWidth:o})},indices:{scrollLeft:i,scrollTop:n}})}},{key:"_setScrollPosition",value:function(t){var e=t.scrollLeft,i=t.scrollTop,n={scrollPositionChangeReason:W};e>=0&&(n.scrollLeft=e),i>=0&&(n.scrollTop=i),(e>=0&&e!==this.state.scrollLeft||i>=0&&i!==this.state.scrollTop)&&this.setState(n)}}],[{key:"getDerivedStateFromProps",value:function(t,e){return 0!==t.cellCount||0===e.scrollLeft&&0===e.scrollTop?t.scrollLeft!==e.scrollLeft||t.scrollTop!==e.scrollTop?{scrollLeft:null!=t.scrollLeft?t.scrollLeft:e.scrollLeft,scrollTop:null!=t.scrollTop?t.scrollTop:e.scrollTop,scrollPositionChangeReason:W}:null:{scrollLeft:0,scrollTop:0,scrollPositionChangeReason:W}}}])}(p.PureComponent);(0,u.A)(j,"defaultProps",{"aria-label":"grid",horizontalOverscanSize:0,noContentRenderer:function(){return null},onScroll:function(){return null},onSectionRendered:function(){return null},scrollToAlignment:"auto",scrollToCell:-1,style:{},verticalOverscanSize:0}),j.propTypes={},v(j);const G=j;var H=function(){return r(function t(e){var i=e.height,s=e.width,o=e.x,r=e.y;n(this,t),this.height=i,this.width=s,this.x=o,this.y=r,this._indexMap={},this._indices=[]},[{key:"addCellIndex",value:function(t){var e=t.index;this._indexMap[e]||(this._indexMap[e]=!0,this._indices.push(e))}},{key:"getCellIndices",value:function(){return this._indices}},{key:"toString",value:function(){return"".concat(this.x,",").concat(this.y," ").concat(this.width,"x").concat(this.height)}}])}(),U=function(){return r(function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;n(this,t),this._sectionSize=e,this._cellMetadata=[],this._sections={}},[{key:"getCellIndices",value:function(t){var e=t.height,i=t.width,n=t.x,s=t.y,o={};return this.getSections({height:e,width:i,x:n,y:s}).forEach(function(t){return t.getCellIndices().forEach(function(t){o[t]=t})}),Object.keys(o).map(function(t){return o[t]})}},{key:"getCellMetadata",value:function(t){var e=t.index;return this._cellMetadata[e]}},{key:"getSections",value:function(t){for(var e=t.height,i=t.width,n=t.x,s=t.y,o=Math.floor(n/this._sectionSize),r=Math.floor((n+i-1)/this._sectionSize),a=Math.floor(s/this._sectionSize),l=Math.floor((s+e-1)/this._sectionSize),c=[],h=o;h<=r;h++)for(var d=a;d<=l;d++){var u="".concat(h,".").concat(d);this._sections[u]||(this._sections[u]=new H({height:this._sectionSize,width:this._sectionSize,x:h*this._sectionSize,y:d*this._sectionSize})),c.push(this._sections[u])}return c}},{key:"getTotalSectionCount",value:function(){return Object.keys(this._sections).length}},{key:"toString",value:function(){var t=this;return Object.keys(this._sections).map(function(e){return t._sections[e].toString()})}},{key:"registerCell",value:function(t){var e=t.cellMetadatum,i=t.index;this._cellMetadata[i]=e,this.getSections(e).forEach(function(t){return t.addCellIndex({index:i})})}}])}();function V(t){var e=t.align,i=void 0===e?"auto":e,n=t.cellOffset,s=t.cellSize,o=t.containerSize,r=t.currentOffset,a=n,l=a-o+s;switch(i){case"start":return a;case"end":return l;case"center":return a-(o-s)/2;default:return Math.max(l,Math.min(a,r))}}function q(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(q=function(){return!!t})()}var X=function(t){function e(t,i){var s,o,r,a;return n(this,e),o=this,a=[t,i],r=c(r=e),(s=l(o,q()?Reflect.construct(r,a||[],c(o).constructor):r.apply(o,a)))._cellMetadata=[],s._lastRenderedCellIndices=[],s._cellCache=[],s._isScrollingChange=s._isScrollingChange.bind(s),s._setCollectionViewRef=s._setCollectionViewRef.bind(s),s}return d(e,t),r(e,[{key:"forceUpdate",value:function(){void 0!==this._collectionView&&this._collectionView.forceUpdate()}},{key:"recomputeCellSizesAndPositions",value:function(){this._cellCache=[],this._collectionView.recomputeCellSizesAndPositions()}},{key:"render",value:function(){var t=(0,T.A)({},(function(t){if(null==t)throw new TypeError("Cannot destructure "+t)}(this.props),this.props));return p.createElement(G,(0,T.A)({cellLayoutManager:this,isScrollingChange:this._isScrollingChange,ref:this._setCollectionViewRef},t))}},{key:"calculateSizeAndPositionData",value:function(){var t=this.props,e=function(t){for(var e=t.cellCount,i=t.cellSizeAndPositionGetter,n=t.sectionSize,s=[],o=new U(n),r=0,a=0,l=0;l=0&&i=0&&l===a&&c())}var J,Q=i(80045),Z=function(){return r(function t(e){var i=e.cellCount,s=e.cellSizeGetter,o=e.estimatedCellSize;n(this,t),(0,u.A)(this,"_cellSizeAndPositionData",{}),(0,u.A)(this,"_lastMeasuredIndex",-1),(0,u.A)(this,"_lastBatchedIndex",-1),(0,u.A)(this,"_cellCount",void 0),(0,u.A)(this,"_cellSizeGetter",void 0),(0,u.A)(this,"_estimatedCellSize",void 0),this._cellSizeGetter=s,this._cellCount=i,this._estimatedCellSize=o},[{key:"areOffsetsAdjusted",value:function(){return!1}},{key:"configure",value:function(t){var e=t.cellCount,i=t.estimatedCellSize,n=t.cellSizeGetter;this._cellCount=e,this._estimatedCellSize=i,this._cellSizeGetter=n}},{key:"getCellCount",value:function(){return this._cellCount}},{key:"getEstimatedCellSize",value:function(){return this._estimatedCellSize}},{key:"getLastMeasuredIndex",value:function(){return this._lastMeasuredIndex}},{key:"getOffsetAdjustment",value:function(){return 0}},{key:"getSizeAndPositionOfCell",value:function(t){if(t<0||t>=this._cellCount)throw Error("Requested index ".concat(t," is outside of range 0..").concat(this._cellCount));if(t>this._lastMeasuredIndex)for(var e=this.getSizeAndPositionOfLastMeasuredCell(),i=e.offset+e.size,n=this._lastMeasuredIndex+1;n<=t;n++){var s=this._cellSizeGetter({index:n});if(void 0===s||isNaN(s))throw Error("Invalid size returned for cell ".concat(n," of value ").concat(s));null===s?(this._cellSizeAndPositionData[n]={offset:i,size:0},this._lastBatchedIndex=t):(this._cellSizeAndPositionData[n]={offset:i,size:s},i+=s,this._lastMeasuredIndex=t)}return this._cellSizeAndPositionData[t]}},{key:"getSizeAndPositionOfLastMeasuredCell",value:function(){return this._lastMeasuredIndex>=0?this._cellSizeAndPositionData[this._lastMeasuredIndex]:{offset:0,size:0}}},{key:"getTotalSize",value:function(){var t=this.getSizeAndPositionOfLastMeasuredCell();return t.offset+t.size+(this._cellCount-this._lastMeasuredIndex-1)*this._estimatedCellSize}},{key:"getUpdatedOffsetForIndex",value:function(t){var e=t.align,i=void 0===e?"auto":e,n=t.containerSize,s=t.currentOffset,o=t.targetIndex;if(n<=0)return 0;var r,a=this.getSizeAndPositionOfCell(o),l=a.offset,c=l-n+a.size;switch(i){case"start":r=l;break;case"end":r=c;break;case"center":r=l-(n-a.size)/2;break;default:r=Math.max(c,Math.min(l,s))}var h=this.getTotalSize();return Math.max(0,Math.min(h-n,r))}},{key:"getVisibleCellRange",value:function(t){var e=t.containerSize,i=t.offset;if(0===this.getTotalSize())return{};var n=i+e,s=this._findNearestCell(i),o=this.getSizeAndPositionOfCell(s);i=o.offset+o.size;for(var r=s;ii&&(t=n-1)}return e>0?e-1:0}},{key:"_exponentialSearch",value:function(t,e){for(var i=1;t=t?this._binarySearch(i,0,t):this._exponentialSearch(i,t)}}])}(),$=function(){return"undefined"!==typeof window&&window.chrome?16777100:15e5},tt=["maxScrollSize"],et=function(){return r(function t(e){var i=e.maxScrollSize,s=void 0===i?$():i,o=(0,Q.A)(e,tt);n(this,t),(0,u.A)(this,"_cellSizeAndPositionManager",void 0),(0,u.A)(this,"_maxScrollSize",void 0),this._cellSizeAndPositionManager=new Z(o),this._maxScrollSize=s},[{key:"areOffsetsAdjusted",value:function(){return this._cellSizeAndPositionManager.getTotalSize()>this._maxScrollSize}},{key:"configure",value:function(t){this._cellSizeAndPositionManager.configure(t)}},{key:"getCellCount",value:function(){return this._cellSizeAndPositionManager.getCellCount()}},{key:"getEstimatedCellSize",value:function(){return this._cellSizeAndPositionManager.getEstimatedCellSize()}},{key:"getLastMeasuredIndex",value:function(){return this._cellSizeAndPositionManager.getLastMeasuredIndex()}},{key:"getOffsetAdjustment",value:function(t){var e=t.containerSize,i=t.offset,n=this._cellSizeAndPositionManager.getTotalSize(),s=this.getTotalSize(),o=this._getOffsetPercentage({containerSize:e,offset:i,totalSize:s});return Math.round(o*(s-n))}},{key:"getSizeAndPositionOfCell",value:function(t){return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(t)}},{key:"getSizeAndPositionOfLastMeasuredCell",value:function(){return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell()}},{key:"getTotalSize",value:function(){return Math.min(this._maxScrollSize,this._cellSizeAndPositionManager.getTotalSize())}},{key:"getUpdatedOffsetForIndex",value:function(t){var e=t.align,i=void 0===e?"auto":e,n=t.containerSize,s=t.currentOffset,o=t.targetIndex;s=this._safeOffsetToOffset({containerSize:n,offset:s});var r=this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({align:i,containerSize:n,currentOffset:s,targetIndex:o});return this._offsetToSafeOffset({containerSize:n,offset:r})}},{key:"getVisibleCellRange",value:function(t){var e=t.containerSize,i=t.offset;return i=this._safeOffsetToOffset({containerSize:e,offset:i}),this._cellSizeAndPositionManager.getVisibleCellRange({containerSize:e,offset:i})}},{key:"resetCell",value:function(t){this._cellSizeAndPositionManager.resetCell(t)}},{key:"_getOffsetPercentage",value:function(t){var e=t.containerSize,i=t.offset,n=t.totalSize;return n<=e?0:i/(n-e)}},{key:"_offsetToSafeOffset",value:function(t){var e=t.containerSize,i=t.offset,n=this._cellSizeAndPositionManager.getTotalSize(),s=this.getTotalSize();if(n===s)return i;var o=this._getOffsetPercentage({containerSize:e,offset:i,totalSize:n});return Math.round(o*(s-e))}},{key:"_safeOffsetToOffset",value:function(t){var e=t.containerSize,i=t.offset,n=this._cellSizeAndPositionManager.getTotalSize(),s=this.getTotalSize();if(n===s)return i;var o=this._getOffsetPercentage({containerSize:e,offset:i,totalSize:s});return Math.round(o*(n-e))}}])}();function it(t){var e=t.cellSize,i=t.cellSizeAndPositionManager,n=t.previousCellsCount,s=t.previousCellSize,o=t.previousScrollToAlignment,r=t.previousScrollToIndex,a=t.previousSize,l=t.scrollOffset,c=t.scrollToAlignment,h=t.scrollToIndex,d=t.size,u=t.sizeJustIncreasedFromZero,p=t.updateScrollIndexCallback,f=i.getCellCount(),m=h>=0&&h0&&(di.getTotalSize()-d&&p(f-1)}var nt=(J="undefined"!==typeof window?window:"undefined"!==typeof self?self:{}).requestAnimationFrame||J.webkitRequestAnimationFrame||J.mozRequestAnimationFrame||J.oRequestAnimationFrame||J.msRequestAnimationFrame||function(t){return J.setTimeout(t,1e3/60)},st=J.cancelAnimationFrame||J.webkitCancelAnimationFrame||J.mozCancelAnimationFrame||J.oCancelAnimationFrame||J.msCancelAnimationFrame||function(t){J.clearTimeout(t)},ot=nt,rt=st,at=function(t){return rt(t.id)},lt=function(t,e){var i;Promise.resolve().then(function(){i=Date.now()});var n=function(){Date.now()-i>=e?t.call():s.id=ot(n)},s={id:ot(n)};return s};function ct(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function ht(t){for(var e=1;e0&&(i._initialScrollTop=i._getCalculatedScrollTop(t,i.state)),t.scrollToColumn>0&&(i._initialScrollLeft=i._getCalculatedScrollLeft(t,i.state)),i}return d(e,t),r(e,[{key:"getOffsetForCell",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.alignment,i=void 0===e?this.props.scrollToAlignment:e,n=t.columnIndex,s=void 0===n?this.props.scrollToColumn:n,o=t.rowIndex,r=void 0===o?this.props.scrollToRow:o,a=ht(ht({},this.props),{},{scrollToAlignment:i,scrollToColumn:s,scrollToRow:r});return{scrollLeft:this._getCalculatedScrollLeft(a),scrollTop:this._getCalculatedScrollTop(a)}}},{key:"getTotalRowsHeight",value:function(){return this.state.instanceProps.rowSizeAndPositionManager.getTotalSize()}},{key:"getTotalColumnsWidth",value:function(){return this.state.instanceProps.columnSizeAndPositionManager.getTotalSize()}},{key:"handleScrollEvent",value:function(t){var e=t.scrollLeft,i=void 0===e?0:e,n=t.scrollTop,s=void 0===n?0:n;if(!(s<0)){this._debounceScrollEnded();var o=this.props,r=o.autoHeight,a=o.autoWidth,l=o.height,c=o.width,h=this.state.instanceProps,d=h.scrollbarSize,u=h.rowSizeAndPositionManager.getTotalSize(),p=h.columnSizeAndPositionManager.getTotalSize(),f=Math.min(Math.max(0,p-c+d),i),m=Math.min(Math.max(0,u-l+d),s);if(this.state.scrollLeft!==f||this.state.scrollTop!==m){var g={isScrolling:!0,scrollDirectionHorizontal:f!==this.state.scrollLeft?f>this.state.scrollLeft?1:-1:this.state.scrollDirectionHorizontal,scrollDirectionVertical:m!==this.state.scrollTop?m>this.state.scrollTop?1:-1:this.state.scrollDirectionVertical,scrollPositionChangeReason:ut};r||(g.scrollTop=m),a||(g.scrollLeft=f),g.needToResetStyleCache=!1,this.setState(g)}this._invokeOnScrollMemoizer({scrollLeft:f,scrollTop:m,totalColumnsWidth:p,totalRowsHeight:u})}}},{key:"invalidateCellSizeAfterRender",value:function(t){var e=t.columnIndex,i=t.rowIndex;this._deferredInvalidateColumnIndex="number"===typeof this._deferredInvalidateColumnIndex?Math.min(this._deferredInvalidateColumnIndex,e):e,this._deferredInvalidateRowIndex="number"===typeof this._deferredInvalidateRowIndex?Math.min(this._deferredInvalidateRowIndex,i):i}},{key:"measureAllCells",value:function(){var t=this.props,e=t.columnCount,i=t.rowCount,n=this.state.instanceProps;n.columnSizeAndPositionManager.getSizeAndPositionOfCell(e-1),n.rowSizeAndPositionManager.getSizeAndPositionOfCell(i-1)}},{key:"recomputeGridSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.columnIndex,i=void 0===e?0:e,n=t.rowIndex,s=void 0===n?0:n,o=this.props,r=o.scrollToColumn,a=o.scrollToRow,l=this.state.instanceProps;l.columnSizeAndPositionManager.resetCell(i),l.rowSizeAndPositionManager.resetCell(s),this._recomputeScrollLeftFlag=r>=0&&(1===this.state.scrollDirectionHorizontal?i<=r:i>=r),this._recomputeScrollTopFlag=a>=0&&(1===this.state.scrollDirectionVertical?s<=a:s>=a),this._styleCache={},this._cellCache={},this.forceUpdate()}},{key:"scrollToCell",value:function(t){var e=t.columnIndex,i=t.rowIndex,n=this.props.columnCount,s=this.props;n>1&&void 0!==e&&this._updateScrollLeftForScrollToColumn(ht(ht({},s),{},{scrollToColumn:e})),void 0!==i&&this._updateScrollTopForScrollToRow(ht(ht({},s),{},{scrollToRow:i}))}},{key:"componentDidMount",value:function(){var t=this.props,i=t.getScrollbarSize,n=t.height,s=t.scrollLeft,o=t.scrollToColumn,r=t.scrollTop,a=t.scrollToRow,l=t.width,c=this.state.instanceProps;if(this._initialScrollTop=0,this._initialScrollLeft=0,this._handleInvalidatedGridSize(),c.scrollbarSizeMeasured||this.setState(function(t){var e=ht(ht({},t),{},{needToResetStyleCache:!1});return e.instanceProps.scrollbarSize=i(),e.instanceProps.scrollbarSizeMeasured=!0,e}),"number"===typeof s&&s>=0||"number"===typeof r&&r>=0){var h=e._getScrollToPositionStateUpdate({prevState:this.state,scrollLeft:s,scrollTop:r});h&&(h.needToResetStyleCache=!1,this.setState(h))}this._scrollingContainer&&(this._scrollingContainer.scrollLeft!==this.state.scrollLeft&&(this._scrollingContainer.scrollLeft=this.state.scrollLeft),this._scrollingContainer.scrollTop!==this.state.scrollTop&&(this._scrollingContainer.scrollTop=this.state.scrollTop));var d=n>0&&l>0;o>=0&&d&&this._updateScrollLeftForScrollToColumn(),a>=0&&d&&this._updateScrollTopForScrollToRow(),this._invokeOnGridRenderedHelper(),this._invokeOnScrollMemoizer({scrollLeft:s||0,scrollTop:r||0,totalColumnsWidth:c.columnSizeAndPositionManager.getTotalSize(),totalRowsHeight:c.rowSizeAndPositionManager.getTotalSize()}),this._maybeCallOnScrollbarPresenceChange()}},{key:"componentDidUpdate",value:function(t,e){var i=this,n=this.props,s=n.autoHeight,o=n.autoWidth,r=n.columnCount,a=n.height,l=n.rowCount,c=n.scrollToAlignment,h=n.scrollToColumn,d=n.scrollToRow,u=n.width,p=this.state,f=p.scrollLeft,m=p.scrollPositionChangeReason,g=p.scrollTop,v=p.instanceProps;this._handleInvalidatedGridSize();var w=r>0&&0===t.columnCount||l>0&&0===t.rowCount;m===pt&&(!o&&f>=0&&(f!==this._scrollingContainer.scrollLeft||w)&&(this._scrollingContainer.scrollLeft=f),!s&&g>=0&&(g!==this._scrollingContainer.scrollTop||w)&&(this._scrollingContainer.scrollTop=g));var b=(0===t.width||0===t.height)&&a>0&&u>0;if(this._recomputeScrollLeftFlag?(this._recomputeScrollLeftFlag=!1,this._updateScrollLeftForScrollToColumn(this.props)):it({cellSizeAndPositionManager:v.columnSizeAndPositionManager,previousCellsCount:t.columnCount,previousCellSize:t.columnWidth,previousScrollToAlignment:t.scrollToAlignment,previousScrollToIndex:t.scrollToColumn,previousSize:t.width,scrollOffset:f,scrollToAlignment:c,scrollToIndex:h,size:u,sizeJustIncreasedFromZero:b,updateScrollIndexCallback:function(){return i._updateScrollLeftForScrollToColumn(i.props)}}),this._recomputeScrollTopFlag?(this._recomputeScrollTopFlag=!1,this._updateScrollTopForScrollToRow(this.props)):it({cellSizeAndPositionManager:v.rowSizeAndPositionManager,previousCellsCount:t.rowCount,previousCellSize:t.rowHeight,previousScrollToAlignment:t.scrollToAlignment,previousScrollToIndex:t.scrollToRow,previousSize:t.height,scrollOffset:g,scrollToAlignment:c,scrollToIndex:d,size:a,sizeJustIncreasedFromZero:b,updateScrollIndexCallback:function(){return i._updateScrollTopForScrollToRow(i.props)}}),this._invokeOnGridRenderedHelper(),f!==e.scrollLeft||g!==e.scrollTop){var y=v.rowSizeAndPositionManager.getTotalSize(),x=v.columnSizeAndPositionManager.getTotalSize();this._invokeOnScrollMemoizer({scrollLeft:f,scrollTop:g,totalColumnsWidth:x,totalRowsHeight:y})}this._maybeCallOnScrollbarPresenceChange()}},{key:"componentWillUnmount",value:function(){this._disablePointerEventsTimeoutId&&at(this._disablePointerEventsTimeoutId)}},{key:"render",value:function(){var t=this.props,e=t.autoContainerWidth,i=t.autoHeight,n=t.autoWidth,s=t.className,o=t.containerProps,r=t.containerRole,a=t.containerStyle,l=t.height,c=t.id,h=t.noContentRenderer,d=t.role,u=t.style,f=t.tabIndex,m=t.width,g=this.state,v=g.instanceProps,w=g.needToResetStyleCache,b=this._isScrolling(),y={boxSizing:"border-box",direction:"ltr",height:i?"auto":l,position:"relative",width:n?"auto":m,WebkitOverflowScrolling:"touch",willChange:"transform"};w&&(this._styleCache={}),this.state.isScrolling||this._resetStyleCache(),this._calculateChildrenToRender(this.props,this.state);var x=v.columnSizeAndPositionManager.getTotalSize(),_=v.rowSizeAndPositionManager.getTotalSize(),A=_>l?v.scrollbarSize:0,S=x>m?v.scrollbarSize:0;S===this._horizontalScrollBarSize&&A===this._verticalScrollBarSize||(this._horizontalScrollBarSize=S,this._verticalScrollBarSize=A,this._scrollbarPresenceChanged=!0),y.overflowX=x+A<=m?"hidden":"auto",y.overflowY=_+S<=l?"hidden":"auto";var C=this._childrenToDisplay,k=0===C.length&&l>0&&m>0;return p.createElement("div",(0,T.A)({ref:this._setScrollingContainerRef},o,{"aria-label":this.props["aria-label"],"aria-readonly":this.props["aria-readonly"],className:P("ReactVirtualized__Grid",s),id:c,onScroll:this._onScroll,role:d,style:ht(ht({},y),u),tabIndex:f}),C.length>0&&p.createElement("div",{className:"ReactVirtualized__Grid__innerScrollContainer",role:r,style:ht({width:e?"auto":x,height:_,maxWidth:x,maxHeight:_,overflow:"hidden",pointerEvents:b?"none":"",position:"relative"},a)},C),k&&h())}},{key:"_calculateChildrenToRender",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,i=t.cellRenderer,n=t.cellRangeRenderer,s=t.columnCount,o=t.deferredMeasurementCache,r=t.height,a=t.overscanColumnCount,l=t.overscanIndicesGetter,c=t.overscanRowCount,h=t.rowCount,d=t.width,u=t.isScrollingOptOut,p=e.scrollDirectionHorizontal,f=e.scrollDirectionVertical,m=e.instanceProps,g=this._initialScrollTop>0?this._initialScrollTop:e.scrollTop,v=this._initialScrollLeft>0?this._initialScrollLeft:e.scrollLeft,w=this._isScrolling(t,e);if(this._childrenToDisplay=[],r>0&&d>0){var b=m.columnSizeAndPositionManager.getVisibleCellRange({containerSize:d,offset:v}),y=m.rowSizeAndPositionManager.getVisibleCellRange({containerSize:r,offset:g}),x=m.columnSizeAndPositionManager.getOffsetAdjustment({containerSize:d,offset:v}),_=m.rowSizeAndPositionManager.getOffsetAdjustment({containerSize:r,offset:g});this._renderedColumnStartIndex=b.start,this._renderedColumnStopIndex=b.stop,this._renderedRowStartIndex=y.start,this._renderedRowStopIndex=y.stop;var A=l({direction:"horizontal",cellCount:s,overscanCellsCount:a,scrollDirection:p,startIndex:"number"===typeof b.start?b.start:0,stopIndex:"number"===typeof b.stop?b.stop:-1}),S=l({direction:"vertical",cellCount:h,overscanCellsCount:c,scrollDirection:f,startIndex:"number"===typeof y.start?y.start:0,stopIndex:"number"===typeof y.stop?y.stop:-1}),C=A.overscanStartIndex,k=A.overscanStopIndex,M=S.overscanStartIndex,E=S.overscanStopIndex;if(o){if(!o.hasFixedHeight())for(var T=M;T<=E;T++)if(!o.has(T,0)){C=0,k=s-1;break}if(!o.hasFixedWidth())for(var R=C;R<=k;R++)if(!o.has(0,R)){M=0,E=h-1;break}}this._childrenToDisplay=n({cellCache:this._cellCache,cellRenderer:i,columnSizeAndPositionManager:m.columnSizeAndPositionManager,columnStartIndex:C,columnStopIndex:k,deferredMeasurementCache:o,horizontalOffsetAdjustment:x,isScrolling:w,isScrollingOptOut:u,parent:this,rowSizeAndPositionManager:m.rowSizeAndPositionManager,rowStartIndex:M,rowStopIndex:E,scrollLeft:v,scrollTop:g,styleCache:this._styleCache,verticalOffsetAdjustment:_,visibleColumnIndices:b,visibleRowIndices:y}),this._columnStartIndex=C,this._columnStopIndex=k,this._rowStartIndex=M,this._rowStopIndex=E}}},{key:"_debounceScrollEnded",value:function(){var t=this.props.scrollingResetTimeInterval;this._disablePointerEventsTimeoutId&&at(this._disablePointerEventsTimeoutId),this._disablePointerEventsTimeoutId=lt(this._debounceScrollEndedCallback,t)}},{key:"_handleInvalidatedGridSize",value:function(){if("number"===typeof this._deferredInvalidateColumnIndex&&"number"===typeof this._deferredInvalidateRowIndex){var t=this._deferredInvalidateColumnIndex,e=this._deferredInvalidateRowIndex;this._deferredInvalidateColumnIndex=null,this._deferredInvalidateRowIndex=null,this.recomputeGridSize({columnIndex:t,rowIndex:e})}}},{key:"_invokeOnScrollMemoizer",value:function(t){var e=this,i=t.scrollLeft,n=t.scrollTop,s=t.totalColumnsWidth,o=t.totalRowsHeight;this._onScrollMemoizer({callback:function(t){var i=t.scrollLeft,n=t.scrollTop,r=e.props,a=r.height;(0,r.onScroll)({clientHeight:a,clientWidth:r.width,scrollHeight:o,scrollLeft:i,scrollTop:n,scrollWidth:s})},indices:{scrollLeft:i,scrollTop:n}})}},{key:"_isScrolling",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return Object.hasOwnProperty.call(t,"isScrolling")?Boolean(t.isScrolling):Boolean(e.isScrolling)}},{key:"_maybeCallOnScrollbarPresenceChange",value:function(){if(this._scrollbarPresenceChanged){var t=this.props.onScrollbarPresenceChange;this._scrollbarPresenceChanged=!1,t({horizontal:this._horizontalScrollBarSize>0,size:this.state.instanceProps.scrollbarSize,vertical:this._verticalScrollBarSize>0})}}},{key:"scrollToPosition",value:function(t){var i=t.scrollLeft,n=t.scrollTop,s=e._getScrollToPositionStateUpdate({prevState:this.state,scrollLeft:i,scrollTop:n});s&&(s.needToResetStyleCache=!1,this.setState(s))}},{key:"_getCalculatedScrollLeft",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return e._getCalculatedScrollLeft(t,i)}},{key:"_updateScrollLeftForScrollToColumn",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,n=e._getScrollLeftForScrollToColumnStateUpdate(t,i);n&&(n.needToResetStyleCache=!1,this.setState(n))}},{key:"_getCalculatedScrollTop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return e._getCalculatedScrollTop(t,i)}},{key:"_resetStyleCache",value:function(){var t=this._styleCache,e=this._cellCache,i=this.props.isScrollingOptOut;this._cellCache={},this._styleCache={};for(var n=this._rowStartIndex;n<=this._rowStopIndex;n++)for(var s=this._columnStartIndex;s<=this._columnStopIndex;s++){var o="".concat(n,"-").concat(s);this._styleCache[o]=t[o],i&&(this._cellCache[o]=e[o])}}},{key:"_updateScrollTopForScrollToRow",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,n=e._getScrollTopForScrollToRowStateUpdate(t,i);n&&(n.needToResetStyleCache=!1,this.setState(n))}}],[{key:"getDerivedStateFromProps",value:function(t,i){var n={};0===t.columnCount&&0!==i.scrollLeft||0===t.rowCount&&0!==i.scrollTop?(n.scrollLeft=0,n.scrollTop=0):(t.scrollLeft!==i.scrollLeft&&t.scrollToColumn<0||t.scrollTop!==i.scrollTop&&t.scrollToRow<0)&&Object.assign(n,e._getScrollToPositionStateUpdate({prevState:i,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}));var s,o,r=i.instanceProps;return n.needToResetStyleCache=!1,t.columnWidth===r.prevColumnWidth&&t.rowHeight===r.prevRowHeight||(n.needToResetStyleCache=!0),r.columnSizeAndPositionManager.configure({cellCount:t.columnCount,estimatedCellSize:e._getEstimatedColumnSize(t),cellSizeGetter:e._wrapSizeGetter(t.columnWidth)}),r.rowSizeAndPositionManager.configure({cellCount:t.rowCount,estimatedCellSize:e._getEstimatedRowSize(t),cellSizeGetter:e._wrapSizeGetter(t.rowHeight)}),0!==r.prevColumnCount&&0!==r.prevRowCount||(r.prevColumnCount=0,r.prevRowCount=0),t.autoHeight&&!1===t.isScrolling&&!0===r.prevIsScrolling&&Object.assign(n,{isScrolling:!1}),Y({cellCount:r.prevColumnCount,cellSize:"number"===typeof r.prevColumnWidth?r.prevColumnWidth:null,computeMetadataCallback:function(){return r.columnSizeAndPositionManager.resetCell(0)},computeMetadataCallbackProps:t,nextCellsCount:t.columnCount,nextCellSize:"number"===typeof t.columnWidth?t.columnWidth:null,nextScrollToIndex:t.scrollToColumn,scrollToIndex:r.prevScrollToColumn,updateScrollOffsetForScrollToIndex:function(){s=e._getScrollLeftForScrollToColumnStateUpdate(t,i)}}),Y({cellCount:r.prevRowCount,cellSize:"number"===typeof r.prevRowHeight?r.prevRowHeight:null,computeMetadataCallback:function(){return r.rowSizeAndPositionManager.resetCell(0)},computeMetadataCallbackProps:t,nextCellsCount:t.rowCount,nextCellSize:"number"===typeof t.rowHeight?t.rowHeight:null,nextScrollToIndex:t.scrollToRow,scrollToIndex:r.prevScrollToRow,updateScrollOffsetForScrollToIndex:function(){o=e._getScrollTopForScrollToRowStateUpdate(t,i)}}),r.prevColumnCount=t.columnCount,r.prevColumnWidth=t.columnWidth,r.prevIsScrolling=!0===t.isScrolling,r.prevRowCount=t.rowCount,r.prevRowHeight=t.rowHeight,r.prevScrollToColumn=t.scrollToColumn,r.prevScrollToRow=t.scrollToRow,r.scrollbarSize=t.getScrollbarSize(),void 0===r.scrollbarSize?(r.scrollbarSizeMeasured=!1,r.scrollbarSize=0):r.scrollbarSizeMeasured=!0,n.instanceProps=r,ht(ht(ht({},n),s),o)}},{key:"_getEstimatedColumnSize",value:function(t){return"number"===typeof t.columnWidth?t.columnWidth:t.estimatedColumnSize}},{key:"_getEstimatedRowSize",value:function(t){return"number"===typeof t.rowHeight?t.rowHeight:t.estimatedRowSize}},{key:"_getScrollToPositionStateUpdate",value:function(t){var e=t.prevState,i=t.scrollLeft,n=t.scrollTop,s={scrollPositionChangeReason:pt};return"number"===typeof i&&i>=0&&(s.scrollDirectionHorizontal=i>e.scrollLeft?1:-1,s.scrollLeft=i),"number"===typeof n&&n>=0&&(s.scrollDirectionVertical=n>e.scrollTop?1:-1,s.scrollTop=n),"number"===typeof i&&i>=0&&i!==e.scrollLeft||"number"===typeof n&&n>=0&&n!==e.scrollTop?s:{}}},{key:"_wrapSizeGetter",value:function(t){return"function"===typeof t?t:function(){return t}}},{key:"_getCalculatedScrollLeft",value:function(t,e){var i=t.columnCount,n=t.height,s=t.scrollToAlignment,o=t.scrollToColumn,r=t.width,a=e.scrollLeft,l=e.instanceProps;if(i>0){var c=i-1,h=o<0?c:Math.min(c,o),d=l.rowSizeAndPositionManager.getTotalSize(),u=l.scrollbarSizeMeasured&&d>n?l.scrollbarSize:0;return l.columnSizeAndPositionManager.getUpdatedOffsetForIndex({align:s,containerSize:r-u,currentOffset:a,targetIndex:h})}return 0}},{key:"_getScrollLeftForScrollToColumnStateUpdate",value:function(t,i){var n=i.scrollLeft,s=e._getCalculatedScrollLeft(t,i);return"number"===typeof s&&s>=0&&n!==s?e._getScrollToPositionStateUpdate({prevState:i,scrollLeft:s,scrollTop:-1}):{}}},{key:"_getCalculatedScrollTop",value:function(t,e){var i=t.height,n=t.rowCount,s=t.scrollToAlignment,o=t.scrollToRow,r=t.width,a=e.scrollTop,l=e.instanceProps;if(n>0){var c=n-1,h=o<0?c:Math.min(c,o),d=l.columnSizeAndPositionManager.getTotalSize(),u=l.scrollbarSizeMeasured&&d>r?l.scrollbarSize:0;return l.rowSizeAndPositionManager.getUpdatedOffsetForIndex({align:s,containerSize:i-u,currentOffset:a,targetIndex:h})}return 0}},{key:"_getScrollTopForScrollToRowStateUpdate",value:function(t,i){var n=i.scrollTop,s=e._getCalculatedScrollTop(t,i);return"number"===typeof s&&s>=0&&n!==s?e._getScrollToPositionStateUpdate({prevState:i,scrollLeft:-1,scrollTop:s}):{}}}])}(p.PureComponent);(0,u.A)(ft,"defaultProps",{"aria-label":"grid","aria-readonly":!0,autoContainerWidth:!1,autoHeight:!1,autoWidth:!1,cellRangeRenderer:function(t){for(var e=t.cellCache,i=t.cellRenderer,n=t.columnSizeAndPositionManager,s=t.columnStartIndex,o=t.columnStopIndex,r=t.deferredMeasurementCache,a=t.horizontalOffsetAdjustment,l=t.isScrolling,c=t.isScrollingOptOut,h=t.parent,d=t.rowSizeAndPositionManager,u=t.rowStartIndex,f=t.rowStopIndex,m=t.styleCache,g=t.verticalOffsetAdjustment,v=t.visibleColumnIndices,w=t.visibleRowIndices,b=[],y=n.areOffsetsAdjusted()||d.areOffsetsAdjusted(),x=!l&&!y,_=u;_<=f;_++)for(var A=d.getSizeAndPositionOfCell(_),S=s;S<=o;S++){var C=n.getSizeAndPositionOfCell(S),k=S>=v.start&&S<=v.stop&&_>=w.start&&_<=w.stop,M="".concat(_,"-").concat(S),E=void 0;x&&m[M]?E=m[M]:r&&!r.has(_,S)?E={height:"auto",left:0,position:"absolute",top:0,width:"auto"}:(E={height:A.size,left:C.offset+a,position:"absolute",top:A.offset+g,width:C.size},m[M]=E);var T={columnIndex:S,isScrolling:l,isVisible:k,key:M,parent:h,rowIndex:_,style:E},R=void 0;!c&&!l||a||g?R=i(T):(e[M]||(e[M]=i(T)),R=e[M]),null!=R&&!1!==R&&(R.props.role||(R=p.cloneElement(R,{role:"gridcell"})),b.push(R))}return b},containerRole:"row",containerStyle:{},estimatedColumnSize:100,estimatedRowSize:30,getScrollbarSize:O,noContentRenderer:function(){return null},onScroll:function(){},onScrollbarPresenceChange:function(){},onSectionRendered:function(){},overscanColumnCount:0,overscanIndicesGetter:function(t){var e=t.cellCount,i=t.overscanCellsCount,n=t.scrollDirection,s=t.startIndex,o=t.stopIndex;return 1===n?{overscanStartIndex:Math.max(0,s),overscanStopIndex:Math.min(e-1,o+i)}:{overscanStartIndex:Math.max(0,s-i),overscanStopIndex:Math.min(e-1,o)}},overscanRowCount:10,role:"grid",scrollingResetTimeInterval:150,scrollToAlignment:"auto",scrollToColumn:-1,scrollToRow:-1,style:{},tabIndex:0,isScrollingOptOut:!1}),v(ft);const mt=ft;function gt(t){var e=t.cellCount,i=t.overscanCellsCount,n=t.scrollDirection,s=t.startIndex,o=t.stopIndex;return i=Math.max(1,i),1===n?{overscanStartIndex:Math.max(0,s-1),overscanStopIndex:Math.min(e-1,o+i)}:{overscanStartIndex:Math.max(0,s-i),overscanStopIndex:Math.min(e-1,o+1)}}function vt(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);ii||s1&&void 0!==arguments[1]?arguments[1]:0,i="function"===typeof t.recomputeGridSize?t.recomputeGridSize:t.recomputeRowHeights;i?i.call(t,e):t.forceUpdate()}(e._registeredChild,e._lastRenderedStartIndex)})})}},{key:"_onRowsRendered",value:function(t){var e=t.startIndex,i=t.stopIndex;this._lastRenderedStartIndex=e,this._lastRenderedStopIndex=i,this._doStuff(e,i)}},{key:"_doStuff",value:function(t,e){var i,n=this,s=this.props,o=s.isRowLoaded,r=s.minimumBatchSize,a=s.rowCount,l=s.threshold,c=function(t){for(var e=t.isRowLoaded,i=t.minimumBatchSize,n=t.rowCount,s=t.startIndex,o=t.stopIndex,r=[],a=null,l=null,c=s;c<=o;c++){e({index:c})?null!==l&&(r.push({startIndex:a,stopIndex:l}),a=l=null):(l=c,null===a&&(a=c))}if(null!==l){for(var h=Math.min(Math.max(l,a+i-1),n-1),d=l+1;d<=h&&!e({index:d});d++)l=d;r.push({startIndex:a,stopIndex:l})}if(r.length)for(var u=r[0];u.stopIndex-u.startIndex+10;){var p=u.startIndex-1;if(e({index:p}))break;u.startIndex=p}return r}({isRowLoaded:o,minimumBatchSize:r,rowCount:a,startIndex:Math.max(0,t-l),stopIndex:Math.min(a-1,e+l)}),h=(i=[]).concat.apply(i,bt(c.map(function(t){return[t.startIndex,t.stopIndex]})));this._loadMoreRowsMemoizer({callback:function(){n._loadUnloadedRanges(c)},indices:{squashedUnloadedRanges:h}})}},{key:"_registerChild",value:function(t){this._registeredChild=t}}])}(p.PureComponent);(0,u.A)(xt,"defaultProps",{minimumBatchSize:10,rowCount:0,threshold:15}),xt.propTypes={};function _t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_t=function(){return!!t})()}var At=function(t){function e(){var t,i,s,o;n(this,e);for(var r=arguments.length,a=new Array(r),h=0;h0&&void 0!==arguments[0]?arguments[0]:{},e=t.columnIndex,i=void 0===e?0:e,n=t.rowIndex,s=void 0===n?0:n;this.Grid&&this.Grid.recomputeGridSize({rowIndex:s,columnIndex:i})}},{key:"recomputeRowHeights",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.recomputeGridSize({rowIndex:t,columnIndex:0})}},{key:"scrollToPosition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToPosition({scrollTop:t})}},{key:"scrollToRow",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToCell({columnIndex:0,rowIndex:t})}},{key:"render",value:function(){var t=this.props,e=t.className,i=t.noRowsRenderer,n=t.scrollToIndex,s=t.width,o=P("ReactVirtualized__List",e);return p.createElement(mt,(0,T.A)({},this.props,{autoContainerWidth:!0,cellRenderer:this._cellRenderer,className:o,columnWidth:s,columnCount:1,noContentRenderer:i,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:this._setRef,scrollToRow:n}))}}])}(p.PureComponent);function St(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,o,r,a=[],l=!0,c=!1;try{if(o=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=o.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){c=!0,s=t}finally{try{if(!l&&null!=i.return&&(r=i.return(),Object(r)!==r))return}finally{if(c)throw s}}return a}}(t,e)||wt(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(0,u.A)(At,"defaultProps",{autoHeight:!1,estimatedRowSize:30,onScroll:function(){},noRowsRenderer:function(){return null},onRowsRendered:function(){},overscanIndicesGetter:gt,overscanRowCount:10,scrollToAlignment:"auto",scrollToIndex:-1,style:{}});const Ct={ge:function(t,e,i,n,s){return"function"===typeof i?function(t,e,i,n,s){for(var o=i+1;e<=i;){var r=e+i>>>1;s(t[r],n)>=0?(o=r,i=r-1):e=r+1}return o}(t,void 0===n?0:0|n,void 0===s?t.length-1:0|s,e,i):function(t,e,i,n){for(var s=i+1;e<=i;){var o=e+i>>>1;t[o]>=n?(s=o,i=o-1):e=o+1}return s}(t,void 0===i?0:0|i,void 0===n?t.length-1:0|n,e)},gt:function(t,e,i,n,s){return"function"===typeof i?function(t,e,i,n,s){for(var o=i+1;e<=i;){var r=e+i>>>1;s(t[r],n)>0?(o=r,i=r-1):e=r+1}return o}(t,void 0===n?0:0|n,void 0===s?t.length-1:0|s,e,i):function(t,e,i,n){for(var s=i+1;e<=i;){var o=e+i>>>1;t[o]>n?(s=o,i=o-1):e=o+1}return s}(t,void 0===i?0:0|i,void 0===n?t.length-1:0|n,e)},lt:function(t,e,i,n,s){return"function"===typeof i?function(t,e,i,n,s){for(var o=e-1;e<=i;){var r=e+i>>>1;s(t[r],n)<0?(o=r,e=r+1):i=r-1}return o}(t,void 0===n?0:0|n,void 0===s?t.length-1:0|s,e,i):function(t,e,i,n){for(var s=e-1;e<=i;){var o=e+i>>>1;t[o]>>1;s(t[r],n)<=0?(o=r,e=r+1):i=r-1}return o}(t,void 0===n?0:0|n,void 0===s?t.length-1:0|s,e,i):function(t,e,i,n){for(var s=e-1;e<=i;){var o=e+i>>>1;t[o]<=n?(s=o,e=o+1):i=o-1}return s}(t,void 0===i?0:0|i,void 0===n?t.length-1:0|n,e)},eq:function(t,e,i,n,s){return"function"===typeof i?function(t,e,i,n,s){for(;e<=i;){var o=e+i>>>1,r=s(t[o],n);if(0===r)return o;r<=0?e=o+1:i=o-1}return-1}(t,void 0===n?0:0|n,void 0===s?t.length-1:0|s,e,i):function(t,e,i,n){for(;e<=i;){var s=e+i>>>1,o=t[s];if(o===n)return s;o<=n?e=s+1:i=s-1}return-1}(t,void 0===i?0:0|i,void 0===n?t.length-1:0|n,e)}};function kt(t,e,i,n,s){this.mid=t,this.left=e,this.right=i,this.leftPoints=n,this.rightPoints=s,this.count=(e?e.count:0)+(i?i.count:0)+n.length}var Mt=kt.prototype;function Et(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function Tt(t,e){var i=Nt(e);t.mid=i.mid,t.left=i.left,t.right=i.right,t.leftPoints=i.leftPoints,t.rightPoints=i.rightPoints,t.count=i.count}function Rt(t,e){var i=t.intervals([]);i.push(e),Tt(t,i)}function Pt(t,e){var i=t.intervals([]),n=i.indexOf(e);return n<0?0:(i.splice(n,1),Tt(t,i),1)}function It(t,e,i){for(var n=0;n=0&&t[n][1]>=e;--n){var s=i(t[n]);if(s)return s}}function Lt(t,e){for(var i=0;i>1],s=[],o=[],r=[];for(i=0;i3*(e+1)?Rt(this,t):this.left.insert(t):this.left=Nt([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?Rt(this,t):this.right.insert(t):this.right=Nt([t]);else{var i=Ct.ge(this.leftPoints,t,Ft),n=Ct.ge(this.rightPoints,t,zt);this.leftPoints.splice(i,0,t),this.rightPoints.splice(n,0,t)}},Mt.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?Pt(this,t):2===(o=this.left.remove(t))?(this.left=null,this.count-=1,1):(1===o&&(this.count-=1),o):0;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?Pt(this,t):2===(o=this.right.remove(t))?(this.right=null,this.count-=1,1):(1===o&&(this.count-=1),o):0;if(1===this.count)return this.leftPoints[0]===t?2:0;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var i=this,n=this.left;n.right;)i=n,n=n.right;if(i===this)n.right=this.right;else{var s=this.left,o=this.right;i.count-=n.count,i.right=n.left,n.left=s,n.right=o}Et(this,n),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?Et(this,this.left):Et(this,this.right);return 1}for(s=Ct.ge(this.leftPoints,t,Ft);sthis.mid){var i;if(this.right)if(i=this.right.queryPoint(t,e))return i;return Dt(this.rightPoints,t,e)}return Lt(this.leftPoints,e)},Mt.queryInterval=function(t,e,i){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,i)))return n;return ethis.mid?Dt(this.rightPoints,t,i):Lt(this.leftPoints,i)};var Wt=Bt.prototype;Wt.insert=function(t){this.root?this.root.insert(t):this.root=new kt(t[0],null,null,[t],[t])},Wt.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),0!==e}return!1},Wt.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},Wt.queryInterval=function(t,e,i){if(t<=e&&this.root)return this.root.queryInterval(t,e,i)},Object.defineProperty(Wt,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(Wt,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});var jt=function(){return r(function t(){var e;n(this,t),(0,u.A)(this,"_columnSizeMap",{}),(0,u.A)(this,"_intervalTree",e&&0!==e.length?new Bt(Nt(e)):new Bt(null)),(0,u.A)(this,"_leftMap",{})},[{key:"estimateTotalHeight",value:function(t,e,i){var n=t-this.count;return this.tallestColumnSize+Math.ceil(n/e)*i}},{key:"range",value:function(t,e,i){var n=this;this._intervalTree.queryInterval(t,t+e,function(t){var e=St(t,3),s=e[0],o=(e[1],e[2]);return i(o,n._leftMap[o],s)})}},{key:"setPosition",value:function(t,e,i,n){this._intervalTree.insert([i,i+n,t]),this._leftMap[t]=e;var s=this._columnSizeMap,o=s[e];s[e]=void 0===o?i+n:Math.max(o,i+n)}},{key:"count",get:function(){return this._intervalTree.count}},{key:"shortestColumnSize",get:function(){var t=this._columnSizeMap,e=0;for(var i in t){var n=t[i];e=0===e?n:Math.min(e,n)}return e}},{key:"tallestColumnSize",get:function(){var t=this._columnSizeMap,e=0;for(var i in t){var n=t[i];e=Math.max(e,n)}return e}}])}();function Gt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Ht(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};n(this,t),(0,u.A)(this,"_cellMeasurerCache",void 0),(0,u.A)(this,"_columnIndexOffset",void 0),(0,u.A)(this,"_rowIndexOffset",void 0),(0,u.A)(this,"columnWidth",function(t){var i=t.index;e._cellMeasurerCache.columnWidth({index:i+e._columnIndexOffset})}),(0,u.A)(this,"rowHeight",function(t){var i=t.index;e._cellMeasurerCache.rowHeight({index:i+e._rowIndexOffset})});var s=i.cellMeasurerCache,o=i.columnIndexOffset,r=void 0===o?0:o,a=i.rowIndexOffset,l=void 0===a?0:a;this._cellMeasurerCache=s,this._columnIndexOffset=r,this._rowIndexOffset=l},[{key:"clear",value:function(t,e){this._cellMeasurerCache.clear(t+this._rowIndexOffset,e+this._columnIndexOffset)}},{key:"clearAll",value:function(){this._cellMeasurerCache.clearAll()}},{key:"defaultHeight",get:function(){return this._cellMeasurerCache.defaultHeight}},{key:"defaultWidth",get:function(){return this._cellMeasurerCache.defaultWidth}},{key:"hasFixedHeight",value:function(){return this._cellMeasurerCache.hasFixedHeight()}},{key:"hasFixedWidth",value:function(){return this._cellMeasurerCache.hasFixedWidth()}},{key:"getHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._cellMeasurerCache.getHeight(t+this._rowIndexOffset,e+this._columnIndexOffset)}},{key:"getWidth",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._cellMeasurerCache.getWidth(t+this._rowIndexOffset,e+this._columnIndexOffset)}},{key:"has",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._cellMeasurerCache.has(t+this._rowIndexOffset,e+this._columnIndexOffset)}},{key:"set",value:function(t,e,i,n){this._cellMeasurerCache.set(t+this._rowIndexOffset,e+this._columnIndexOffset,i,n)}}])}(),Kt=["rowIndex"],Yt=["columnIndex","rowIndex"],Jt=["columnIndex"],Qt=["onScroll","onSectionRendered","onScrollbarPresenceChange","scrollLeft","scrollToColumn","scrollTop","scrollToRow"];function Zt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function $t(t){for(var e=1;e0?new Xt({cellMeasurerCache:h,columnIndexOffset:0,rowIndexOffset:f}):h,s._deferredMeasurementCacheBottomRightGrid=d>0||f>0?new Xt({cellMeasurerCache:h,columnIndexOffset:d,rowIndexOffset:f}):h,s._deferredMeasurementCacheTopRightGrid=d>0?new Xt({cellMeasurerCache:h,columnIndexOffset:d,rowIndexOffset:0}):h),s}return d(e,t),r(e,[{key:"forceUpdateGrids",value:function(){this._bottomLeftGrid&&this._bottomLeftGrid.forceUpdate(),this._bottomRightGrid&&this._bottomRightGrid.forceUpdate(),this._topLeftGrid&&this._topLeftGrid.forceUpdate(),this._topRightGrid&&this._topRightGrid.forceUpdate()}},{key:"invalidateCellSizeAfterRender",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.columnIndex,i=void 0===e?0:e,n=t.rowIndex,s=void 0===n?0:n;this._deferredInvalidateColumnIndex="number"===typeof this._deferredInvalidateColumnIndex?Math.min(this._deferredInvalidateColumnIndex,i):i,this._deferredInvalidateRowIndex="number"===typeof this._deferredInvalidateRowIndex?Math.min(this._deferredInvalidateRowIndex,s):s}},{key:"measureAllCells",value:function(){this._bottomLeftGrid&&this._bottomLeftGrid.measureAllCells(),this._bottomRightGrid&&this._bottomRightGrid.measureAllCells(),this._topLeftGrid&&this._topLeftGrid.measureAllCells(),this._topRightGrid&&this._topRightGrid.measureAllCells()}},{key:"recomputeGridSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.columnIndex,i=void 0===e?0:e,n=t.rowIndex,s=void 0===n?0:n,o=this.props,r=o.fixedColumnCount,a=o.fixedRowCount,l=Math.max(0,i-r),c=Math.max(0,s-a);this._bottomLeftGrid&&this._bottomLeftGrid.recomputeGridSize({columnIndex:i,rowIndex:c}),this._bottomRightGrid&&this._bottomRightGrid.recomputeGridSize({columnIndex:l,rowIndex:c}),this._topLeftGrid&&this._topLeftGrid.recomputeGridSize({columnIndex:i,rowIndex:s}),this._topRightGrid&&this._topRightGrid.recomputeGridSize({columnIndex:l,rowIndex:s}),this._leftGridWidth=null,this._topGridHeight=null,this._maybeCalculateCachedStyles(!0)}},{key:"componentDidMount",value:function(){var t=this.props,e=t.scrollLeft,i=t.scrollTop;if(e>0||i>0){var n={};e>0&&(n.scrollLeft=e),i>0&&(n.scrollTop=i),this.setState(n)}this._handleInvalidatedGridSize()}},{key:"componentDidUpdate",value:function(){this._handleInvalidatedGridSize()}},{key:"render",value:function(){var t=this.props,e=t.onScroll,i=t.onSectionRendered,n=(t.onScrollbarPresenceChange,t.scrollLeft,t.scrollToColumn),s=(t.scrollTop,t.scrollToRow),o=(0,Q.A)(t,Qt);if(this._prepareForRender(),0===this.props.width||0===this.props.height)return null;var r=this.state,a=r.scrollLeft,l=r.scrollTop;return p.createElement("div",{style:this._containerOuterStyle},p.createElement("div",{style:this._containerTopStyle},this._renderTopLeftGrid(o),this._renderTopRightGrid($t($t({},o),{},{onScroll:e,scrollLeft:a}))),p.createElement("div",{style:this._containerBottomStyle},this._renderBottomLeftGrid($t($t({},o),{},{onScroll:e,scrollTop:l})),this._renderBottomRightGrid($t($t({},o),{},{onScroll:e,onSectionRendered:i,scrollLeft:a,scrollToColumn:n,scrollToRow:s,scrollTop:l}))))}},{key:"_getBottomGridHeight",value:function(t){return t.height-this._getTopGridHeight(t)}},{key:"_getLeftGridWidth",value:function(t){var e=t.fixedColumnCount,i=t.columnWidth;if(null==this._leftGridWidth)if("function"===typeof i){for(var n=0,s=0;s=0?t.scrollLeft:e.scrollLeft,scrollTop:null!=t.scrollTop&&t.scrollTop>=0?t.scrollTop:e.scrollTop}:null}}])}(p.PureComponent);(0,u.A)(ee,"defaultProps",{classNameBottomLeftGrid:"",classNameBottomRightGrid:"",classNameTopLeftGrid:"",classNameTopRightGrid:"",enableFixedColumnScroll:!1,enableFixedRowScroll:!1,fixedColumnCount:0,fixedRowCount:0,scrollToColumn:-1,scrollToRow:-1,style:{},styleBottomLeftGrid:{},styleBottomRightGrid:{},styleTopLeftGrid:{},styleTopRightGrid:{},hideTopRightGridScrollbar:!1,hideBottomLeftGridScrollbar:!1}),ee.propTypes={},v(ee);function ie(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ie=function(){return!!t})()}(function(t){function e(t,i){var s,o,r,a;return n(this,e),o=this,a=[t,i],r=c(r=e),(s=l(o,ie()?Reflect.construct(r,a||[],c(o).constructor):r.apply(o,a))).state={clientHeight:0,clientWidth:0,scrollHeight:0,scrollLeft:0,scrollTop:0,scrollWidth:0},s._onScroll=s._onScroll.bind(s),s}return d(e,t),r(e,[{key:"render",value:function(){var t=this.props.children,e=this.state,i=e.clientHeight,n=e.clientWidth,s=e.scrollHeight,o=e.scrollLeft,r=e.scrollTop,a=e.scrollWidth;return t({clientHeight:i,clientWidth:n,onScroll:this._onScroll,scrollHeight:s,scrollLeft:o,scrollTop:r,scrollWidth:a})}},{key:"_onScroll",value:function(t){var e=t.clientHeight,i=t.clientWidth,n=t.scrollHeight,s=t.scrollLeft,o=t.scrollTop,r=t.scrollWidth;this.setState({clientHeight:e,clientWidth:i,scrollHeight:n,scrollLeft:s,scrollTop:o,scrollWidth:r})}}])}(p.PureComponent)).propTypes={};const ne={ASC:"ASC",DESC:"DESC"};function se(t){var e=t.sortDirection,i=P("ReactVirtualized__Table__sortableHeaderIcon",{"ReactVirtualized__Table__sortableHeaderIcon--ASC":e===ne.ASC,"ReactVirtualized__Table__sortableHeaderIcon--DESC":e===ne.DESC});return p.createElement("svg",{className:i,width:18,height:18,viewBox:"0 0 24 24"},e===ne.ASC?p.createElement("path",{d:"M7 14l5-5 5 5z"}):p.createElement("path",{d:"M7 10l5 5 5-5z"}),p.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}function oe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(oe=function(){return!!t})()}se.propTypes={};var re=function(t){function e(){return n(this,e),t=this,s=arguments,i=c(i=e),l(t,oe()?Reflect.construct(i,s||[],c(t).constructor):i.apply(t,s));var t,i,s}return d(e,t),r(e)}(p.Component);function ae(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function le(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{},e=t.columnIndex,i=void 0===e?0:e,n=t.rowIndex,s=void 0===n?0:n;this.Grid&&this.Grid.recomputeGridSize({rowIndex:s,columnIndex:i})}},{key:"recomputeRowHeights",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.recomputeGridSize({rowIndex:t})}},{key:"scrollToPosition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToPosition({scrollTop:t})}},{key:"scrollToRow",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToCell({columnIndex:0,rowIndex:t})}},{key:"getScrollbarWidth",value:function(){if(this.GridElement){var t=this.GridElement,e=t.clientWidth||0;return(t.offsetWidth||0)-e}return 0}},{key:"componentDidMount",value:function(){this._setScrollbarWidth()}},{key:"componentDidUpdate",value:function(){this._setScrollbarWidth()}},{key:"render",value:function(){var t=this,e=this.props,i=e.children,n=e.className,s=e.disableHeader,o=e.gridClassName,r=e.gridStyle,a=e.headerHeight,l=e.headerRowRenderer,c=e.height,h=e.id,d=e.noRowsRenderer,u=e.rowClassName,f=e.rowStyle,m=e.scrollToIndex,g=e.style,v=e.width,w=this.state.scrollbarWidth,b=s?c:c-a,y="function"===typeof u?u({index:-1}):u,x="function"===typeof f?f({index:-1}):f;return this._cachedColumnStyles=[],p.Children.toArray(i).forEach(function(e,i){var n=t._getFlexStyleForColumn(e,e.props.style||re.defaultProps.style);t._cachedColumnStyles[i]=le({overflow:"hidden"},n)}),p.createElement("div",{"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-colcount":p.Children.toArray(i).length,"aria-rowcount":this.props.rowCount,className:P("ReactVirtualized__Table",n),id:h,role:"grid",style:g},!s&&l({className:P("ReactVirtualized__Table__headerRow",y),columns:this._getHeaderColumns(),style:le({height:a,overflow:"hidden",paddingRight:w,width:v},x)}),p.createElement(mt,(0,T.A)({},this.props,{elementRef:this._setGridElementRef,"aria-readonly":null,autoContainerWidth:!0,className:P("ReactVirtualized__Table__Grid",o),cellRenderer:this._createRow,columnWidth:v,columnCount:1,height:b,id:void 0,noContentRenderer:d,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:this._setRef,role:"rowgroup",scrollbarWidth:w,scrollToRow:m,style:le(le({},r),{},{overflowX:"hidden"})})))}},{key:"_createColumn",value:function(t){var e=t.column,i=t.columnIndex,n=t.isScrolling,s=t.parent,o=t.rowData,r=t.rowIndex,a=this.props.onColumnClick,l=e.props,c=l.cellDataGetter,h=l.cellRenderer,d=l.className,u=l.columnData,f=l.dataKey,m=l.id,g=h({cellData:c({columnData:u,dataKey:f,rowData:o}),columnData:u,columnIndex:i,dataKey:f,isScrolling:n,parent:s,rowData:o,rowIndex:r}),v=this._cachedColumnStyles[i],w="string"===typeof g?g:null;return p.createElement("div",{"aria-colindex":i+1,"aria-describedby":m,className:P("ReactVirtualized__Table__rowColumn",d),key:"Row"+r+"-Col"+i,onClick:function(t){a&&a({columnData:u,dataKey:f,event:t})},role:"gridcell",style:v,title:w},g)}},{key:"_createHeader",value:function(t){var e,i,n,s,o,r=t.column,a=t.index,l=this.props,c=l.headerClassName,h=l.headerStyle,d=l.onHeaderClick,u=l.sort,f=l.sortBy,m=l.sortDirection,g=r.props,v=g.columnData,w=g.dataKey,b=g.defaultSortDirection,y=g.disableSort,x=g.headerRenderer,_=g.id,A=g.label,S=!y&&u,C=P("ReactVirtualized__Table__headerColumn",c,r.props.headerClassName,{ReactVirtualized__Table__sortableHeaderColumn:S}),k=this._getFlexStyleForColumn(r,le(le({},h),r.props.headerStyle)),M=x({columnData:v,dataKey:w,disableSort:y,label:A,sortBy:f,sortDirection:m});if(S||d){var E=f!==w?b:m===ne.DESC?ne.ASC:ne.DESC,T=function(t){S&&u({defaultSortDirection:b,event:t,sortBy:w,sortDirection:E}),d&&d({columnData:v,dataKey:w,event:t})};o=r.props["aria-label"]||A||w,s="none",n=0,e=T,i=function(t){"Enter"!==t.key&&" "!==t.key||T(t)}}return f===w&&(s=m===ne.ASC?"ascending":"descending"),p.createElement("div",{"aria-label":o,"aria-sort":s,className:C,id:_,key:"Header-Col"+a,onClick:e,onKeyDown:i,role:"columnheader",style:k,tabIndex:n},M)}},{key:"_createRow",value:function(t){var e=this,i=t.rowIndex,n=t.isScrolling,s=t.key,o=t.parent,r=t.style,a=this.props,l=a.children,c=a.onRowClick,h=a.onRowDoubleClick,d=a.onRowRightClick,u=a.onRowMouseOver,f=a.onRowMouseOut,m=a.rowClassName,g=a.rowGetter,v=a.rowRenderer,w=a.rowStyle,b=this.state.scrollbarWidth,y="function"===typeof m?m({index:i}):m,x="function"===typeof w?w({index:i}):w,_=g({index:i}),A=p.Children.toArray(l).map(function(t,s){return e._createColumn({column:t,columnIndex:s,isScrolling:n,parent:o,rowData:_,rowIndex:i,scrollbarWidth:b})}),S=P("ReactVirtualized__Table__row",y),C=le(le({},r),{},{height:this._getRowHeight(i),overflow:"hidden",paddingRight:b},x);return v({className:S,columns:A,index:i,isScrolling:n,key:s,onRowClick:c,onRowDoubleClick:h,onRowRightClick:d,onRowMouseOver:u,onRowMouseOut:f,rowData:_,style:C})}},{key:"_getFlexStyleForColumn",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="".concat(t.props.flexGrow," ").concat(t.props.flexShrink," ").concat(t.props.width,"px"),n=le(le({},e),{},{flex:i,msFlex:i,WebkitFlex:i});return t.props.maxWidth&&(n.maxWidth=t.props.maxWidth),t.props.minWidth&&(n.minWidth=t.props.minWidth),n}},{key:"_getHeaderColumns",value:function(){var t=this,e=this.props,i=e.children;return(e.disableHeader?[]:p.Children.toArray(i)).map(function(e,i){return t._createHeader({column:e,index:i})})}},{key:"_getRowHeight",value:function(t){var e=this.props.rowHeight;return"function"===typeof e?e({index:t}):e}},{key:"_onScroll",value:function(t){var e=t.clientHeight,i=t.scrollHeight,n=t.scrollTop;(0,this.props.onScroll)({clientHeight:e,scrollHeight:i,scrollTop:n})}},{key:"_onSectionRendered",value:function(t){var e=t.rowOverscanStartIndex,i=t.rowOverscanStopIndex,n=t.rowStartIndex,s=t.rowStopIndex;(0,this.props.onRowsRendered)({overscanStartIndex:e,overscanStopIndex:i,startIndex:n,stopIndex:s})}},{key:"_setRef",value:function(t){this.Grid=t}},{key:"_setGridElementRef",value:function(t){this.GridElement=t}},{key:"_setScrollbarWidth",value:function(){var t=this.getScrollbarWidth();this.setState({scrollbarWidth:t})}}])}(p.PureComponent);(0,u.A)(he,"defaultProps",{disableHeader:!1,estimatedRowSize:30,headerHeight:0,headerStyle:{},noRowsRenderer:function(){return null},onRowsRendered:function(){return null},onScroll:function(){return null},overscanIndicesGetter:gt,overscanRowCount:10,rowRenderer:function(t){var e=t.className,i=t.columns,n=t.index,s=t.key,o=t.onRowClick,r=t.onRowDoubleClick,a=t.onRowMouseOut,l=t.onRowMouseOver,c=t.onRowRightClick,h=t.rowData,d=t.style,u={"aria-rowindex":n+1};return(o||r||a||l||c)&&(u["aria-label"]="row",u.tabIndex=0,o&&(u.onClick=function(t){return o({event:t,index:n,rowData:h})}),r&&(u.onDoubleClick=function(t){return r({event:t,index:n,rowData:h})}),a&&(u.onMouseOut=function(t){return a({event:t,index:n,rowData:h})}),l&&(u.onMouseOver=function(t){return l({event:t,index:n,rowData:h})}),c&&(u.onContextMenu=function(t){return c({event:t,index:n,rowData:h})})),p.createElement("div",(0,T.A)({},u,{className:e,key:s,role:"row",style:d}),i)},headerRowRenderer:function(t){var e=t.className,i=t.columns,n=t.style;return p.createElement("div",{className:e,role:"row",style:n},i)},rowStyle:{},scrollToAlignment:"auto",scrollToIndex:-1,style:{}}),he.propTypes={};var de=[],ue=null,pe=null;function fe(){pe&&(pe=null,document.body&&null!=ue&&(document.body.style.pointerEvents=ue),ue=null)}function me(){fe(),de.forEach(function(t){return t.__resetIsScrolling()})}function ge(t){t.currentTarget===window&&null==ue&&document.body&&(ue=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),function(){pe&&at(pe);var t=0;de.forEach(function(e){t=Math.max(t,e.props.scrollingResetTimeInterval)}),pe=lt(me,t)}(),de.forEach(function(e){e.props.scrollElement===t.currentTarget&&e.__handleWindowScrollEvent()})}function ve(t,e){de.some(function(t){return t.props.scrollElement===e})||e.addEventListener("scroll",ge),de.push(t)}function we(t,e){(de=de.filter(function(e){return e!==t})).length||(e.removeEventListener("scroll",ge),pe&&(at(pe),fe()))}var be=function(t){return t===window},ye=function(t){return t.getBoundingClientRect()};function xe(t,e){if(t){if(be(t)){var i=window,n=i.innerHeight,s=i.innerWidth;return{height:"number"===typeof n?n:0,width:"number"===typeof s?s:0}}return ye(t)}return{height:e.serverHeight,width:e.serverWidth}}function _e(t){return be(t)&&document.documentElement?{top:"scrollY"in window?window.scrollY:document.documentElement.scrollTop,left:"scrollX"in window?window.scrollX:document.documentElement.scrollLeft}:{top:t.scrollTop,left:t.scrollLeft}}function Ae(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Se(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:this.props.scrollElement,e=this.props.onResize,i=this.state,n=i.height,s=i.width,o=this._child||this._windowScrollerRef.current;if(o instanceof Element&&t){var r=function(t,e){if(be(e)&&document.documentElement){var i=document.documentElement,n=ye(t),s=ye(i);return{top:n.top-s.top,left:n.left-s.left}}var o=_e(e),r=ye(t),a=ye(e);return{top:r.top+o.top-a.top,left:r.left+o.left-a.left}}(o,t);this._positionFromTop=r.top,this._positionFromLeft=r.left}var a=xe(t,this.props);n===a.height&&s===a.width||(this.setState({height:a.height,width:a.width}),e({height:a.height,width:a.width})),!0===this.props.updateScrollTopOnUpdatePosition&&(this.__handleWindowScrollEvent(),this.__resetIsScrolling())}},{key:"componentDidMount",value:function(){var t=this.props.scrollElement;this._detectElementResize=_(),this.updatePosition(t),t&&(ve(this,t),this._registerResizeListener(t)),this._isMounted=!0}},{key:"componentDidUpdate",value:function(t,e){var i=this.props.scrollElement,n=t.scrollElement;n!==i&&null!=n&&null!=i&&(this.updatePosition(i),we(this,n),ve(this,i),this._unregisterResizeListener(n),this._registerResizeListener(i))}},{key:"componentWillUnmount",value:function(){var t=this.props.scrollElement;t&&(we(this,t),this._unregisterResizeListener(t)),this._isMounted=!1}},{key:"render",value:function(){var t=this.props.children,e=this.state,i=e.isScrolling,n=e.scrollTop,s=e.scrollLeft,o=e.height,r=e.width;return p.createElement("div",{ref:this._windowScrollerRef},t({onChildScroll:this._onChildScroll,registerChild:this._registerChild,height:o,isScrolling:i,scrollLeft:s,scrollTop:n,width:r}))}}])}(p.PureComponent);(0,u.A)(Me,"defaultProps",{onResize:function(){},onScroll:function(){},scrollingResetTimeInterval:150,scrollElement:ke(),serverHeight:0,serverWidth:0})},86189:(t,e)=>{"use strict";e.__esModule=!0,e.default=function(t,e){if(t&&e){var i=Array.isArray(e)?e:e.split(",");if(0===i.length)return!0;var n=t.name||"",s=(t.type||"").toLowerCase(),o=s.replace(/\/.*$/,"");return i.some(function(t){var e=t.trim().toLowerCase();return"."===e.charAt(0)?n.toLowerCase().endsWith(e):e.endsWith("/*")?o===e.replace(/\/.*$/,""):s===e})}return!0}},94702:(t,e,i)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.CopyToClipboard=void 0;var s=a(i(9950)),o=a(i(67243)),r=["text","onCopy","options","children"];function a(t){return t&&t.__esModule?t:{default:t}}function l(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function c(t){for(var e=1;e=0||(s[i]=t[i]);return s}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}function d(t,e){for(var i=0;i{"use strict";var n=i(94702).CopyToClipboard;n.CopyToClipboard=n,t.exports=n}}]); ================================================ FILE: web-app/build/static/js/1621.35fa42d6.chunk.js.LICENSE.txt ================================================ /** * @licstart The following is the entire license notice for the * JavaScript code in this page * * Copyright 2024 Mozilla Foundation * * 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. * * @licend The above is the entire license notice for the * JavaScript code in this page */ ================================================ FILE: web-app/build/static/js/1634.23887961.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[1634,4945],{3796:(e,t,n)=>{n.d(t,{_:()=>r});var s=n(59908),o=n(26347),i=n(45176),a=n(45536),l=n(49078);const r=(e,t,n,r)=>{var c;const d=encodeURIComponent("".concat(t,"-").concat(r.name,"-").concat((new Date).getTime(),"-").concat(Math.random())),u=(0,s.oK)().toLowerCase().includes("win");if(((null===(c=r.name)||void 0===c?void 0:c.length)||0)>200&&u)return void e((0,a.Jl)(!0));const h=(0,o.E0)(8),m=(0,i.RG)(t,n,r.version_id,r.size||0,null,h,t=>{e((0,a.DW)({instanceID:d,progress:t}))},()=>{e((0,a.rx)(d))},t=>{e((0,a.iL)({instanceID:d,msg:t}))},()=>{e((0,a.Dm)(d))},()=>{e((0,l.Hk)("File download will be handled directly by the browser."))});(0,o.FP)(h,m),e((0,a.cP)({ID:h,bucketName:t,done:!1,instanceID:d,percentage:0,prefix:r.name||"",type:"download",waitingForFile:!0,failed:!1,cancelled:!1,errorMessage:""}))}},18949:(e,t,n)=>{n.d(t,{Ex:()=>p,HS:()=>h,mS:()=>m,op:()=>u,oz:()=>x});var s=n(11359),o=n(59908),i=n(26347),a=n(45176),l=n(45536),r=n(49078),c=n(43217),d=n(70444);const u=(0,s.zD)("objectBrowser/downloadSelected",async(e,t)=>{let{getState:n,rejectWithValue:s,dispatch:d}=t;const u=n(),h=t=>{const n=encodeURIComponent("".concat(e,"-").concat(t.name,"-").concat((new Date).getTime(),"-").concat(Math.random())),s=(0,i.E0)(8),o=(0,a.RG)(e,t.name,t.version_id,t.size,null,s,e=>{d((0,l.DW)({instanceID:n,progress:e}))},()=>{d((0,l.rx)(n))},e=>{d((0,l.iL)({instanceID:n,msg:e}))},()=>{d((0,l.Dm)(n))},()=>{d((0,r.Hk)("File download will be handled directly by the browser."))});(0,i.FP)(s,o),d((0,l.cP)({ID:s,bucketName:e,done:!1,instanceID:n,percentage:0,prefix:t.name,type:"download",waitingForFile:!0,failed:!1,cancelled:!1,errorMessage:""}))};if(0!==u.objectBrowser.selectedObjects.length){let t=[];const n=e=>u.objectBrowser.selectedObjects.includes(e.name);if(t=u.objectBrowser.records.filter(n),1===t.length){if(t[0].name.length>200&&(0,o.oK)().toLowerCase().includes("win"))return void d((0,l.Ew)(t[0]));h(t[0])}else if(1===t.length)h(t[0]);else if(t.length>1){const n="".concat(c.c9.now().toFormat("LL-dd-yyyy-HH-mm-ss"),"_files_list.zip"),s=t.reduce((e,t)=>{const n=null===t||void 0===t?void 0:t.delete_flag;return t&&!n?e.push(t.name):console.log("Skipping ".concat(null===t||void 0===t?void 0:t.name," from download.")),e},[]);return void await(0,a.Fj)(e,s,n)}}}),h=(0,s.zD)("objectBrowser/openPreview",async(e,t)=>{let{getState:n,rejectWithValue:s,dispatch:o}=t;const i=n();if(1===i.objectBrowser.selectedObjects.length){let e;const t=e=>i.objectBrowser.selectedObjects.includes(e.name);e=i.objectBrowser.records.find(t),e&&(o((0,l.go)(e)),o((0,l.xE)(!0)))}}),m=(0,s.zD)("objectBrowser/openShare",async(e,t)=>{let{getState:n,rejectWithValue:s,dispatch:o}=t;const i=n();if(1===i.objectBrowser.selectedObjects.length){let e;const t=e=>i.objectBrowser.selectedObjects.includes(e.name);e=i.objectBrowser.records.find(t),e&&(o((0,l.go)(e)),o((0,l.Lf)(!0)))}}),x=(0,s.zD)("objectBrowser/openAnonymousAccess",async(e,t)=>{let{getState:n,dispatch:s}=t;const o=n();1===o.objectBrowser.selectedObjects.length&&o.objectBrowser.selectedObjects[0].endsWith("/")&&s((0,l.I8)(!0))}),p=(0,s.zD)("objectBrowser/maxShareLinkExpTime",async(e,t)=>{let{rejectWithValue:n,dispatch:s}=t;return d.F.buckets.getMaxShareLinkExp().then(e=>{s((0,l.QV)(e.data.exp))}).catch(async e=>n(e.error))})},21572:(e,t,n)=>{n.r(t),n.d(t,{default:()=>_});var s=n(9950),o=n(98341),i=n(89132),a=n(95189),l=n.n(a),r=n(32680),c=n(43217),d=n(44414);const u=e=>{let{id:t,label:n,maxSeconds:o,entity:a,onChange:l}=e;const r=Math.floor(o/86400),u=Math.floor(o%86400/3600),h=Math.floor(o%3600/60),[m,x]=(0,s.useState)(0),[p,j]=(0,s.useState)(0),[b,g]=(0,s.useState)(0),[f,v]=(0,s.useState)(!0),[_,S]=(0,s.useState)(null);(0,s.useEffect)(()=>{x(r),j(u),g(h)},[r,u,h]),(0,s.useEffect)(()=>{var e,t,n;isNaN(p)||isNaN(m)||isNaN(b)||S((e=m,t=p,n=b,c.c9.now().plus({hours:t+24*e,minutes:n}).toISO()))},[m,p,b]),(0,s.useEffect)(()=>{if(f&&_){const e=c.c9.fromISO(_).toFormat("yyyy-MM-dd HH:mm:ss");l(e.split(" ").join("T"),!0)}else l("0000-00-00",!1)},[_,l,f]),(0,s.useEffect)(()=>{let e=!0;(m<0||m>7||m>r||isNaN(m))&&(e=!1),(p<0||p>23||isNaN(p))&&(e=!1),(b<0||b>59||isNaN(b))&&(e=!1),m===r&&(p>u&&(e=!1),p===u&&b>h&&(e=!1)),m<=0&&p<=0&&b<=0&&(e=!1),v(e)},[_,r,u,h,l,m,p,b]);const O={"& .textBoxContainer":{minWidth:0},"& input":{textAlign:"center",paddingRight:10,paddingLeft:10,width:40}};return(0,d.jsxs)(i.azJ,{className:"inputItem",children:[(0,d.jsx)(i.azJ,{sx:{display:"flex",alignItems:"center",marginBottom:5},children:(0,d.jsx)(i.l1Y,{htmlFor:t,children:n})}),(0,d.jsxs)(i.azJ,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-evenly",gap:10,"& .reverseInput":{flexFlow:"row-reverse","& > label":{fontWeight:400,marginLeft:15,marginRight:25}}},children:[(0,d.jsx)(i.azJ,{children:(0,d.jsx)(i.cl_,{id:t,className:"reverseInput removeArrows",type:"number",min:"0",max:"7",label:"Days",name:t,onChange:e=>{x(parseInt(e.target.value))},value:m.toString(),sx:O,noLabelMinWidth:!0})}),(0,d.jsx)(i.azJ,{children:(0,d.jsx)(i.cl_,{id:t,className:"reverseInput removeArrows",type:"number",min:"0",max:"23",label:"Hours",name:t,onChange:e=>{j(parseInt(e.target.value))},value:p.toString(),sx:O,noLabelMinWidth:!0})}),(0,d.jsx)(i.azJ,{children:(0,d.jsx)(i.cl_,{id:t,className:"reverseInput removeArrows",type:"number",min:"0",max:"59",label:"Minutes",name:t,onChange:e=>{g(parseInt(e.target.value))},value:b.toString(),sx:O,noLabelMinWidth:!0})})]}),(0,d.jsx)(i.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",marginTop:25,marginLeft:10,marginBottom:15,"& .validityText":{fontSize:14,marginTop:15,display:"flex",alignItems:"center",justifyContent:"center","@media (max-width: 900px)":{flexFlow:"column"},"& > .min-icon":{color:"#5E5E5E",width:15,height:15,marginRight:10}},"& .validTill":{fontWeight:"bold",marginLeft:15},"& .invalidDurationText":{marginTop:15,display:"flex",color:"red",fontSize:11}},children:f&&_?(0,d.jsxs)("div",{className:"validityText",children:[(0,d.jsx)(i.qYV,{}),(0,d.jsxs)("div",{children:[a," will be available until:"]})," ",(0,d.jsx)("div",{className:"validTill",children:c.c9.fromISO(_).toFormat("MM/dd/yyyy HH:mm:ss ZZZZ")})]}):(0,d.jsx)("div",{className:"invalidDurationText",children:"Please select a valid duration."})})]})};var h=n(59908),m=n(49078),x=n(99491),p=n(70444),j=n(48965),b=n(18949),g=n(45536),f=n(95491),v=n.n(f);const _=e=>{let{open:t,closeModalAndRefresh:n,bucketName:a,dataObject:c}=e;const f=(0,x.jL)(),_=(0,o.d4)(m.Rq),S=(0,o.d4)(g.yL),[O,w]=(0,s.useState)(""),[T,C]=(0,s.useState)(!0),[y,E]=(0,s.useState)(!1),[I,A]=(0,s.useState)(""),[N,k]=(0,s.useState)(!0),[B,L]=(0,s.useState)("null"),F=v()((e,t)=>{k(t),t?A(e):(A(""),w(""))},300);return(0,s.useEffect)(()=>{f((0,b.Ex)())},[f]),(0,s.useEffect)(()=>{if(void 0===c.version_id)return _?(p.F.buckets.listObjects(a,{prefix:c.name||"",with_versions:_}).then(e=>{const t=(e.data.objects||[]).find(e=>e.is_latest);L(t?"".concat(t.version_id):"null")}).catch(e=>{f((0,m.Dy)((0,j.S)(e.error)))}),void C(!1)):(L("null"),void C(!1));L(c.version_id||"null"),C(!1)},[a,c,_,f]),(0,s.useEffect)(()=>{if(N&&!T){E(!0),w("");const e=new Date("".concat(I)),t=new Date,n=Math.ceil((e.getTime()-t.getTime())/1e3);n>0&&p.F.buckets.shareObject(a,{prefix:c.name||"",version_id:B,expires:""!==I?"".concat(n,"s"):""}).then(e=>{w(e.data),E(!1)}).catch(e=>{f((0,m.Dy)((0,j.S)(e.error))),w(""),E(!1)})}},[c,I,a,N,w,f,_,T,B]),(0,d.jsx)(s.Fragment,{children:(0,d.jsxs)(r.A,{title:"Share File",titleIcon:(0,d.jsx)(i.liv,{style:{fill:"#4CCB92"}}),modalOpen:t,onClose:()=>{n()},children:[T&&(0,d.jsx)(i.xA9,{item:!0,xs:12,children:(0,d.jsx)(i.z21,{})}),!T&&(0,d.jsxs)(s.Fragment,{children:[(0,d.jsx)(i.xA9,{item:!0,xs:12,sx:{fontSize:14,fontWeight:400},children:(0,d.jsx)(i.m_M,{placement:"right",tooltip:(0,d.jsxs)("span",{children:["You can reset your session by logging out and logging back in to the web UI. ",(0,d.jsx)("br",{})," ",(0,d.jsx)("br",{}),"You can increase the maximum configuration time by setting the MINIO_STS_DURATION environment variable on all your nodes. ",(0,d.jsx)("br",{})," ",(0,d.jsx)("br",{}),"You can use ",(0,d.jsx)("b",{children:"mc share"})," as an alternative to this UI, where the session length does not limit the URL validity."]}),children:(0,d.jsxs)("span",{children:["The following URL lets you share this object without requiring a login. ",(0,d.jsx)("br",{}),"The URL expires automatically at the earlier of your configured time (",(0,h.K7)(S),") or the expiration of your current web session."]})})}),(0,d.jsx)("br",{}),(0,d.jsx)(i.xA9,{item:!0,xs:12,children:(0,d.jsx)(u,{id:"date",label:"Active for",maxSeconds:S,onChange:F,entity:"Link"})}),(0,d.jsx)(i.xA9,{item:!0,xs:12,sx:{marginBottom:10},children:(0,d.jsx)(i.EmB,{actionButton:(0,d.jsx)(l(),{text:O,children:(0,d.jsx)(i.$nd,{id:"copy-path",variant:"regular",onClick:()=>{f((0,m.h0)("Share URL Copied to clipboard"))},disabled:""===O||y,style:{width:"28px",height:"28px",padding:"0px"},icon:(0,d.jsx)(i.TdU,{})})}),children:O})})]})]})})}},32680:(e,t,n)=>{n.d(t,{A:()=>d});var s=n(9950),o=n(98341),i=n(89132),a=n(99491),l=n(49078),r=n(96382),c=n(44414);const d=e=>{let{onClose:t,modalOpen:n,title:d,children:u,wideLimit:h=!0,titleIcon:m=null,iconColor:x="default",sx:p}=e;const j=(0,a.jL)(),[b,g]=(0,s.useState)(!1),f=(0,o.d4)(e=>e.system.modalSnackBar);(0,s.useEffect)(()=>{j((0,l.h0)(""))},[j]),(0,s.useEffect)(()=>{if(f){if(""===f.message)return void g(!1);"error"!==f.type&&g(!0)}},[f]);let v="";return f&&(v=f.detailedErrorMsg,(""===v||v&&v.length<5)&&(v=f.message)),(0,c.jsxs)(i.ngX,{onClose:t,open:n,title:d,titleIcon:m,widthLimit:h,sx:p,iconColor:x,children:[(0,c.jsx)(r.A,{isModal:!0}),(0,c.jsx)(i.qb_,{onClose:()=>{g(!1),j((0,l.h0)(""))},open:b,message:v,mode:"inline",variant:"error"===f.type?"error":"default",autoHideDuration:"error"===f.type?10:5,condensed:!0}),u]})}},39971:(e,t,n)=>{n.r(t),n.d(t,{default:()=>g});var s=n(9950),o=n(32680),i=n(89132),a=n(87946),l=n.n(a),r=n(45176),c=n(70444),d=n(32878),u=n(54823),h=n(49910),m=n(44414);d.EA.workerSrc="./scripts/pdf.worker.min.mjs";const x=e=>{let{path:t,loading:n,onLoad:o,downloadFile:a}=e;const[l,r]=(0,s.useState)(!1),[c,d]=(0,s.useState)(0);if(!t)return null;const x=c>5?5:c,p=Array.from(Array(x).keys());return(0,m.jsxs)(s.Fragment,{children:[l&&0===c&&(0,m.jsx)(i.Wei,{variant:"error",title:"Error",message:(0,m.jsxs)(s.Fragment,{children:["File preview couldn't be displayed, Please try Download instead.",(0,m.jsx)(i.azJ,{sx:{display:"flex",justifyContent:"center",marginTop:12},children:(0,m.jsx)(i.$nd,{id:"download-preview",onClick:a,variant:"callAction",children:"Download File"})})]}),sx:{marginBottom:10}}),!n&&!l&&(0,m.jsx)(i.Wei,{variant:"warning",title:"File Preview",message:(0,m.jsxs)(s.Fragment,{children:["This is a File Preview for the first ",p.length," pages of the document, if you wish to work with the full document please download instead.",(0,m.jsx)(i.azJ,{sx:{display:"flex",justifyContent:"center",marginTop:12},children:(0,m.jsx)(i.$nd,{id:"download-preview",onClick:a,variant:"callAction",children:"Download File"})})]}),sx:{marginBottom:10}}),!l&&(0,m.jsx)(i.azJ,{sx:{overflowY:"auto","& .react-pdf__Page__canvas":{margin:"0 auto",backgroundColor:"transparent"}},children:(0,m.jsx)(u.A,{file:t,onLoadSuccess:e=>{let{_pdfInfo:t}=e;d(t.numPages||0),r(!1),o()},onLoadError:e=>{r(!0),o(),console.error(e)},children:p.map(e=>(0,m.jsx)(h.A,{pageNumber:e+1,renderAnnotationLayer:!1,renderTextLayer:!1,renderForms:!1},"render-page-".concat(e)))})})]})};var p=n(3796),j=n(99491);const b=e=>{let{bucketName:t,actualInfo:n,isFullscreen:o=!1}=e;const a=(0,j.jL)(),[d,u]=(0,s.useState)(!0),[h,b]=(0,s.useState)(null),[g,f]=(0,s.useState)(!1),v=(null===n||void 0===n?void 0:n.name)||"",_=(0,s.useCallback)(()=>{g||c.F.buckets.getObjectMetadata(t,{prefix:v,versionID:n.version_id||""}).then(e=>{let t=l()(e.data,"objectMetadata",{});f(!0),b(t)}).catch(e=>{console.error("Error Getting Metadata Status: ",e,null===e||void 0===e?void 0:e.detailedError),f(!0)})},[t,v,g,n.version_id]);(0,s.useEffect)(()=>{t&&v&&_()},[t,v,_]);let S="";if(n){let e=document.baseURI.replace(window.location.origin,"");S="".concat(window.location.origin).concat(e,"api/v1/buckets/").concat(encodeURIComponent(t),"/objects/download?preview=true&prefix=").concat(encodeURIComponent(n.name||"")),n.version_id&&(S=S.concat("&version_id=".concat(n.version_id)))}let O=(0,r.IZ)(h,v);const w=()=>{u(!1)};return(0,m.jsxs)(s.Fragment,{children:["none"!==O&&d&&(0,m.jsx)(i.xA9,{item:!0,xs:12,children:(0,m.jsx)(i.z21,{})}),g?(0,m.jsxs)(i.azJ,{sx:{textAlign:"center","& .iframeContainer":{border:"0px",flex:"1 1 auto",width:"100%",height:250,backgroundColor:"transparent",borderRadius:5,"&.image":{height:500},"&.audio":{height:150},"&.video":{height:350},"&.fullHeight":{height:"calc(100vh - 185px)"}},"& .iframeBase":{backgroundColor:"#fff"},"& .iframeHidden":{display:"none"}},children:["video"===O&&(0,m.jsx)("video",{style:{width:"auto",height:"auto",maxWidth:"calc(100vw - 100px)",maxHeight:"calc(100vh - 200px)"},autoPlay:!0,controls:!0,muted:!1,playsInline:!0,onPlay:w,children:(0,m.jsx)("source",{src:S,type:"video/mp4"})}),"audio"===O&&(0,m.jsx)("audio",{style:{width:"100%",height:"auto"},autoPlay:!0,controls:!0,muted:!1,playsInline:!0,onPlay:w,children:(0,m.jsx)("source",{src:S,type:"audio/mpeg"})}),"image"===O&&(0,m.jsx)("img",{style:{width:"auto",height:"auto",maxWidth:"100vw",maxHeight:"100vh"},src:S,alt:"preview",onLoad:w}),"pdf"===O&&(0,m.jsx)(s.Fragment,{children:(0,m.jsx)(x,{path:S,onLoad:w,loading:d,downloadFile:()=>{(0,p._)(a,t,v,n)}})}),"none"===O&&(0,m.jsx)("div",{children:(0,m.jsx)(i.Wei,{message:" File couldn't be previewed using file extension or mime type. Please try Download instead",title:"Preview unavailable",sx:{margin:"15px 0"}})}),"none"!==O&&"video"!==O&&"audio"!==O&&"image"!==O&&"pdf"!==O&&(0,m.jsx)("div",{className:"iframeBase ".concat(d?"iframeHidden":""),children:(0,m.jsx)("iframe",{src:S,title:"File Preview",allowTransparency:!0,className:"iframeContainer ".concat(o?"fullHeight":O),onLoad:w,children:"File couldn't be loaded. Please try Download instead"})})]}):null]})},g=e=>{let{open:t,bucketName:n,actualInfo:a,onClosePreview:l}=e;return(0,m.jsx)(s.Fragment,{children:(0,m.jsx)(o.A,{modalOpen:t,title:"Preview - ".concat(null===a||void 0===a?void 0:a.name),onClose:l,wideLimit:!1,titleIcon:(0,m.jsx)(i.jG,{}),children:(0,m.jsx)(b,{bucketName:n,actualInfo:a})})})}},48374:(e,t,n)=>{n.d(t,{A:()=>a});var s=n(9950),o=n(89132),i=n(44414);const a=e=>{let{value:t}=e;const[n,a]=(0,s.useState)(!1);return(0,i.jsxs)(o.azJ,{sx:{display:"flex",alignItems:"center",flexFlow:"row",["@media (max-width: ".concat(o.nmC.sm,"px)")]:{flexFlow:"column"}},children:[(0,i.jsx)(o.cl_,{id:"inspect-dec-key",name:"inspect-dec-key",placeholder:"",label:"",type:n?"text":"password",onChange:()=>{},value:t,overlayIcon:(0,i.jsx)(o.TdU,{}),readOnly:!0,overlayAction:()=>navigator.clipboard.writeText(t)}),(0,i.jsx)(o.$nd,{id:"show-hide-key",style:{marginLeft:"10px"},variant:"callAction",onClick:()=>a(!n),label:"Show/Hide"})]})}},54945:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var s=n(9950),o=n(32680),i=n(89132),a=n(70444),l=n(48965),r=n(45246),c=n(49078),d=n(99491),u=n(44414);const h=e=>{let{modalOpen:t,onClose:n,bucket:h,prefilledRoute:m}=e;const x=(0,d.jL)(),[p,j]=(0,s.useState)(""),[b,g]=(0,s.useState)("readonly");(0,s.useEffect)(()=>{m&&j(m)},[m]);return(0,u.jsx)(o.A,{modalOpen:t,title:"Add Anonymous Access Rule",onClose:n,titleIcon:(0,u.jsx)(i.No_,{}),children:(0,u.jsxs)(i.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,u.jsx)(i.cl_,{value:p,label:"Prefix",id:"prefix",name:"prefix",placeholder:"Enter Prefix",onChange:e=>{j(e.target.value)},tooltip:"Enter '/' to apply the rule to all prefixes and objects at the bucket root. Do not include the wildcard asterisk '*' as part of the prefix *unless* it is an explicit part of the prefix name. The Console automatically appends an asterisk to the appropriate sections of the resulting IAM policy."}),(0,u.jsx)(i.l6P,{id:"access",name:"Access",onChange:e=>{g(e)},label:"Access",value:b,options:[{label:"readonly",value:"readonly"},{label:"writeonly",value:"writeonly"},{label:"readwrite",value:"readwrite"}],disabled:!1,helpTip:(0,u.jsx)(s.Fragment,{children:"Select the desired level of access available to unauthenticated Users"}),helpTipPlacement:"right"}),(0,u.jsxs)(i.xA9,{item:!0,xs:12,sx:r.Uz.modalButtonBar,children:[(0,u.jsx)(i.$nd,{id:"clear",type:"button",variant:"regular",onClick:()=>{j(""),g("readonly")},label:"Clear"}),(0,u.jsx)(i.$nd,{id:"add-access-save",type:"submit",variant:"callAction",disabled:""===p.trim(),onClick:()=>{a.F.bucket.setAccessRuleWithBucket(h,{prefix:p,access:b}).then(e=>{x((0,c.Hk)("Access Rule added successfully")),n()}).catch(e=>{x((0,c.C9)((0,l.S)(e.error))),n()})},label:"Save"})]})]})})}},55604:(e,t,n)=>{n.d(t,{A:()=>a});var s=n(89379),o=n(9950),i=n(44414);const a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n){return(0,i.jsx)(o.Suspense,{fallback:t,children:(0,i.jsx)(e,(0,s.A)({},n))})}}},71634:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Je});var s=n(9950),o=n(98341),i=n(28429),a=n(70444),l=n(99491),r=n(93598),c=n(45536),d=n(89379),u=n(87946),h=n.n(u),m=n(89132),x=n(48965),p=n(55044),j=n(43217),b=n(59908),g=n(95189),f=n.n(g),v=n(19335),_=n(42074),S=n(26843),O=n(55604),w=n(49078);const T=e=>(e.match(/\.([^.]*?)(?=\?|#|$)/)||[])[1],C=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const s=Object.keys(e).reduce((n,s)=>(T(s)&&s.includes(t)&&(n[s]=e[s]),n),{});return Object.keys(s).filter(e=>{const o=s[e].some(e=>n.find(t=>{let n=!1;if(-1!==t.indexOf("*")){const s=t.substring(0,t.length-1);n=e.includes(s)}return n||e===t})),i=e.substring(0,e.indexOf("/*."))==="arn:aws:s3:::".concat(t);return o&&(i&&"arn:aws:s3:::*"!==e)})};var y=n(44414);const E=(0,O.A)(s.lazy(()=>n.e(2797).then(n.bind(n,42797)))),I=v.Ay.div(()=>({display:"flex","& .additionalOptions":{paddingRight:"10px",display:"flex",alignItems:"center",["@media (max-width: ".concat(m.nmC.lg,"px)")]:{display:"none"}},"& .slashSpacingStyle":{margin:"0 5px"}})),A=e=>{let{bucketName:t,internalPaths:n,hidePathButton:a,additionalOptions:d}=e;const u=(0,l.jL)(),h=(0,i.Zp)(),x=(0,o.d4)(e=>e.objectBrowser.rewind.rewindEnabled),p=(0,o.d4)(e=>e.objectBrowser.versionsMode),j=(0,o.d4)(e=>e.objectBrowser.versionedFile),g=(0,o.d4)(e=>e.system.anonymousMode),[v,O]=(0,s.useState)(!1),[T,A]=(0,s.useState)(!1),N=[r.OV.S3_PUT_OBJECT,r.OV.S3_PUT_ACTIONS],k=(0,o.d4)(e=>e.console.session&&e.console.session.permissions||{});let B=n;""!==n&&(B="/".concat(n));const L=B.split("/").filter(e=>""!==e),F=L.length-1,V=t+B||t,D=C(k,V,N);(0,s.useEffect)(()=>{A(!1),Object.keys(k).forEach(e=>{e.includes(V)&&e.includes("/*")&&A(!0)})},[V,n,k]);const R=(0,S._)([V,...D],N)||g||T;let P=L.map((e,n)=>{const o="".concat(L.slice(0,n+1).join("/"),"/"),i="/browser/".concat(encodeURIComponent(t),"/").concat(o?"".concat(encodeURIComponent(o)):"");return n===F&&e===j?null:(0,y.jsxs)(s.Fragment,{children:[(0,y.jsx)("span",{className:"slashSpacingStyle",children:"/"}),n===F?(0,y.jsx)("span",{style:{cursor:"default",whiteSpace:"pre"},children:(0,b.Tw)(e)}):(0,y.jsx)(_.N_,{style:{whiteSpace:"pre"},to:i,onClick:()=>{u((0,c.cQ)({status:!1,objectName:""}))},children:(0,b.Tw)(e)})]},"breadcrumbs-".concat(n.toString()))}),U=[];p&&(U=[(0,y.jsx)(s.Fragment,{children:(0,y.jsxs)("span",{children:[(0,y.jsx)("span",{className:"slashSpacingStyle",children:"/"}),j," - Versions"]})},"breadcrumbs-versionedItem")]);const z=[(0,y.jsx)(s.Fragment,{children:(0,y.jsx)(_.N_,{to:"/browser/".concat(t),onClick:()=>{u((0,c.cQ)({status:!1,objectName:""}))},children:t})},"breadcrumbs-root-path"),...P,...U];return(0,y.jsxs)(s.Fragment,{children:[(0,y.jsxs)(I,{children:[v&&(0,y.jsx)(E,{modalOpen:v,bucketName:t,folderName:n,onClose:()=>{O(!1)},limitedSubPath:T&&!((0,S._)([V,...D],N)||g)}),(0,y.jsx)(m.BIu,{sx:{whiteSpace:"pre"},goBackFunction:()=>{if(p)u((0,c.cQ)({status:!1,objectName:""}));else{if(0===L.length)return void h("/browser");const e=L.slice(0,-1);h("/browser/".concat(t).concat(e.length>0?"/".concat(encodeURIComponent("".concat(e.join("/"),"/"))):""))}},additionalOptions:(0,y.jsxs)(s.Fragment,{children:[(0,y.jsx)(f(),{text:"".concat(t,"/").concat(L.join("/")),children:(0,y.jsx)(m.$nd,{id:"copy-path",icon:(0,y.jsx)(m.TdU,{style:{width:"12px",height:"12px",fill:"#969FA8",marginTop:-1}}),variant:"regular",onClick:()=>{u((0,w.Hk)("Path copied to clipboard"))},style:{width:"28px",height:"28px",color:"#969FA8",border:"#969FA8 1px solid",marginRight:5}})}),(0,y.jsx)(m.azJ,{className:"additionalOptions",children:d})]}),children:z}),!a&&(0,y.jsx)(m.m_M,{tooltip:R?"Choose or create a new path":(0,r.vj)([r.OV.S3_PUT_OBJECT,r.OV.S3_PUT_ACTIONS],"create a new path"),children:(0,y.jsx)(m.$nd,{id:"new-path",onClick:()=>{O(!0)},disabled:!g&&(x||!R),icon:(0,y.jsx)(m.pj3,{style:{fill:"#969FA8"}}),style:{whiteSpace:"nowrap"},variant:"regular",label:"Create new path"})})]}),(0,y.jsx)(m.azJ,{sx:{display:"none",marginTop:15,marginBottom:5,justifyContent:"flex-start","& > div":{fontSize:12,fontWeight:"normal",flexDirection:"row",flexWrap:"nowrap"},["@media (max-width: ".concat(m.nmC.lg,"px)")]:{display:"flex"}},children:d})]})};var N=n(45176);const k=e=>"Enabled"===e||"Suspended"===e;var B=n(26347),L=n(47304),F=n(18949),V=n(30272);const D=e=>{let{uploadPath:t,bucketName:n,forceDisable:i=!1,uploadFileFunction:a,uploadFolderFunction:l,overrideStyles:c={}}=e;const[d,u]=(0,s.useState)(null),[h,x]=(0,s.useState)(!1),p=(0,o.d4)(e=>e.system.anonymousMode),j=(0,o.d4)(e=>e.console.session&&e.console.session.permissions||{}),b=[r.OV.S3_PUT_OBJECT,r.OV.S3_PUT_ACTIONS],g=C(j,t,b),f=Boolean(d),v=()=>{u(null)},_=(0,S._)([t,...g],b)||p,O=(0,S._)([n,...g],b,!1,!0),w=_||O;return(0,y.jsxs)(s.Fragment,{children:[(0,y.jsx)(V.A,{tooltip:w?"Upload Files":(0,r.vj)([r.OV.S3_PUT_OBJECT,r.OV.S3_PUT_ACTIONS],"upload files to this bucket"),children:(0,y.jsx)(m.$nd,{id:"upload-main","aria-controls":"upload-main-menu","aria-haspopup":"true","aria-expanded":f?"true":void 0,onClick:e=>{x(!h),u(e.currentTarget)},label:"Upload",icon:(0,y.jsx)(m.JMY,{}),variant:"callAction",disabled:i||!w,sx:c})}),(0,y.jsx)(m.Vey,{id:"upload-main-menu",options:[{label:"Upload File",icon:(0,y.jsx)(m.JMY,{}),value:"file",disabled:!_||i},{label:"Upload Folder",icon:(0,y.jsx)(m.nDF,{}),value:"folder",disabled:!O||i}],selectedOption:"",onSelect:e=>{"folder"!==e?a(v):l(v)},hideTriggerAction:()=>{x(!1)},open:h,anchorEl:d,anchorOrigin:"end",useAnchorWidth:!0})]})},R=e=>{let{open:t,closePanel:n,className:s="",children:o}=e;return(0,y.jsxs)(m.azJ,{id:"details-panel",sx:{borderColor:"#EAEDEE",borderWidth:0,borderStyle:"solid",borderRadius:3,borderBottomLeftRadius:0,borderBottomRightRadius:0,width:0,transitionDuration:"0.3s",overflowX:"hidden",overflowY:"auto",position:"relative",opacity:0,marginLeft:-1,"&.open":{width:300,minWidth:300,borderLeftWidth:1,opacity:1},"@media (max-width: 799px)":{"&.open":{width:"100%",minWidth:"100%",borderLeftWidth:0}}},className:"".concat(t?"open":""," ").concat(s),children:[(0,y.jsx)(m.$nd,{variant:"text",id:"close-details-list",onClick:n,icon:(0,y.jsx)(m._FR,{}),sx:{position:"absolute",right:5,top:18,padding:0,height:14,"&:hover:not(:disabled)":{backgroundColor:"transparent"}}}),o]})};var P=n(3796);const U=e=>{let{icon:t,strings:n}=e;return(0,y.jsxs)(m.azJ,{sx:{display:"flex",alignItems:"center","& .min-icon":{width:16,height:16,marginRight:4,minWidth:16,minHeight:16},"& .fileNameText":{whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"}},children:[t,(0,y.jsx)("span",{className:"fileNameText",children:(0,b.qf)(n[n.length-1])})]})},z=[{icon:(0,y.jsx)(m.FRZ,{}),extensions:["mp4","mov","avi","mpeg","mpg"]},{icon:(0,y.jsx)(m.jCy,{}),extensions:["mp3","m4a","aac"]},{icon:(0,y.jsx)(m.yTC,{}),extensions:["pdf"]},{icon:(0,y.jsx)(m.QvW,{}),extensions:["ppt","pptx"]},{icon:(0,y.jsx)(m.z9t,{}),extensions:["xls","xlsx"]},{icon:(0,y.jsx)(m.VSs,{}),extensions:["cer","crt","pem"]},{icon:(0,y.jsx)(m.bM2,{}),extensions:["html","xml","css","py","go","php","cpp","h","java"]},{icon:(0,y.jsx)(m.qM2,{}),extensions:["cfg","yaml"]},{icon:(0,y.jsx)(m.ITz,{}),extensions:["sql"]},{icon:(0,y.jsx)(m.PcO,{}),extensions:["ttf","otf"]},{icon:(0,y.jsx)(m.yEV,{}),extensions:["doc","docx","txt","rtf"]},{icon:(0,y.jsx)(m.j_m,{}),extensions:["zip","rar","tar","gz"]},{icon:(0,y.jsx)(m.DUd,{}),extensions:["epub","mobi","azw","azw3"]},{icon:(0,y.jsx)(m.nLN,{}),extensions:["jpeg","jpg","gif","tiff","png","heic","dng"]}],G=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e,s=(0,y.jsx)(m.KlI,{});e.endsWith("/")&&(s=(0,y.jsx)(m.kez,{}),n=e.slice(0,-1));const o=e.toLowerCase();for(const a of z)for(const e of a.extensions)o.endsWith(".".concat(e))&&(s=a.icon);!e.endsWith("/")&&e.indexOf(".")<0&&(s=(0,y.jsx)(m.YJK,{}));const i=n.split("/");return t?s:(0,y.jsx)(U,{icon:s,strings:i})};var M=n(39971);const J=e=>{let{metaData:t}=e;const n=Object.keys(t);return(0,y.jsx)(s.Fragment,{children:n.map((e,n)=>{const s=(e=>Array.isArray(e)?e.map(b.Tw).join(", "):(0,b.Tw)(e))(t[e]);return(0,y.jsxs)(m.azJ,{sx:{marginBottom:15,fontSize:14,maxHeight:180,overflowY:"auto"},children:[(0,y.jsx)("strong",{children:e}),(0,y.jsx)("br",{}),s]},"box-meta-".concat(e,"-").concat(n.toString()))})})};var K=n(21572),W=n(5501),H=n(45246);const Y=[{value:"01",label:"January"},{value:"02",label:"February"},{value:"03",label:"March"},{value:"04",label:"April"},{value:"05",label:"May"},{value:"06",label:"June"},{value:"07",label:"July"},{value:"08",label:"August"},{value:"09",label:"September"},{value:"10",label:"October"},{value:"11",label:"November"},{value:"12",label:"December"}],$=Array.from(Array(31),(e,t)=>({value:(t+1).toString(),label:(t+1).toString()})),Z=(new Date).getFullYear(),q=Array.from(Array(50),(e,t)=>({value:(t+Z).toString(),label:(t+Z).toString()}));var Q=n(32680);const X=(0,s.forwardRef)((e,t)=>{let{id:n,label:o,disableOptions:i=!1,tooltip:a="",borderBottom:l=!1,onDateChange:r,value:c=""}=e;(0,s.useImperativeHandle)(t,()=>({resetDate:b}));const[d,u]=(0,s.useState)(""),[h,x]=(0,s.useState)(""),[p,j]=(0,s.useState)("");(0,s.useEffect)(()=>{if(""!==c){const e=c.split("-");j(e[0]),u(e[1]),x("".concat(parseInt(e[2])))}},[c]),(0,s.useEffect)(()=>{const[e,t]=((e,t,n)=>{const s=Date.parse("".concat(e,"-").concat(t,"-").concat(n));if(isNaN(s))return[!1,""];const o=parseInt(t),i=parseInt(n),a=o<10?"0".concat(o):o,l=i<10?"0".concat(i):i,r=new Date(s).toISOString().split("T")[0],c="".concat(e,"-").concat(a,"-").concat(l);return[r===c,c]})(p,d,h);r(t,e)},[d,h,p,r]);const b=()=>{u(""),x(""),j("")},g=()=>i||!1,f=[{value:"",label:""},...Y],v=[{value:"",label:""},...$],_=[{value:"",label:""},...q];return(0,y.jsxs)(m.azJ,{className:"inputItem",children:[(0,y.jsx)(m.azJ,{sx:{display:"flex",alignItems:"center",gap:5,marginBottom:5},children:(0,y.jsxs)(m.l1Y,{htmlFor:n,children:[(0,y.jsx)("span",{children:o}),""!==a&&(0,y.jsx)(m.azJ,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,y.jsx)(m.m_M,{tooltip:a,placement:"top",children:(0,y.jsx)(m.azJ,{sx:{"& .min-icon":{width:13}},children:(0,y.jsx)(m.NTw,{})})})})]})}),(0,y.jsxs)(m.azJ,{sx:{display:"flex",gap:12},children:[(0,y.jsx)(m.l6P,{id:"".concat(n,"-month"),name:"".concat(n,"-month"),value:d,onChange:e=>{u(e)},options:f,label:"",disabled:g()}),(0,y.jsx)(m.l6P,{id:"".concat(n,"-day"),name:"".concat(n,"-day"),value:h,onChange:e=>{x(e)},options:v,label:"",disabled:g()}),(0,y.jsx)(m.l6P,{id:"".concat(n,"-year"),name:"".concat(n,"-year"),value:p,onChange:e=>{j(e)},options:_,label:"",disabled:g(),sx:{marginBottom:12}})]})]})}),ee=e=>{let{open:t,closeModalAndRefresh:n,objectName:i,objectInfo:r,bucketName:c}=e;const d=(0,l.jL)(),u=(0,o.d4)(e=>e.objectBrowser.retentionConfig),[h,p]=(0,s.useState)(!0),[j,b]=(0,s.useState)(""),[g,f]=(0,s.useState)(""),[v,_]=(0,s.useState)(!1),[S,O]=(0,s.useState)(!1),[T,C]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(r.retention_mode&&(b((null===u||void 0===u?void 0:u.mode)||W.BT.Governance),C(!0)),r.retention_until_date){const t=new Date(r.retention_until_date);if("Invalid Date"!==t.toString()){const n=t.getFullYear(),s=(e=t.getMonth()+1)<10?"0".concat(e):"".concat(e),o=t.getDate();isNaN(o)||"NaN"===s||isNaN(n)||f("".concat(n,"-").concat(s,"-").concat(o))}C(!0)}var e},[r,null===u||void 0===u?void 0:u.mode]);const E=(0,s.useRef)(null),I=()=>{p(!1),b(W.BT.Governance),E.current&&E.current.resetDate()},A=T&&("governance"===j||""===j);return(0,y.jsx)(Q.A,{title:"Set Retention Policy",modalOpen:t,onClose:()=>{I(),n(!1)},children:(0,y.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{(e=>{e.preventDefault()})(e)},children:(0,y.jsxs)(m.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,y.jsxs)(m.azJ,{className:"inputItem",children:[(0,y.jsx)("strong",{children:"Selected Object"}),": ",i]}),A&&(0,y.jsx)(m.dOG,{value:"status",id:"status",name:"status",checked:h,onChange:e=>{p(!h)},label:"Status",indicatorLabels:["Enabled","Disabled"]}),(0,y.jsx)(m.z6M,{currentValue:j,id:"type",name:"type",label:"Type",disableOptions:!h||T&&""!==j,onChange:e=>{b(e.target.value)},selectorOptions:[{label:"Governance",value:W.BT.Governance},{label:"Compliance",value:W.BT.Compliance}]}),(0,y.jsx)(X,{id:"date",label:"Date",disableOptions:!(h&&("governance"===j||"compliance"===j)),ref:E,value:g,borderBottom:!0,onDateChange:(e,t)=>{_(t),t&&f(e)}}),(0,y.jsxs)(m.xA9,{item:!0,xs:12,sx:H.Uz.modalButtonBar,children:[(0,y.jsx)(m.$nd,{id:"reset",type:"button",variant:"regular",onClick:I,label:"Reset"}),(0,y.jsx)(m.$nd,{id:"save",type:"submit",variant:"callAction",disabled:h&&""===j||h&&!v||S,onClick:()=>{O(!0);const e=r.name||"",t=r.version_id||null,s=h||"governance"!==j?"".concat(g,"T23:59:59Z"):"";h||"governance"!==j?((e,t,s)=>{a.F.buckets.putObjectRetention(c,{prefix:e,version_id:t||""},{expires:s,mode:j}).then(()=>{O(!1),n(!0)}).catch(e=>{d((0,w.Dy)((0,x.S)(e.error))),O(!1)})})(e,t,s):((e,t)=>{a.F.buckets.deleteObjectRetention(c,{prefix:e,version_id:t||""}).then(()=>{O(!1),n(!0)}).catch(e=>{d((0,w.Dy)((0,x.S)(e.error))),O(!1)})})(e,t)},label:"Save"})]})]})})})};var te=n(49534),ne=n(1531);const se=e=>{let{closeDeleteModalAndRefresh:t,deleteOpen:n,selectedBucket:i,selectedObject:a,versioningInfo:c,selectedVersion:d=""}=e;const u=(0,l.jL)(),[h,x]=(0,ne.A)(()=>t(!0),e=>{u((0,w.C9)(e)),"Access Denied."===e.detailedError&&t(!0)}),[p,j]=(0,s.useState)(!1),[b,g]=(0,s.useState)(!1),f=(0,o.d4)(e=>e.objectBrowser.retentionConfig),v=(0,S._)([i],[r.OV.S3_BYPASS_GOVERNANCE_RETENTION])&&"governance"===(null===f||void 0===f?void 0:f.mode);if(!a)return null;return(0,y.jsx)(te.A,{title:"Delete Object",confirmText:"Delete",isOpen:n,titleIcon:(0,y.jsx)(m.xWY,{}),isLoading:h,onConfirm:()=>{const e=a.endsWith("/");x("DELETE","/api/v1/buckets/".concat(encodeURIComponent(i),"/objects?prefix=").concat(encodeURIComponent(a)).concat(""!==d?"&version_id=".concat(encodeURIComponent(d)):"&recursive=".concat(e,"&all_versions=").concat(p)).concat(b?"&bypass=true":""))},onClose:()=>t(!1),confirmationContent:(0,y.jsxs)(s.Fragment,{children:["Are you sure you want to delete: ",(0,y.jsx)("br",{}),(0,y.jsx)("b",{children:a})," ",""!==d?(0,y.jsxs)(s.Fragment,{children:[(0,y.jsx)("br",{}),(0,y.jsx)("br",{}),"Version ID:",(0,y.jsx)("br",{}),(0,y.jsx)("strong",{children:d})]}):"","? ",(0,y.jsx)("br",{}),(0,y.jsx)("br",{}),k(null===c||void 0===c?void 0:c.status)&&""===d&&(0,y.jsx)(s.Fragment,{children:(0,y.jsx)(m.dOG,{label:"Delete All Versions",indicatorLabels:["Yes","No"],checked:p,value:"delete_versions",id:"delete-versions",name:"delete-versions",onChange:e=>{j(!p)},description:""})}),v&&(p||""!==d)&&(0,y.jsx)(s.Fragment,{children:(0,y.jsx)("div",{style:{marginTop:10},children:(0,y.jsx)(m.dOG,{label:"Bypass Governance Mode",indicatorLabels:["Yes","No"],checked:b,value:"bypass_governance",id:"bypass_governance",name:"bypass_governance",onChange:e=>{g(!b)},description:""})})}),p&&(0,y.jsxs)(s.Fragment,{children:[(0,y.jsxs)("div",{style:{marginTop:10,border:"#c83b51 1px solid",borderRadius:3,padding:5,backgroundColor:"#c83b5120",color:"#c83b51"},children:["This will remove the object as well as all of its versions,"," ",(0,y.jsx)("br",{}),"This action is irreversible."]}),(0,y.jsx)("br",{}),"Are you sure you want to continue?"]})]})})},oe=e=>{let{open:t,closeModalAndRefresh:n,objectName:o,bucketName:i,actualInfo:r}=e;const c=(0,l.jL)(),[d,u]=(0,s.useState)(!1),[p,j]=(0,s.useState)(!1),b=r.version_id;(0,s.useEffect)(()=>{const e=h()(r,"legal_hold_status","OFF");u("ON"===e)},[r]);const g=()=>{u(!1)};return(0,y.jsx)(Q.A,{title:"Set Legal Hold",modalOpen:t,onClose:()=>{g(),n(!1)},children:(0,y.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{(e=>{e.preventDefault(),j(!0),a.F.buckets.putObjectLegalHold(i,{prefix:o,version_id:b||""},{status:d?W.SW.Enabled:W.SW.Disabled}).then(()=>{j(!1),n(!0)}).catch(e=>{c((0,w.Dy)((0,x.S)(e.error))),j(!1)})})(e)},children:(0,y.jsxs)(m.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,y.jsxs)(m.azJ,{className:"inputItem",children:[(0,y.jsx)("strong",{children:"Object"}),": ",i+"/"+o]}),(0,y.jsx)(m.dOG,{value:"legalhold",id:"legalhold",name:"legalhold",checked:d,onChange:e=>{u(!d)},label:"Legal Hold Status",indicatorLabels:["Enabled","Disabled"],tooltip:"To enable this feature you need to enable versioning on the bucket before creation"}),(0,y.jsxs)(m.xA9,{item:!0,xs:12,sx:H.Uz.modalButtonBar,children:[(0,y.jsx)(m.$nd,{id:"clear",type:"button",variant:"regular",onClick:g,label:"Clear"}),(0,y.jsx)(m.$nd,{id:"save",type:"submit",variant:"callAction",disabled:p,label:" Save"})]})]})})})},ie=v.Ay.b(e=>{let{theme:t}=e;return{color:h()(t,"signalColors.danger","#C83B51"),marginLeft:5}}),ae=e=>{var t;let{modalOpen:n,onCloseAndUpdate:i,bucketName:c,actualInfo:u}=e;const p=(0,l.jL)(),j=(0,o.d4)(w.Rq),[b,g]=(0,s.useState)(""),[f,v]=(0,s.useState)(""),[_,O]=(0,s.useState)(!1),[T,C]=(0,s.useState)(!1),[E,I]=(0,s.useState)(""),[A,N]=(0,s.useState)(""),k=u.tags,B=Object.keys(k||{}),L=null===(t=u.name)||void 0===t?void 0:t.split("/"),F=(null===L||void 0===L?void 0:L.pop())||"",V=e=>(0,y.jsxs)(m.azJ,{sx:{fontSize:16,margin:"20px 0 30px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:"100%"},children:["Tag",e?"s":""," for: ",(0,y.jsx)("strong",{children:F})]});return(0,y.jsx)(s.Fragment,{children:(0,y.jsx)(Q.A,{modalOpen:n,title:T?"Delete Tag":"Edit Tags",onClose:()=>{i(!0)},iconColor:T?"delete":"default",titleIcon:T?(0,y.jsx)(m.aaC,{}):(0,y.jsx)(m.cGQ,{}),children:T?(0,y.jsx)(s.Fragment,{children:(0,y.jsxs)(m.xA9,{container:!0,children:[V(!1),"Are you sure you want to delete the tag"," ",(0,y.jsxs)(ie,{children:[E," : ",A]})," ","?",(0,y.jsxs)(m.xA9,{item:!0,xs:12,sx:H.Uz.modalButtonBar,children:[(0,y.jsx)(m.$nd,{id:"cancel",type:"button",variant:"regular",onClick:()=>{I(""),N(""),C(!1)},label:"Cancel"}),(0,y.jsx)(m.$nd,{type:"submit",variant:"secondary",onClick:()=>{const e=(0,d.A)({},k);delete e[E];const t=j?u.version_id||"":"null";a.F.buckets.putObjectTags(c,{prefix:u.name||"",version_id:t},{tags:e}).then(()=>{i(!0),O(!1)}).catch(e=>{p((0,w.Dy)((0,x.S)(e.error))),O(!1)})},id:"deleteTag",label:"Delete Tag"})]})]})}):(0,y.jsxs)(m.azJ,{children:[(0,y.jsx)(S.R,{scopes:[r.OV.S3_GET_OBJECT_TAGGING,r.OV.S3_GET_ACTIONS],resource:c,children:(0,y.jsxs)(m.azJ,{sx:{display:"flex",flexFlow:"column",width:"100%"},children:[V(!0),(0,y.jsxs)(m.azJ,{sx:{fontSize:14,fontWeight:"normal"},children:["Current Tags:",(0,y.jsx)("br",{}),0===B.length?(0,y.jsx)("span",{className:"muted",children:"There are no tags for this object"}):(0,y.jsx)(s.Fragment,{}),(0,y.jsx)(m.azJ,{sx:{marginTop:"5px",marginBottom:"15px"},children:B.map((e,t)=>{const n=h()(k,"".concat(e),"");return""!==n?(0,y.jsx)(S.R,{scopes:[r.OV.S3_DELETE_OBJECT_TAGGING,r.OV.S3_DELETE_ACTIONS],resource:c,errorProps:{deleteIcon:null,onDelete:null},children:(0,y.jsx)(m.vwO,{id:"".concat(e," : ").concat(n),label:"".concat(e," : ").concat(n),variant:"regular",color:"default",onDelete:()=>{((e,t)=>{I(e),N(t),C(!0)})(e,n)}})},"chip-".concat(t)):null})})]})]})}),(0,y.jsx)(S.R,{scopes:[r.OV.S3_PUT_OBJECT_TAGGING,r.OV.S3_PUT_ACTIONS],resource:c,errorProps:{disabled:!0,onClick:null},children:(0,y.jsxs)(m.azJ,{children:[(0,y.jsx)(m._xt,{icon:(0,y.jsx)(m.b_$,{}),separator:!1,children:"Add New Tag"}),(0,y.jsxs)(m.Hbc,{containerPadding:!1,withBorders:!1,children:[(0,y.jsx)(m.cl_,{value:b,label:"Tag Key",id:"newTagKey",name:"newTagKey",placeholder:"Enter Tag Key",onChange:e=>{g(e.target.value)}}),(0,y.jsx)(m.cl_,{value:f,label:"Tag Label",id:"newTagLabel",name:"newTagLabel",placeholder:"Enter Tag Label",onChange:e=>{v(e.target.value)}}),(0,y.jsxs)(m.xA9,{item:!0,xs:12,sx:H.Uz.modalButtonBar,children:[(0,y.jsx)(m.$nd,{id:"clear",type:"button",variant:"regular",color:"primary",onClick:()=>{v(""),g("")},label:"Clear"}),(0,y.jsx)(m.$nd,{type:"submit",variant:"callAction",disabled:""===f.trim()||""===b.trim()||_,onClick:()=>{O(!0);const e={};e[b]=f;const t=(0,d.A)((0,d.A)({},k),e),n=j?u.version_id||"":"null";a.F.buckets.putObjectTags(c,{prefix:u.name||"",version_id:n},{tags:t}).then(()=>{i(!0),O(!1)}).catch(e=>{p((0,w.Dy)((0,x.S)(e.error))),O(!1)})},id:"saveTag",label:"Save"})]})]})]})})]})})})};var le=n(48374);const re=e=>{let{closeInspectModalAndRefresh:t,inspectOpen:n,inspectPath:o,volumeName:i}=e;const a=(0,l.jL)(),r=()=>t(!1),[c,d]=(0,s.useState)(!0),[u,h]=(0,s.useState)(""),[x,p]=(0,s.useState)("");if(!o)return null;return(0,y.jsxs)(s.Fragment,{children:[!u&&(0,y.jsx)(Q.A,{modalOpen:n,titleIcon:(0,y.jsx)(m.nTF,{}),title:"Inspect Object",onClose:r,children:(0,y.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{(e=>{e.preventDefault()})(e)},children:["Would you like to encrypt ",(0,y.jsx)("b",{children:o}),"? ",(0,y.jsx)("br",{}),(0,y.jsx)(m.dOG,{label:"Encrypt",indicatorLabels:["Yes","No"],checked:c,value:"encrypt",id:"encrypt",name:"encrypt",onChange:e=>{d(!c)},description:""}),(0,y.jsx)(m.xA9,{item:!0,xs:12,sx:H.Uz.modalButtonBar,children:(0,y.jsx)(m.$nd,{id:"inspect",type:"submit",variant:"callAction",color:"primary",onClick:async()=>{let e=document.baseURI.replace(window.location.origin,"");(async e=>await fetch(e,{method:"GET"}))("".concat(window.location.origin).concat(e,"api/v1/admin/inspect?volume=").concat(encodeURIComponent(i),"&file=").concat(encodeURIComponent(o+"/xl.meta"),"&encrypt=").concat(c)).then(async e=>{if(!e.ok){const t=await e.json();a((0,w.C9)({errorMessage:t.message,detailedError:t.code}))}const t=await e.blob(),n=e.headers.get("content-disposition").split('"')[1],s=(0,b.UM)(n)||"";(0,b.OT)(t,n),p(n),""!==s?h(s):r()}).catch(e=>{a((0,w.C9)(e))})},label:"Inspect"})})]})}),u?(0,y.jsxs)(Q.A,{modalOpen:n,title:"Inspect Decryption Key",onClose:()=>{(0,b.Yj)(x),r(),h("")},titleIcon:(0,y.jsx)(m.aJN,{}),children:[(0,y.jsxs)(m.azJ,{children:["This will be displayed only once. It cannot be recovered.",(0,y.jsx)("br",{}),"Use secure medium to share this key."]}),(0,y.jsx)(m.azJ,{children:(0,y.jsx)(le.A,{value:u})})]}):null]})},ce=e=>{let{open:t,closeModal:n,currentItem:o,internalPaths:i,actualInfo:a,bucketName:r}=e;const c=(0,l.jL)(),[d,u]=(0,s.useState)(o),[h,x]=(0,s.useState)(!1);return(0,y.jsxs)(Q.A,{title:"Rename Download",modalOpen:t,onClose:n,titleIcon:(0,y.jsx)(m.qUP,{}),children:[(0,y.jsxs)("div",{children:["The file you are trying to download has a long name.",(0,y.jsx)("br",{}),"This can cause issues on Windows Systems by trimming the file name after download.",(0,y.jsx)("br",{}),(0,y.jsx)("br",{})," We recommend to rename the file download"]}),(0,y.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{(e=>{e.preventDefault(),(0,P._)(c,r,i,a),n()})(e)},children:(0,y.jsxs)(m.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,y.jsx)(m.cl_,{id:"download-filename",name:"download-filename",onChange:e=>{u(e.target.value)},label:"",type:"text",value:d,error:d.length>200&&!h?"Filename should be less than 200 characters long.":""}),(0,y.jsx)(m.dOG,{value:"acceptLongName",id:"acceptLongName",name:"acceptLongName",checked:h,onChange:e=>{x(e.target.checked),e.target.checked&&u(o)},label:"Use Original Name"}),(0,y.jsx)(m.xA9,{item:!0,xs:12,sx:H.Uz.modalButtonBar,children:(0,y.jsx)(m.$nd,{id:"download-file",type:"submit",variant:"callAction",color:"primary",disabled:d.length>200&&!h,label:"Download File"})})]})})]})},de={is_latest:!0,last_modified:"",legal_hold_status:"",name:"",retention_mode:"",retention_until_date:"",size:0,tags:{},version_id:void 0},ue=e=>{let{internalPaths:t,bucketName:n,versioningInfo:i,locking:d,onClosePanel:u}=e;const x=(0,l.jL)(),p=(0,o.d4)(w.Rq),j=(0,o.d4)(e=>e.objectBrowser.versionsMode),g=(0,o.d4)(e=>e.objectBrowser.selectedVersion),f=(0,o.d4)(e=>e.objectBrowser.loadingObjectInfo),v=(0,o.d4)(e=>e.objectBrowser.versionsLimit),[_,O]=(0,s.useState)(!1),[T,C]=(0,s.useState)(!1),[E,I]=(0,s.useState)(!1),[A,k]=(0,s.useState)(!1),[B,L]=(0,s.useState)(!1),[F,D]=(0,s.useState)(null),[R,U]=(0,s.useState)([]),[z,W]=(0,s.useState)(null),[H,Y]=(0,s.useState)([]),[$,Z]=(0,s.useState)(!1),[q,Q]=(0,s.useState)(!1),[X,te]=(0,s.useState)(0),[ne,ie]=(0,s.useState)(!1),[le,ue]=(0,s.useState)(!1),[he,me]=(0,s.useState)(null),[xe,pe]=(0,s.useState)(!1),je=(t||"").split("/").pop()||"";let be=[];F&&F.name&&(be=F.name.split("/")),(0,s.useEffect)(()=>{if(p&&R&&R.length>=1){let e=R.find(e=>e.is_latest)||de;""!==g&&(e=R.find(e=>e.version_id===g)||de),e.is_delete_marker||pe(!0),D(e)}},[g,p,R]),(0,s.useEffect)(()=>{f&&""!==t&&a.F.buckets.listObjects(n,{prefix:t,with_versions:p,limit:v+1}).then(e=>{const t=e.data.objects||[];if(p){ie(t.length>v),t.splice(v),U(t),Y(t);const e=t.reduce((e,t)=>null!==t&&void 0!==t&&t.size?e+t.size:e,0);te(e)}else{const e=t[0];D(e),Y([]),e.is_delete_marker||pe(!0)}x((0,c.oe)(!1))}).catch(e=>{console.error("Error loading object details",e.error),x((0,c.oe)(!1))})},[f,n,t,x,p,g,v]),(0,s.useEffect)(()=>{xe&&""!==t&&a.F.buckets.getObjectMetadata(n,{prefix:t,versionID:(null===F||void 0===F?void 0:F.version_id)||""}).then(e=>{let t=h()(e.data,"objectMetadata",{});me(t),pe(!1)}).catch(e=>{console.error("Error Getting Metadata Status: ",e.detailedError),pe(!1)})},[n,t,xe,null===F||void 0===F?void 0:F.version_id]);let ge=[];F&&F.tags&&(ge=Object.keys(F.tags));const fe=(0,y.jsx)("div",{style:{textAlign:"center",marginTop:35},children:(0,y.jsx)(m.aHM,{})});if(!F)return f?fe:null;const ve=be.length>0?be[be.length-1]:F.name,_e=[n,je,[n,F.name].join("/")],Se=(0,S._)(n,[r.OV.S3_PUT_OBJECT_LEGAL_HOLD,r.OV.S3_PUT_ACTIONS]),Oe=(0,S._)(_e,[r.OV.S3_PUT_OBJECT_TAGGING,r.OV.S3_PUT_ACTIONS]),we=(0,S._)(_e,[r.OV.S3_GET_OBJECT_RETENTION,r.OV.S3_PUT_OBJECT_RETENTION,r.OV.S3_GET_ACTIONS,r.OV.S3_PUT_ACTIONS],!0),Te=(0,S._)(_e,[r.OV.ADMIN_INSPECT_DATA]),Ce=(0,S._)(_e,[r.OV.S3_GET_BUCKET_VERSIONING,r.OV.S3_PUT_BUCKET_VERSIONING,r.OV.S3_GET_OBJECT_VERSION,r.OV.S3_GET_ACTIONS,r.OV.S3_PUT_ACTIONS]),ye=(0,S._)(_e,[r.OV.S3_GET_OBJECT,r.OV.S3_GET_ACTIONS]),Ee=(0,S._)([n,je,[n,F.name].join("/")],[r.OV.S3_DELETE_OBJECT,r.OV.S3_DELETE_ACTIONS]);let Ie=(0,N.IZ)(he,je);const Ae=[{action:()=>{(0,P._)(x,n,t,F)},label:"Download",disabled:!!F.is_delete_marker||!ye,icon:(0,y.jsx)(m.s3U,{}),tooltip:ye?"Download this Object":(0,r.vj)([r.OV.S3_GET_OBJECT,r.OV.S3_GET_ACTIONS],"download this object")},{action:()=>{O(!0)},label:"Share",disabled:!!F.is_delete_marker||!ye,icon:(0,y.jsx)(m.liv,{}),tooltip:ye?"Share this File":(0,r.vj)([r.OV.S3_GET_OBJECT,r.OV.S3_GET_ACTIONS],"share this object")},{action:()=>{Q(!0)},label:"Preview",disabled:!!F.is_delete_marker||"none"===Ie&&!ye,icon:(0,y.jsx)(m.cyn,{}),tooltip:ye?"Preview this File":(0,r.vj)([r.OV.S3_GET_OBJECT,r.OV.S3_GET_ACTIONS],"preview this object")},{action:()=>{k(!0)},label:"Legal Hold",disabled:!d||!p||!!F.is_delete_marker||!Se||""!==g,icon:(0,y.jsx)(m.ODz,{}),tooltip:Se?d?"Change Legal Hold rules for this File":"Object Locking must be enabled on this bucket in order to set Legal Hold":(0,r.vj)([r.OV.S3_PUT_OBJECT_LEGAL_HOLD,r.OV.S3_PUT_ACTIONS],"change legal hold settings for this object")},{action:()=>{C(!0)},label:"Retention",disabled:!p||!!F.is_delete_marker||!we||""!==g||!d,icon:(0,y.jsx)(m.gn6,{}),tooltip:we?d?"Change Retention rules for this File":"Object Locking must be enabled on this bucket in order to set Retention Rules":(0,r.vj)([r.OV.S3_GET_OBJECT_RETENTION,r.OV.S3_PUT_OBJECT_RETENTION,r.OV.S3_GET_ACTIONS,r.OV.S3_PUT_ACTIONS],"change Retention Rules for this object")},{action:()=>{I(!0)},label:"Tags",disabled:!!F.is_delete_marker||""!==g||!Oe,icon:(0,y.jsx)(m.P3Z,{}),tooltip:Oe?"Change Tags for this File":(0,r.vj)([r.OV.S3_PUT_OBJECT_TAGGING,r.OV.S3_GET_OBJECT_TAGGING,r.OV.S3_GET_ACTIONS,r.OV.S3_PUT_ACTIONS],"set Tags on this object")},{action:()=>{L(!0)},label:"Inspect",disabled:!p||!!F.is_delete_marker||""!==g||!Te,icon:(0,y.jsx)(m.nTF,{}),tooltip:Te?"Inspect this file":(0,r.vj)([r.OV.ADMIN_INSPECT_DATA],"inspect this file")},{action:()=>{x((0,c.cQ)({status:!j,objectName:ve}))},label:j?"Hide Object Versions":"Display Object Versions",icon:(0,y.jsx)(m.j1U,{}),disabled:!p||!(F.version_id&&"null"!==F.version_id)||!Ce,tooltip:Ce?F.version_id&&"null"!==F.version_id?"Display Versions for this file":"":(0,r.vj)([r.OV.S3_GET_BUCKET_VERSIONING,r.OV.S3_PUT_BUCKET_VERSIONING,r.OV.S3_GET_OBJECT_VERSION,r.OV.S3_GET_ACTIONS,r.OV.S3_PUT_ACTIONS],"display all versions of this object")}];return(0,y.jsxs)(s.Fragment,{children:[_&&F&&(0,y.jsx)(K.default,{open:_,closeModalAndRefresh:()=>{W(null),O(!1)},bucketName:n,dataObject:z||F}),T&&F&&(0,y.jsx)(ee,{open:T,closeModalAndRefresh:e=>{C(!1),e&&x((0,c.oe)(!0))},objectName:je,objectInfo:F,bucketName:n}),$&&(0,y.jsx)(se,{deleteOpen:$,selectedBucket:n,selectedObject:t,closeDeleteModalAndRefresh:e=>{Z(!1),e&&""===g?u(!0):(x((0,c.SK)(!0)),x((0,c.Ai)("")),x((0,c.oe)(!0)))},versioningInfo:p?i:void 0,selectedVersion:g}),A&&F&&(0,y.jsx)(oe,{open:A,closeModalAndRefresh:e=>{k(!1),e&&x((0,c.oe)(!0))},objectName:F.name||"",bucketName:n,actualInfo:F}),q&&F&&(0,y.jsx)(M.default,{open:q,bucketName:n,actualInfo:F,onClosePreview:()=>{Q(!1)}}),E&&F&&(0,y.jsx)(ae,{modalOpen:E,bucketName:n,actualInfo:F,onCloseAndUpdate:e=>{I(!1),e&&x((0,c.oe)(!0))}}),B&&F&&(0,y.jsx)(re,{inspectOpen:B,volumeName:n,inspectPath:F.name||"",closeInspectModalAndRefresh:e=>{L(!1),e&&x((0,c.oe)(!0))}}),le&&F&&(0,y.jsx)(ce,{open:le,closeModal:()=>{ue(!1)},currentItem:je,bucketName:n,internalPaths:t,actualInfo:F}),f?(0,y.jsx)(s.Fragment,{children:fe}):(0,y.jsxs)(m.azJ,{sx:{"& .ObjectDetailsTitle":{display:"flex",alignItems:"center","& .min-icon":{width:26,height:26,minWidth:26,minHeight:26}},"& .objectNameContainer":{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",alignItems:"center",marginLeft:10},"& .capitalizeFirst":{textTransform:"capitalize"},"& .detailContainer":{padding:"0 22px",marginBottom:10,fontSize:14}},children:[(0,y.jsx)(m.Smc,{title:(0,y.jsxs)("div",{className:"ObjectDetailsTitle",children:[G(ve||"",!0),(0,y.jsx)("span",{className:"objectNameContainer",children:ve})]}),items:Ae}),(0,y.jsx)(V.A,{tooltip:Ee?"":(0,r.vj)([r.OV.S3_DELETE_OBJECT,r.OV.S3_DELETE_ACTIONS],"delete this object"),children:(0,y.jsx)(m.xA9,{item:!0,xs:12,sx:{justifyContent:"center",display:"flex"},children:(0,y.jsx)(S.R,{resource:[n,je,[n,F.name].join("/")],scopes:[r.OV.S3_DELETE_OBJECT,r.OV.S3_DELETE_ACTIONS],errorProps:{disabled:!0},children:(0,y.jsx)(m.$nd,{id:"delete-element-click",icon:(0,y.jsx)(m.d7y,{}),iconLocation:"start",fullWidth:!0,variant:"secondary",onClick:()=>{Z(!0)},disabled:""===g&&F.is_delete_marker,sx:{width:"calc(100% - 44px)",margin:"8px 0"},label:"Delete".concat(""!==g?" version":"")})})})}),(0,y.jsx)(m.kCK,{icon:(0,y.jsx)(m.Hch,{}),label:"Object Info"}),(0,y.jsxs)(m.azJ,{className:"detailContainer",children:[(0,y.jsx)("strong",{children:"Name:"}),(0,y.jsx)("br",{}),(0,y.jsx)("div",{style:{overflowWrap:"break-word"},children:ve})]}),""!==g&&(0,y.jsxs)(m.azJ,{className:"detailContainer",children:[(0,y.jsx)("strong",{children:"Version ID:"}),(0,y.jsx)("br",{}),g]}),(0,y.jsxs)(m.azJ,{className:"detailContainer",children:[(0,y.jsx)("strong",{children:"Size:"}),(0,y.jsx)("br",{}),(0,b.nO)("".concat(F.size||"0"))]}),F.version_id&&"null"!==F.version_id&&""===g&&(0,y.jsxs)(m.azJ,{className:"detailContainer",children:[(0,y.jsx)("strong",{children:"Versions:"}),(0,y.jsx)("br",{}),H.length,ne?"+":""," version",1!==H.length?"s":"",","," ",(0,b.qO)(X),ne?"+":""]}),""===g&&(0,y.jsxs)(m.azJ,{className:"detailContainer",children:[(0,y.jsx)("strong",{children:"Last Modified:"}),(0,y.jsx)("br",{}),(e=>{const t=new Date,n=new Date(e),s=t.getTime()-n.getTime(),o=(0,b.eQ)(s,"ms");return""!==o.trim()?"".concat(o," ago"):"Just now"})(F.last_modified||"")]}),(0,y.jsxs)(m.azJ,{className:"detailContainer",children:[(0,y.jsx)("strong",{children:"ETAG:"}),(0,y.jsx)("br",{}),F.etag||"N/A"]}),(0,y.jsxs)(m.azJ,{className:"detailContainer",children:[(0,y.jsx)("strong",{children:"Tags:"}),(0,y.jsx)("br",{}),0===ge.length?"N/A":ge.map((e,t)=>(0,y.jsxs)("span",{children:[e,":",h()(F.tags,"".concat(e),""),t{let{versionToRestore:t,bucketName:n,objectPath:o,restoreOpen:i,onCloseAndUpdate:r}=e;const d=(0,l.jL)(),[u,h]=(0,s.useState)(!1);return(0,y.jsx)(te.A,{title:"Restore File Version",confirmText:"Restore",isOpen:i,isLoading:u,titleIcon:(0,y.jsx)(m.YkU,{}),onConfirm:()=>{h(!0),a.F.buckets.putObjectRestore(n,{prefix:o,version_id:t.version_id||""}).then(()=>{h(!1),r(!0),d((0,c.NV)({prefix:o,objectInfo:t}))}).catch(e=>{d((0,w.C9)((0,x.S)(e.error))),h(!1)})},confirmButtonProps:{variant:"secondary",disabled:u},onClose:()=>{r(!1)},confirmationContent:(0,y.jsxs)(m.azJ,{id:"alert-dialog-description",children:["Are you sure you want to restore ",(0,y.jsx)("br",{}),(0,y.jsx)("b",{children:o})," ",(0,y.jsx)("br",{})," with Version ID:",(0,y.jsx)("br",{}),(0,y.jsx)("b",{children:t.version_id}),"?"]})})},me=e=>{let{type:t}=e,n="#000",s="";switch(t){case"null":n="#07193E",s="NULL VERSION";break;case"deleted":n="#868686",s="DELETED";break;default:n="#174551",s="CURRENT VERSION"}return(0,y.jsx)("span",{style:{backgroundColor:n,padding:"0 5px",display:"inline-block",color:"#FFF",fontWeight:"bold",fontSize:12,borderRadius:2,whiteSpace:"nowrap",margin:"0 10px"},children:s})},xe=v.Ay.div(e=>{let{theme:t}=e;return{"&:before":{content:"' '",display:"block",position:"absolute",width:"2px",height:"calc(100% + 2px)",backgroundColor:h()(t,"borderColor","#F8F8F8"),left:"24px"},"& .mainFileVersionItem":{borderBottom:"".concat(h()(t,"borderColor","#F8F8F8")," 1px solid"),padding:"1rem 0",margin:"0 0.5rem 0 2.5rem",cursor:"pointer","&.deleted":{color:"#868686"}},"& .intermediateLayer":{margin:"0 1.5rem 0 1.5rem","&:hover, &.selected":{backgroundColor:h()(t,"boxBackground","#F8F8F8"),"& > div":{borderBottomColor:h()(t,"boxBackground","#F8F8F8")}}},"& .versionContainer":{fontSize:16,fontWeight:"bold",display:"flex",alignItems:"center","& svg.min-icon":{width:18,height:18,minWidth:18,minHeight:18,marginRight:10}},"& .buttonContainer":{textAlign:"right","& button":{marginLeft:"1.5rem"}},"& .versionID":{fontSize:"12px",margin:"2px 0",whiteSpace:"nowrap",textOverflow:"ellipsis",maxWidth:"95%",overflow:"hidden"},"& .versionData":{marginRight:"10px",fontSize:12,color:"#868686"},"@media (max-width: 600px)":{"& .buttonContainer":{"& button":{marginLeft:"5px"}}},"@media (max-width: 799px)":{"&:before":{display:"none"},"& .mainFileVersionItem":{padding:"5px 0px",margin:0},"& .intermediateLayer":{margin:0,"&:hover, &.selected":{backgroundColor:"transparent","& > div":{borderBottomColor:h()(t,"boxBackground","#F8F8F8")}}},"& .versionContainer":{fontSize:14,"& svg.min-icon":{display:"none"}},"& .versionData":{textOverflow:"ellipsis",maxWidth:"95%",overflow:"hidden",whiteSpace:"nowrap"},"& .collapsableInfo":{display:"flex",flexDirection:"column"},"& .versionItem":{display:"none"}}}}),pe=e=>{let{fileName:t,versionInfo:n,isSelected:s,checkable:o,isChecked:i,onCheck:a,onShare:l,onDownload:r,onRestore:c,onPreview:d,globalClick:u,index:h,key:x,style:p}=e;const g=n.is_delete_marker,f=[{icon:(0,y.jsx)(m.cyn,{}),action:d,tooltip:"Preview"},{icon:(0,y.jsx)(m.s3U,{}),action:r,tooltip:"Download this version"},{icon:(0,y.jsx)(m.liv,{}),action:l,tooltip:"Share this version"},{icon:(0,y.jsx)(m.YkU,{}),action:c,tooltip:"Restore this version"}];let v=null;n.is_delete_marker?v="deleted":n.is_latest?v="current":"null"===n.version_id&&(v="null");let _=j.c9.now();return n.last_modified&&(_=j.c9.fromISO(n.last_modified)),(0,y.jsx)(xe,{children:(0,y.jsx)(m.xA9,{container:!0,className:"ctrItem",onClick:()=>{u(n)},style:p,children:(0,y.jsx)(m.xA9,{item:!0,xs:12,className:"intermediateLayer".concat(" ",s?"selected":""),children:(0,y.jsxs)(m.xA9,{item:!0,xs:!0,className:"mainFileVersionItem ".concat(n.is_delete_marker?"deleted":""),children:[(0,y.jsx)(m.xA9,{item:!0,xs:12,children:(0,y.jsxs)(m.xA9,{container:!0,children:[(0,y.jsxs)(m.xA9,{item:!0,xs:!0,md:4,className:"versionContainer",sx:{".inputItem":{width:"auto"}},children:[o&&(0,y.jsx)(m.Sc0,{checked:i,id:"select-".concat(n.version_id),name:"select-".concat(n.version_id),onChange:e=>{e.stopPropagation(),a(n.version_id||"")},value:n.version_id||"",disabled:n.is_delete_marker,sx:{width:"initial"}}),G(t,!0)," v",h.toString(),(0,y.jsx)("span",{className:"versionItem",children:v&&(0,y.jsx)(me,{type:v})})]}),(0,y.jsx)(m.xA9,{item:!0,xs:10,md:8,className:"buttonContainer",children:f.map((e,t)=>(0,y.jsx)(m.m_M,{tooltip:e.tooltip,children:(0,y.jsx)(m.K0,{size:"small",id:"version-action-".concat(e.tooltip,"-").concat(t.toString()),className:"spacing".concat(" ",g?"buttonDisabled":""),disabled:g,onClick:t=>{t.stopPropagation(),g?t.preventDefault():e.action(n)},sx:{backgroundColor:"#F8F8F8",borderRadius:"100%",width:"28px",height:"28px",padding:"5px","& .min-icon":{width:"14px",height:"14px"}},children:e.icon})},"version-action-".concat(e.tooltip,"-").concat(t.toString())))})]})}),(0,y.jsx)(m.xA9,{item:!0,xs:12,className:"versionID",children:"null"!==n.version_id?n.version_id:"-"}),(0,y.jsxs)(m.xA9,{item:!0,xs:12,className:"collapsableInfo",children:[(0,y.jsxs)("span",{className:"versionData",children:[(0,y.jsx)("strong",{children:"Last modified:"})," ",_.toFormat("ccc, LLL dd yyyy HH:mm:ss (ZZZZ)")]}),(0,y.jsxs)("span",{className:"versionData",children:[(0,y.jsx)("strong",{children:"Size:"})," ",(0,b.nO)("".concat(n.size||"0"))]})]})]})})},x)})},je=e=>{let{closeDeleteModalAndRefresh:t,deleteOpen:n,selectedBucket:i,selectedObject:c}=e;const d=(0,l.jL)(),[u,h]=(0,s.useState)(!1),[p,j]=(0,s.useState)(""),[b,g]=(0,s.useState)(!1),f=(0,o.d4)(e=>e.objectBrowser.retentionConfig),v=(0,S._)([i],[r.OV.S3_BYPASS_GOVERNANCE_RETENTION])&&"governance"===(null===f||void 0===f?void 0:f.mode);if((0,s.useEffect)(()=>{u&&a.F.buckets.deleteObject(i,{prefix:c,non_current_versions:!0,bypass:b}).then(()=>{t(!0)}).catch(e=>{d((0,w.C9)((0,x.S)(e.error))),h(!1)})},[u,t,d,c,i,b]),!c)return null;return(0,y.jsx)(te.A,{title:"Delete Non-Current versions",confirmText:"Delete",isOpen:n,titleIcon:(0,y.jsx)(m.xWY,{}),isLoading:u,onConfirm:()=>{h(!0)},onClose:()=>t(!1),confirmButtonProps:{disabled:"YES, PROCEED"!==p||u},confirmationContent:(0,y.jsxs)(s.Fragment,{children:["Are you sure you want to delete all the non-current versions for:"," ",(0,y.jsx)("b",{children:c}),"? ",(0,y.jsx)("br",{}),v&&(0,y.jsx)(s.Fragment,{children:(0,y.jsx)("div",{style:{marginTop:10},children:(0,y.jsx)(m.dOG,{label:"Bypass Governance Mode",indicatorLabels:["Yes","No"],checked:b,value:"bypass_governance",id:"bypass_governance",name:"bypass_governance",onChange:e=>{g(!b)},description:""})})}),(0,y.jsx)("br",{}),"To continue please type ",(0,y.jsx)("b",{children:"YES, PROCEED"})," in the box.",(0,y.jsx)("br",{}),(0,y.jsx)("br",{}),(0,y.jsx)(m.xA9,{item:!0,xs:12,children:(0,y.jsx)(m.cl_,{id:"type-confirm",name:"retype-tenant",onChange:e=>{j(e.target.value)},label:"",value:p})})]})})},be=e=>{let{closeDeleteModalAndRefresh:t,deleteOpen:n,selectedBucket:i,selectedVersions:c,selectedObject:d}=e;const u=(0,l.jL)(),[h,p]=(0,s.useState)(!1),[j,b]=(0,s.useState)(!1),g=(0,o.d4)(e=>e.objectBrowser.retentionConfig),f=(0,S._)([i],[r.OV.S3_BYPASS_GOVERNANCE_RETENTION])&&"governance"===(null===g||void 0===g?void 0:g.mode);return(0,s.useEffect)(()=>{if(h){const e=c.map(e=>({path:d,versionID:e,recursive:!1}));e.length>0&&a.F.buckets.deleteMultipleObjects(i,e,{all_versions:!1,bypass:j}).then(()=>{p(!1),t(!0)}).catch(e=>{u((0,w.C9)((0,x.S)(e.error))),p(!1)})}},[h,t,i,d,c,j,u]),c?(0,y.jsx)(te.A,{title:"Delete Selected Versions",confirmText:"Delete",isOpen:n,titleIcon:(0,y.jsx)(m.xWY,{}),isLoading:h,onConfirm:()=>{p(!0)},onClose:()=>t(!1),confirmationContent:(0,y.jsxs)(s.Fragment,{children:["Are you sure you want to delete the selected ",c.length," ","versions for ",(0,y.jsx)("strong",{children:d}),"?",f&&(0,y.jsx)(s.Fragment,{children:(0,y.jsx)("div",{style:{marginTop:10},children:(0,y.jsx)(m.dOG,{label:"Bypass Governance Mode",indicatorLabels:["Yes","No"],checked:j,value:"bypass_governance",id:"bypass_governance",name:"bypass_governance",onChange:e=>{b(!j)},description:""})})})]})}):null};var ge=n(85049);const fe={is_latest:!0,last_modified:"",legal_hold_status:"",name:"",retention_mode:"",retention_until_date:"",size:0,tags:{},version_id:void 0},ve=e=>{let{internalPaths:t,bucketName:n}=e;const i=(0,l.jL)(),r=(0,o.d4)(e=>e.objectBrowser.searchVersions),d=(0,o.d4)(e=>e.objectBrowser.loadingVersions),u=(0,o.d4)(e=>e.objectBrowser.selectedVersion),p=(0,o.d4)(e=>e.objectBrowser.versionsLimit),j=(0,o.d4)(w.Rq),[g,f]=(0,s.useState)(!1),[v,_]=(0,s.useState)(null),[S,O]=(0,s.useState)(null),[T,C]=(0,s.useState)([]),[E,I]=(0,s.useState)(!1),[N,k]=(0,s.useState)(!1),[B,L]=(0,s.useState)(null),[F,D]=(0,s.useState)("date"),[R,U]=(0,s.useState)(!1),[z,G]=(0,s.useState)(!1),[J,W]=(0,s.useState)(!1),[H,Y]=(0,s.useState)([]),[$,Z]=(0,s.useState)(!1);let q=[];v&&v.name&&(q=v.name.split("/")),(0,s.useEffect)(()=>{d||v||i((0,c.SK)(!0))},[d,v,i]),(0,s.useEffect)(()=>{d&&""!==t&&a.F.buckets.listObjects(n,{prefix:t,with_versions:j,limit:p+1}).then(e=>{const n=h()(e.data,"objects",[]);I(n.length>p),n.splice(p);const s=n.filter(e=>e.name===t);j?(_(s.find(e=>e.is_latest)||fe),C(s)):(_(s[0]),C([])),i((0,c.SK)(!1))}).catch(e=>{i((0,w.C9)((0,x.S)(e.error))),i((0,c.SK)(!1))})},[d,n,t,i,j,p]);const Q=e=>{O(e),f(!0)},X=e=>{O(e),U(!0)},ee=e=>{L(e),k(!0)},te=e=>{(0,P._)(i,n,t,e)},ne=e=>{i((0,c.Ai)(e.version_id||""))},se=T.filter(e=>!!e.version_id&&e.version_id.includes(r)),oe=e=>{Z(!1),e&&(i((0,c.SK)(!0)),i((0,c.Ai)("")),i((0,c.oe)(!0)),Y([]))},ie=T.reduce((e,t)=>t.size?e+t.size:e,0);se.sort((e,t)=>{if("size"===F)return e.size&&t.size?e.sizet.size?1:0:0;{const n=new Date(e.last_modified||"").getTime(),s=new Date(t.last_modified||"").getTime();return ns?-1:0}});const ae=e=>{if(H.includes(e)){const t=H.filter(t=>t!==e);return void Y(t)}const t=[...H];t.push(e),Y(t)};return(0,y.jsxs)(s.Fragment,{children:[g&&v&&(0,y.jsx)(K.default,{open:g,closeModalAndRefresh:()=>{O(null),f(!1),U(!1)},bucketName:n,dataObject:S||v}),N&&v&&B&&(0,y.jsx)(he,{restoreOpen:N,bucketName:n,versionToRestore:B,objectPath:v.name||"",onCloseAndUpdate:e=>{k(!1),L(null),e&&(i((0,c.SK)(!0)),i((0,c.oe)(!0)))}}),R&&v&&(0,y.jsx)(M.default,{open:R,bucketName:n,actualInfo:{name:v.name||"",version_id:S&&S.version_id?S.version_id:"null",size:S&&S.size?S.size:0,content_type:"",last_modified:v.last_modified||""},onClosePreview:()=>{U(!1)}}),z&&(0,y.jsx)(je,{deleteOpen:z,closeDeleteModalAndRefresh:e=>{G(!1),e&&(i((0,c.SK)(!0)),i((0,c.Ai)("")),i((0,c.oe)(!0)))},selectedBucket:n,selectedObject:t}),$&&(0,y.jsx)(be,{selectedBucket:n,selectedObject:t,deleteOpen:$,selectedVersions:H,closeDeleteModalAndRefresh:oe}),(0,y.jsxs)(m.xA9,{container:!0,sx:{width:"100%",padding:10,"@media (max-width: 799px)":{minHeight:800}},children:[!v&&(0,y.jsx)(m.xA9,{item:!0,xs:12,children:(0,y.jsx)(m.z21,{})}),v&&(0,y.jsxs)(s.Fragment,{children:[(0,y.jsx)(m.xA9,{item:!0,xs:12,children:(0,y.jsx)(A,{bucketName:n,internalPaths:t,hidePathButton:!0})}),(0,y.jsx)(m.xA9,{item:!0,xs:12,sx:{position:"relative","& .detailsSpacer":{marginRight:18,"@media (max-width: 600px)":{marginRight:0}},["@media (max-width: ".concat(m.nmC.md,"px)")]:{"&::before":{display:"none"}}},children:(0,y.jsx)(m.lcx,{icon:(0,y.jsx)("span",{style:{display:"block",marginTop:"-10px"},children:(0,y.jsx)(m.j1U,{style:{width:20,height:20}})}),title:"".concat(q.length>0?q[q.length-1]:v.name," Versions"),subTitle:(0,y.jsxs)(s.Fragment,{children:[(0,y.jsx)("span",{className:"detailsSpacer",children:(0,y.jsxs)("strong",{children:[T.length,E?"+":""," Version",1===T.length?"":"s","\xa0\xa0\xa0"]})}),(0,y.jsx)("span",{className:"detailsSpacer",children:(0,y.jsxs)("strong",{children:[(0,b.qO)(ie),E?"+":""]})}),E&&(0,y.jsx)(V.A,{tooltip:"Load more Versions",children:(0,y.jsx)(m.$nd,{label:"Load more",id:"load-more-versions",onClick:()=>{i((0,c.Vk)(p+10)),oe(!0)},icon:(0,y.jsx)(m.fNY,{}),variant:"regular",style:{marginLeft:50}})})]}),actions:(0,y.jsxs)(s.Fragment,{children:[(0,y.jsx)(V.A,{tooltip:"Select Multiple Versions",children:(0,y.jsx)(m.$nd,{id:"select-multiple-versions",onClick:()=>{W(!J)},icon:(0,y.jsx)(m.IN,{}),variant:J?"callAction":"regular",style:{marginRight:8}})}),J&&(0,y.jsx)(V.A,{tooltip:"Delete Selected Versions",children:(0,y.jsx)(m.$nd,{id:"delete-multiple-versions",onClick:()=>{Z(!0)},icon:(0,y.jsx)(m.d7y,{}),variant:"secondary",style:{marginRight:8},disabled:0===H.length})}),(0,y.jsx)(V.A,{tooltip:"Delete Non Current Versions",children:(0,y.jsx)(m.$nd,{id:"delete-non-current",onClick:()=>{G(!0)},icon:(0,y.jsx)(m.rgY,{}),variant:"secondary",style:{marginRight:15},disabled:T.length<=1})}),(0,y.jsx)(m.l6P,{id:"sort-by",options:[{label:"Date",value:"date"},{label:"Size",value:"size"}],value:F,label:"Sort by",onChange:e=>{D(e)},noLabelMinWidth:!0})]}),bottomBorder:!1})}),(0,y.jsx)(m.xA9,{item:!0,xs:12,sx:{flexGrow:1,height:"calc(100% - 120px)",overflow:"auto",["@media (max-width: ".concat(m.nmC.md,"px)")]:{height:600}},children:v.version_id&&"null"!==v.version_id&&(0,y.jsx)(ge.B8,{style:{width:"100%"},containerStyle:{width:"100%",maxWidth:"100%"},width:1,height:800,rowCount:se.length,rowHeight:108,rowRenderer:e=>{let{key:t,index:n,isScrolling:s,isVisible:o,style:i}=e;const a=T.length-n;return(0,y.jsx)(pe,{style:i,fileName:(null===v||void 0===v?void 0:v.name)||"",versionInfo:se[n],index:a,onDownload:te,onRestore:ee,onShare:Q,onPreview:X,globalClick:ne,isSelected:u===se[n].version_id,checkable:J,onCheck:ae,isChecked:H.includes(se[n].version_id||"")},t)}})})]})]})]})},_e=e=>{if(e.name.endsWith("/"))return"";const t=j.c9.now(),n=j.c9.fromISO(e.last_modified);return t.hasSame(n,"day")&&t.hasSame(n,"month")&&t.hasSame(n,"year")?"Today, ".concat(n.toFormat("HH:mm")):n.toFormat("ccc, LLL dd yyyy HH:mm (ZZZZ)")},Se=e=>e.name.endsWith("/")||!e.size?"-":(0,b.nO)(String(e.size)),Oe=[{label:"Name",elementKey:"name",renderFunction:G,enableSort:!0},{label:"Last Modified",elementKey:"last_modified",renderFunction:_e,renderFullObject:!0,enableSort:!0},{label:"Size",elementKey:"size",renderFunction:Se,renderFullObject:!0,width:100,enableSort:!0}],we=[{label:"Name",elementKey:"name",renderFunction:G,enableSort:!0},{label:"Object Date",elementKey:"last_modified",renderFunction:_e,renderFullObject:!0,enableSort:!0},{label:"Size",elementKey:"size",renderFunction:Se,renderFullObject:!0,width:100,enableSort:!0},{label:"Deleted",elementKey:"delete_flag",renderFunction:e=>e?"Yes":"No",width:60}];var Te=n(86070);const Ce=()=>{const e=(0,l.jL)(),t=(0,i.g)(),n=(0,i.Zp)(),[a,d]=(0,s.useState)("ASC"),[u,x]=(0,s.useState)("name"),p=t.bucketName||"",j=(0,o.d4)(e=>e.objectBrowser.objectDetailsOpen),b=(0,o.d4)(e=>e.objectBrowser.requestInProgress),g=(0,o.d4)(Te.s$),f=!(null===g||void 0===g||!g.includes("object-browser-only")),v=(0,o.d4)(e=>e.objectBrowser.rewind.rewindEnabled),_=(0,o.d4)(e=>e.objectBrowser.records),O=(0,o.d4)(e=>e.objectBrowser.searchObjects),w=(0,o.d4)(e=>e.objectBrowser.selectedObjects),T=(0,o.d4)(e=>e.objectBrowser.connectionError),C=(0,o.d4)(e=>e.system.anonymousMode),E=(0,S._)(p,[r.OV.S3_LIST_BUCKET,r.OV.S3_ALL_LIST_BUCKET]),I=_.filter(e=>{if(""===O)return!0;return e.name.toLowerCase().indexOf(O.toLowerCase())>=0}).sort((0,N.$w)(u));let A=[];A="ASC"===a?I:I.reverse();const k=[{type:"view",tooltip:"View",onClick:t=>{var s;const o=t.name||"",i="/browser/".concat(encodeURIComponent(p)).concat(o?"/".concat(encodeURIComponent(o)):"");!C||null!==(s=t.name)&&void 0!==s&&s.endsWith("/")?(e((0,c.KX)([])),n(i),C||(e((0,c.TO)(!0)),e((0,c.SK)(!0))),e((0,c.A7)(o))):(0,P._)(e,p,o,t)},sendOnlyId:!1}];let B=E||C?"This location is empty".concat(v?"":", please try uploading a new file"):(0,r.vj)([r.OV.S3_LIST_BUCKET,r.OV.S3_ALL_LIST_BUCKET],"view Objects in this bucket");T&&(B="Objects List unavailable. Please review your WebSockets configuration and try again");let L="calc(100vh - 290px)";return f&&(L="calc(100vh - 315px)"),(0,y.jsx)(m.bQt,{itemActions:k,columns:v?we:Oe,isLoading:b,entityName:"Objects",idField:"name",records:A,customPaperHeight:L,selectedItems:w,onSelect:C?void 0:t=>{const n=t.target,s=n.value,o=n.checked;let i=[...w];return o?i.push(s):i=i.filter(e=>e!==s),e((0,c.KX)(i)),e((0,c.A7)(null)),i},customEmptyMessage:B,sortEnabled:{currentSort:u,currentDirection:a,onSortClick:t=>{const n=h()(t,"sortDirection","DESC");x(t.sortBy),d(n),e((0,c.Yw)(!0))}},onSelectAll:()=>{if(e((0,c.A7)(null)),w.length===A.length)return void e((0,c.KX)([]));const t=A.map(e=>e.name);e((0,c.KX)(t))},rowStyle:e=>{var t;let{index:n}=e;return null!==(t=A[n])&&void 0!==t&&t.delete_flag?"deleted":""},sx:{minHeight:j?"100%":"initial"},noBackground:!0})};var ye=n(27428);const Ee=()=>{const e=(0,l.jL)(),t=(0,o.d4)(e=>e.objectBrowser.searchObjects);return(0,y.jsx)(ye.A,{placeholder:"Start typing to filter objects in the bucket",onChange:t=>{e((0,c.$X)(t))},value:t})};var Ie=n(54945);const Ae=(0,O.A)(s.lazy(()=>n.e(66).then(n.bind(n,50066)))),Ne=(0,O.A)(s.lazy(()=>Promise.resolve().then(n.bind(n,21572)))),ke=(0,O.A)(s.lazy(()=>n.e(3697).then(n.bind(n,53697)))),Be=(0,O.A)(s.lazy(()=>Promise.resolve().then(n.bind(n,39971)))),Le={borderWidth:2,borderRadius:2,borderColor:"transparent",outline:"none"},Fe={borderStyle:"dashed",backgroundColor:"transparent",borderColor:"#2196f3"},Ve={borderStyle:"dashed",backgroundColor:"transparent",borderColor:"#00e676"},De=()=>{var e;const t=(0,l.jL)(),n=(0,i.g)(),u=(0,i.Zp)(),g=(0,i.zy)(),f=(0,o.d4)(e=>e.objectBrowser.rewind.rewindEnabled),v=(0,o.d4)(e=>e.objectBrowser.rewind.bucketToRewind),_=(0,o.d4)(e=>e.objectBrowser.versionsMode),O=(0,o.d4)(e=>e.objectBrowser.showDeleted),E=(0,o.d4)(e=>e.objectBrowser.objectDetailsOpen),I=(0,o.d4)(e=>e.objectBrowser.selectedInternalPaths),P=(0,o.d4)(e=>e.objectBrowser.requestInProgress),U=(0,o.d4)(e=>e.objectBrowser.simplePath),z=(0,o.d4)(e=>e.objectBrowser.versionInfo),G=(0,o.d4)(e=>e.objectBrowser.lockingEnabled),M=(0,o.d4)(e=>e.objectBrowser.downloadRenameModal),J=(0,o.d4)(e=>e.objectBrowser.selectedPreview),K=(0,o.d4)(e=>e.objectBrowser.shareFileModalOpen),W=(0,o.d4)(e=>e.objectBrowser.previewOpen),H=(0,o.d4)(e=>e.objectBrowser.selectedBucket),Y=(0,o.d4)(e=>e.system.anonymousMode),$=(0,o.d4)(e=>e.objectBrowser.anonymousAccessOpen),Z=(0,o.d4)(e=>{var t;return(null===(t=e.objectBrowser)||void 0===t?void 0:t.records)||[]}),q=(0,o.d4)(L.Nx),Q=(0,o.d4)(L.fT),[X,ee]=(0,s.useState)(!1),[te,ne]=(0,s.useState)(!1),[se,oe]=(0,s.useState)(!1),[ie,ae]=(0,s.useState)(!1),[le,re]=(0,s.useState)(!1),[de,he]=(0,s.useState)(null),[me,xe]=(0,s.useState)(null),[pe,je]=(0,s.useState)(!1),be=k(z.status),ge=n.bucketName||"",fe=g.pathname.split("/browser/".concat(ge,"/")),_e=2===fe.length?decodeURIComponent(fe[1]):"",Se=_e.split("/").filter(e=>""!==e);let Oe=[ge];Se.length>0&&(Oe=Oe.concat(Se));const we=(0,s.useRef)(null),Te=(0,s.useRef)(null),ye=(0,o.d4)(e=>e.console.session&&e.console.session.permissions||{}),De=[r.OV.S3_PUT_OBJECT,r.OV.S3_PUT_ACTIONS],Re=Oe.join("/"),Pe=function(e,t){const n=C(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]).reduce((e,t)=>{const n=T(t);return n&&e.push(".".concat(n)),e},[]);return[...new Set(n)].join(",")}(ye,Re,De),Ue=C(ye,Re,De),ze=(0,S._)([Re,...Ue],[r.OV.S3_GET_OBJECT,r.OV.S3_GET_ACTIONS]),Ge=(0,S._)(ge,[r.OV.S3_GET_OBJECT,r.OV.S3_GET_ACTIONS,r.OV.S3_GET_BUCKET_VERSIONING]),Me=(0,S._)([Re,...Ue],[r.OV.S3_DELETE_OBJECT,r.OV.S3_DELETE_ACTIONS]),Je=(0,S._)([Re,...Ue],De)||Y,Ke=(0,S._)(ge,[r.OV.S3_GET_BUCKET_POLICY,r.OV.S3_PUT_BUCKET_POLICY,r.OV.S3_GET_ACTIONS,r.OV.S3_PUT_ACTIONS]),We=(0,o.d4)(e=>e.objectBrowser.selectedObjects),He=(()=>{let e=!1;if(1===We.length){e=!!Z.find(e=>e.name==="".concat(We[0])&&e.delete_flag)}return e})(),Ye=(0,s.useCallback)(()=>{const e=We[0];!pe&&e&&a.F.buckets.getObjectMetadata(ge,{prefix:e}).then(e=>{let t=h()(e.data,"objectMetadata",{});je(!0),xe(t)}).catch(e=>{console.error("Error Getting Metadata Status: ",e,null===e||void 0===e?void 0:e.detailedError),je(!0)})},[ge,We,pe]);(0,s.useEffect)(()=>{ge&&!He&&Ye()},[ge,We,Ye,He]),(0,s.useEffect)(()=>{f&&v!==ge&&t((0,c.rS)())},[f,v,ge,t]),(0,s.useEffect)(()=>{null!==Te.current&&(Te.current.setAttribute("directory",""),Te.current.setAttribute("webkitdirectory",""))},[Te]),(0,s.useEffect)(()=>{if(1===We.length){const e=We[0],t=e.endsWith("/");let n=(0,N.IZ)(me,e);re(!("none"===n||!ze)),ae(!(!ze||t))}else ae(!1),re(!1)},[We,ze,me]),(0,s.useEffect)(()=>{de||Y||a.F.buckets.getBucketQuota(ge).then(e=>{let t=null;e.data.quota&&(t=e.data),he(t)}).catch(e=>{console.error("Error Getting Quota Status: ",e.error.detailedMessage),he(null)})},[de,ge,Y]),(0,s.useEffect)(()=>{We.length>0?t((0,c.TO)(!0)):0!==We.length||null!==I||P||t((0,c.TO)(!1))},[We,I,t,P]),(0,s.useEffect)(()=>{se||(t((0,L.ZU)(!0)),oe(!0))},[se,t,oe]),(0,s.useEffect)(()=>{!P&&!q||Y||a.F.buckets.bucketInfo(ge).then(e=>{t((0,L.ZU)(!1)),t((0,L.$T)(e.data))}).catch(e=>{t((0,L.ZU)(!1)),t((0,w.C9)((0,x.S)(e)))})},[ge,q,t,Y,P]),(0,s.useEffect)(()=>{""!==H&&a.F.buckets.getBucketRetentionConfig(H).then(e=>{t((0,c.PJ)(e.data))}).catch(()=>{t((0,c.PJ)(null))})},[H,t]);const $e=e=>{if(null!==e&&void 0!==e&&null!==e.target.files&&void 0!==e.target.files){e.preventDefault();var t=[];for(let n=0;n{let s="";U&&(s=U.endsWith("/")?U:U+"/");((e,n,s,o)=>{let i=i=>new Promise((a,l)=>{let r="api/v1/buckets/".concat(n,"/objects/upload");const d=i.name,u=new Blob([i],{type:i.type}),m=(e=>e.replace(/(^|\/)\.\//g,"/"))(h()(i,"path","")),x=h()(i,"webkitRelativePath","");let p=o;const j=(0,B.E0)(8);""!==m?p=m:""!==x&&(p=x);let b="";if(""!==s||""!==p){const e=p.split("/").slice(0,-1).join("/"),t=s.endsWith("/")?s.slice(0,-1):s;b="".concat(t).concat(t.endsWith("/")||""===e||e.startsWith("/")?"":"/").concat(e).concat(!e.endsWith("/")||""===e.trim()&&!s.endsWith("/")?"/":"")}r=""!==b?"".concat(r,"?prefix=").concat(encodeURIComponent(b+d)):"".concat(r,"?prefix=").concat(encodeURIComponent(d));const g=encodeURIComponent("".concat(n,"-").concat(b,"-").concat((new Date).getTime(),"-").concat(Math.random()));let f=new XMLHttpRequest;f.open("POST",r,!0),Y&&f.setRequestHeader("X-Anonymous","1");const v=e.length>1;let _="An error occurred while uploading the file".concat(v?"s":"",".");const S={413:"Error - File size too large"};f.withCredentials=!1,f.onload=function(){if(f.status>=200&&f.status<300)t((0,c.rx)(g)),a({status:f.status}),(0,B.vy)(j);else{if(S[f.status])_=S[f.status];else if(f.response)try{const e=JSON.parse(f.response);_=e.detailedMessage}catch(e){_="something went wrong"}t((0,c.iL)({instanceID:g,msg:_})),l({status:f.status,message:_}),(0,B.vy)(j)}},f.upload.addEventListener("error",()=>{l(_),t((0,c.iL)({instanceID:g,msg:"A network error occurred."}))}),f.upload.addEventListener("progress",e=>{const n=Math.floor(100*e.loaded/e.total);t((0,c.DW)({instanceID:g,progress:n}))}),f.onerror=()=>{l(_),t((0,c.iL)({instanceID:g,msg:"A network error occurred."}))},f.onloadend=()=>{0===e.length&&t((0,c.Yw)(!0))},f.onabort=()=>{t((0,c.Dm)(g))};const O=new FormData;void 0!==i.size&&(O.append(i.size.toString(),u,d),(0,B.FP)(j,f),t((0,c.cP)({ID:j,bucketName:n,done:!1,instanceID:g,percentage:0,prefix:"".concat(b).concat(d),type:"upload",waitingForFile:!1,failed:!1,cancelled:!1,errorMessage:""})),(0,B.vx)(j,O))});const a=[];t((0,c.Nu)());for(let t=0;t{const n=e.filter(e=>"rejected"===e.status);if(n.length>0){const e=a.length,s=a.length-n.length,o={errorMessage:"There were some errors during file upload",detailedError:"Uploaded files ".concat(s,"/").concat(e)};t((0,w.C9)(o))}t((0,c.Yw)(!0))})})(e,ge,s,n)},[ge,t,U,Y]),qe=(0,s.useCallback)(e=>{if(e&&e.length>0&&Je){let n=e[0].path,s=e;Pe.length>0&&(s=e.filter(e=>{const t=T(e.name);return Pe.includes(t)})),s.length?(Ze(s,n),console.log("".concat(s.length," Allowed Files Processed out of ").concat(e.length,"."),Re,...Ue),s.length!==e.length&&t((0,w.C9)({errorMessage:"Upload is restricted.",detailedError:(0,r.vj)([r.OV.S3_PUT_OBJECT,r.OV.S3_PUT_ACTIONS],"upload objects to this location")}))):(t((0,w.C9)({errorMessage:"Could not process drag and drop.",detailedError:(0,r.vj)([r.OV.S3_PUT_OBJECT,r.OV.S3_PUT_ACTIONS],"upload objects to this location")})),console.error("Could not process drag and drop . upload may be restricted.",Re,...Ue))}Je||t((0,w.C9)({errorMessage:"Upload not allowed",detailedError:(0,r.vj)([r.OV.S3_PUT_OBJECT,r.OV.S3_PUT_ACTIONS],"upload objects to this location")}))},[Ze]),{getRootProps:Qe,getInputProps:Xe,isDragActive:et,isDragAccept:tt}=(0,p.VB)({noClick:!0,onDrop:qe}),nt=(0,s.useMemo)(()=>(0,d.A)((0,d.A)((0,d.A)({},Le),et?Fe:{}),tt?Ve:{}),[et,tt]),st=e=>{if(t((0,c.A7)(null)),t((0,c.cQ)({status:!1})),E&&null!==I){const e=_e.split("/");e.pop();let t="";e&&e.length>0&&(t="".concat(e.join("/"),"/")),u("/browser/".concat(encodeURIComponent(ge),"/").concat(encodeURIComponent(t)))}t((0,c.TO)(!1)),e&&t((0,c.Yw)(!0))};let ot=j.c9.now();null!==Q&&void 0!==Q&&Q.creation_date&&(ot=j.c9.fromISO(Q.creation_date));const it=(null===We||void 0===We?void 0:We.length)<=1?"Download Selected":" Download selected objects as Zip. Any Deleted objects in the selection would be skipped from download.",at=[{action:()=>{t((0,F.op)(ge))},label:"Download",disabled:!ze||He,icon:(0,y.jsx)(m.s3U,{}),tooltip:ze?it:(0,r.vj)([r.OV.S3_GET_OBJECT,r.OV.S3_GET_ACTIONS],"download objects from this bucket")},{action:()=>{t((0,F.mS)())},label:"Share",disabled:1!==We.length||!ie||He,icon:(0,y.jsx)(m.liv,{}),tooltip:ie?"Share Selected File":"Sharing unavailable"},{action:()=>{t((0,F.HS)())},label:"Preview",disabled:1!==We.length||!le||He,icon:(0,y.jsx)(m.cyn,{}),tooltip:le?"Preview Selected File":"Preview unavailable"},{action:()=>{t((0,F.oz)())},label:"Anonymous Access",disabled:1!==We.length||!We[0].endsWith("/")||!Ke,icon:(0,y.jsx)(m._kf,{}),tooltip:1===We.length&&We[0].endsWith("/")?"Set Anonymous Access to this Folder":"Anonymous Access unavailable"},{action:()=>{ee(!0)},label:"Delete",icon:(0,y.jsx)(m.d7y,{}),disabled:!Me||0===We.length,tooltip:Me?"Delete Selected Files":(0,r.vj)([r.OV.S3_DELETE_OBJECT,r.OV.S3_DELETE_ACTIONS],"delete objects in this bucket")}];return(0,y.jsxs)(s.Fragment,{children:[K&&J&&(0,y.jsx)(Ne,{open:K,closeModalAndRefresh:()=>{t((0,c.Lf)(!1)),t((0,c.go)(null))},bucketName:ge,dataObject:{name:J.name,last_modified:"",version_id:J.version_id}}),X&&(0,y.jsx)(Ae,{deleteOpen:X,selectedBucket:ge,selectedObjects:We,closeDeleteModalAndRefresh:e=>{ee(!1),e&&(t((0,w.Hk)("Objects deleted successfully.")),t((0,c.KX)([])),t((0,c.Yw)(!0)))},versioning:z}),te&&(0,y.jsx)(ke,{open:te,closeModalAndRefresh:()=>{ne(!1)},bucketName:ge}),W&&J&&(0,y.jsx)(Be,{open:W,bucketName:ge,actualInfo:{name:J.name||"",last_modified:"",version_id:J.version_id||"",size:J.size||0},onClosePreview:()=>{t((0,c.xE)(!1)),t((0,c.go)(null))}}),!!M&&(0,y.jsx)(ce,{open:!!M,closeModal:()=>{t((0,c.Ew)(null))},currentItem:(null===(e=M.name.split("/"))||void 0===e?void 0:e.pop())||"",bucketName:ge,internalPaths:_e,actualInfo:{name:M.name,last_modified:"",version_id:M.version_id,size:M.size}}),$&&(0,y.jsx)(Ie.default,{onClose:()=>{t((0,c.I8)(!1))},bucket:ge,modalOpen:$,prefilledRoute:"".concat(We[0],"*")}),(0,y.jsxs)(m.Mxu,{variant:"full",children:[Y&&(0,y.jsx)("div",{style:{paddingBottom:16},children:(0,y.jsx)(Ee,{})}),(0,y.jsx)(m.azJ,{withBorders:!0,sx:{padding:"0 5px"},children:(0,y.jsx)(m.lcx,{icon:(0,y.jsx)("span",{children:(0,y.jsx)(m.brV,{style:{width:30}})}),title:ge,subTitle:Y?null:(0,y.jsxs)(m.azJ,{sx:{"& .detailsSpacer":{marginRight:18,"@media (max-width: 600px)":{marginRight:0}}},children:[(0,y.jsxs)("span",{className:"detailsSpacer",children:["Created on:\xa0",(0,y.jsx)("strong",{children:null!==Q&&void 0!==Q&&Q.creation_date?ot.toFormat("ccc, LLL dd yyyy HH:mm:ss (ZZZZ)"):""})]}),(0,y.jsxs)("span",{className:"detailsSpacer",children:["Access:\xa0\xa0",(0,y.jsx)("strong",{children:(null===Q||void 0===Q?void 0:Q.access)||""})]}),Q&&(0,y.jsx)(s.Fragment,{children:(0,y.jsxs)("span",{className:"detailsSpacer",children:[Q.size&&(0,y.jsx)(s.Fragment,{children:(0,b.qO)(Q.size)}),Q.size&&de&&(0,y.jsxs)(s.Fragment,{children:[" ","/ ",(0,b.qO)(de.quota||0)]}),Q.size&&Q.objects?" - ":"",Q.objects&&(0,y.jsxs)(s.Fragment,{children:[Q.objects,"\xa0Object",Q.objects&&1!==Q.objects?"s":""]})]})})]}),actions:(0,y.jsxs)(s.Fragment,{children:[!Y&&(0,y.jsx)(V.A,{tooltip:Ge?"Rewind Bucket":(0,r.vj)([r.OV.S3_GET_OBJECT,r.OV.S3_GET_ACTIONS,r.OV.S3_GET_BUCKET_VERSIONING],"apply rewind in this bucket"),children:(0,y.jsx)(m.$nd,{id:"rewind-objects-list",label:"Rewind",icon:(0,y.jsx)(m.Exy,{color:"alert",dotOnly:!0,invisible:!f,children:(0,y.jsx)(m.osr,{style:{minWidth:16,minHeight:16,width:16,height:16,marginTop:-3}})}),variant:"regular",onClick:()=>{ne(!0)},disabled:!be||!Ge})}),(0,y.jsx)(V.A,{tooltip:"Reload List",children:(0,y.jsx)(m.$nd,{id:"refresh-objects-list",label:"Refresh",icon:(0,y.jsx)(m.fNY,{}),variant:"regular",onClick:()=>{_?t((0,c.SK)(!0)):(t((0,c.A3)()),t((0,c.Yw)(!0)))},disabled:!Y&&(!(0,S._)(ge,[r.OV.S3_LIST_BUCKET,r.OV.S3_ALL_LIST_BUCKET])||f)})}),(0,y.jsx)("input",{type:"file",multiple:!0,accept:Pe||void 0,onChange:$e,style:{display:"none"},ref:we}),(0,y.jsx)("input",{type:"file",multiple:!0,onChange:$e,style:{display:"none"},ref:Te}),(0,y.jsx)(D,{bucketName:ge,uploadPath:Re,uploadFileFunction:e=>{we&&we.current&&we.current.click(),e()},uploadFolderFunction:e=>{Te&&Te.current&&Te.current.click(),e()}})]}),bottomBorder:!1})}),(0,y.jsxs)("div",(0,d.A)((0,d.A)({id:"object-list-wrapper"},Qe({style:(0,d.A)({},nt)})),{},{children:[(0,y.jsx)("input",(0,d.A)({},Xe())),(0,y.jsxs)(m.azJ,{withBorders:!0,sx:{display:"flex",borderTop:0,padding:0,"& .hideListOnSmall":{"@media (max-width: 799px)":{display:"none"}}},children:[_?(0,y.jsx)(s.Fragment,{children:null!==I&&(0,y.jsx)(ve,{internalPaths:I,bucketName:ge})}):(0,y.jsx)(S.R,{scopes:[r.OV.S3_LIST_BUCKET,r.OV.S3_ALL_LIST_BUCKET],resource:ge,errorProps:{disabled:!0},children:(0,y.jsxs)(m.xA9,{item:!0,xs:12,sx:{width:"100%",position:"relative","&.detailsOpen":{"@media (max-width: 799px)":{display:"none"}}},className:E?"detailsOpen":"",children:[!Y&&(0,y.jsx)(m.xA9,{item:!0,xs:12,sx:{padding:"12px 14px 5px"},children:(0,y.jsx)(A,{bucketName:ge,internalPaths:_e,additionalOptions:!be||f?null:(0,y.jsx)(m.Sc0,{name:"deleted_objects",id:"showDeletedObjects",value:"deleted_on",label:"Show deleted objects",onChange:()=>{t((0,c.A3)()),t((0,c.lA)(!O)),st(!0)},checked:O,sx:{marginLeft:5,"@media (max-width: 600px)":{marginLeft:0,flexDirection:"row"}}}),hidePathButton:!1})}),(0,y.jsx)(Ce,{})]})}),!Y&&(0,y.jsx)(S.R,{scopes:[r.OV.S3_LIST_BUCKET,r.OV.S3_ALL_LIST_BUCKET],resource:ge,errorProps:{disabled:!0},children:(0,y.jsxs)(R,{open:E,closePanel:()=>{st(!1)},className:"".concat(_?"hideListOnSmall":""),children:[We.length>0&&(0,y.jsx)(m.Smc,{items:at,title:"Selected Objects:"}),null!==I&&(0,y.jsx)(ue,{internalPaths:I,bucketName:ge,onClosePanel:st,versioningInfo:z,locking:G})]})})]})]}))]})]})};var Re=n(46881),Pe=n(89563),Ue=n(82817),ze=n(77370),Ge=n(70503);const Me=e=>{let{bucketName:t}=e;const n=(0,l.jL)(),a=(0,o.d4)(Te.s$),d=(0,o.d4)(e=>e.objectBrowser.versionsMode),u=(0,o.d4)(e=>e.objectBrowser.versionedFile),h=(0,o.d4)(e=>e.objectBrowser.searchVersions),x=!(null===a||void 0===a||!a.includes("object-browser-only")),p=(0,i.Zp)(),j=(0,Re.A)(t,[r.OV.S3_GET_BUCKET_POLICY,r.OV.S3_PUT_BUCKET_POLICY,r.OV.S3_GET_BUCKET_VERSIONING,r.OV.S3_PUT_BUCKET_VERSIONING,r.OV.S3_GET_BUCKET_ENCRYPTION_CONFIGURATION,r.OV.S3_PUT_BUCKET_ENCRYPTION_CONFIGURATION,r.OV.S3_DELETE_BUCKET,r.OV.S3_GET_BUCKET_NOTIFICATIONS,r.OV.S3_PUT_BUCKET_NOTIFICATIONS,r.OV.S3_GET_REPLICATION_CONFIGURATION,r.OV.S3_PUT_REPLICATION_CONFIGURATION,r.OV.S3_GET_LIFECYCLE_CONFIGURATION,r.OV.S3_PUT_LIFECYCLE_CONFIGURATION,r.OV.ADMIN_GET_BUCKET_QUOTA,r.OV.ADMIN_SET_BUCKET_QUOTA,r.OV.S3_PUT_BUCKET_TAGGING,r.OV.S3_GET_BUCKET_TAGGING,r.OV.S3_LIST_BUCKET_VERSIONS,r.OV.S3_GET_BUCKET_POLICY_STATUS,r.OV.S3_DELETE_BUCKET_POLICY,r.OV.S3_GET_ACTIONS,r.OV.S3_PUT_ACTIONS]),b=(0,y.jsx)(s.Fragment,{children:d?(0,y.jsx)(s.Fragment,{children:(0,y.jsx)(ye.A,{placeholder:"Start typing to filter versions of ".concat(u),onChange:e=>{n((0,c.aj)(e))},value:h})}):(0,y.jsx)(S.R,{scopes:[r.OV.S3_LIST_BUCKET,r.OV.S3_ALL_LIST_BUCKET],resource:t,errorProps:{disabled:!0},children:(0,y.jsx)(Ee,{})})});return(0,s.useEffect)(()=>{n((0,w.ph)("object_browser"))},[]),(0,y.jsx)(s.Fragment,{children:x?(0,y.jsxs)(m.xA9,{container:!0,sx:{padding:"20px 32px 0"},children:[(0,y.jsx)(m.xA9,{children:(0,y.jsx)(Pe.A,{marginRight:30,marginTop:10})}),(0,y.jsxs)(m.xA9,{item:!0,xs:!0,sx:{display:"flex",gap:10},children:[b,(0,y.jsx)(ze.A,{})]})]}):(0,y.jsx)(Ue.A,{label:(0,y.jsx)(m.EGL,{label:"Object Browser",onClick:()=>{p(r.zZ.OBJECT_BROWSER_VIEW)}}),actions:(0,y.jsxs)(s.Fragment,{children:[(0,y.jsx)(S.R,{scopes:r.pC[r.ac.BUCKET_ADMIN],resource:t,errorProps:{disabled:!0},children:(0,y.jsx)(V.A,{tooltip:j?"Configure Bucket":"You do not have the required permissions to configure this bucket. Please contact your MinIO administrator to request "+r.ac.BUCKET_ADMIN+" permisions.",children:(0,y.jsx)(m.$nd,{id:"configure-bucket-main",color:"primary","aria-label":"Configure Bucket",onClick:()=>p("/buckets/".concat(t,"/admin")),icon:(0,y.jsx)(m.Zes,{style:{width:20,height:20,marginTop:-3}}),style:{padding:"0 10px"}})})}),(0,y.jsx)(Ge.A,{})]}),middleComponent:b})})},Je=()=>{const e=(0,l.jL)(),t=(0,i.g)(),n=(0,i.zy)(),d=(0,o.d4)(e=>e.objectBrowser.loadingVersioning),u=(0,o.d4)(e=>e.objectBrowser.rewind.rewindEnabled),h=(0,o.d4)(e=>e.objectBrowser.rewind.dateToRewind),m=(0,o.d4)(e=>e.objectBrowser.showDeleted),x=(0,o.d4)(e=>e.objectBrowser.requestInProgress),p=(0,o.d4)(e=>e.objectBrowser.loadingLocking),j=(0,o.d4)(e=>e.objectBrowser.reloadObjectsList),b=(0,o.d4)(e=>e.objectBrowser.simplePath),g=(0,o.d4)(e=>e.system.anonymousMode),f=(0,o.d4)(e=>e.objectBrowser.selectedBucket),v=(0,o.d4)(e=>e.objectBrowser.records),_=t.bucketName||"",S=n.pathname.split("/browser/".concat(encodeURIComponent(_),"/")),O=2===S.length?decodeURIComponent(S[1]):"",w=(0,s.useCallback)(t=>{let n=(new Date).toISOString();null!==h&&u&&(n=h);e({type:"socket/OBRequest",payload:{bucketName:_,path:t,rewindMode:u||m,date:n}})},[_,m,h,u,e]),T=(0,s.useCallback)(function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e((0,c.cQ)({status:!1}));let n=O;O.endsWith("/")||""===O||(n="".concat(O.split("/").slice(0,-1).join("/"),"/")),"/"===n&&(n=""),(n!==b||_!==f||t)&&(e((0,c.u)(!0)),w(n))},[O,e,b,f,_,w]);(0,s.useEffect)(()=>()=>{e({type:"socket/OBCancelLast"})},[e]),(0,s.useEffect)(()=>{e((0,c.vn)(!0)),O.endsWith("/")||""===O?(e((0,c.TO)(!1)),e((0,c.A7)(null)),e((0,c.Qy)(!0))):(e((0,c.oe)(!0)),e((0,c.TO)(!0)),e((0,c.SK)(!0)),e((0,c.A7)(O||"")))},[_,O,h,u,e]),(0,s.useEffect)(()=>{T(!1)},[T]),(0,s.useEffect)(()=>{j&&0===v.length&&!x&&T(!0)},[j,v,x,T]);const C=(0,Re.A)(_,[r.OV.S3_LIST_BUCKET,r.OV.S3_ALL_LIST_BUCKET])||g;return(0,s.useEffect)(()=>{d&&!g&&(C?a.F.buckets.getBucketVersioning(_).then(t=>{e((0,c.AP)(t.data)),e((0,c.vn)(!1))}).catch(t=>{console.error("Error Getting Object Versioning Status: ",t.error.detailedMessage),e((0,c.vn)(!1))}):(e((0,c.vn)(!1)),e((0,c.A3)())))},[_,d,e,C,g]),(0,s.useEffect)(()=>{p&&(C?a.F.buckets.getBucketObjectLockingStatus(_).then(t=>{e((0,c.xW)(t.data.object_locking_enabled)),e((0,c.Qy)(!1))}).catch(t=>{console.error("Error Getting Object Locking Status: ",t.error.detailedMessage),e((0,c.Qy)(!1))}):(e((0,c.A3)()),e((0,c.Qy)(!1))))},[_,p,e,C]),(0,y.jsxs)(s.Fragment,{children:[!g&&(0,y.jsx)(Me,{bucketName:_}),(0,y.jsx)(De,{})]})}}}]); ================================================ FILE: web-app/build/static/js/1715.61cf86b7.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[1715,9459],{7174:(e,t,n)=>{n.d(t,{Ck:()=>l,PE:()=>r,Qm:()=>c,Xm:()=>s,uu:()=>d});var i=n(89379),o=(n(9950),n(89132)),a=n(44414);const l=[{icon:(0,a.jsx)(o.DzZ,{}),configuration_id:"region",configuration_label:"Region"},{icon:(0,a.jsx)(o.MZJ,{}),configuration_id:"compression",configuration_label:"Compression"},{icon:(0,a.jsx)(o.loI,{}),configuration_id:"api",configuration_label:"API"},{icon:(0,a.jsx)(o.qm4,{}),configuration_id:"heal",configuration_label:"Heal"},{icon:(0,a.jsx)(o.Pq3,{}),configuration_id:"scanner",configuration_label:"Scanner"},{icon:(0,a.jsx)(o.RYV,{}),configuration_id:"etcd",configuration_label:"Etcd"},{icon:(0,a.jsx)(o.D0K,{}),configuration_id:"logger_webhook",configuration_label:"Logger Webhook"},{icon:(0,a.jsx)(o.rBG,{}),configuration_id:"audit_webhook",configuration_label:"Audit Webhook"},{icon:(0,a.jsx)(o.Dk$,{}),configuration_id:"audit_kafka",configuration_label:"Audit Kafka"}],r={region:[{name:"name",required:!0,label:"Server Location",tooltip:'Name of the location of the server e.g. "us-west-rack2"',type:"string",placeholder:"e.g. us-west-rack-2"},{name:"comment",required:!1,label:"Comment",tooltip:"You can add a comment to this setting",type:"comment",placeholder:"Enter custom notes if any"}],compression:[{name:"extensions",required:!1,label:"Extensions",tooltip:'Extensions to compress e.g. ".txt", ".log" or ".csv" - you can write one per field',type:"csv",placeholder:"Enter an Extension",withBorder:!0},{name:"mime_types",required:!1,label:"Mime Types",tooltip:'Mime types e.g. "text/*", "application/json" or "application/xml" - you can write one per field',type:"csv",placeholder:"Enter a Mime Type",withBorder:!0}],api:[{name:"requests_max",required:!1,label:"Requests Max",tooltip:"Maximum number of concurrent requests, e.g. '1600'",type:"number",placeholder:"Enter Requests Max"},{name:"cors_allow_origin",required:!1,label:"Cors Allow Origin",tooltip:"List of origins allowed for CORS requests",type:"csv",placeholder:"Enter allowed origin e.g. https://example.com"},{name:"replication_workers",required:!1,label:"Replication Workers",tooltip:"Number of replication workers, defaults to 100",type:"number",placeholder:"Enter Replication Workers"},{name:"replication_failed_workers",required:!1,label:"Replication Failed Workers",tooltip:"Number of replication workers for recently failed replicas, defaults to 4",type:"number",placeholder:"Enter Replication Failed Workers"}],heal:[{name:"bitrotscan",required:!1,label:"Bitrot Scan",tooltip:"Perform bitrot scan on disks when checking objects during scanner",type:"on|off"},{name:"max_sleep",required:!1,label:"Max Sleep",tooltip:"Maximum sleep duration between objects to slow down heal operation, e.g. 2s",type:"duration",placeholder:"Enter Max Sleep Duration"},{name:"max_io",required:!1,label:"Max IO",tooltip:"Maximum IO requests allowed between objects to slow down heal operation, e.g. 3",type:"number",placeholder:"Enter Max IO"}],scanner:[{name:"delay",required:!1,label:"Delay Multiplier",tooltip:"Scanner delay multiplier, defaults to '10.0'",type:"number",placeholder:"Enter Delay"},{name:"max_wait",required:!1,label:"Max Wait",tooltip:"Maximum wait time between operations, defaults to '15s'",type:"duration",placeholder:"Enter Max Wait"},{name:"cycle",required:!1,label:"Cycle",tooltip:"Time duration between scanner cycles, defaults to '1m'",type:"duration",placeholder:"Enter Cycle"}],etcd:[{name:"endpoints",required:!0,label:"Endpoints",tooltip:'List of etcd endpoints e.g. "http://localhost:2379" - you can write one per field',type:"csv",placeholder:"Enter Endpoint"},{name:"path_prefix",required:!1,label:"Path Prefix",tooltip:'Namespace prefix to isolate tenants e.g. "customer1/"',type:"string",placeholder:"Enter Path Prefix"},{name:"coredns_path",required:!1,label:"Coredns Path",tooltip:'Shared bucket DNS records, default is "/skydns"',type:"string",placeholder:"Enter Coredns Path"},{name:"client_cert",required:!1,label:"Client Cert",tooltip:"Client cert for mTLS authentication",type:"string",placeholder:"Enter Client Cert"},{name:"client_cert_key",required:!1,label:"Client Cert Key",tooltip:"Client cert key for mTLS authentication",type:"string",placeholder:"Enter Client Cert Key"},{name:"comment",required:!1,label:"Comment",tooltip:"You can add a comment to this setting",type:"comment",multiline:!0,placeholder:"Enter custom notes if any"}],logger_webhook:[{name:"endpoint",required:!0,label:"Endpoint",type:"string",placeholder:"Enter Endpoint"},{name:"auth_token",required:!0,label:"Auth Token",type:"string",placeholder:"Enter Auth Token"}],audit_webhook:[{name:"endpoint",required:!0,label:"Endpoint",type:"string",placeholder:"Enter Endpoint"},{name:"auth_token",required:!0,label:"Auth Token",type:"string",placeholder:"Enter Auth Token"}],audit_kafka:[{name:"enable",required:!1,label:"Enable",tooltip:"Enable audit_kafka target",type:"on|off",customValueProcess:e=>""===e||"on"===e?"on":"off"},{name:"brokers",required:!0,label:"Brokers",type:"csv",placeholder:"Enter Kafka Broker"},{name:"topic",required:!1,label:"Topic",type:"string",placeholder:"Enter Kafka Topic",tooltip:"Kafka topic used for bucket notifications"},{name:"sasl",required:!1,label:"Use SASL",tooltip:"Enable SASL (Simple Authentication and Security Layer) authentication",type:"on|off"},{name:"sasl_username",required:!1,label:"SASL Username",type:"string",placeholder:"Enter SASL Username",tooltip:"Username for SASL/PLAIN or SASL/SCRAM authentication"},{name:"sasl_password",required:!1,label:"SASL Password",type:"password",placeholder:"Enter SASL Password",tooltip:"Password for SASL/PLAIN or SASL/SCRAM authentication"},{name:"sasl_mechanism",required:!1,label:"SASL Mechanism",type:"string",placeholder:"Enter SASL Mechanism",tooltip:"SASL authentication mechanism"},{name:"tls",required:!1,label:"Use TLS",tooltip:"Enable TLS (Transport Layer Security)",type:"on|off"},{name:"tls_skip_verify",required:!1,label:"Skip TLS Verification",tooltip:"Trust server TLS without verification",type:"on|off"},{name:"client_tls_cert",required:!1,label:"Client Cert",tooltip:"Client cert for mTLS authentication",type:"string",placeholder:"Enter Client Cert"},{name:"client_tls_key",required:!1,label:"Client Cert Key",tooltip:"Client cert key for mTLS authentication",type:"string",placeholder:"Enter Client Cert Key"},{name:"tls_client_auth",required:!1,label:"TLS Client Auth",tooltip:"ClientAuth determines the Kafka server's policy for TLS client authorization",type:"string"},{name:"version",required:!1,label:"Version",tooltip:"Specify the version of the Kafka cluster",type:"string"}]},s=e=>e.filter(e=>""!==e.value),c=(e,t,n)=>{const i=e.target,o=i.value;let a=[...n];return i.checked?a.push(o):a=a.filter(e=>e!==o),t(a),a},d=e=>{let t={};return e.forEach(e=>{if(e.env_override){const n={value:e.env_override.value||"",overrideEnv:e.env_override.name||""};t=(0,i.A)((0,i.A)({},t),{},{[e.key]:n})}}),t}},18120:(e,t,n)=>{n.d(t,{A:()=>u});var i=n(9950),o=n(70444),a=n(48965),l=n(49534),r=n(89132),s=n(49078),c=n(99491),d=n(44414);const u=e=>{let{configurationName:t,closeResetModalAndRefresh:n,resetOpen:u}=e;const p=(0,c.jL)(),[h,m]=(0,i.useState)(!1);(0,i.useEffect)(()=>{h&&o.F.configs.resetConfig(t).then(()=>{m(!1),n(!0)}).catch(e=>{m(!1),p((0,s.C9)((0,a.S)(e.error)))})},[n,t,h,p]);return(0,d.jsx)(l.A,{title:"Restore Defaults",confirmText:"Yes, Reset Configuration",isOpen:u,titleIcon:(0,d.jsx)(r.xWY,{}),isLoading:h,onConfirm:()=>{m(!0)},onClose:()=>{n(!1)},confirmationContent:(0,d.jsxs)(i.Fragment,{children:[h&&(0,d.jsx)(r.z21,{}),(0,d.jsxs)(i.Fragment,{children:["Are you sure you want to restore these configurations to default values?",(0,d.jsx)("br",{}),(0,d.jsx)("b",{style:{maxWidth:"200px",whiteSpace:"normal",wordWrap:"break-word"},children:"Please note that this may cause your system to not be accessible"})]})]})})}},32680:(e,t,n)=>{n.d(t,{A:()=>d});var i=n(9950),o=n(98341),a=n(89132),l=n(99491),r=n(49078),s=n(96382),c=n(44414);const d=e=>{let{onClose:t,modalOpen:n,title:d,children:u,wideLimit:p=!0,titleIcon:h=null,iconColor:m="default",sx:f}=e;const x=(0,l.jL)(),[g,v]=(0,i.useState)(!1),b=(0,o.d4)(e=>e.system.modalSnackBar);(0,i.useEffect)(()=>{x((0,r.h0)(""))},[x]),(0,i.useEffect)(()=>{if(b){if(""===b.message)return void v(!1);"error"!==b.type&&v(!0)}},[b]);let y="";return b&&(y=b.detailedErrorMsg,(""===y||y&&y.length<5)&&(y=b.message)),(0,c.jsxs)(a.ngX,{onClose:t,open:n,title:d,titleIcon:h,widthLimit:p,sx:f,iconColor:m,children:[(0,c.jsx)(s.A,{isModal:!0}),(0,c.jsx)(a.qb_,{onClose:()=>{v(!1),x((0,r.h0)(""))},open:g,message:y,mode:"inline",variant:"error"===b.type?"error":"default",autoHideDuration:"error"===b.type?10:5,condensed:!0}),u]})}},49459:(e,t,n)=>{n.r(t),n.d(t,{default:()=>s});var i=n(9950),o=n(89132),a=n(54235),l=n(44414);const r=(e,t,n)=>{let i="on|off"===t?"off":"";if(n.length>0){const t=n.find(t=>t.key===e);t&&(i=t.value||"")}return i},s=e=>{let{onChange:t,fields:n,defaultVals:s,overrideEnv:c}=e;const[d,u]=(0,i.useState)([]),p=n||[],h=s||[];(0,i.useEffect)(()=>{const e=n.map(e=>({key:e.name,value:r(e.name,e.type,h)}));u(e)},[n,s]),(0,i.useEffect)(()=>{t(d)},[d]);const m=(e,t,n)=>{const i=[...d];t=t.trim(),i[n]={key:e,value:t},u(i)},f=(e,t)=>{const n=d[t];if(n){const t=null===c||void 0===c?void 0:c["".concat(n.key)];if(t)return(0,l.jsx)(o.EmB,{label:e.label,actionButton:(0,l.jsx)(o.xA9,{item:!0,sx:{display:"flex",justifyContent:"flex-end",paddingRight:"10px"},children:(0,l.jsx)(o.m_M,{tooltip:"This value is set from the ".concat(t.overrideEnv," environment variable"),placement:"left",children:(0,l.jsx)(o.D0K,{style:{width:20}})})}),sx:{width:"100%"},children:t.value})}switch(e.type){case"on|off":const i=n?n.value:"off";return(0,l.jsx)(o.dOG,{onChange:n=>{const i=n.target.checked?"on":"off";m(e.name,i,t)},id:e.name,name:e.name,label:e.label,value:"switch_on",tooltip:e.tooltip,checked:"on"===i});case"csv":return(0,l.jsx)(a.A,{elements:n?n.value:"",label:e.label,name:e.name,onChange:n=>{let i="";i=Array.isArray(n)?n.join(","):n,m(e.name,i,t)},tooltip:e.tooltip,commonPlaceholder:e.placeholder,withBorder:!0});case"comment":return(0,l.jsx)(o.hFj,{id:e.name,name:e.name,label:e.label,tooltip:e.tooltip,value:n?n.value:"",onChange:n=>m(e.name,n.target.value,t),placeholder:e.placeholder});default:return(0,l.jsx)(o.cl_,{id:e.name,name:e.name,label:e.label,tooltip:e.tooltip,value:n?n.value:"",onChange:n=>m(e.name,n.target.value,t),placeholder:e.placeholder})}};return(0,l.jsx)(o.Hbc,{withBorders:!1,containerPadding:!1,children:p.map((e,t)=>(0,l.jsx)(i.Fragment,{children:f(e,t)},e.name))})}},54235:(e,t,n)=>{n.d(t,{A:()=>s});var i=n(9950),o=n(87946),a=n.n(o),l=n(89132),r=n(44414);const s=e=>{let{elements:t,name:n,label:o,tooltip:s="",commonPlaceholder:c="",onChange:d,withBorder:u=!1}=e;const[p,h]=(0,i.useState)([""]),m=(0,i.createRef)();(0,i.useEffect)(()=>{if(1===p.length&&""===p[0]&&t&&""!==t){const e=t.split(",");e.push(""),h(e)}},[t,p]),(0,i.useEffect)(()=>{if(p.length>1){const e=m.current;e&&e.scrollIntoView(!1)}},[p,m]);const f=(0,i.useCallback)(e=>{d(e)},[d]),x=(0,i.useRef)(!0);(0,i.useEffect)(()=>{if(x.current)return void(x.current=!1);const e=p.filter(e=>""!==e.trim()).join(",");f(e)},[p]);const g=e=>{e.persist();let t=[...p];const n=a()(e.target,"dataset.index","0");t[parseInt(n)]=e.target.value,h(t)},v=p.map((e,t)=>(0,r.jsx)(l.cl_,{id:"".concat(n,"-").concat(t.toString()),label:"",name:"".concat(n,"-").concat(t.toString()),value:p[t],onChange:g,index:t,placeholder:c,overlayIcon:t===p.length-1?(0,r.jsx)(l.REV,{}):null,overlayAction:()=>{(e=>{if(""!==e[e.length-1].trim()){const t=[...e];t.push(""),h(t)}})(p)}},"csv-multi-".concat(n,"-").concat(t.toString())));return(0,r.jsx)(i.Fragment,{children:(0,r.jsxs)(l.azJ,{sx:{display:"flex"},className:"inputItem",children:[(0,r.jsxs)(l.l1Y,{sx:{alignItems:"flex-start"},children:[(0,r.jsx)("span",{children:o}),""!==s&&(0,r.jsx)(l.azJ,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,r.jsx)(l.m_M,{tooltip:s,placement:"top",children:(0,r.jsx)(l.azJ,{className:s,children:(0,r.jsx)(l.NTw,{})})})})]}),(0,r.jsxs)(l.azJ,{withBorders:u,sx:{width:"100%",overflowY:"auto",height:150,position:"relative"},children:[v,(0,r.jsx)("div",{ref:m})]})]})})}},81715:(e,t,n)=>{n.r(t),n.d(t,{default:()=>D});var i=n(9950),o=n(89132),a=n(7174),l=n(28429),r=n(87946),s=n.n(r),c=n(98341),d=n(70444),u=n(48965),p=n(49078),h=n(99491),m=n(32680),f=n(45246),x=n(44414);const g=e=>{let{open:t,type:n,onCloseEndpoint:a}=e;const[l,r]=(0,i.useState)(""),[s,c]=(0,i.useState)(""),[g,v]=(0,i.useState)(""),[b,y]=(0,i.useState)(!1),[j,k]=(0,i.useState)(["name","endpoint"]),[C,_]=(0,i.useState)(["name","endpoint","auth-token"]),E=(0,h.jL)(),S=e=>{_(C.filter(t=>t!==e))},w=(e,t)=>{j.includes(e)&&t?k(j.filter(t=>t!==e)):t||j.includes(e)||k([...j,e])};let A="Add new Webhook",T=(0,x.jsx)(o.XC7,{});switch(n){case"logger_webhook":A="New Logger Webhook",T=(0,x.jsx)(o.D0K,{});break;case"audit_webhook":A="New Audit Webhook",T=(0,x.jsx)(o.rBG,{})}return(0,x.jsx)(i.Fragment,{children:(0,x.jsxs)(m.A,{modalOpen:t,title:A,onClose:a,titleIcon:T,children:[(0,x.jsxs)(o.Hbc,{containerPadding:!1,withBorders:!1,children:[(0,x.jsx)(o.cl_,{id:"name",name:"name",onChange:e=>{S("name"),r(e.target.value),w("name",e.target.validity.valid)},error:j.includes("name")&&!C.includes("name")?"Invalid Name":"",label:"Name",value:l,pattern:"^(?=.*[a-zA-Z0-9]).{1,}$",required:!0}),(0,x.jsx)(o.cl_,{id:"endpoint",name:"endpoint",onChange:e=>{S("endpoint"),c(e.target.value),w("endpoint",e.target.validity.valid)},error:j.includes("endpoint")&&!C.includes("endpoint")?"Invalid Endpoint set":"",label:"Endpoint",value:s,pattern:"^(https?):\\/\\/([a-zA-Z0-9\\-.]+)(:[0-9]+)?(\\/[a-zA-Z0-9_\\-.\\/]*)?$",required:!0}),(0,x.jsx)(o.cl_,{id:"auth-token",name:"auth-token",onChange:e=>{S("auth-token"),v(e.target.value)},label:"Auth Token",value:g})]}),b&&(0,x.jsx)(o.xA9,{item:!0,xs:12,sx:{marginBottom:10},children:(0,x.jsx)(o.z21,{})}),(0,x.jsxs)(o.xA9,{item:!0,xs:12,sx:f.Uz.modalButtonBar,children:[(0,x.jsx)(o.$nd,{id:"reset",type:"button",variant:"regular",disabled:b,onClick:a,label:"Cancel",sx:{marginRight:10}}),(0,x.jsx)(o.$nd,{id:"save-lifecycle",type:"submit",variant:"callAction",color:"primary",disabled:b||0!==j.length,label:"Save",onClick:()=>{if(b)return;if(0!==j.length)return;if(""===l.trim())return void k([...j,"name"]);if(""===s.trim())return void k([...j,"endpoint"]);y(!0);const e={key_values:[{key:"endpoint",value:s},{key:"auth_token",value:g}],arn_resource_id:l};d.F.configs.setConfig(n,e).then(e=>{y(!1),E((0,p.YR)(e.data.restart||!1)),e.data.restart||E((0,p.Hk)("Configuration saved successfully")),a(),E((0,p.TE)(!0))}).catch(e=>{y(!1),E((0,p.C9)((0,u.S)(e.error)))})}})]})]})})};var v=n(49534);const b=e=>{let{modalOpen:t,onClose:n,selectedARN:a}=e;const[l,r]=(0,i.useState)(!1),s=(0,h.jL)();(0,i.useEffect)(()=>{l&&d.F.configs.resetConfig(a).then(()=>{r(!1),s((0,p.YR)(!0)),s((0,p.TE)(!0)),n()}).catch(e=>{r(!1),s((0,p.C9)((0,u.S)(e.error)))})},[l,s,n,a]);const c=!a.includes(":");let m="Are you sure you want to delete the Configured Endpoint";return c&&(m="Are you sure you want to reset the Default"),(0,x.jsx)(v.A,{title:c?"Reset Default Webhook":"Delete Webhook",confirmText:c?"Reset":"Delete",isOpen:t,isLoading:l,onConfirm:()=>{r(!0)},titleIcon:(0,x.jsx)(o.xWY,{}),onClose:n,confirmationContent:(0,x.jsxs)(i.Fragment,{children:["".concat(m," "),(0,x.jsx)("strong",{children:a}),"?"]})})},y=e=>{var t,n,l,r,s,c;let{open:g,type:v,endpointInfo:b,onCloseEndpoint:y}=e;const[j,k]=(0,i.useState)(""),[C,_]=(0,i.useState)(""),[E,S]=(0,i.useState)(""),[w,A]=(0,i.useState)("on"),[T,q]=(0,i.useState)(!1),[L,R]=(0,i.useState)([]),I=(0,h.jL)();(0,i.useEffect)(()=>{if(b){const e=b.key_values.find(e=>"endpoint"===e.key),t=b.key_values.find(e=>"auth_token"===e.key),n=b.key_values.find(e=>"enable"===e.key);let i=[];if(e){const t=e.value;""===t?i.push("endpoint"):_(t)}if(t){const e=t.value;""===e?i.push("auth-token"):S(e)}n&&"off"===n.value&&A(n.value),k(b.name||""),R(i)}},[b]);const M=!j.includes(":"),B=b.key_values.filter(e=>!!e.env_override),F=(0,a.uu)(B);let D="Edit Webhook",N=(0,x.jsx)(o.XC7,{});switch(v){case"logger_webhook":D="Edit ".concat(M?" the Default ":"","Logger Webhook"),N=(0,x.jsx)(o.D0K,{});break;case"audit_webhook":D="Edit ".concat(M?" the Default ":"","Audit Webhook"),N=(0,x.jsx)(o.rBG,{})}return B.length>0&&(D="View env variable Webhook"),(0,x.jsx)(i.Fragment,{children:(0,x.jsx)(m.A,{modalOpen:g,title:"".concat(D).concat(M?"":" - ".concat(j)),onClose:y,titleIcon:N,children:(0,x.jsx)(o.Hbc,{withBorders:!1,containerPadding:!1,children:B.length>0?(0,x.jsxs)(i.Fragment,{children:[(0,x.jsx)(o.EmB,{label:"Enabled",sx:{width:"100%"},actionButton:(0,x.jsx)(o.xA9,{item:!0,sx:{display:"flex",justifyContent:"flex-end",paddingRight:"10px"},children:(0,x.jsx)(o.m_M,{tooltip:F.enable?"This value is set from the ".concat((null===(t=F.enable)||void 0===t?void 0:t.overrideEnv)||"N/A"," environment variable"):"",placement:"left",children:(0,x.jsx)(o.D0K,{style:{width:20}})})}),children:(null===(n=F.enable)||void 0===n?void 0:n.value)||"-"}),(0,x.jsx)(o.EmB,{label:"Endpoint",sx:{width:"100%"},actionButton:(0,x.jsx)(o.xA9,{item:!0,sx:{display:"flex",justifyContent:"flex-end",paddingRight:"10px"},children:(0,x.jsx)(o.m_M,{tooltip:F.enable?"This value is set from the ".concat((null===(l=F.endpoint)||void 0===l?void 0:l.overrideEnv)||"N/A"," environment variable"):"",placement:"left",children:(0,x.jsx)(o.D0K,{style:{width:20}})})}),children:(null===(r=F.endpoint)||void 0===r?void 0:r.value)||"-"}),(0,x.jsx)(o.EmB,{label:"Auth Token",sx:{width:"100%"},actionButton:(0,x.jsx)(o.xA9,{item:!0,sx:{display:"flex",justifyContent:"flex-end",paddingRight:"10px"},children:(0,x.jsx)(o.m_M,{tooltip:F.enable?"This value is set from the ".concat((null===(s=F.auth_token)||void 0===s?void 0:s.overrideEnv)||"N/A"," environment variable"):"",placement:"left",children:(0,x.jsx)(o.D0K,{style:{width:20}})})}),children:(null===(c=F.auth_token)||void 0===c?void 0:c.value)||"-"})]}):(0,x.jsxs)(i.Fragment,{children:[(0,x.jsx)(o.dOG,{onChange:e=>{const t=e.target.checked?"on":"off";A(t)},id:"endpoint_enabled",name:"endpoint_enabled",label:"Enabled",value:"switch_on",checked:"on"===w}),(0,x.jsx)(o.cl_,{id:"endpoint",name:"endpoint",onChange:e=>{_(e.target.value),((e,t)=>{L.includes(e)&&t?R(L.filter(t=>t!==e)):t||L.includes(e)||R([...L,e])})("endpoint",e.target.validity.valid)},error:L.includes("endpoint")?"Invalid Endpoint set":"",label:"Endpoint",value:C,pattern:"^(https?):\\/\\/([a-zA-Z0-9\\-.]+)(:[0-9]+)?(\\/[a-zA-Z0-9_\\-.\\/]*)?$",required:!0}),(0,x.jsx)(o.cl_,{id:"auth-token",name:"auth-token",onChange:e=>{S(e.target.value)},label:"Auth Token",value:E}),T&&(0,x.jsx)(o.xA9,{item:!0,xs:12,sx:{marginBottom:10},children:(0,x.jsx)(o.z21,{})}),(0,x.jsxs)(o.xA9,{item:!0,sx:f.Uz.modalButtonBar,children:[(0,x.jsx)(o.$nd,{id:"reset",type:"button",variant:"regular",disabled:T,onClick:y,label:"Cancel"}),(0,x.jsx)(o.$nd,{id:"save-lifecycle",type:"submit",variant:"callAction",color:"primary",disabled:T||0!==L.length,label:"Update",onClick:()=>{if(T)return;if(0!==L.length)return;if(!C||""===C.trim())return void R([...L,"endpoint"]);q(!0);const e={key_values:[{key:"endpoint",value:C},{key:"auth_token",value:E},{key:"enable",value:w}]};d.F.configs.setConfig(j,e).then(e=>{q(!1),I((0,p.YR)(e.data.restart||!1)),e.data.restart||I((0,p.Hk)("Configuration saved successfully")),y(),I((0,p.TE)(!0))}).catch(e=>{q(!1),I((0,p.C9)((0,u.S)(e.error)))})}})]})]})})})})},j=e=>{let{setResetConfigurationOpen:t,WebhookSettingslist:n,type:a}=e;const[l,r]=(0,i.useState)(!1),[s,c]=(0,i.useState)(!1),[d,u]=(0,i.useState)(!1),[p,h]=(0,i.useState)(""),[m,f]=(0,i.useState)(null),v=[{type:"view",onClick:e=>{e.name&&(u(!0),f(e))}},{type:"delete",onClick:e=>{e.name&&(c(!0),h(e.name))},disableButtonFunction:e=>{const t=n.find(t=>t.name===e);if(t){var i;const e=null===(i=t.key_values)||void 0===i?void 0:i.filter(e=>!!e.env_override);return!!(e&&e.length>0)}return!1}}];return(0,x.jsxs)(o.xA9,{container:!0,children:[l&&(0,x.jsx)(g,{open:l,type:a,onCloseEndpoint:()=>{r(!1)}}),s&&(0,x.jsx)(b,{modalOpen:s,onClose:()=>{c(!1),h("")},selectedARN:p,type:a}),d&&m&&(0,x.jsx)(y,{open:d,type:a,endpointInfo:m,onCloseEndpoint:()=>{u(!1),f(null)}}),(0,x.jsx)(o.xA9,{item:!0,xs:12,sx:{display:"flex",justifyContent:"flex-end"},children:(0,x.jsx)(o.$nd,{id:"newWebhook",variant:"callAction",onClick:()=>{r(!0)},children:"New Endpoint"})}),(0,x.jsx)(o.xA9,{item:!0,xs:12,sx:{padding:"0 10px 10px"},children:(0,x.jsxs)(i.Fragment,{children:[(0,x.jsx)("h3",{children:"Currently Configured Endpoints"}),(0,x.jsx)(o.bQt,{columns:[{label:"Status",elementKey:"key_values",renderFunction:e=>{const t=e.find(e=>"enable"===e.key);if(null!==t&&void 0!==t&&t.env_override){const e=null!==t&&void 0!==t&&t.env_override.value&&"on"!==(null===t||void 0===t?void 0:t.env_override.value)&&null!==t&&void 0!==t&&t.env_override.value?"Disabled":"Enabled";return(0,x.jsxs)(o.xA9,{container:!0,sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyItems:"start",fontSize:"8px"},children:[(0,x.jsx)(o.D0K,{style:{fill:"#052F51",width:"14px"}}),e?"Enabled":"Disabled"]})}return t&&"on"!==t.value&&t.value?(0,x.jsxs)(o.xA9,{container:!0,sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyItems:"start",fontSize:"8px"},children:[(0,x.jsx)(o.lgW,{style:{fill:"#C83B51",width:14,height:14}}),"Disabled"]}):(0,x.jsxs)(o.xA9,{container:!0,sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyItems:"start",fontSize:"8px"},children:[(0,x.jsx)(o.JrA,{style:{fill:"#4CCB92",width:14,height:14}}),"Enabled"]})},width:50},{label:"Name",elementKey:"name"},{label:"Endpoint",elementKey:"key_values",renderFunction:e=>{const t=e.find(e=>"endpoint"===e.key);return t?t.env_override?t.env_override.value:t.value:""}}],itemActions:v,idField:"name",isLoading:!1,records:n,entityName:"endpoints",customPaperHeight:"calc(100vh - 750px)"})]})})]})};var k=n(49459),C=n(18120);const _=e=>{let{selectedConfiguration:t,className:n=""}=e;const r=(0,h.jL)(),m=(0,l.Zp)(),{pathname:f=""}=(0,l.zy)();let g=f.substring(f.lastIndexOf("/")+1);g="settings"===g?"region":g;const[v,b]=(0,i.useState)([]),[y,_]=(0,i.useState)(!1),[E,S]=(0,i.useState)([]),[w,A]=(0,i.useState)([]),[T,q]=(0,i.useState)(!1),[L,R]=(0,i.useState)({}),I=(0,c.d4)(e=>e.system.loadingConfigurations);(0,i.useEffect)(()=>{r((0,p.TE)(!0))},[g,r]),(0,i.useEffect)(()=>{if(I){const e=s()(t,"configuration_id",!1);if(e)return void d.F.configs.configInfo(e).then(t=>{A(t.data);let n=s()(t.data[0],"key_values",[]);const i=a.PE[e].map(e=>{const t=n.find(t=>t.key===e.name),i=(null===t||void 0===t?void 0:t.value)||"";return{key:e.name,value:e.customValueProcess?e.customValueProcess(i):i,env_override:null===t||void 0===t?void 0:t.env_override}});S(i),R((0,a.uu)(i)),r((0,p.TE)(!1))}).catch(e=>{r((0,p.TE)(!1)),r((0,p.C9)((0,u.S)(e.error)))});r((0,p.TE)(!1))}},[I,t,r]),(0,i.useEffect)(()=>{if(y){const e={key_values:(0,a.Xm)(v)};d.F.configs.setConfig(t.configuration_id,e).then(e=>{_(!1),r((0,p.YR)(e.data.restart||!1)),r((0,p.TE)(!0)),e.data.restart||r((0,p.Hk)("Configuration saved successfully"))}).catch(e=>{_(!1),r((0,p.C9)((0,u.S)(e.error)))})}},[y,r,t,v,m]);const M=(0,i.useCallback)(e=>{b(e)},[b]),B=()=>{q(!0)};return(0,x.jsx)(i.Fragment,{children:(0,x.jsxs)("div",{onMouseMove:()=>{r((0,p.ph)("settings_".concat(t.configuration_label)))},children:[T&&(0,x.jsx)(C.A,{configurationName:t.configuration_id,closeResetModalAndRefresh:e=>{q(!1),r((0,p.YR)(e)),e&&r((0,p.TE)(!0))},resetOpen:T}),I?(0,x.jsx)(o.xA9,{item:!0,xs:12,sx:{textAlign:"center",paddingTop:"15px"},children:(0,x.jsx)(o.aHM,{})}):(0,x.jsx)(o.azJ,{sx:{padding:"15px",height:"100%"},children:"logger_webhook"===t.configuration_id||"audit_webhook"===t.configuration_id?(0,x.jsx)(j,{WebhookSettingslist:w,setResetConfigurationOpen:B,type:t.configuration_id}):(0,x.jsx)(i.Fragment,{children:(0,x.jsxs)("form",{noValidate:!0,onSubmit:e=>{e.preventDefault(),_(!0)},className:n,style:{height:"100%",display:"flex",flexFlow:"column"},children:[(0,x.jsx)(o.xA9,{item:!0,xs:12,sx:{display:"grid",gridTemplateColumns:"1fr",gap:"10px"},children:(0,x.jsx)(k.default,{fields:a.PE[t.configuration_id],onChange:M,defaultVals:E,overrideEnv:L})}),(0,x.jsxs)(o.xA9,{item:!0,xs:12,sx:{paddingTop:"15px ",textAlign:"right",maxHeight:"60px",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:[(0,x.jsx)(o.$nd,{type:"button",id:"restore-defaults",variant:"secondary",onClick:B,label:"Restore Defaults"}),"\xa0 \xa0",(0,x.jsx)(o.$nd,{id:"save",type:"submit",variant:"callAction",disabled:y,label:"Save"})]})]})})})]})})},E=()=>{const{pathname:e=""}=(0,l.zy)(),t=e.substring(e.lastIndexOf("/")+1),n=a.Ck.find(e=>e.configuration_id===t),i="".concat(t);return(0,x.jsx)(o.xA9,{item:!0,xs:12,sx:{height:"100%","& .identity_ldap, .api":{"& label":{minWidth:220,marginRight:0}}},children:n&&(0,x.jsx)(_,{className:"".concat(i),selectedConfiguration:n})})};var S=n(93598),w=n(82817),A=n(1531),T=n(59908),q=n(43217),L=n(30272);const R=()=>{const e=(0,c.wA)(),[t,n]=(0,A.A)(e=>{(0,T.OT)(new Blob([window.atob(e.value)]),"minio-server-config-".concat(q.c9.now().toFormat("LL-dd-yyyy-HH-mm-ss"),".conf"))},t=>{e((0,p.C9)(t))});return(0,x.jsx)(L.A,{tooltip:"Warning! The resulting file will contain server configuration information in plain text",children:(0,x.jsx)(o.$nd,{id:"export-config",onClick:()=>{n("GET","api/v1/configs/export")},icon:(0,x.jsx)(o.JMY,{}),label:"Export",variant:"regular",disabled:t})})},I=()=>{const e=(0,l.Zp)(),t=(0,c.wA)(),n=(0,c.d4)(e=>e.system.serverNeedsRestart),[a,r]=(0,i.useState)(void 0),s=(0,i.useRef)(null),[d,u]=(0,A.A)(e=>{t((0,p.YR)(!0)),r(!0)},e=>{t((0,p.C9)(e))});(0,i.useEffect)(()=>{!n&&a&&e(0)},[n,a,e]);return(0,x.jsxs)(i.Fragment,{children:[(0,x.jsx)("input",{type:"file",onChange:e=>{if(null===e||void 0===e||null===e.target.files||void 0===e.target.files)return;e.preventDefault();const[t]=e.target.files,n=new FormData,i=new Blob([t],{type:t.type});n.append("file",i,t.name),u("POST","api/v1/configs/import",n),e.target.value=""},style:{display:"none"},ref:s}),(0,x.jsx)(L.A,{tooltip:"The file must be valid and should have valid config values",children:(0,x.jsx)(o.$nd,{id:"import-config",onClick:()=>{s&&s.current&&s.current.click()},icon:(0,x.jsx)(o.s3U,{}),label:"Import",variant:"regular",disabled:d})})]})};var M=n(70503);const B=["region"],F=["cache"],D=()=>{const{pathname:e=""}=(0,l.zy)(),t=(0,h.jL)(),n=(0,l.Zp)(),[r,s]=(0,i.useState)([]),c=(0,i.useCallback)(async()=>{d.F.configs.listConfig().then(e=>{var t;if(e&&null!==e&&void 0!==e&&e.data&&null!==e&&void 0!==e&&null!==(t=e.data)&&void 0!==t&&t.configurations){var n;const t=((null===e||void 0===e||null===(n=e.data)||void 0===n?void 0:n.configurations)||[]).reduce((e,t)=>{let{key:n=""}=t;return F.includes(n)||e.push(n),e},[]);s(t)}}).catch(e=>{t((0,p.C9)((0,u.S)(e)))})},[t]);(0,i.useEffect)(()=>{c(),t((0,p.ph)("settings_Region"))},[]);const m=a.Ck.filter(e=>{let{configuration_id:t}=e;return B.includes(t)||r.includes(t)||!r.length});return(0,x.jsxs)(i.Fragment,{children:[(0,x.jsx)(w.A,{label:"Configuration",actions:(0,x.jsx)(M.A,{})}),(0,x.jsxs)(o.Mxu,{children:[(0,x.jsxs)(o.xA9,{item:!0,xs:12,id:"settings-container",children:[(0,x.jsx)(o.lcx,{icon:(0,x.jsx)(o.Zes,{}),title:"MinIO Configuration:",actions:(0,x.jsxs)(o.azJ,{sx:{display:"flex",gap:10},children:[(0,x.jsx)(I,{}),(0,x.jsx)(R,{})]}),sx:{marginBottom:15}}),(0,x.jsx)(o.tUM,{currentTabOrPath:e,onTabClick:e=>{n(e)},useRouteTabs:!0,options:m.map(e=>{const{configuration_id:t,configuration_label:n,icon:i}=e;return{tabConfig:{id:"settings-tab-".concat(n),label:n,value:t,icon:i,to:(o=t,"".concat(S.zZ.SETTINGS,"/").concat(o))}};var o}),routes:(0,x.jsxs)(l.BV,{children:[m.map(e=>(0,x.jsx)(l.qh,{path:"".concat(e.configuration_id),element:(0,x.jsx)(E,{})},"configItem-".concat(e.configuration_label))),(0,x.jsx)(l.qh,{path:"/",element:(0,x.jsx)(l.C5,{to:"".concat(S.zZ.SETTINGS,"/region")})})]})})]}),(0,x.jsx)(o.xA9,{item:!0,xs:12,sx:{paddingTop:"15px"},children:(0,x.jsx)(o.lVp,{title:"Learn more about Configurations",iconComponent:(0,x.jsx)(o.Zes,{}),help:(0,x.jsxs)(i.Fragment,{children:["MinIO supports a variety of configurations ranging from encryption, compression, region, notifications, etc.",(0,x.jsx)("br",{}),(0,x.jsx)("br",{}),"You can learn more at the"," ",(0,x.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/reference/minio-server/settings.html#minio-server-configuration-settings",target:"_blank",rel:"noopener",children:"documentation"}),"."]})})})]})]})}}}]); ================================================ FILE: web-app/build/static/js/1869.0f80c90a.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[1869],{32680:(e,t,l)=>{l.d(t,{A:()=>d});var a=l(9950),s=l(98341),n=l(89132),i=l(99491),o=l(49078),r=l(96382),c=l(44414);const d=e=>{let{onClose:t,modalOpen:l,title:d,children:u,wideLimit:x=!0,titleIcon:m=null,iconColor:h="default",sx:f}=e;const p=(0,i.jL)(),[b,j]=(0,a.useState)(!1),v=(0,s.d4)(e=>e.system.modalSnackBar);(0,a.useEffect)(()=>{p((0,o.h0)(""))},[p]),(0,a.useEffect)(()=>{if(v){if(""===v.message)return void j(!1);"error"!==v.type&&j(!0)}},[v]);let g="";return v&&(g=v.detailedErrorMsg,(""===g||g&&g.length<5)&&(g=v.message)),(0,c.jsxs)(n.ngX,{onClose:t,open:l,title:d,titleIcon:m,widthLimit:x,sx:f,iconColor:h,children:[(0,c.jsx)(r.A,{isModal:!0}),(0,c.jsx)(n.qb_,{onClose:()=>{j(!1),p((0,o.h0)(""))},open:b,message:g,mode:"inline",variant:"error"===v.type?"error":"default",autoHideDuration:"error"===v.type?10:5,condensed:!0}),u]})}},81869:(e,t,l)=>{l.r(t),l.d(t,{default:()=>m});var a=l(89379),s=l(9950),n=l(89132),i=l(49078),o=l(99491),r=l(70444),c=l(5501),d=l(32680),u=l(45246),x=l(44414);const m=e=>{let{open:t,selectedBucket:l,closeModalAndRefresh:m}=e;const h=(0,o.jL)(),[f,p]=(0,s.useState)(!1),[b,j]=(0,s.useState)(""),[v,g]=(0,s.useState)(""),[A,C]=(0,s.useState)(""),[S,k]=(0,s.useState)([]),[E,y]=(0,s.useState)([]),w=(0,s.useCallback)(()=>{p(!0),r.F.admin.arnList().then(e=>{null!==e.data.arns&&y(e.data.arns),p(!1)}).catch(e=>{p(!1),h((0,i.Dy)(e))})},[h]);(0,s.useEffect)(()=>{w()},[w]);const R=[{label:"PUT - Object Uploaded",value:c.Wj.Put},{label:"GET - Object accessed",value:c.Wj.Get},{label:"DELETE - Object Deleted",value:c.Wj.Delete},{label:"REPLICA - Object Replicated",value:c.Wj.Replica},{label:"ILM - Object Transitioned",value:c.Wj.Ilm},{label:"SCANNER - Object has too many versions / Prefixes has too many sub-folders",value:c.Wj.Scanner}],I=null===E||void 0===E?void 0:E.map(e=>({label:e,value:e}));return(0,x.jsx)(d.A,{modalOpen:t,onClose:()=>{m()},title:"Subscribe To Bucket Events",titleIcon:(0,x.jsx)(n.VDx,{}),children:(0,x.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),f||(p(!0),r.F.buckets.createBucketEvent(l,{configuration:{arn:A,events:S,prefix:b,suffix:v},ignoreExisting:!0}).then(()=>{p(!1),m()}).catch(e=>{p(!1),h((0,i.Dy)(e))}))},children:(0,x.jsxs)(n.xA9,{container:!0,children:[(0,x.jsxs)(n.xA9,{item:!0,xs:12,sx:u.a_.formScrollable,children:[(0,x.jsx)(n.xA9,{item:!0,xs:12,sx:(0,a.A)((0,a.A)({},u.h$.formFieldRow),{},{"& div div .MuiOutlinedInput-root":{padding:0}}),children:(0,x.jsx)(n.jT8,{onChange:e=>{C(e)},id:"select-access-policy",name:"select-access-policy",label:"ARN",value:A,options:I||[],helpTip:(0,x.jsx)(s.Fragment,{children:(0,x.jsx)("a",{target:"blank",href:"https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html",children:"Amazon Resource Name"})})})}),(0,x.jsx)(n.xA9,{item:!0,xs:12,sx:u.h$.formFieldRow,children:(0,x.jsx)(n.cl_,{id:"prefix-input",name:"prefix-input",label:"Prefix",value:b,onChange:e=>{j(e.target.value)}})}),(0,x.jsx)(n.xA9,{item:!0,xs:12,sx:u.h$.formFieldRow,children:(0,x.jsx)(n.cl_,{id:"suffix-input",name:"suffix-input",label:"Suffix",value:v,onChange:e=>{g(e.target.value)}})}),(0,x.jsx)(n.xA9,{item:!0,xs:12,sx:u.h$.formFieldRow,children:(0,x.jsx)(n.bQt,{columns:[{label:"Event",elementKey:"label"}],idField:"value",records:R,onSelect:e=>{const t=e.target,l=t.value,a=t.checked;let s=[...S];a?s.push(l):s=s.filter(e=>e!==l),k(s)},selectedItems:S,noBackground:!0,customPaperHeight:"260px"})})]}),(0,x.jsxs)(n.xA9,{item:!0,xs:12,sx:u.Uz.modalButtonBar,children:[(0,x.jsx)(n.$nd,{id:"cancel-add-event",type:"button",variant:"regular",disabled:f,onClick:()=>{m()},label:"Cancel"}),(0,x.jsx)(n.$nd,{id:"save-event",type:"submit",variant:"callAction",disabled:f||""===A||0===S.length,label:"Save"})]})]})})})}}}]); ================================================ FILE: web-app/build/static/js/1988.2b6fa00d.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[1988],{11988:(e,t,n)=>{n.r(t),n.d(t,{default:()=>x});var l=n(9950),s=n(89132),a=n(70444),i=n(48965),r=n(49078),c=n(99491),o=n(54235),d=n(45246),u=n(44414);const x=e=>{let{closeVersioningModalAndRefresh:t,modalOpen:n,selectedBucket:x,versioningInfo:h={},objectLockingEnabled:g}=e;const p=(0,c.jL)(),[f,m]=(0,l.useState)(!1),[b,j]=(0,l.useState)("Enabled"===(null===h||void 0===h?void 0:h.status)),[v,k]=(0,l.useState)(!(null===h||void 0===h||!h.excludeFolders)),[w,C]=(0,l.useState)((e=>{const t=null===e||void 0===e?void 0:e.excludedPrefixes;return t?t.map(e=>e.prefix).join(","):""})(h));return(0,u.jsx)(s.ngX,{onClose:()=>t(!1),open:n,title:"Versioning on Bucket",children:(0,u.jsxs)(s.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,u.jsx)(s.dOG,{id:"activateVersioning",label:"Versioning Status",checked:b,onChange:e=>{j(e.target.checked)},indicatorLabels:["Enabled","Disabled"]}),b&&!g&&(0,u.jsxs)(l.Fragment,{children:[(0,u.jsx)(s.dOG,{id:"excludeFolders",label:"Exclude Folders",checked:v,onChange:e=>{k(e.target.checked)},indicatorLabels:["Enabled","Disabled"]}),(0,u.jsx)(o.A,{elements:w,label:"Excluded Prefixes",name:"excludedPrefixes",onChange:e=>{let t="";t=Array.isArray(e)?e.join(","):e,C(t)},withBorder:!0})]}),(0,u.jsxs)(s.azJ,{sx:d.Uz.modalButtonBar,children:[(0,u.jsx)(s.$nd,{id:"clear",type:"button",variant:"regular",color:"primary",onClick:()=>{C(""),k(!1),j(!1)},label:"Clear"}),(0,u.jsx)(s.$nd,{type:"submit",variant:"callAction",onClick:()=>{f||(m(!0),a.F.buckets.setBucketVersioning(x,{enabled:b,excludeFolders:!!b&&v,excludePrefixes:b?w.split(",").filter(e=>""!==e.trim()):[]}).then(()=>{m(!1),t(!0)}).catch(e=>{m(!1),p((0,r.C9)((0,i.S)(e.error)))}))},id:"saveTag",label:"Save"})]})]})})}},54235:(e,t,n)=>{n.d(t,{A:()=>c});var l=n(9950),s=n(87946),a=n.n(s),i=n(89132),r=n(44414);const c=e=>{let{elements:t,name:n,label:s,tooltip:c="",commonPlaceholder:o="",onChange:d,withBorder:u=!1}=e;const[x,h]=(0,l.useState)([""]),g=(0,l.createRef)();(0,l.useEffect)(()=>{if(1===x.length&&""===x[0]&&t&&""!==t){const e=t.split(",");e.push(""),h(e)}},[t,x]),(0,l.useEffect)(()=>{if(x.length>1){const e=g.current;e&&e.scrollIntoView(!1)}},[x,g]);const p=(0,l.useCallback)(e=>{d(e)},[d]),f=(0,l.useRef)(!0);(0,l.useEffect)(()=>{if(f.current)return void(f.current=!1);const e=x.filter(e=>""!==e.trim()).join(",");p(e)},[x]);const m=e=>{e.persist();let t=[...x];const n=a()(e.target,"dataset.index","0");t[parseInt(n)]=e.target.value,h(t)},b=x.map((e,t)=>(0,r.jsx)(i.cl_,{id:"".concat(n,"-").concat(t.toString()),label:"",name:"".concat(n,"-").concat(t.toString()),value:x[t],onChange:m,index:t,placeholder:o,overlayIcon:t===x.length-1?(0,r.jsx)(i.REV,{}):null,overlayAction:()=>{(e=>{if(""!==e[e.length-1].trim()){const t=[...e];t.push(""),h(t)}})(x)}},"csv-multi-".concat(n,"-").concat(t.toString())));return(0,r.jsx)(l.Fragment,{children:(0,r.jsxs)(i.azJ,{sx:{display:"flex"},className:"inputItem",children:[(0,r.jsxs)(i.l1Y,{sx:{alignItems:"flex-start"},children:[(0,r.jsx)("span",{children:s}),""!==c&&(0,r.jsx)(i.azJ,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,r.jsx)(i.m_M,{tooltip:c,placement:"top",children:(0,r.jsx)(i.azJ,{className:c,children:(0,r.jsx)(i.NTw,{})})})})]}),(0,r.jsxs)(i.azJ,{withBorders:u,sx:{width:"100%",overflowY:"auto",height:150,position:"relative"},children:[b,(0,r.jsx)("div",{ref:g})]})]})})}}}]); ================================================ FILE: web-app/build/static/js/2258.bea2d07d.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2258],{1144:(e,t,n)=>{n.d(t,{A:()=>d});n(9950);var i=n(19335),a=n(87946),l=n.n(a),o=n(89132),s=n(44414);const r=i.Ay.div(e=>{let{theme:t}=e;return{fontFamily:"Inter,sans-serif",maxWidth:"321px",display:"flex",marginLeft:"auto",marginRight:"auto",cursor:"default",color:l()(t,"signalColors.main","#07193E"),"& .mainBox":{flex:1,display:"flex",padding:"0 8px 0 8px",["@media (max-width: ".concat(o.nmC.sm,"px)")]:{padding:"0 10px 0 10px"},"& .indicatorIcon":{width:"20px",height:"20px",marginTop:"8px",maxWidth:"26px","& .min-icon":{width:"16px",height:"16px"}},"& .indicatorContainer":{flex:1,display:"flex",flexFlow:"column","& .indicatorLabel":{fontSize:"16px",fontWeight:600},"& .counterIndicator":{display:"flex",alignItems:"center",gap:"5px",justifyContent:"space-between",paddingBottom:0,fontSize:"55px",["@media (max-width: ".concat(o.nmC.sm,"px)")]:{paddingBottom:10,fontSize:"35px"},["@media (max-width: ".concat(o.nmC.lg,"px)")]:{fontSize:"45px"},["@media (max-width: ".concat(o.nmC.xl,"px)")]:{fontSize:"50px"},flexFlow:"row",fontWeight:600,"& .stat-text":{color:l()(t,"mutedText","#87888D"),fontSize:"12px",marginTop:"8px"},"& .stat-value":{textAlign:"center",height:"50px"},"& .min-icon":{marginRight:"8px",marginTop:"8px",height:"10px",width:"10px"}},"& .onlineCounter":{display:"flex",alignItems:"center",marginTop:"5px","& .min-icon":{fill:l()(t,"signalColors.good","#4CCB92")}},"& .offlineCount":{display:"flex",alignItems:"center",marginTop:"8px","& .min-icon":{fill:l()(t,"signalColors.danger","#C51B3F")}}}}}}),d=e=>{let{onlineCount:t=0,offlineCount:n=0,icon:i=null,label:a="",okStatusText:l="Online",notOkStatusText:d="Offline"}=e;return(0,s.jsx)(r,{children:(0,s.jsxs)(o.azJ,{className:"mainBox",children:[(0,s.jsxs)(o.azJ,{className:"indicatorContainer",children:[(0,s.jsx)(o.azJ,{className:"indicatorLabel",children:a}),(0,s.jsxs)(o.azJ,{className:"counterIndicator",children:[(0,s.jsxs)(o.azJ,{children:[(0,s.jsx)(o.azJ,{className:"stat-value",children:t}),(0,s.jsxs)(o.azJ,{className:"onlineCounter",children:[(0,s.jsx)(o.GQ2,{}),(0,s.jsx)("div",{className:"stat-text",children:l})]})]}),(0,s.jsxs)(o.azJ,{children:[(0,s.jsx)(o.azJ,{className:"stat-value",children:n}),(0,s.jsxs)(o.azJ,{className:"offlineCount",children:[(0,s.jsx)(o.GQ2,{})," ",(0,s.jsx)("div",{className:"stat-text",children:d})]})]})]})]}),(0,s.jsx)(o.azJ,{className:"indicatorIcon",children:i})]})})}},32680:(e,t,n)=>{n.d(t,{A:()=>c});var i=n(9950),a=n(98341),l=n(89132),o=n(99491),s=n(49078),r=n(96382),d=n(44414);const c=e=>{let{onClose:t,modalOpen:n,title:c,children:x,wideLimit:m=!0,titleIcon:p=null,iconColor:g="default",sx:h}=e;const u=(0,o.jL)(),[f,j]=(0,i.useState)(!1),C=(0,a.d4)(e=>e.system.modalSnackBar);(0,i.useEffect)(()=>{u((0,s.h0)(""))},[u]),(0,i.useEffect)(()=>{if(C){if(""===C.message)return void j(!1);"error"!==C.type&&j(!0)}},[C]);let y="";return C&&(y=C.detailedErrorMsg,(""===y||y&&y.length<5)&&(y=C.message)),(0,d.jsxs)(l.ngX,{onClose:t,open:n,title:c,titleIcon:p,widthLimit:m,sx:h,iconColor:g,children:[(0,d.jsx)(r.A,{isModal:!0}),(0,d.jsx)(l.qb_,{onClose:()=>{j(!1),u((0,s.h0)(""))},open:f,message:y,mode:"inline",variant:"error"===C.type?"error":"default",autoHideDuration:"error"===C.type?10:5,condensed:!0}),x]})}},75054:(e,t,n)=>{n.d(t,{CS:()=>o,Ez:()=>i,WJ:()=>a,Zb:()=>l});const i={RED:"#C83B51",GREEN:"#4CCB92",YELLOW:"#FFBD62"},a=(e,t)=>e<=t/2?"bad":2!==t&&e===t/2+1?"warn":e===t?"good":void 0,l=e=>{switch(e){case"offline":return"bad";case"online":return"good";default:return"warn"}},o=(e,t)=>e<=t/2?"bad":e===t/2+1?"warn":e===t?"good":void 0},77517:(e,t,n)=>{n.d(t,{A:()=>o});var i=n(9950),a=n(89132),l=n(44414);const o=e=>{let{timeStart:t,setTimeStart:n,timeEnd:o,setTimeEnd:s,triggerSync:r,label:d="Filter:",startLabel:c="Start Time:",endLabel:x="End Time:"}=e;return(0,l.jsx)(a.xA9,{item:!0,xs:12,sx:{"& .filter-date-input-label, .end-time-input-label":{display:"none"},"& .MuiInputBase-adornedEnd.filter-date-date-time-input":{width:"100%",border:"1px solid #eaeaea",paddingLeft:"8px",paddingRight:"8px",borderRadius:"1px"},"& .MuiInputAdornment-root button":{height:"20px",width:"20px",marginRight:"5px"},"& .filter-date-input-wrapper":{height:"30px",width:"100%","& .MuiTextField-root":{height:"30px",width:"90%","& input.Mui-disabled":{color:"#000000",WebkitTextFillColor:"#101010"}}}},children:(0,l.jsxs)(a.azJ,{sx:{display:"grid",height:40,alignItems:"center",gridTemplateColumns:"auto 2fr auto",padding:0,["@media (max-width: ".concat(a.nmC.sm,"px)")]:{padding:5},["@media (max-width: ".concat(a.nmC.md,"px)")]:{gridTemplateColumns:"1fr",height:"auto"},gap:"5px"},children:[(0,l.jsx)(a.azJ,{sx:{fontSize:"14px",fontWeight:500,marginRight:"5px"},className:"muted",children:d}),(0,l.jsxs)(a.azJ,{customBorderPadding:"0px",sx:{display:"grid",height:40,alignItems:"center",gridTemplateColumns:"1fr 1fr",gap:"8px",paddingLeft:"8px",paddingRight:"8px",["@media (max-width: ".concat(a.nmC.md,"px)")]:{height:"auto",gridTemplateColumns:"1fr"}},children:[(0,l.jsx)(a.e8j,{value:t,onChange:n,id:"stTime",secondsSelector:!1,pickerStartComponent:(0,l.jsxs)(i.Fragment,{children:[(0,l.jsx)(a.b1c,{}),(0,l.jsx)("span",{children:c})]})}),(0,l.jsx)(a.e8j,{value:o,onChange:s,id:"endTime",secondsSelector:!1,pickerStartComponent:(0,l.jsxs)(i.Fragment,{children:[(0,l.jsx)(a.b1c,{}),(0,l.jsx)("span",{children:x})]})})]}),r&&(0,l.jsx)(a.azJ,{sx:{alignItems:"flex-end",display:"flex",justifyContent:"flex-end"},children:(0,l.jsx)(a.$nd,{id:"sync",type:"button",variant:"callAction",onClick:r,icon:(0,l.jsx)(a.Fjq,{}),label:"Sync"})})]})})}},82258:(e,t,n)=>{n.r(t),n.d(t,{default:()=>lt});var i=n(9950),a=n(98341),l=n(99491),o=n(75021),s=n(86070),r=n(49078),d=n(89132),c=n(89379),x=n(87946),m=n.n(x);let p=function(e){return e.singleValue="singleValue",e.linearGraph="linearGraph",e.areaGraph="areaGraph",e.barChart="barChart",e.pieChart="pieChart",e.singleRep="singleRep",e.simpleWidget="simpleWidget",e}({});var g=n(59908),h=n(44414);const u=["#C4D4E9","#DCD1EE","#D1EEE7","#EEDED1","#AAF38F","#F9E6C5","#C83B51","#F4CECE","#D6D6D6"],f=e=>(0,g.hr)(e,"ns"),j=e=>parseInt(e).toString(10),C=[{id:1,title:"Uptime",data:"N/A",type:p.simpleWidget,widgetIcon:(0,h.jsx)(d.Owo,{}),labelDisplayFunction:g.hr},{id:50,title:"Capacity",data:[],dataOuter:[{name:"outer",value:100}],widgetConfiguration:{outerChart:{colorList:["#9c9c9c"],innerRadius:0,outerRadius:0,startAngle:0,endAngle:0},innerChart:{colorList:u,innerRadius:20,outerRadius:50,startAngle:90,endAngle:-200}},type:p.pieChart,innerLabel:"N/A",labelDisplayFunction:g.nO},{id:51,title:"Usable Capacity",data:[],dataOuter:[{name:"outer",value:100}],widgetConfiguration:{outerChart:{colorList:["#9c9c9c"],innerRadius:0,outerRadius:0,startAngle:0,endAngle:0},innerChart:{colorList:u,innerRadius:20,outerRadius:50,startAngle:90,endAngle:-200}},type:p.pieChart,innerLabel:"N/A",labelDisplayFunction:g.nO},{id:68,title:"Data Usage Growth",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.areaGraph,yAxisFormatter:g.nO,xAxisFormatter:g.yz},{id:52,title:"Object size distribution",data:[],widgetConfiguration:[{dataKey:"a",color:"#2781B0",background:{fill:"#EEF1F4"},greatestColor:"#081C42"}],customStructure:[{originTag:"LESS_THAN_1024_B",displayTag:"Less than 1024B"},{originTag:"BETWEEN_1024B_AND_1_MB",displayTag:"Between 1024B and 1MB"},{originTag:"BETWEEN_1_MB_AND_10_MB",displayTag:"Between 1MB and 10MB"},{originTag:"BETWEEN_10_MB_AND_64_MB",displayTag:"Between 10MB and 64MB"},{originTag:"BETWEEN_64_MB_AND_128_MB",displayTag:"Between 64MB and 128MB"},{originTag:"BETWEEN_128_MB_AND_512_MB",displayTag:"Between 128MB and 512MB"},{originTag:"GREATER_THAN_512_MB",displayTag:"Greater than 512MB"}],type:p.barChart},{id:66,title:"Buckets",data:[],innerLabel:"N/A",type:p.singleRep,color:"#0071BC",fillColor:"#ADD5E0"},{id:44,title:"Objects",data:[],innerLabel:"N/A",type:p.singleRep,color:"#0071BC",fillColor:"#ADD5E0"},{id:63,title:"API Data Received Rate",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000",strokeWidth:3}],type:p.linearGraph,xAxisFormatter:g.yz,yAxisFormatter:g.nO},{id:61,title:"Total Open FDs",data:[],innerLabel:"N/A",type:p.singleRep,color:"#22B573",fillColor:"#A6E8C4"},{id:62,title:"Total Goroutines",data:[],innerLabel:"N/A",type:p.singleRep,color:"#F7655E",fillColor:"#F4CECE"},{id:77,title:"Node CPU Usage",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,yAxisFormatter:j,xAxisFormatter:g.yz},{id:60,title:"API Request Rate",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,yAxisFormatter:j,xAxisFormatter:g.yz},{id:70,title:"API Data Sent Rate",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,xAxisFormatter:g.yz,yAxisFormatter:g.nO},{id:17,title:"Internode Data Transfer",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,yAxisFormatter:g.nO,xAxisFormatter:g.yz},{id:73,title:"Node IO",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,yAxisFormatter:g.nO,xAxisFormatter:g.yz},{id:80,title:"Time Since Last Heal Activity",data:"N/A",type:p.simpleWidget,widgetIcon:(0,h.jsx)(d.Sdx,{}),labelDisplayFunction:f},{id:81,title:"Time Since Last Scan Activity",data:"N/A",type:p.simpleWidget,widgetIcon:(0,h.jsx)(d.KLX,{}),labelDisplayFunction:f},{id:71,title:"API Request Error Rate",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,xAxisFormatter:g.yz},{id:76,title:"Node Memory Usage",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,xAxisFormatter:g.yz,yAxisFormatter:g.nO},{id:74,title:"Drive Used Capacity",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,xAxisFormatter:g.yz,yAxisFormatter:g.nO},{id:82,title:"Drives Free Inodes",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,disableYAxis:!0,xAxisFormatter:g.yz},{id:11,title:"Node Syscalls",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,yAxisFormatter:j,xAxisFormatter:g.yz},{id:8,title:"Node File Descriptors",data:[],widgetConfiguration:[{dataKey:"",keyLabel:"",lineColor:"#000",fillColor:"#000"}],type:p.linearGraph,yAxisFormatter:j,xAxisFormatter:g.yz},{id:500,mergedPanels:[{id:53,title:"Online",data:"N/A",type:p.singleValue},{id:69,title:"Offline",data:"N/A",type:p.singleValue}],title:"Servers"},{id:501,mergedPanels:[{id:9,title:"Online",data:"N/A",type:p.singleValue},{id:78,title:"Offline",data:"N/A",type:p.singleValue}],title:"Drives"},{id:502,mergedPanels:[{id:65,title:"Upload",data:"N/A",type:p.singleValue,labelDisplayFunction:g.nO},{id:64,title:"Download",data:"N/A",type:p.singleValue,labelDisplayFunction:g.nO}],title:"Network"}],y=(e,t)=>{if(0===e.length)return["","0"];if("mean"===t){const t=e.reduce((e,t)=>e+parseFloat(t[1]),0);return["",Math.floor(t/e.length).toString()]}{const t=e.sort((e,t)=>e[0]-t[0]);return t[t.length-1]}},v=(e,t)=>{if(!e)return t;const n=e.type;switch(t.type){case p.singleValue:case p.simpleWidget:if("stat"===n||"singlestat"===n){let n=m()(e,"targets[0].result[0].values",[]);null===n&&(n=[]);const i=m()(e,"options.reduceOptions.calcs[0]","lastNotNull"),a=y(n,i),l=t.labelDisplayFunction?t.labelDisplayFunction(a[1]):a[1];return(0,c.A)((0,c.A)({},t),{},{data:l})}break;case p.pieChart:if("gauge"===n){const n=m()(e,"options.reduceOptions.calcs[0]","lastNotNull");let i=m()(e,"targets",[]).filter(e=>null!==e);const a=i.map(e=>(e.result&&Array.isArray(e.result)?e.result:[]).map(t=>{const n=m()(t,"values",[]),i=Object.keys(t.metric),a=n.sort((e,t)=>parseInt(e[0][1])-parseInt(t[0][1])),l=t.metric[i[0]],o=a[a.length-1];return{name:l,value:parseInt(o[1]),legend:e.legendFormat}})),l=i[0].result&&i[0].result.length>0?i[0].result[0].values:[],o=y(l,n),s=t.labelDisplayFunction?t.labelDisplayFunction(o[1]):o[1];return(0,c.A)((0,c.A)({},t),{},{data:a,innerLabel:s})}break;case p.linearGraph:case p.areaGraph:if("graph"===n){let n=m()(e,"targets",[]);null===n&&(n=[]);const i=[],a=[];n.forEach((e,t)=>{let n=m()(e,"result",[]);const l=e.legendFormat;null===n&&(n=[]),n.forEach(e=>{const n=((e,t)=>{const n=Object.keys(e),i=new RegExp("{{(".concat(n.join("|"),")}}"),"g");let a=t.replace(i,t=>{const n=t.replace(/({{|}})/g,"");return e[n]});const l=(a.match(/{{/g)||[]).length,o=(a.match(/}}/g)||[]).length;let s=a.replace(/{{(.*?)}}/g,"");return l===o&&0!==l&&0!==o&&(n.forEach(t=>{a=a.replace(t,e[t])}),s=a),s})(e.metric,l),o="key_".concat(t).concat(n);i.push({dataKey:o,keyLabel:n,lineColor:"",fillColor:""});let s=m()(e,"values",[]);null===s&&(s=[]),s.forEach(e=>{const t=a.findIndex(t=>t.name===e[0]);if(-1===t){let t={name:e[0]};t[o]=e[1],a.push(t)}else a[t][o]=e[1]})})});const l=i.sort((e,t)=>e.keyLabelt.keyLabel?1:0).map((e,t)=>(0,c.A)((0,c.A)({},e),{},{lineColor:u[t]||(0,g.h4)(e.keyLabel),fillColor:u[t]||(0,g.h4)(e.keyLabel)})),o=a.sort((e,t)=>e.name-t.name);return(0,c.A)((0,c.A)({},t),{},{widgetConfiguration:l,data:o})}break;case p.barChart:if("bargauge"===n){let n=m()(e,"targets[0].result",[]);null===n&&(n=[]);const i=(e,t)=>e[0]-t[0];let a=[];return a=t.customStructure?t.customStructure.map(e=>{const t=n.find(t=>t.metric.range===e.originTag),a=m()(t,"values",[]).sort(i),l=a[a.length-1]||["","0"];return{name:e.displayTag,a:parseInt(l[1])}}):n.map(e=>{const t=Object.keys(e.metric),n=e.metric[t[0]],a=m()(e,"values",[]).sort(i),l=a[a.length-1]||["","0"];return{name:n,a:parseInt(l[1])}}),(0,c.A)((0,c.A)({},t),{},{data:a})}break;case p.singleRep:if("stat"===n){let n=m()(e,"targets[0].result[0].values",[]);null===n&&(n=[]);const i=m()(e,"options.reduceOptions.calcs[0]","lastNotNull"),a=y(n,i),l=n.sort((e,t)=>e[0]-t[0]);let o=[];1===l.length&&o.push({value:0}),l.forEach(e=>{o.push({value:parseInt(e[1])})});const s=t.labelDisplayFunction?t.labelDisplayFunction(a[1]):a[1];return(0,c.A)((0,c.A)({},t),{},{data:o,innerLabel:s})}}return t},w=e=>{const t=e.split(" "),n=()=>{let t=e;return isNaN(parseFloat(e))||(t=(0,g.dq)(parseFloat(e))),(0,h.jsx)(i.Fragment,{children:t})};return 2!==t.length?n():g.MD.includes(t[1])?(0,h.jsxs)("span",{className:"commonValue",children:[t[0],(0,h.jsx)("span",{className:"unitText",children:t[1]})]}):n()};var b=n(19335),z=n(81095),S=n(80294),A=n(60158),T=n(44813),I=n(85706),J=n(72528),F=n(16335),N=n(45246),E=n(14216);const L=e=>{let{panelItem:t}=e;const n=(0,l.jL)();return(0,h.jsx)(d.azJ,{sx:{alignItems:"right",gap:"10px","& .link-text":{color:"#2781B0",fontSize:"12px",fontWeight:600},"& .zoom-graph-icon":{backgroundColor:"transparent",border:0,padding:0,cursor:"pointer","& svg":{color:"#D0D0D0",height:16},"&:hover":{"& svg":{color:"#404143"}}}},children:(0,h.jsx)("button",{onClick:()=>{n((0,E.ZQ)(t))},className:"zoom-graph-icon",children:(0,h.jsx)(d.mSu,{})})})};var k=n(66318);const W=e=>{let{title:t,componentRef:n,data:a}=e;const[o,s]=i.useState(null),c=Boolean(o),x=(0,l.jL)(),m=()=>{if(null!==a&&a.length>0)((e,t)=>{let n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8,"+t),n.setAttribute("download",e),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)})(null!==t?(t+"_"+Date.now().toString()+".csv").replace(/\s+/g,"").trim().toLowerCase():"widgetData_"+Date.now().toString()+".csv",(e=a,[Object.keys(e[0])].concat(e).map(e=>Object.values(e).toString()).join("\n")));else{let e;e={errorMessage:"Unable to download widget data",detailedError:"Unable to download widget data - data not available"},(e=>{x((0,r.C9)(e))})(e)}var e},p=e=>{"csv"===e?m():"png"===e&&(()=>{if(null!==t){const e=(t+"_"+Date.now().toString()+".png").replace(/\s+/g,"").trim().toLowerCase();(0,k.exportComponentAsPNG)(n,{fileName:e})}else{const e="widgetData_"+Date.now().toString()+".png";(0,k.exportComponentAsPNG)(n,{fileName:e})}})()};return(0,h.jsx)(i.Fragment,{children:(0,h.jsxs)(d.azJ,{sx:{justifyItems:"center","& .download-icon":{backgroundColor:"transparent",border:0,padding:0,cursor:"pointer","& svg":{color:"#D0D0D0",height:16},"&:hover":{"& svg":{color:"#404143"}}}},children:[(0,h.jsx)("button",{className:"download-icon",onClick:e=>{s(e.currentTarget)},children:(0,h.jsx)(d.s3U,{})}),(0,h.jsx)(d.Vey,{id:"download-widget-main-menu",options:[{label:"Download as CSV",value:"csv"},{label:"Download as PNG",value:"png"}],selectedOption:"",onSelect:e=>p(e),hideTriggerAction:()=>{s(null)},open:c,anchorEl:o,anchorOrigin:"end"})]})})},B=e=>{let{active:t,payload:n,label:i,barChartConfiguration:a}=e;return t?(0,h.jsxs)(d.azJ,{sx:N.VI.customTooltip,children:[(0,h.jsx)(d.azJ,{sx:N.VI.timeStampTitle,children:i}),n&&n.map((e,t)=>(0,h.jsxs)(d.azJ,{sx:N.VI.labelContainer,children:[(0,h.jsx)(d.azJ,{sx:N.VI.labelColor,style:{backgroundColor:a[t].color}}),(0,h.jsx)(d.azJ,{sx:(0,c.A)((0,c.A)({},N.VI.itemValue),{},{"& span.valueContainer":(0,c.A)({},N.VI.valueContainer)}),children:(0,h.jsx)("span",{className:"valueContainer",children:e.value})})]},"pltiem-".concat(t,"-").concat(i)))]}):null};var D=n(2586);const R=b.Ay.div(e=>{let{theme:t}=e;return(0,c.A)((0,c.A)({},(0,N.yE)(t)),{},{loadingAlign:{width:"100%",paddingTop:"15px",textAlign:"center",margin:"auto"}})}),M=e=>{let{y:t,payload:n}=e;return(0,h.jsx)("text",{width:50,fontSize:"69.7%",textAnchor:"start",fill:"#333",transform:"translate(5,".concat(t,")"),fontWeight:400,dy:3,children:n.value})},O=e=>{let{title:t,panelItem:n,timeStart:o,timeEnd:s,apiPrefix:c,zoomActivated:x=!1}=e;const m=(0,l.jL)(),[p,g]=(0,i.useState)(!1),[u,f]=(0,i.useState)([]),[j,C]=(0,i.useState)(null),[y,w]=(0,i.useState)(!1),[b,N]=(0,i.useState)(window.innerWidth>=d.nmC.md),E=(0,i.useRef)(null),k=(0,a.d4)(e=>e.dashboard.widgetLoadVersion);(0,i.useEffect)(()=>{g(!0)},[k]),(0,i.useEffect)(()=>{const e=()=>{let e=!1;window.innerWidth>=d.nmC.md&&(e=!0),N(e)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),(0,i.useEffect)(()=>{if(p){let e=0;if(null!==o&&null!==s){const t=s.toUnixInteger()-o.toUnixInteger(),n=Math.floor(t/60);e=n<1?15:n}D.A.invoke("GET","/api/v1/".concat(c,"/info/widgets/").concat(n.id,"/?step=").concat(e,"&").concat(null!==o?"&start=".concat(o.toUnixInteger()):"").concat(null!==o&&null!==s?"&":"").concat(null!==s?"end=".concat(s.toUnixInteger()):"")).then(e=>{const t=v(e,n);f(t.data),C(t),g(!1)}).catch(e=>{m((0,r.C9)(e)),g(!1)})}},[p,n,s,o,m,c]);const O=j?j.widgetConfiguration:[];let U=0,V=0;if(1===O.length){const e=O[0];u.forEach((t,n)=>{t[e.dataKey]>V&&(V=t[e.dataKey],U=n)})}return(0,h.jsx)(R,{children:(0,h.jsxs)(d.azJ,{className:x?"":"singleValueContainer",onMouseOver:()=>{w(!0)},onMouseLeave:()=>{w(!1)},children:[!x&&(0,h.jsxs)(d.xA9,{container:!0,children:[(0,h.jsx)(d.xA9,{item:!0,xs:10,sx:{alignItems:"start",justifyItems:"start"},children:(0,h.jsx)("div",{className:"titleContainer",children:t})}),(0,h.jsx)(d.xA9,{item:!0,xs:1,sx:{display:"flex",justifyContent:"flex-end"},children:y&&(0,h.jsx)(L,{panelItem:n})}),(0,h.jsx)(d.xA9,{item:!0,xs:1,sx:{display:"flex",justifyContent:"flex-end"},children:(0,h.jsx)(W,{title:t,componentRef:E,data:u})})]}),p&&(0,h.jsx)(d.azJ,{className:"loadingAlign",children:(0,h.jsx)(d.aHM,{})}),!p&&(0,h.jsx)("div",{ref:E,className:x?"zoomChartCont":"contentContainer",children:(0,h.jsx)(z.u,{width:"99%",initialDimension:{width:820,height:140},children:(0,h.jsxs)(S.E,{data:u,layout:"vertical",barCategoryGap:1,children:[(0,h.jsx)(A.W,{type:"number",hide:!0}),(0,h.jsx)(T.h,{dataKey:"name",type:"category",interval:0,tick:(0,h.jsx)(M,{}),tickLine:!1,axisLine:!1,width:150,hide:!b,style:{fontSize:"12px",fontWeight:100}}),O.map(e=>(0,h.jsx)(I.y,{dataKey:e.dataKey,fill:e.color,background:e.background,barSize:x?25:12,children:1===O.length?(0,h.jsx)(i.Fragment,{children:u.map((t,n)=>(0,h.jsx)(J.f,{fill:n===U?e.greatestColor:e.color},"chart-bar-".concat(n.toString())))}):null},"bar-".concat(e.dataKey))),(0,h.jsx)(F.m,{cursor:{fill:"rgba(255, 255, 255, 0.3)"},content:(0,h.jsx)(B,{barChartConfiguration:O})})]})})})]})})};var U=n(68354),V=n(93245),P=n(10734);const G=e=>{let{active:t,payload:n,label:i,linearConfiguration:a,yAxisFormatter:l}=e;return t?(0,h.jsxs)(d.azJ,{sx:N.VI.customTooltip,children:[(0,h.jsx)(d.azJ,{sx:N.VI.timeStampTitle,children:(0,g.yz)(i,!0)}),n&&n.map((e,t)=>(0,h.jsxs)(d.azJ,{sx:N.VI.labelContainer,children:[(0,h.jsx)(d.azJ,{sx:N.VI.labelColor,style:{backgroundColor:a[t].lineColor}}),(0,h.jsx)(d.azJ,{sx:(0,c.A)((0,c.A)({},N.VI.itemValue),{},{"& span.valueContainer":(0,c.A)({},N.VI.valueContainer)}),children:(0,h.jsxs)("span",{className:"valueContainer",children:[a[t].keyLabel,":"," ",l(e.value)]})})]},"lbPl-".concat(t,"-").concat(a[t].keyLabel)))]}):null},_=b.Ay.div(e=>{let{theme:t}=e;return(0,c.A)((0,c.A)({},(0,N.yE)(t)),{},{"& .chartCont":{position:"relative",height:140,width:"100%"},"& .legendChart":{display:"flex",flexDirection:"column",flex:"0 1 auto",maxHeight:130,margin:0,overflowY:"auto",position:"relative",textAlign:"center",width:"100%",justifyContent:"flex-start",color:m()(t,"mutedText","#87888d"),fontWeight:"bold",fontSize:12,["@media (max-width: ".concat(d.nmC.md,"px)")]:{display:"none"}},"& .loadingAlign":{width:40,height:40,textAlign:"center",margin:"15px auto"}})}),K=e=>{let{title:t,timeStart:n,timeEnd:o,panelItem:s,apiPrefix:x,hideYAxis:m=!1,areaWidget:p=!1,yAxisFormatter:g=e=>e,xAxisFormatter:u=(e,t,n)=>e,zoomActivated:f=!1}=e;const j=(0,l.jL)(),[C,y]=(0,i.useState)(!1),[w,b]=(0,i.useState)(!1),[S,I]=(0,i.useState)([]),[J,N]=(0,i.useState)([]),[E,k]=(0,i.useState)(0),[B,R]=(0,i.useState)(null),M=(0,a.d4)(e=>e.dashboard.widgetLoadVersion),O=(0,i.useRef)(null);(0,i.useEffect)(()=>{y(!0)},[M]),(0,i.useEffect)(()=>{if(C){let e=0;if(null!==n&&null!==o){const t=o.toUnixInteger()-n.toUnixInteger(),i=Math.floor(t/60);e=i<1?15:i}D.A.invoke("GET","/api/v1/".concat(x,"/info/widgets/").concat(s.id,"/?step=").concat(e,"&").concat(null!==n?"&start=".concat(n.toUnixInteger()):"").concat(null!==n&&null!==o?"&":"").concat(null!==o?"end=".concat(o.toUnixInteger()):"")).then(e=>{const t=v(e,s);I(t.data),R(t),y(!1);let n=0;for(const i of t.data)for(const e in i){if("name"===e)continue;let t=parseInt(i[e]);isNaN(t)&&(t=0),n{j((0,r.C9)(e)),y(!1)})}},[C,s,o,n,j,x]);let K=Math.floor(S.length/5);(0,i.useEffect)(()=>{const e=S.map(e=>{const t=new Date(1e3*(null===e||void 0===e?void 0:e.name));return(0,c.A)((0,c.A)({},e),{},{name:t})});N(e)},[S]);const H=B?null===B||void 0===B?void 0:B.widgetConfiguration:[],Q=e=>{const{cx:t,cy:n,index:i}=e;return i%3!==0?null:(0,h.jsx)("circle",{cx:t,cy:n,r:3,strokeWidth:0,fill:"#07264A"})};let q=!1;return f&&(q=!0),(0,h.jsx)(_,{children:(0,h.jsxs)(d.azJ,{className:f?"":"singleValueContainer",onMouseOver:()=>{b(!0)},onMouseLeave:()=>{b(!1)},children:[!f&&(0,h.jsxs)(d.xA9,{container:!0,children:[(0,h.jsx)(d.xA9,{item:!0,xs:10,sx:{alignItems:"start"},children:(0,h.jsx)(d.azJ,{className:"titleContainer",children:t})}),(0,h.jsx)(d.xA9,{item:!0,xs:1,sx:{display:"flex",justifyContent:"flex-end",alignContent:"flex-end"},children:w&&(0,h.jsx)(L,{panelItem:s})}),(0,h.jsx)(d.xA9,{item:!0,xs:1,sx:{display:"flex",justifyContent:"flex-end"},children:null!==O&&(0,h.jsx)(W,{title:t,componentRef:O,data:J})})]}),(0,h.jsx)("div",{ref:O,children:(0,h.jsxs)(d.azJ,{sx:f?{flexDirection:"column"}:{height:"100%",display:"grid",gridTemplateColumns:"1fr 1fr",["@media (max-width: ".concat(d.nmC.md,"px)")]:{gridTemplateColumns:"1fr"}},style:p?{gridTemplateColumns:"1fr"}:{},children:[C&&(0,h.jsx)(d.aHM,{className:"loadingAlign"}),!C&&(0,h.jsxs)(i.Fragment,{children:[(0,h.jsx)(d.azJ,{className:f?"zoomChartCont":"chartCont",children:(0,h.jsx)(z.u,{width:"99%",initialDimension:{width:820,height:140},children:(0,h.jsxs)(U.Q,{data:S,margin:{top:5,right:20,left:m?20:5,bottom:0},children:[p&&(0,h.jsx)("defs",{children:(0,h.jsxs)("linearGradient",{id:"colorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,h.jsx)("stop",{offset:"0%",stopColor:"#2781B0",stopOpacity:1}),(0,h.jsx)("stop",{offset:"100%",stopColor:"#ffffff",stopOpacity:0}),(0,h.jsx)("stop",{offset:"95%",stopColor:"#ffffff",stopOpacity:.8})]})}),(0,h.jsx)(V.d,{strokeDasharray:p?"2 2":"5 5",strokeWidth:1,strokeOpacity:1,stroke:"#eee0e0",vertical:!p}),(0,h.jsx)(A.W,{dataKey:"name",tickFormatter:e=>u(e,q,!0),interval:K,tick:{fontSize:"68%",fontWeight:"normal",color:"#404143"},tickCount:10,stroke:"#082045"}),(0,h.jsx)(T.h,{type:"number",domain:[0,1.1*E],hide:m,tickFormatter:e=>g(e),tick:{fontSize:"68%",fontWeight:"normal",color:"#404143"},stroke:"#082045"}),H.map((e,t)=>(0,h.jsx)(P.G,{type:"monotone",dataKey:e.dataKey,isAnimationActive:!1,stroke:p?"#D7E5F8":e.lineColor,fill:p?"url(#colorUv)":e.fillColor,fillOpacity:p?.65:0,strokeWidth:p?0:3,strokeLinecap:"round",dot:!!p&&(0,h.jsx)(Q,{})},"area-".concat(e.dataKey,"-").concat(t.toString()))),(0,h.jsx)(F.m,{content:(0,h.jsx)(G,{linearConfiguration:H,yAxisFormatter:g}),wrapperStyle:{zIndex:5e3}})]})})}),!p&&(0,h.jsxs)(i.Fragment,{children:[f&&(0,h.jsxs)(i.Fragment,{children:[(0,h.jsx)("strong",{children:"Series"}),(0,h.jsx)("br",{}),(0,h.jsx)("br",{})]}),(0,h.jsx)(d.azJ,{className:"legendChart",children:H.map((e,t)=>(0,h.jsxs)(d.azJ,{className:"singleLegendContainer",children:[(0,h.jsx)(d.azJ,{className:"colorContainer",style:{backgroundColor:e.lineColor}}),(0,h.jsx)(d.azJ,{className:"legendLabel",children:e.keyLabel})]},"legend-".concat(e.keyLabel,"-").concat(t.toString())))})]})]})]})})]})})};var H=n(67360),Q=n(54203);const q=b.Ay.div(e=>{let{theme:t}=e;return(0,c.A)((0,c.A)({},(0,N.yE)(t)),{},{"& .loadingAlign":{width:"100%",paddingTop:"15px",textAlign:"center",margin:"auto"},"& .pieChartLabel":{fontSize:60,color:m()(t,"signalColors.main","#07193E"),fontWeight:"bold",width:"100%","& .unitText":{color:m()(t,"mutedText","#87888d"),fontSize:12}},"& .chartContainer":{width:"100%",height:140}})}),Y=e=>{let{title:t,panelItem:n,timeStart:o,timeEnd:s,apiPrefix:c}=e;const x=(0,l.jL)(),[p,g]=(0,i.useState)(!1),[u,f]=(0,i.useState)([]),[j,C]=(0,i.useState)([]),[y,b]=(0,i.useState)(null),S=(0,a.d4)(e=>e.dashboard.widgetLoadVersion);(0,i.useEffect)(()=>{g(!0)},[S]),(0,i.useEffect)(()=>{if(p){let e=0;if(null!==o&&null!==s){const t=s.toUnixInteger()-o.toUnixInteger(),n=Math.floor(t/60);e=n<1?15:n}D.A.invoke("GET","/api/v1/".concat(c,"/info/widgets/").concat(n.id,"/?step=").concat(e,"&").concat(null!==o?"&start=".concat(o.toUnixInteger()):"").concat(null!==o&&null!==s?"&":"").concat(null!==s?"end=".concat(s.toUnixInteger()):"")).then(e=>{const t=v(e,n);f(t.data),C(t.dataOuter),b(t),g(!1)}).catch(e=>{x((0,r.C9)(e)),g(!1)})}},[p,n,s,o,x,c]);const A=y?y.widgetConfiguration:[],T=null===y||void 0===y?void 0:y.innerLabel,I=m()(A,"innerChart.colorList",[]),F=m()(A,"outerChart.colorList",[]);return(0,h.jsx)(q,{children:(0,h.jsxs)(d.azJ,{className:"singleValueContainer",children:[(0,h.jsx)(d.azJ,{className:"titleContainer",children:t}),p&&(0,h.jsx)(d.azJ,{className:"loadingAlign",children:(0,h.jsx)(d.aHM,{})}),!p&&(0,h.jsxs)(d.azJ,{className:"contentContainer",children:[(0,h.jsx)("span",{className:"pieChartLabel",children:T&&w(T)}),(0,h.jsx)(d.azJ,{className:"chartContainer",children:(0,h.jsx)(z.u,{width:"99%",children:(0,h.jsxs)(H.r,{margin:{top:5,bottom:5,left:0,right:0},children:[j&&(0,h.jsx)(Q.F,{data:j,cx:"50%",cy:"50%",dataKey:"value",innerRadius:m()(A,"outerChart.innerRadius",0),outerRadius:m()(A,"outerChart.outerRadius","80%"),startAngle:m()(A,"outerChart.startAngle",0),endAngle:m()(A,"outerChart.endAngle",360),fill:"#201763",children:j.map((e,t)=>(0,h.jsx)(J.f,{fill:"undefined"===typeof F[t]?"#393939":F[t]},"cellOuter-".concat(t)))}),u&&(0,h.jsx)(Q.F,{data:u,dataKey:"value",cx:"50%",cy:"50%",innerRadius:m()(A,"innerChart.innerRadius",0),outerRadius:m()(A,"innerChart.outerRadius","80%"),startAngle:m()(A,"innerChart.startAngle",0),endAngle:m()(A,"innerChart.endAngle",360),fill:"#201763",children:u.map((e,t)=>(0,h.jsx)(J.f,{fill:"undefined"===typeof I[t]?"#393939":I[t]},"cell-".concat(t)))})]})})})]})]})})},X=b.Ay.span(e=>{let{theme:t}=e;return{display:"inline-flex",color:m()(t,"signalColors.main","#07193E"),alignItems:"center","& .icon":{color:m()(t,"signalColors.main","#07193E"),fill:m()(t,"signalColors.main","#07193E"),marginRight:5,marginLeft:12},"& .widgetLabel":{fontWeight:"bold",textTransform:"uppercase",marginRight:10},"& .widgetValue":{marginRight:25}}}),Z=e=>{let{iconWidget:t,title:n,panelItem:o,timeStart:s,timeEnd:c,apiPrefix:x,renderFn:m}=e;const p=(0,l.jL)(),[g,u]=(0,i.useState)(!1),[f,j]=(0,i.useState)(""),C=(0,a.d4)(e=>e.dashboard.widgetLoadVersion);return(0,i.useEffect)(()=>{u(!0)},[C]),(0,i.useEffect)(()=>{if(g){let e=0;if(null!==s&&null!==c){const t=c.toUnixInteger()-s.toUnixInteger(),n=Math.floor(t/60);e=n<1?15:n}D.A.invoke("GET","/api/v1/".concat(x,"/info/widgets/").concat(o.id,"/?step=").concat(e,"&").concat(null!==s?"&start=".concat(s.toUnixInteger()):"").concat(null!==s&&null!==c?"&":"").concat(null!==c?"end=".concat(c.toUnixInteger()):"")).then(e=>{const t=v(e,o);j(t.data),u(!1)}).catch(e=>{p((0,r.C9)(e)),u(!1)})}},[g,o,c,s,p,x]),m?m({valueToRender:f,loading:g,title:n,id:o.id,iconWidget:t}):(0,h.jsxs)(i.Fragment,{children:[g&&(0,h.jsx)("div",{className:"loadingAlign",children:(0,h.jsx)(d.aHM,{})}),!g&&(0,h.jsxs)(X,{children:[(0,h.jsx)("span",{className:"icon",children:t||null}),(0,h.jsxs)("span",{className:"widgetLabel",children:[n,": "]}),(0,h.jsx)("span",{className:"widgetValue",children:f})]})]})},$=e=>{let{children:t}=e;return(0,h.jsx)(d.azJ,{withBorders:!0,sx:{borderRadius:"3px",padding:15,height:136,maxWidth:"100%",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{padding:5,height:"auto"},["@media (max-width: ".concat(d.nmC.md,"px)")]:{display:"flex",flexFlow:"column",maxWidth:"initial"}},children:t})},ee=b.Ay.div(e=>{let{theme:t}=e;return{fontFamily:"Inter,sans-serif",color:m()(t,"signalColors.main","#07193E"),maxWidth:"300px",display:"flex",marginLeft:"auto",marginRight:"auto",cursor:"default",position:"relative",width:"100%"}}),te=e=>{let{value:t,label:n="",icon:i=null,loading:a=!1}=e;return(0,h.jsx)(ee,{children:(0,h.jsxs)(d.azJ,{sx:{flex:1,display:"flex",width:"100%",padding:"0 8px 0 8px",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{padding:"0 10px 0 10px"}},children:[(0,h.jsxs)(d.azJ,{sx:{flex:1,display:"flex",flexFlow:"column",marginTop:"12px",zIndex:10,overflow:"hidden"},children:[(0,h.jsx)(d.azJ,{sx:{fontSize:"16px",fontWeight:600},children:n}),(0,h.jsx)(d.m_M,{tooltip:t,placement:"bottom",children:(0,h.jsx)(d.azJ,{sx:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",maxWidth:187,flexFlow:"row",fontSize:55,["@media (max-width: ".concat(d.nmC.sm,"px)")]:{fontSize:35,maxWidth:200,flexFlow:"column"},["@media (max-width: ".concat(d.nmC.md,"px)")]:{fontSize:35},["@media (max-width: ".concat(d.nmC.lg,"px)")]:{fontSize:36},["@media (max-width: ".concat(d.nmC.xl,"px)")]:{fontSize:50}},children:t})})]}),(0,h.jsx)(d.azJ,{sx:{display:"flex",flexFlow:"column",alignItems:"center",justifyContent:"flex-start",marginTop:"8px",maxWidth:"26px","& .min-icon":{width:"16px",height:"16px"}},children:a?(0,h.jsx)(d.aHM,{style:{width:"16px",height:"16px"}}):i})]})})},ne=e=>{let{title:t,value:n,loading:i}=e;return(0,h.jsx)(te,{label:t,icon:(0,h.jsx)(d.brV,{}),value:n,loading:i})},ie=e=>{let{title:t,value:n,loading:i}=e;return(0,h.jsx)(te,{label:t,icon:(0,h.jsx)(d.Sxe,{}),value:n,loading:i})},ae=(0,a.Ng)(null,{setErrorSnackMessage:r.C9})(e=>{let{title:t,panelItem:n,timeStart:o,timeEnd:s,propLoading:d,apiPrefix:c}=e;const x=(0,l.jL)(),[m,p]=(0,i.useState)(!1),[u,f]=(0,i.useState)(null),j=(0,a.d4)(e=>e.dashboard.widgetLoadVersion);(0,i.useEffect)(()=>{p(!0)},[j]),(0,i.useEffect)(()=>{if(m){let e=0;if(null!==o&&null!==s){const t=s.toUnixInteger()-o.toUnixInteger(),n=Math.floor(t/60);e=n<1?15:n}D.A.invoke("GET","/api/v1/".concat(c,"/info/widgets/").concat(n.id,"/?step=").concat(e,"&").concat(null!==o?"&start=".concat(o.toUnixInteger()):"").concat(null!==o&&null!==s?"&":"").concat(null!==s?"end=".concat(s.toUnixInteger()):"")).then(e=>{const t=v(e,n);f(t),p(!1)}).catch(e=>{x((0,r.C9)(e)),p(!1)})}},[m,n,s,o,x,c]);let C="";if(u){const e=parseInt(u.innerLabel||"0");C=isNaN(e)?"0":(0,g.dq)(e)}return 66===(y=n.id)?(0,h.jsx)($,{children:(0,h.jsx)(ne,{loading:m,title:t,value:u?C:""})}):44===y?(0,h.jsx)($,{children:(0,h.jsx)(ie,{loading:m,title:t,value:u?C:""})}):null;var y}),le=b.Ay.div(e=>{let{theme:t}=e;return(0,c.A)({display:"flex",height:140,flexDirection:"column",justifyContent:"center","& .unitText":{color:m()(t,"mutedText","#87888d"),fontSize:12},"& .loadingAlign":{width:"100%",textAlign:"center",margin:"auto"},"& .metric":{fontSize:60,lineHeight:1,color:m()(t,"signalColors.main","#07193E"),fontWeight:700},"& .titleElement":{fontSize:10,color:m()(t,"mutedText","#87888d"),fontWeight:700}},(0,N.yE)(t))}),oe=e=>{let{title:t,panelItem:n,timeStart:o,timeEnd:s,apiPrefix:c,renderFn:x}=e;const m=(0,l.jL)(),[p,g]=(0,i.useState)(!1),[u,f]=(0,i.useState)(""),j=(0,a.d4)(e=>e.dashboard.widgetLoadVersion);(0,i.useEffect)(()=>{g(!0)},[j]),(0,i.useEffect)(()=>{if(p){let e=0;if(null!==o&&null!==s){const t=s.toUnixInteger()-o.toUnixInteger(),n=Math.floor(t/60);e=n<1?15:n}D.A.invoke("GET","/api/v1/".concat(c,"/info/widgets/").concat(n.id,"/?step=").concat(e,"&").concat(null!==o?"&start=".concat(o.toUnixInteger()):"").concat(null!==o&&null!==s?"&":"").concat(null!==s?"end=".concat(s.toUnixInteger()):"")).then(e=>{const t=v(e,n);f(t.data),g(!1)}).catch(e=>{m((0,r.C9)(e)),g(!1)})}},[p,n,s,o,m,c]);const C=w(u);return x?x({valueToRender:C,loading:p,title:t,id:n.id}):(0,h.jsxs)(le,{children:[p&&(0,h.jsx)(d.azJ,{className:"loadingAlign",children:(0,h.jsx)(d.aHM,{})}),!p&&(0,h.jsxs)(i.Fragment,{children:[(0,h.jsx)(d.azJ,{className:"metric",children:w(u)}),(0,h.jsx)(d.azJ,{className:"titleElement",children:t})]})]})},se=b.Ay.div(e=>{let{theme:t}=e;return{flex:1,display:"flex",alignItems:"center",flexFlow:"row","& .usableLabel":{color:m()(t,"mutedText","#87888d"),fontSize:"10px",display:"flex",flexFlow:"column",alignItems:"center",textAlign:"center"},"& .usedLabel":{color:m()(t,"mutedText","#87888d"),fontWeight:"bold",fontSize:"14px"},"& .totalUsed":{display:"flex","& .value":{fontSize:"50px",fontFamily:"Inter",fontWeight:600,alignSelf:"flex-end",lineHeight:1},"& .unit":{color:m()(t,"mutedText","#87888d"),fontWeight:"bold",fontSize:"14px",marginLeft:"12px",alignSelf:"flex-end"}},"& .ofUsed":{marginTop:"5px","& .value":{color:m()(t,"mutedText","#87888d"),fontWeight:"bold",fontSize:"14px",textAlign:"right"}},["@media (max-width: ".concat(d.nmC.sm,"px)")]:{flexFlow:"column"}}}),re=e=>{let{value:t,timeStart:n,timeEnd:o,apiPrefix:s}=e;const c=(0,l.jL)(),[x,m]=(0,i.useState)(!1),[p,u]=(0,i.useState)(0),[f,j]=(0,i.useState)(0),[C,y]=(0,i.useState)(0),[w,b]=(0,i.useState)(0),z=(0,a.d4)(e=>e.dashboard.widgetLoadVersion);(0,i.useEffect)(()=>{m(!0)},[z]),(0,i.useEffect)(()=>{if(x){let e=0;if(null!==n&&null!==o){const t=o.toUnixInteger()-n.toUnixInteger(),i=Math.floor(t/60);e=i<1?15:i}D.A.invoke("GET","/api/v1/".concat(s,"/info/widgets/").concat(t.id,"/?step=").concat(e,"&").concat(null!==n?"&start=".concat(n.toUnixInteger()):"").concat(null!==n&&null!==o?"&":"").concat(null!==o?"end=".concat(o.toUnixInteger()):"")).then(e=>{const n=v(e,t);let i=0,a=0,l=0;n.data.forEach(e=>{e.forEach(e=>{switch(e.legend){case"Total Usable":i+=e.value;break;case"Used Space":a+=e.value;break;case"Usable Free":l+=e.value}})});const o=Math.round(l/i*100);u(l),j(o),y(a),b(i),m(!1)}).catch(e=>{c((0,r.C9)(e)),m(!1)})}},[x,t,o,n,c,s]);const S=(0,g.GT)(C,!0,!1),A=[{value:p,color:"#D6D6D6",label:"Usable Available Space"},{value:C,color:(0,g.zv)(C,w),label:"Used Space"}];return(0,h.jsxs)(se,{children:[(0,h.jsx)(d.azJ,{sx:{fontSize:"16px",fontWeight:600,["@media (max-width: ".concat(d.nmC.sm,"px)")]:{alignSelf:"flex-start"}},children:"Capacity"}),(0,h.jsxs)(d.azJ,{sx:{position:"relative",width:110,height:110,marginLeft:"auto",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{marginLeft:""}},children:[(0,h.jsxs)(d.azJ,{sx:{position:"absolute",display:"flex",flexFlow:"column",alignItems:"center",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontWeight:"bold",fontSize:12},children:["".concat(f,"%"),(0,h.jsx)("br",{}),(0,h.jsx)(d.azJ,{className:"usableLabel",children:"Free"})]}),(0,h.jsx)(H.r,{width:110,height:110,children:(0,h.jsx)(Q.F,{data:A,cx:"50%",cy:"50%",dataKey:"value",outerRadius:50,innerRadius:40,startAngle:-70,endAngle:360,animationDuration:1,children:A.map((e,t)=>(0,h.jsx)(J.f,{fill:e.color},"cellCapacity-".concat(t)))})})]}),(0,h.jsxs)(d.azJ,{sx:{display:"flex",alignItems:"center",marginLeft:"auto",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{marginLeft:""}},children:[(0,h.jsxs)(d.azJ,{children:[(0,h.jsx)(d.azJ,{className:"usedLabel",children:"Used:"}),(0,h.jsxs)(d.azJ,{className:"totalUsed",children:[(0,h.jsx)("div",{className:"value",children:S.total}),(0,h.jsx)("div",{className:"unit",children:S.unit})]}),(0,h.jsx)(d.azJ,{className:"ofUsed",children:(0,h.jsxs)("div",{className:"value",children:["Of: ",(0,g.qO)(w)]})})]}),(0,h.jsx)(d.azJ,{sx:{marginLeft:"15px",height:"100%",display:"flex",alignItems:"flex-start"},children:(0,h.jsx)(d.azJ,{children:x?(0,h.jsx)(d.aHM,{style:{width:"26px",height:"26px"}}):(0,h.jsx)(d.wNL,{})})})]})]})},de=b.Ay.div(e=>{let{theme:t}=e;return{display:"grid",alignItems:"center",gap:8,height:33,paddingLeft:15,gridTemplateColumns:"20px 1.5fr .5fr 20px",background:m()(t,"boxBackground","#FBFAFA"),"& .min-icon":{height:"12px",width:"12px",fill:m()(t,"signalColors.good","#4CCB92")},"& .ok-icon":{height:"8px",width:"8px",fill:m()(t,"signalColors.good","#4CCB92"),color:m()(t,"signalColors.good","#4CCB92")},"& .timeStatLabel":{fontSize:"12px",color:m()(t,"signalColors.good","#4CCB92"),fontWeight:600},"& .timeStatValue":{fontSize:"12px",color:m()(t,"signalColors.good","#4CCB92")}}}),ce=e=>{let{icon:t,label:n,value:i,loading:a=!1}=e;return(0,h.jsxs)(de,{className:"dashboard-time-stat-item",children:[a?(0,h.jsx)(d.aHM,{style:{width:10,height:10}}):t,(0,h.jsx)(d.azJ,{className:"timeStatLabel",children:n}),(0,h.jsx)(d.azJ,{className:"timeStatValue",children:i}),"n/a"!==i?(0,h.jsx)(d.BK0,{className:"ok-icon"}):null]})},xe=e=>{let{valueToRender:t="",loading:n=!1,iconWidget:i=null}=e;return(0,h.jsx)(d.azJ,{sx:{display:"flex",height:"47px",borderRadius:"2px","& .dashboard-time-stat-item":{height:"100%",width:"100%"}},children:(0,h.jsx)(ce,{loading:n,icon:i,label:(0,h.jsxs)(d.azJ,{children:[(0,h.jsx)(d.azJ,{sx:{display:"inline",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{display:"none"}},children:"Time since last"})," ","Heal Activity"]}),value:t})})},me=e=>{let{valueToRender:t="",loading:n=!1,iconWidget:i=null}=e;return(0,h.jsx)(d.azJ,{sx:{display:"flex",height:"47px",borderRadius:"2px","& .dashboard-time-stat-item":{height:"100%",width:"100%"}},children:(0,h.jsx)(ce,{loading:n,icon:i,label:(0,h.jsxs)(d.azJ,{children:[(0,h.jsx)(d.azJ,{sx:{display:"inline",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{display:"none"}},children:"Time since last"})," ","Scan Activity"]}),value:t})})},pe=e=>{let{valueToRender:t="",loading:n=!1,iconWidget:i=null}=e;return(0,h.jsx)(d.azJ,{sx:{display:"flex",height:47,borderRadius:2,"& .dashboard-time-stat-item":{height:"100%",width:"100%"}},children:(0,h.jsx)(ce,{loading:n,icon:i,label:(0,h.jsx)(d.azJ,{children:"Uptime"}),value:t})})},ge=function(e,t,n,i,a){let l=arguments.length>5&&void 0!==arguments[5]&&arguments[5];switch(e.type){case p.singleValue:return(0,h.jsx)(oe,{title:e.title,panelItem:e,timeStart:t,timeEnd:n,apiPrefix:a});case p.simpleWidget:let o,s=null;return 80===e.id?s=xe:81===e.id?s=me:1===e.id&&(s=pe),[80,81,1].includes(e.id)&&(o=e=>{let{valueToRender:t,loading:n,title:i,id:a,iconWidget:l}=e;return(0,h.jsx)(s,{valueToRender:t,loading:n,title:i,id:a,iconWidget:l})}),(0,h.jsx)(Z,{title:e.title,panelItem:e,timeStart:t,timeEnd:n,apiPrefix:a,iconWidget:e.widgetIcon,renderFn:o});case p.pieChart:return 50===e.id?(0,h.jsx)($,{children:(0,h.jsx)(re,{value:e,timeStart:t,timeEnd:n,apiPrefix:a})}):(0,h.jsx)(Y,{title:e.title,panelItem:e,timeStart:t,timeEnd:n,apiPrefix:a});case p.linearGraph:case p.areaGraph:return(0,h.jsx)(K,{title:e.title,panelItem:e,timeStart:t,timeEnd:n,hideYAxis:e.disableYAxis,xAxisFormatter:e.xAxisFormatter,yAxisFormatter:e.yAxisFormatter,apiPrefix:a,areaWidget:e.type===p.areaGraph,zoomActivated:l});case p.barChart:return(0,h.jsx)(O,{title:e.title,panelItem:e,timeStart:t,timeEnd:n,apiPrefix:a,zoomActivated:l});case p.singleRep:const r=e.fillColor?e.fillColor:e.color;return(0,h.jsx)(ae,{title:e.title,panelItem:e,timeStart:t,timeEnd:n,propLoading:i,color:e.color,fillColor:r,apiPrefix:a});default:return null}},he=[{sx:{minWidth:0,display:"grid",gap:"30px",gridTemplateColumns:"1fr 1fr 1fr 1fr",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{gridTemplateColumns:"1fr"},["@media (max-width: ".concat(d.nmC.md,"px)")]:{gridTemplateColumns:"1fr 1fr"}},columns:[{componentId:66},{componentId:44},{componentId:500},{componentId:501}]},{sx:{display:"grid",minWidth:0,gap:"30px",gridTemplateColumns:"1fr 1fr",["@media (max-width: ".concat(d.nmC.md,"px)")]:{gridTemplateColumns:"1fr"}},columns:[{componentId:50},{componentId:502}]},{sx:{display:"grid",minWidth:0,gap:"30px",gridTemplateColumns:"1fr 1fr 1fr",["@media (max-width: ".concat(d.nmC.md,"px)")]:{gridTemplateColumns:"1fr"}},columns:[{componentId:80},{componentId:81},{componentId:1}]},{sx:{display:"grid",minWidth:0,gap:"30px",gridTemplateColumns:"1fr 1fr",["@media (max-width: ".concat(d.nmC.md,"px)")]:{gridTemplateColumns:"1fr"}},columns:[{componentId:68},{componentId:52}]},{sx:{display:"grid",minWidth:0,gap:"30px",gridTemplateColumns:"1fr 1fr",["@media (max-width: ".concat(d.nmC.md,"px)")]:{gridTemplateColumns:"1fr"}},columns:[{componentId:63},{componentId:70}]}],ue=[{sx:{display:"grid",gridTemplateColumns:"1fr",gap:"30px"},columns:[{componentId:60}]},{sx:{display:"grid",minWidth:0,gap:"30px",gridTemplateColumns:"1fr 1fr",["@media (max-width: ".concat(d.nmC.md,"px)")]:{gridTemplateColumns:"1fr"}},columns:[{componentId:71,sx:{flex:1,width:"50%",flexShrink:0}},{componentId:17,sx:{flex:1,width:"50%",flexShrink:0}}]},{sx:{display:"grid",gridTemplateColumns:"1fr",gap:"30px"},columns:[{componentId:73}]}],fe=[{sx:{display:"grid",minWidth:0,gridTemplateColumns:"1fr 1fr",gap:"30px"},columns:[{componentId:76},{componentId:77}]},{sx:{display:"grid",minWidth:0,gridTemplateColumns:"1fr 1fr",gap:"30px"},columns:[{componentId:82},{componentId:74}]}],je=[{sx:{display:"grid",minWidth:0,gridTemplateColumns:"1fr 1fr",gap:"30px"},columns:[{componentId:11},{componentId:8}]}],Ce=e=>{let{children:t}=e;return(0,h.jsx)(d.azJ,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:"30px"},children:t})};var ye=n(32680);const ve=e=>{let{value:t,modalOpen:n,timeStart:a,timeEnd:o,apiPrefix:s}=e;const r=(0,l.jL)();return t?(0,h.jsx)(ye.A,{title:t.title,onClose:()=>{r((0,E.Nv)())},modalOpen:n,wideLimit:!1,sx:{padding:0},children:(0,h.jsx)(i.Fragment,{children:ge(t,a,o,!0,s,!0)})}):null};var we=n(77517),be=n(42074);const ze=b.Ay.div(e=>{let{theme:t}=e;return(0,c.A)((0,c.A)({},(0,N.yE)(t)),{},{"& .metricText":{fontSize:70,lineHeight:1.1,color:m()(t,"signalColors.main","#07193E"),fontWeight:"bold"},"& .unitText":{fontSize:10,color:m()(t,"mutedText","#87888d"),fontWeight:"normal"},"& .subHeaderContainer":{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},"& .subMessage":{fontSize:10,color:m()(t,"mutedText","#87888d"),"&.bold":{fontWeight:"bold"}},"& .headerContainer":{display:"flex",justifyContent:"space-between"},"& .viewAll":{fontSize:10,color:m()(t,"signalColors.danger","#C83B51"),textTransform:"capitalize","& a, & a:hover, & a:visited, & a:active":{color:m()(t,"signalColors.danger","#C83B51")}}})}),Se=e=>{let{title:t,metricValue:n,metricUnit:a,subMessage:l,moreLink:o,rightComponent:s,extraMargin:r=!1}=e;const c=()=>(0,h.jsx)(i.Fragment,{children:(0,h.jsxs)("div",{className:"subHeaderContainer",children:[(0,h.jsxs)("div",{className:"leftSide",children:[(0,h.jsx)("div",{children:(0,h.jsxs)("span",{className:"metricText",children:[n,(0,h.jsx)("span",{className:"unitText",children:a})]})}),l&&(0,h.jsx)(d.azJ,{sx:{fontWeight:l.fontWeight||"normal"},children:l.message})]}),(0,h.jsx)("div",{className:"rightSide",children:s})]})}),x=()=>(0,h.jsx)(i.Fragment,{children:(0,h.jsxs)("div",{className:"headerContainer",children:[(0,h.jsx)("span",{className:"titleContainer",children:t}),o&&(0,h.jsx)(i.Fragment,{children:(0,h.jsx)("span",{className:"viewAll",children:(0,h.jsx)(be.N_,{to:o,children:"View All"})})})]})});return(0,h.jsx)(i.Fragment,{children:(0,h.jsx)(d.azJ,{withBorders:!0,sx:{height:200,padding:16,margin:r?"10px 20px 10px 0":""},children:""!==n&&(0,h.jsxs)(ze,{children:[(0,h.jsx)(x,{}),(0,h.jsx)(c,{})]})})})},Ae=e=>{let{title:t,leftComponent:n,rightComponent:a}=e;return(0,h.jsx)(i.Fragment,{children:(0,h.jsx)(Se,{title:t,metricValue:n,rightComponent:a})})},Te=e=>{let{panelItem:t,timeStart:n,timeEnd:o,apiPrefix:s,statLabel:c}=e;const x=(0,l.jL)(),[m,p]=(0,i.useState)(!1),[g,u]=(0,i.useState)(""),f=(0,a.d4)(e=>e.dashboard.widgetLoadVersion);return(0,i.useEffect)(()=>{p(!0)},[f]),(0,i.useEffect)(()=>{if(m){let e=0;if(null!==n&&null!==o){const t=o.toUnixInteger()-n.toUnixInteger(),i=Math.floor(t/60);e=i<1?15:i}D.A.invoke("GET","/api/v1/".concat(s,"/info/widgets/").concat(t.id,"/?step=").concat(e,"&").concat(null!==n?"&start=".concat(n.toUnixInteger()):"").concat(null!==n&&null!==o?"&":"").concat(null!==o?"end=".concat(o.toUnixInteger()):"")).then(e=>{const n=v(e,t);u(n.data),p(!1)}).catch(e=>{x((0,r.C9)(e)),p(!1)})}},[m,t,o,n,x,s]),m?(0,h.jsx)(d.azJ,{sx:{width:"100%",paddingTop:"5px",textAlign:"center",margin:"auto"},children:(0,h.jsx)(d.aHM,{style:{width:12,height:12}})}):(0,h.jsxs)(d.azJ,{children:[(0,h.jsx)(d.azJ,{className:"stat-value",children:g}),c]})},Ie=b.Ay.div(e=>{let{theme:t}=e;return{fontFamily:"Inter,sans-serif",color:m()(t,"signalColors.main","#07193E"),maxWidth:"321px",display:"flex",marginLeft:"auto",marginRight:"auto",cursor:"default","& .stat-text":{color:m()(t,"mutedText","#87888d"),fontSize:"12px",marginTop:"8px"}}}),Je=e=>{let{statItemLeft:t=null,statItemRight:n=null,icon:i=null,label:a=""}=e;return(0,h.jsx)(Ie,{children:(0,h.jsxs)(d.azJ,{sx:{flex:1,display:"flex",padding:"0 8px 0 8px",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{padding:"0 10px 0 10px"}},children:[(0,h.jsxs)(d.azJ,{sx:{flex:1,display:"flex",flexFlow:"column"},children:[(0,h.jsx)(d.azJ,{sx:{fontSize:"16px",fontWeight:600},children:a}),(0,h.jsxs)(d.azJ,{sx:{display:"flex",alignItems:"center",gap:5,justifyContent:"space-between",paddingBottom:0,fontSize:55,flexFlow:"row",fontWeight:600,"& .stat-value":{textAlign:"center",height:"50px"},"& .min-icon":{marginRight:"8px",marginTop:"8px",height:"10px",width:"10px"},["@media (max-width: ".concat(d.nmC.sm,"px)")]:{fontSize:35},["@media (max-width: ".concat(d.nmC.lg,"px)")]:{fontSize:45},["@media (max-width: ".concat(d.nmC.xl,"px)")]:{fontSize:50}},children:[t,n]})]}),(0,h.jsx)(d.azJ,{sx:{width:"20px",height:"20px",marginTop:"8px",maxWidth:"26px","& .min-icon":{width:"16px",height:"16px"}},children:i})]})})},Fe=b.Ay.div(e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",marginTop:"5px",gap:8,"&.online":{"& .min-icon":{margin:0,fill:m()(t,"signalColors.good","#4CCB92")}},"&.offline":{"& .min-icon":{margin:0,fill:m()(t,"signalColors.danger","#C51B3F")}},"& .indicatorText":{color:m()(t,"mutedText","#C51B3F"),fontSize:12}}}),Ne=e=>{let{info:t,timeStart:n,timeEnd:i,apiPrefix:a}=e;const{mergedPanels:l=[],id:o}=t,[s,r]=l,c=(0,h.jsx)(Te,{panelItem:s,timeStart:n,timeEnd:i,apiPrefix:a,statLabel:(0,h.jsxs)(Fe,{className:"online",children:[(0,h.jsx)(d.GQ2,{}),(0,h.jsx)(d.azJ,{className:"indicatorText",children:"Online"})]})}),x=(0,h.jsx)(Te,{panelItem:r,timeStart:n,timeEnd:i,apiPrefix:a,statLabel:(0,h.jsxs)(Fe,{className:"offline",children:[(0,h.jsx)(d.GQ2,{}),(0,h.jsx)(d.azJ,{className:"indicatorText",children:"Offline"})]})});let m=null,p="";return 500===o?(m=(0,h.jsx)(d.WXN,{}),p="Servers"):501===o&&(m=(0,h.jsx)(d.JUN,{}),p="Drives"),(0,h.jsx)(Je,{statItemLeft:c,statItemRight:x,icon:m,label:p})},Ee=b.Ay.div(e=>{let{theme:t}=e;return{"& .putLabel":{display:"flex",gap:10,alignItems:"center",marginTop:"10px","& .min-icon":{height:15,width:15,fill:m()(t,"signalColors.good","#4CCB92")},"& .getText":{fontSize:"18px",color:m()(t,"mutedText","#87888d"),fontWeight:"bold"},"& .valueText":{fontSize:50,fontFamily:"Inter",fontWeight:600}}}}),Le=e=>{let{value:t,loading:n}=e;return(0,h.jsxs)(Ee,{children:[(0,h.jsxs)(d.azJ,{className:"putLabel",children:[(0,h.jsx)(d.azJ,{className:"getText",children:"GET"}),n?(0,h.jsx)(d.aHM,{style:{width:"15px",height:"15px"}}):(0,h.jsx)(d.OFF,{})]}),(0,h.jsx)(d.azJ,{className:"valueText",children:t})]})},ke=b.Ay.div(e=>{let{theme:t}=e;return{"& .putLabel":{display:"flex",gap:10,alignItems:"center",marginTop:"10px","& .min-icon":{height:15,width:15,fill:m()(t,"signalColors.info","#2781B0")},"& .putText":{fontSize:"18px",color:m()(t,"mutedText","#87888d"),fontWeight:"bold"},"& .valueText":{fontSize:50,fontFamily:"Inter",fontWeight:600}}}}),We=e=>{let{value:t,loading:n}=e;return(0,h.jsxs)(ke,{children:[(0,h.jsxs)(d.azJ,{className:"putLabel",children:[(0,h.jsx)(d.azJ,{className:"putText",children:"PUT"}),n?(0,h.jsx)(d.aHM,{style:{width:"15px",height:"15px"}}):(0,h.jsx)(d.z8D,{})]}),(0,h.jsx)(d.azJ,{className:"valueText",children:t})]})},Be=b.Ay.div(e=>{let{theme:t}=e;return{flex:1,display:"flex",alignItems:"center",flexFlow:"row",gap:"15px","& .unitText":{fontSize:"14px",color:m()(t,"mutedText","#87888d"),marginLeft:"5px"},"& .unit":{color:m()(t,"mutedText","#87888d"),fontSize:"18px",marginLeft:"12px",marginTop:"10px"},["@media (max-width: ".concat(d.nmC.sm,"px)")]:{flexFlow:"column"}}}),De=e=>{let{value:t,timeStart:n,timeEnd:i,apiPrefix:a}=e;const{mergedPanels:l=[]}=t,[o,s]=l,r=(0,h.jsx)(oe,{title:t.title,panelItem:o,timeStart:n,timeEnd:i,apiPrefix:a,renderFn:e=>{let{valueToRender:t,loading:n,title:i,id:a}=e;return(0,h.jsx)(We,{value:t,loading:n,title:i,id:a})}}),c=(0,h.jsx)(oe,{title:t.title,panelItem:s,timeStart:n,timeEnd:i,apiPrefix:a,renderFn:e=>{let{valueToRender:t,loading:n,title:i,id:a}=e;return(0,h.jsx)(Le,{value:t,loading:n,title:i,id:a})}});return(0,h.jsxs)(Be,{children:[(0,h.jsx)(d.azJ,{sx:{fontSize:"16px",fontWeight:600},children:"Network"}),(0,h.jsx)(d.azJ,{sx:{position:"relative",width:110,height:110,marginLeft:"auto",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{marginLeft:"0"}},children:(0,h.jsx)(d.azJ,{sx:{position:"absolute",display:"flex",flexFlow:"column",alignItems:"center",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontWeight:"bold",fontSize:12},children:c})}),(0,h.jsx)(d.azJ,{sx:{display:"flex",alignItems:"center",marginLeft:"auto",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{marginLeft:"0"}},children:(0,h.jsx)(d.azJ,{sx:{display:"flex",alignItems:"center","& .value":{fontSize:"50px",fontFamily:"Inter"}},children:r})}),(0,h.jsx)(d.azJ,{sx:{marginLeft:"15px",height:"100%",display:"flex",alignItems:"flex-start","& .min-icon":{height:"15px",width:"15px"}},children:(0,h.jsx)(d.vhL,{})})]})},Re=e=>{let{info:t,timeStart:n,timeEnd:i,loading:a,apiPrefix:l}=e;const{mergedPanels:o=[],title:s="",id:r}=t,[d,c]=o;return[500,501].includes(r)?(0,h.jsx)($,{children:(0,h.jsx)(Ne,{info:t,timeStart:n,timeEnd:i,apiPrefix:l})}):502===r?(0,h.jsx)($,{children:(0,h.jsx)(De,{apiPrefix:l,timeEnd:i,timeStart:n,value:t})}):(0,h.jsx)(Ae,{title:s,leftComponent:ge(d,n,i,a,l),rightComponent:ge(c,n,i,a,l)})};var Me=n(1144),Oe=n(33684),Ue=n.n(Oe),Ve=n(75054);const Pe=b.Ay.div(e=>{let{theme:t}=e;return{alignItems:"baseline",padding:"5px",display:"flex",gap:"5px","& .StatBox":{display:"flex",alignItems:"center",justifyContent:"center",flexFlow:"column","& .stat-text":{color:m()(t,"mutedText","#87888d"),fontSize:"12px"},"& .stat-value":{fontSize:"18px",color:m()(t,"signalColors.main","#07193E"),display:"flex",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","& .stat-container":{display:"flex",alignItems:"center",justifyContent:"center",flexFlow:"column",marginLeft:"5px",maxWidth:"40px","&:first-of-type(svg)":{fill:m()(t,"mutedText","#87888d")},"& .stat-indicator":{marginRight:"0px",justifyContent:"center",alignItems:"center",textAlign:"center","& svg.min-icon":{width:"10px",height:"10px"},"&.good":{"& svg.min-icon":{fill:m()(t,"signalColors.good","#4CCB92")}},"&.warn":{"& svg.min-icon":{fill:m()(t,"signalColors.warning","#FFBD62")}},"&.bad":{"& svg.min-icon":{fill:m()(t,"signalColors.danger","#C51B3F")}}}}}}}}),Ge=b.Ay.div(e=>{let{theme:t}=e;return{display:"flex",alignItems:"flex-start",flexFlow:"column",flex:1,"& .server-state":{marginLeft:"8px","& .min-icon":{height:"14px",width:"14px"},"&.good":{"& svg.min-icon":{fill:m()(t,"signalColors.good","#4CCB92")}},"&.warn":{"& svg.min-icon":{fill:m()(t,"signalColors.warning","#FFBD62")}},"&.bad":{"& svg.min-icon":{fill:m()(t,"signalColors.danger","#C51B3F")}}}}}),_e=e=>{let{label:t="",value:n="",statusColor:i="warn",hasStatus:a=!1}=e;return(0,h.jsx)(Pe,{children:(0,h.jsxs)(d.azJ,{className:"StatBox",children:[(0,h.jsxs)("div",{className:"stat-value",children:[n," ",(0,h.jsx)(d.azJ,{className:"stat-container",children:a?(0,h.jsx)(d.azJ,{className:"stat-indicator ".concat(i),children:(0,h.jsx)(d.GQ2,{})}):(0,h.jsx)(d.azJ,{sx:{width:"12px",height:"12px"}})})]}),(0,h.jsx)("div",{className:"stat-text",children:t})]})})},Ke=e=>{let{server:t}=e;const n=Object.keys(m()(t,"network",{})),i=n.length,a=t.drives?t.drives.length:0,l=n.reduce((e,n)=>"online"===(t.network?t.network[n]:"")?e+1:e,0),o=t.drives?t.drives.filter(e=>"ok"===e.state).length:0;return(0,h.jsx)(Ge,{children:(0,h.jsxs)(d.azJ,{sx:{display:"flex",alignItems:"center",padding:"3px",gap:"15px",justifyContent:"space-between",width:"100%",paddingLeft:"20px",flexFlow:"row",["@media (max-width: ".concat(d.nmC.md,"px)")]:{flexFlow:"column"}},children:[(0,h.jsxs)(d.azJ,{sx:{display:"flex",alignItems:"center"},children:[(0,h.jsx)(d.azJ,{sx:{fontWeight:600,textTransform:"none"},children:t.endpoint||""}),(null===t||void 0===t?void 0:t.state)&&(0,h.jsx)(d.azJ,{className:"server-state ".concat((0,Ve.Zb)(t.state)),children:(0,h.jsx)(d.GQ2,{})})]}),(0,h.jsxs)(d.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"center",flex:"1.5",gap:"5%"},children:[(0,h.jsx)(_e,{statusColor:(0,Ve.WJ)(o,a),label:"Drives",hasStatus:!0,value:"".concat(o,"/").concat(a)}),(0,h.jsx)(_e,{statusColor:(0,Ve.CS)(l,i),label:"Network",hasStatus:!0,value:"".concat(l,"/").concat(i)}),(0,h.jsx)(_e,{statusColor:"good",label:"Up time",value:null!==t&&void 0!==t&&t.uptime?(0,g.hr)("".concat(t.uptime)):"N/A"})]}),(0,h.jsx)(_e,{statusColor:"good",label:"",value:(0,h.jsxs)(d.azJ,{sx:{background:"rgb(235, 236, 237)",color:"#000000",paddingLeft:"10px",paddingRight:"10px",borderRadius:"2px",fontSize:"12px",marginTop:"5px","& .label":{fontWeight:600,marginRight:"3px"}},children:[(0,h.jsx)("span",{className:"label",children:"Version:"}),t.version?t.version:"N/A"]})})]})})},He=e=>{var t,n,a,l;let{drive:o}=e;const s=(0,b.DP)(),r=null!==(t=o.totalSpace)&&void 0!==t?t:0,c=null!==(n=o.usedSpace)&&void 0!==n?n:0,x=0!==r?Math.max(c/r*100,0):0,p=null!==(a=o.availableSpace)&&void 0!==a?a:0,u=0!==r?Math.max(p/r*100,0):0,f=(0,i.useMemo)(()=>{switch(o.state){case"offline":return Ve.Ez.RED;case"ok":return Ve.Ez.GREEN;default:return Ve.Ez.YELLOW}},[o.state]),j=(0,i.useMemo)(()=>{switch(o.state){case"offline":return"Offline Drive";case"ok":return"Online Drive";default:return"Unknown"}},[o.state]);return(0,h.jsxs)(d.azJ,{withBorders:!0,sx:{display:"flex",flexFlow:"row",padding:12,gap:24,alignItems:"center",["@media (max-width: ".concat(d.nmC.xs,"px)")]:{flexFlow:"column",alignItems:"start"},"& .info-label":{color:m()(s,"mutedText","#87888d"),fontSize:12},"& .info-value":{fontSize:18,color:m()(s,"signalColors.main","#07193E"),display:"flex",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"& .drive-endpoint":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",wordBreak:"break-all",fontWeight:600,fontSize:16,["@media (max-width: ".concat(d.nmC.sm,"px)")]:{fontSize:10}},"& .percentage-row":{display:"flex",gap:4,alignItems:"center",fontSize:12,"& .percentage-value":{fontWeight:700}}},children:[(0,h.jsx)(d.cNv,{chartLabel:"Used Capacity",label:!0,usedBytes:c,totalBytes:r,width:"153",height:"153"}),(0,h.jsxs)(d.azJ,{sx:{display:"flex",flexFlow:"column",gap:12,flex:1},children:[(0,h.jsxs)(d.azJ,{sx:{display:"flex",flexFlow:"row",gap:8,["@media (max-width: ".concat(d.nmC.xs,"px)")]:{flexFlow:"column"}},children:[(0,h.jsxs)(d.azJ,{sx:{flex:"1 1 60%",["@media (max-width: ".concat(d.nmC.xs,"px)")]:{flex:"1 1 100%"}},children:[(0,h.jsx)("label",{className:"info-label",children:"Drive Name"}),(0,h.jsx)(d.azJ,{className:"drive-endpoint",children:null!==(l=o.endpoint)&&void 0!==l?l:""})]}),(0,h.jsxs)(d.azJ,{sx:{flex:"1 1 20%",["@media (max-width: ".concat(d.nmC.xs,"px)")]:{flex:"1 1 100%"}},children:[(0,h.jsx)("label",{className:"info-label",children:"Drive Status"}),(0,h.jsxs)(d.azJ,{sx:{display:"flex",flexFlow:"row",alignItems:"center",fontSize:12,fontWeight:600,gap:4,color:f,"& .min-icon":{height:8,width:8,flexShrink:0}},children:[(0,h.jsx)(d.GQ2,{}),j]})]})]}),(0,h.jsxs)(d.azJ,{sx:{display:"flex",flexFlow:"row",gap:36},children:[(0,h.jsxs)(d.azJ,{sx:{display:"flex",flexFlow:"column"},children:[(0,h.jsx)("label",{className:"info-label",children:"Used Capacity"}),(0,h.jsx)(d.azJ,{className:"info-value",children:(0,g.nO)(c.toString())}),(0,h.jsxs)(d.azJ,{className:"percentage-row",children:[(0,h.jsxs)(d.azJ,{className:"percentage-value",children:[x.toFixed(2),"%"]}),(0,h.jsxs)(d.azJ,{children:["of ",(0,g.nO)(r.toString())]})]})]}),(0,h.jsx)(d.azJ,{sx:{width:1,backgroundColor:m()(s,"borderColor","#BBBBBB")}}),(0,h.jsxs)(d.azJ,{sx:{display:"flex",flexFlow:"column"},children:[(0,h.jsx)("label",{className:"info-label",children:"Available Capacity"}),(0,h.jsx)(d.azJ,{className:"info-value",children:(0,g.nO)(p.toString())}),(0,h.jsxs)(d.azJ,{className:"percentage-row",children:[(0,h.jsxs)(d.azJ,{className:"percentage-value",children:[u.toFixed(2),"%"]}),(0,h.jsxs)(d.azJ,{children:["of ",(0,g.nO)(r.toString())]})]})]})]})]})]})},Qe=e=>{let{data:t}=e;const[n,a]=i.useState(t.length>1?"":t[0].endpoint+"-0"),l=e=>{a(e)};return(0,h.jsxs)(d.azJ,{children:[(0,h.jsxs)(d.azJ,{sx:{fontSize:18,lineHeight:2,fontWeight:700},children:["Servers (",t.length,")"]}),(0,h.jsx)(d.azJ,{children:t.map((e,t)=>{var i,a;const o="".concat(e.endpoint,"-").concat(t),s=n===o;return(0,h.jsxs)(d.nD3,{expanded:s,onTitleClick:()=>{l(s?"":o)},id:"key",title:(0,h.jsx)(Ke,{server:e,index:t}),sx:{marginBottom:15},children:[(0,h.jsxs)(d.azJ,{useBackground:!0,sx:{padding:"10px 30px",fontWeight:"bold"},children:["Drives (",null===(i=e.drives)||void 0===i?void 0:i.length,")"]}),(0,h.jsx)(d.azJ,{sx:{flex:1,display:"flex",flexDirection:"column",padding:"15px 30px",gap:15,["@media (max-width: ".concat(d.nmC.sm,"px)")]:{padding:"10px 10px"}},children:null===(a=e.drives)||void 0===a?void 0:a.map((e,t)=>(0,h.jsx)(He,{drive:e},"".concat(e.endpoint,"-").concat(t)))})]},o)})})]})},qe=b.Ay.div(e=>{let{theme:t}=e;return{fontFamily:"Inter,sans-serif",color:m()(t,"signalColors.main","#07193E"),maxWidth:"300px",display:"flex",marginLeft:"auto",marginRight:"auto",cursor:"default",position:"relative",width:"100%"}}),Ye=e=>{let{counterValue:t,label:n="",icon:i=null,actions:a=null}=e;return(0,h.jsx)(qe,{children:(0,h.jsxs)(d.azJ,{sx:{flex:1,display:"flex",width:"100%",padding:"0 8px 0 8px",position:"absolute",["@media (max-width: ".concat(d.nmC.md,"px)")]:{padding:"0 10px 0 10px"}},children:[(0,h.jsxs)(d.azJ,{sx:{flex:1,display:"flex",flexFlow:"column",marginTop:"8px",zIndex:10,overflow:"hidden"},children:[(0,h.jsx)(d.azJ,{sx:{fontSize:"16px",fontWeight:600},children:n}),(0,h.jsx)(d.m_M,{tooltip:t,placement:"bottom",children:(0,h.jsx)(d.azJ,{sx:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",maxWidth:187,flexFlow:"row",fontSize:t.toString().length>=5?50:55,["@media (max-width: ".concat(d.nmC.sm,"px)")]:{flexFlow:"column",maxWidth:200,fontSize:t.toString().length>=5?20:35},["@media (max-width: ".concat(d.nmC.md,"px)")]:{fontSize:t.toString().length>=5?28:35},["@media (max-width: ".concat(d.nmC.lg,"px)")]:{fontSize:t.toString().length>=5?28:36},["@media (max-width: ".concat(d.nmC.xl,"px)")]:{fontSize:t.toString().length>=5?45:50}},children:t})})]}),(0,h.jsxs)(d.azJ,{sx:{display:"flex",flexFlow:"column",alignItems:"center",justifyContent:"flex-start",marginTop:"8px",maxWidth:"26px","& .min-icon":{width:"16px",height:"16px"}},children:[i,(0,h.jsx)(d.azJ,{sx:{display:"flex"},children:a})]})]})})};var Xe=n(90859),Ze=n(93598),$e=n(30272);const et=e=>{let{children:t}=e;return(0,h.jsx)(d.azJ,{withBorders:!0,sx:{padding:15,height:"136px",maxWidth:"100%",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{padding:5,maxWidth:"initial"}},children:t})},tt=e=>{var t,n,i,a,l,o,s,r,c,x;let{usage:m}=e;const p=m&&m.usage?m.usage.toString():"0",u=(e=>void 0===e?{total:"0",unit:"Mi"}:(0,g.GT)(e))(p),{lastScan:f="n/a",lastHeal:j="n/a",upTime:C="n/a"}={},y=(e=>e&&e.servers?[...e.servers].sort(function(e,t){var n,i;const a=(null===(n=e.endpoint)||void 0===n?void 0:n.toLowerCase())||"",l=(null===(i=t.endpoint)||void 0===i?void 0:i.toLowerCase())||"";return al?1:0}):[])(m);let v=[];y.forEach(e=>{var t;const n=null===(t=e.drives)||void 0===t?void 0:t.map(e=>e);n&&(v=[...v,...n])});const w=Ue()(y,"state"),{offline:b=[],online:z=[]}=w,S=Ue()(v,"state"),{offline:A=[],ok:T=[]}=S;return(0,h.jsx)(d.azJ,{children:(0,h.jsxs)(d.azJ,{sx:{display:"grid",gridTemplateRows:"1fr",gridTemplateColumns:"1fr",gap:27,marginBottom:40},children:[(0,h.jsxs)(d.azJ,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:"40px"},children:[(0,h.jsxs)(d.azJ,{sx:{display:"grid",gridTemplateRows:"136px",gridTemplateColumns:"1fr 1fr 1fr",gap:20,["@media (max-width: ".concat(d.nmC.sm,"px)")]:{gridTemplateColumns:"1fr"},["@media (max-width: ".concat(d.nmC.md,"px)")]:{marginBottom:0}},children:[(0,h.jsx)(et,{children:(0,h.jsx)(Ye,{label:"Buckets",icon:(0,h.jsx)(d.brV,{}),counterValue:m?(0,g.dq)(m.buckets):0,actions:(0,h.jsx)(be.N_,{to:Ze.zZ.BUCKETS,style:{zIndex:11,textDecoration:"none",top:"40px",position:"relative",marginRight:"75px"},children:(0,h.jsx)($e.A,{tooltip:"Browse",children:(0,h.jsx)(d.$nd,{id:"browse-dashboard",onClick:()=>{},label:"Browse",icon:(0,h.jsx)(d.flY,{}),variant:"regular",style:{padding:5,height:30,fontSize:14,marginTop:20}})})})})}),(0,h.jsx)(et,{children:(0,h.jsx)(Ye,{label:"Objects",icon:(0,h.jsx)(d.Sxe,{}),counterValue:m?(0,g.dq)(m.objects):0})}),(0,h.jsx)(et,{children:(0,h.jsx)(Me.A,{onlineCount:z.length,offlineCount:b.length,label:"Servers",icon:(0,h.jsx)(d.WXN,{})})}),(0,h.jsx)(et,{children:(0,h.jsx)(Me.A,{offlineCount:(null===m||void 0===m||null===(t=m.backend)||void 0===t?void 0:t.offlineDrives)||A.length,onlineCount:(null===m||void 0===m||null===(n=m.backend)||void 0===n?void 0:n.onlineDrives)||T.length,label:"Drives",icon:(0,h.jsx)(d.JUN,{})})}),(0,h.jsxs)(d.azJ,{withBorders:!0,sx:{gridRowStart:"1",gridRowEnd:"3",gridColumnStart:"3",padding:15,display:"grid",justifyContent:"stretch"},children:[(0,h.jsx)(Xe.A,{usageValue:p,total:u.total,unit:u.unit}),(0,h.jsxs)(d.azJ,{sx:{display:"flex",flexFlow:"column",gap:"14px"},children:[(0,h.jsx)(ce,{icon:(0,h.jsx)(d.Sdx,{}),label:(0,h.jsxs)(d.azJ,{children:[(0,h.jsx)(d.azJ,{sx:{display:"inline",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{display:"none"}},children:"Time since last"})," ","Heal Activity"]}),value:j}),(0,h.jsx)(ce,{icon:(0,h.jsx)(d.Zui,{}),label:(0,h.jsxs)(d.azJ,{children:[(0,h.jsx)(d.azJ,{sx:{display:"inline",["@media (max-width: ".concat(d.nmC.sm,"px)")]:{display:"none"}},children:"Time since last"})," ","Scan Activity"]}),value:f}),(0,h.jsx)(ce,{icon:(0,h.jsx)(d.Owo,{}),label:"Uptime",value:C})]})]})]}),(0,h.jsxs)(d.azJ,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"14px",["@media (max-width: ".concat(d.nmC.lg,"px)")]:{gridTemplateColumns:"1fr"}},children:[(0,h.jsx)(ce,{icon:(0,h.jsx)(d.NBP,{}),label:"Backend type",value:null!==(i=null===m||void 0===m||null===(a=m.backend)||void 0===a?void 0:a.backendType)&&void 0!==i?i:"Unknown"}),(0,h.jsx)(ce,{icon:(0,h.jsx)(d.eXQ,{}),label:"Standard storage class parity",value:null!==(l=null===m||void 0===m||null===(o=m.backend)||void 0===o||null===(s=o.standardSCParity)||void 0===s?void 0:s.toString())&&void 0!==l?l:"n/a"}),(0,h.jsx)(ce,{icon:(0,h.jsx)(d.eXQ,{}),label:"Reduced redundancy storage class parity",value:null!==(r=null===m||void 0===m||null===(c=m.backend)||void 0===c||null===(x=c.rrSCParity)||void 0===x?void 0:x.toString())&&void 0!==r?r:"n/a"})]}),(0,h.jsx)(d.azJ,{sx:{display:"grid",gridTemplateRows:"auto",gridTemplateColumns:"1fr",gap:"auto"},children:(0,h.jsx)(Qe,{data:y})})]}),"not configured"===(null===m||void 0===m?void 0:m.advancedMetricsStatus)&&(0,h.jsx)(d.azJ,{children:(0,h.jsx)(d.lVp,{iconComponent:(0,h.jsx)(d.uMc,{}),title:"We can\u2019t retrieve advanced metrics at this time.",help:(0,h.jsxs)(d.azJ,{children:[(0,h.jsx)(d.azJ,{sx:{fontSize:"14px"},children:"Console Dashboard will display basic metrics as we couldn\u2019t connect to Prometheus successfully. Please try again in a few minutes. If the problem persists, you can review your configuration and confirm that Prometheus server is up and running."}),(0,h.jsx)(d.azJ,{sx:{paddingTop:20,fontSize:14},children:(0,h.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/operations/monitoring/collect-minio-metrics-using-prometheus.html",target:"_blank",rel:"noopener",children:"Read more about Prometheus on the Docs site."})})]})})})]})})},nt=e=>{let{apiPrefix:t="admin",usage:n}=e;const a=(0,l.jL)(),r=(0,l.GV)(e=>e.dashboard.status),c=(0,l.GV)(e=>e.dashboard.zoom.openZoom),x=(0,l.GV)(e=>e.dashboard.zoom.widgetRender),m=(0,l.GV)(s.s$),p=!(null===m||void 0===m||!m.includes("object-browser-only"));let g=!1;(null!==m&&void 0!==m&&m.includes("hide-menu")||p)&&(g=!0);const[u,f]=(0,i.useState)(null),[j,y]=(0,i.useState)(null),v=C,[w,b]=(0,i.useState)("info"),z=e=>e.reduce((e,n,a)=>{const{columns:l=[]}=n,o=l.map((e,n)=>{var l;return((e,n)=>(0,h.jsx)(i.Fragment,{children:e?(0,h.jsx)(i.Fragment,{children:(0,h.jsx)(d.azJ,{children:e.mergedPanels?(0,h.jsx)(Re,{info:e,timeStart:u,timeEnd:j,loading:!0,apiPrefix:t}):ge(e,u,j,!0,t,c)})}):null},"widget-".concat(n)))((l=e.componentId,v.find(e=>e.id===l)),"".concat(a,"-").concat(n))});return[...e,(0,h.jsx)(d.azJ,{sx:n.sx,children:o},"layout-row-".concat(a))]},[]),S="not configured"===(null===n||void 0===n?void 0:n.advancedMetricsStatus),A=(0,h.jsx)(d.azJ,{sx:{marginBottom:20},children:"info"===w?(0,h.jsxs)(d.xA9,{container:!0,children:[(0,h.jsx)(d.xA9,{item:!0,children:(0,h.jsx)(d.azJ,{sx:{fontSize:18,lineHeight:2,fontWeight:700},children:"Server Information"})}),(0,h.jsx)(d.xA9,{item:!0,xs:!0,children:(0,h.jsx)(d.xA9,{container:!0,direction:"row-reverse",children:(0,h.jsx)(d.xA9,{item:!0,children:(0,h.jsx)(d.$nd,{id:"sync",type:"button",variant:"callAction",onClick:()=>{a((0,o.i)())},disabled:"loading"===r,icon:(0,h.jsx)(d.Fjq,{}),label:"Sync"})})})})]}):(0,h.jsx)(we.A,{timeStart:u,setTimeStart:f,timeEnd:j,setTimeEnd:y,triggerSync:()=>{a((0,E.pA)())}})});let T=[{tabConfig:{label:"Info",id:"info",disabled:!1},content:(0,h.jsxs)(i.Fragment,{children:[(!n||"loading"===r)&&(0,h.jsx)(d.z21,{}),n&&"idle"===r&&(0,h.jsxs)(i.Fragment,{children:[A,(0,h.jsx)(tt,{usage:n})]})]})},...[{tabConfig:{label:"Usage",id:"usage",disabled:S},content:(0,h.jsxs)(i.Fragment,{children:[A,(0,h.jsxs)(Ce,{children:["unavailable"===(null===n||void 0===n?void 0:n.advancedMetricsStatus)&&(0,h.jsx)(d.lVp,{iconComponent:(0,h.jsx)(d.uMc,{}),title:"We can\u2019t retrieve advanced metrics at this time.",help:(0,h.jsx)(d.azJ,{sx:{fontSize:"14px"},children:"It looks like Prometheus is not available or reachable at the moment."})}),v.length?z(he):null]})]})},{tabConfig:{label:"Traffic",id:"traffic",disabled:S},content:(0,h.jsxs)(i.Fragment,{children:[A,(0,h.jsxs)(Ce,{children:["unavailable"===(null===n||void 0===n?void 0:n.advancedMetricsStatus)&&(0,h.jsx)(d.lVp,{iconComponent:(0,h.jsx)(d.uMc,{}),title:"We can\u2019t retrieve advanced metrics at this time.",help:(0,h.jsx)(d.azJ,{sx:{fontSize:"14px"},children:"It looks like Prometheus is not available or reachable at the moment."})}),v.length?z(ue):null]})]})},{tabConfig:{label:"Resources",id:"resources",disabled:S},content:(0,h.jsxs)(i.Fragment,{children:[A,(0,h.jsxs)(Ce,{children:["unavailable"===(null===n||void 0===n?void 0:n.advancedMetricsStatus)&&(0,h.jsx)(d.lVp,{iconComponent:(0,h.jsx)(d.uMc,{}),title:"We can\u2019t retrieve advanced metrics at this time.",help:(0,h.jsx)(d.azJ,{sx:{fontSize:"14px"},children:"It looks like Prometheus is not available or reachable at the moment."})}),v.length?z(fe):null,(0,h.jsx)("h2",{style:{margin:0,borderBottom:"1px solid #dedede"},children:"Advanced"}),v.length?z(je):null]})]})}]];return(0,h.jsxs)(d.Mxu,{sx:{padding:g?0:"2rem"},children:[c&&(0,h.jsx)(ve,{modalOpen:c,timeStart:u,timeEnd:j,widgetRender:0,value:x,apiPrefix:t}),(0,h.jsx)(d.tUM,{horizontal:!0,options:T,currentTabOrPath:w,onTabClick:e=>{b(e)}})]})};var it=n(82817),at=n(70503);const lt=()=>{const e=(0,l.jL)(),[t,n]=(0,i.useState)(!1),d=(0,a.d4)(e=>e.dashboard.usage),c=(0,a.d4)(s.s$),x=!(null===c||void 0===c||!c.includes("object-browser-only"));let m=!1;return(null!==c&&void 0!==c&&c.includes("hide-menu")||x)&&(m=!0),(0,i.useEffect)(()=>{t||(n(!0),e((0,o.i)()))},[t,e]),(0,i.useEffect)(()=>{e((0,r.ph)("metrics"))},[e]),(0,h.jsxs)(i.Fragment,{children:[!m&&(0,h.jsx)(it.A,{label:"Metrics",actions:(0,h.jsx)(at.A,{})}),(0,h.jsx)(nt,{usage:d})]})}}}]); ================================================ FILE: web-app/build/static/js/2499.a423e5db.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2499],{32680:(e,t,n)=>{n.d(t,{A:()=>u});var a=n(9950),o=n(98341),l=n(89132),r=n(99491),i=n(49078),s=n(96382),d=n(44414);const u=e=>{let{onClose:t,modalOpen:n,title:u,children:c,wideLimit:b=!0,titleIcon:h=null,iconColor:p="default",sx:x}=e;const m=(0,r.jL)(),[g,f]=(0,a.useState)(!1),j=(0,o.d4)(e=>e.system.modalSnackBar);(0,a.useEffect)(()=>{m((0,i.h0)(""))},[m]),(0,a.useEffect)(()=>{if(j){if(""===j.message)return void f(!1);"error"!==j.type&&f(!0)}},[j]);let C="";return j&&(C=j.detailedErrorMsg,(""===C||C&&C.length<5)&&(C=j.message)),(0,d.jsxs)(l.ngX,{onClose:t,open:n,title:u,titleIcon:h,widthLimit:b,sx:x,iconColor:p,children:[(0,d.jsx)(s.A,{isModal:!0}),(0,d.jsx)(l.qb_,{onClose:()=>{f(!1),m((0,i.h0)(""))},open:g,message:C,mode:"inline",variant:"error"===j.type?"error":"default",autoHideDuration:"error"===j.type?10:5,condensed:!0}),c]})}},52499:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var a=n(9950),o=n(89132),l=n(59908),r=n(45246),i=n(32680),s=n(58093),d=n(49078),u=n(99491),c=n(70444),b=n(48965),h=n(44414);const p=e=>{let{open:t,enabled:n,cfg:p,selectedBucket:x,closeModalAndRefresh:m}=e;const g=(0,u.jL)(),[f,j]=(0,a.useState)(!1),[C,k]=(0,a.useState)(!1),[v,S]=(0,a.useState)("1"),[y,A]=(0,a.useState)("Ti"),[q,B]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(n&&(k(!0),p)){const e=(0,l.GT)(p.quota||0,!0,!1,!0);S(e.total.toString()),A(e.unit),B(!0)}},[n,p]),(0,a.useEffect)(()=>{B(!C||/^\d*(?:\.\d{1,2})?$/.test(v))},[C,v]);return(0,h.jsx)(i.A,{modalOpen:t,onClose:()=>{m()},title:"Enable Bucket Quota",titleIcon:(0,h.jsx)(o.Uh,{}),children:(0,h.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),!f&&q&&c.F.buckets.setBucketQuota(x,{enabled:C,amount:parseInt((0,l.q5)(v,y,!0)),quota_type:"hard"}).then(()=>{j(!1),m()}).catch(e=>{j(!1),g((0,d.Dy)((0,b.S)(e.error)))})},children:(0,h.jsxs)(o.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,h.jsx)(o.dOG,{value:"bucket_quota",id:"bucket_quota",name:"bucket_quota",checked:C,onChange:e=>{k(e.target.checked)},label:"Enabled"}),C&&(0,h.jsx)(o.cl_,{id:"quota_size",name:"quota_size",onChange:e=>{S(e.target.value),e.target.validity.valid?B(!0):B(!1)},label:"Quota",value:v,required:!0,min:"1",overlayObject:(0,h.jsx)(s.A,{id:"quota_unit",onUnitChange:e=>{A(e)},unitSelected:y,unitsList:(0,l.l9)(["Ki"]),disabled:!1}),error:q?"":"Please enter a valid quota"}),(0,h.jsxs)(o.xA9,{item:!0,xs:12,sx:r.Uz.modalButtonBar,children:[(0,h.jsx)(o.$nd,{id:"cancel",type:"button",variant:"regular",disabled:f,onClick:()=>{m()},label:"Cancel"}),(0,h.jsx)(o.$nd,{id:"save",type:"submit",variant:"callAction",disabled:f||!q,label:"Save"})]}),f&&(0,h.jsx)(o.xA9,{item:!0,xs:12,children:(0,h.jsx)(o.z21,{})})]})})})}},58093:(e,t,n)=>{n.d(t,{A:()=>u});var a=n(9950),o=n(89132),l=n(19335),r=n(87946),i=n.n(r),s=n(44414);const d=l.Ay.button(e=>{let{theme:t}=e;return{border:"1px solid ".concat(i()(t,"borderColor","#E2E2E2")),borderRadius:3,color:i()(t,"secondaryText","#5B5C5C"),backgroundColor:i()(t,"boxBackground","#FBFAFA"),fontSize:12}}),u=e=>{let{id:t,unitSelected:n,unitsList:l,disabled:r=!1,onUnitChange:i}=e;const[u,c]=a.useState(null),b=Boolean(u),h=e=>{c(null),""!==e&&i&&i(e)};return(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(d,{id:"".concat(t,"-button"),"aria-controls":"".concat(t,"-menu"),"aria-haspopup":"true","aria-expanded":b?"true":void 0,onClick:e=>{c(e.currentTarget)},disabled:r,type:"button",children:n}),(0,s.jsx)(o.Vey,{id:"upload-main-menu",options:l,selectedOption:"",onSelect:e=>h(e),hideTriggerAction:()=>{h("")},open:b,anchorEl:u,anchorOrigin:"end"})]})}}}]); ================================================ FILE: web-app/build/static/js/2587.58909bb0.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2587],{6805:(e,r,i)=>{i.d(r,{A:()=>a});var t=i(9950),o=i(89132),n=i(44414);const l=e=>{let{icon:r,description:i}=e;return(0,n.jsxs)(o.azJ,{sx:{display:"flex","& .min-icon":{marginRight:"10px",height:"23px",width:"23px",marginBottom:"10px"}},children:[r," ",(0,n.jsx)("div",{style:{fontSize:"14px",fontStyle:"italic",color:"#5E5E5E"},children:i})]})},a=e=>{let{helpText:r,docLink:i,docText:a,contents:s}=e;return(0,n.jsxs)(o.azJ,{sx:{flex:1,border:"1px solid #eaeaea",borderRadius:"2px",display:"flex",flexFlow:"column",padding:"20px"},children:[(0,n.jsxs)(o.azJ,{sx:{fontSize:"16px",fontWeight:600,display:"flex",alignItems:"center",marginBottom:"16px",paddingBottom:"20px","& .min-icon":{height:"21px",width:"21px",marginRight:"15px"}},children:[(0,n.jsx)(o.nag,{}),(0,n.jsx)("div",{children:r})]}),(0,n.jsxs)(o.azJ,{sx:{fontSize:"14px",marginBottom:"15px"},children:[s.map((e,r)=>(0,n.jsxs)(t.Fragment,{children:[e.icon&&(0,n.jsx)(o.azJ,{sx:{paddingBottom:"20px"},children:(0,n.jsx)(l,{icon:e.icon,description:e.iconDescription})}),(0,n.jsx)(o.azJ,{sx:{paddingBottom:"20px"},children:e.text})]},"feature-item-".concat(r))),(0,n.jsx)(o.azJ,{sx:{paddingBottom:"20px"},children:(0,n.jsx)("a",{href:i,target:"_blank",rel:"noopener",children:a})})]})]})}},62587:(e,r,i)=>{i.r(r),i.d(r,{default:()=>b});var t=i(9950),o=i(93598),n=i(89132),l=i(89379),a=i(28429),s=i(99491),d=i(45246),c=i(49078),p=i(82817),u=i(70503),h=i(70444),x=i(48965),m=i(44414);const f=e=>{let{icon:r,helpBox:i,header:o,backLink:f,title:y,formFields:g}=e;const b=(0,l.A)({name:{required:!0,hasError:(e,r)=>!e&&r?"Config Name is required":"",label:"Name",tooltip:"Name for identity provider configuration",placeholder:"Name",type:"text"}},g),D=(0,a.Zp)(),C=(0,s.jL)(),[O,v]=(0,t.useState)({}),[j,_]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{C((0,c.ph)("add_idp_config"))},[]),(0,m.jsxs)(n.xA9,{item:!0,xs:12,children:[(0,m.jsx)(p.A,{label:(0,m.jsx)(n.EGL,{onClick:()=>D(f),label:o}),actions:(0,m.jsx)(u.A,{})}),(0,m.jsx)(n.Mxu,{children:(0,m.jsxs)(n.Hbc,{helpBox:i,children:[(0,m.jsx)(n._xt,{icon:r,children:y}),(0,m.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{(e=>{_(!0),e.preventDefault();const r=O.name;let i="";for(const t of Object.keys(g))O[t]&&(i+="".concat(t,"=").concat(O[t]," "));h.F.idp.createConfiguration("openid",{name:r,input:i}).then(e=>{D(f),C((0,c.YR)(!0===e.data.restart))}).catch(e=>{C((0,c.C9)((0,x.S)(e.error)))}).finally(()=>_(!1))})(e)},children:(0,m.jsx)(n.xA9,{container:!0,children:(0,m.jsxs)(n.xA9,{xs:12,item:!0,children:[Object.entries(b).map(e=>{let[r,i]=e;return((e,r)=>"toggle"===r.type?(0,m.jsx)(n.dOG,{indicatorLabels:["Enabled","Disabled"],checked:"on"===O[e],value:"is-field-enabled",id:"is-field-enabled",name:"is-field-enabled",label:r.label,tooltip:r.tooltip,onChange:r=>v((0,l.A)((0,l.A)({},O),{},{[e]:r.target.checked?"on":"off"})),description:""}):(0,m.jsx)(n.cl_,{id:e,required:r.required,name:e,label:r.label,tooltip:r.tooltip,error:r.hasError(O[e],!0),value:O[e]?O[e]:"",onChange:r=>v((0,l.A)((0,l.A)({},O),{},{[e]:r.target.value})),placeholder:r.placeholder,type:r.type}))(r,i)}),(0,m.jsxs)(n.xA9,{item:!0,xs:12,sx:d.Uz.modalButtonBar,children:[(0,m.jsx)(n.$nd,{id:"clear",type:"button",variant:"regular",onClick:()=>{v({})},label:"Clear"}),(0,m.jsx)(n.$nd,{id:"save-key",type:"submit",variant:"callAction",color:"primary",disabled:j||!(()=>{for(const[e,r]of Object.entries(b))if(r.required&&(void 0===O[e]||null===O[e]||""===O[e]))return!1;return!0})(),label:"Save"})]})]})})})]})})]})};var y=i(91234),g=i(6805);const b=()=>(0,m.jsx)(f,{icon:(0,m.jsx)(n.XAi,{}),helpBox:(0,m.jsx)(g.A,{helpText:"Learn more about OpenID Connect Configurations",contents:y.G5,docLink:"https://docs.min.io/community/minio-object-store/operations/external-iam.html#openid-connect-oidc",docText:"Learn more about OpenID Connect Configurations"}),header:"OpenID Configurations",backLink:o.zZ.IDP_OPENID_CONFIGURATIONS,title:"Create OpenID Configuration",formFields:y.Vb})},91234:(e,r,i)=>{i.d(r,{G5:()=>l,Lq:()=>s,Vb:()=>a,iT:()=>n});var t=i(89132),o=i(44414);const n=[{text:"MinIO supports using an Active Directory or LDAP (AD/LDAP) service for external management of user identities. Configuring an external IDentity Provider (IDP) enables Single-Sign On (SSO) workflows, where applications authenticate against the external IDP before accessing MinIO.",icon:(0,o.jsx)(t.Tir,{}),iconDescription:"Create Configurations"},{text:"MinIO queries the configured Active Directory / LDAP server to verify the credentials specified by the application and optionally return a list of groups in which the user has membership. MinIO supports two modes (Lookup-Bind Mode and Username-Bind Mode) for performing these queries",icon:null,iconDescription:""},{text:"MinIO recommends using Lookup-Bind mode as the preferred method for verifying AD/LDAP credentials. Username-Bind mode is a legacy method retained for backwards compatibility only.",icon:null,iconDescription:""}],l=[{text:"MinIO supports using an OpenID Connect (OIDC) compatible IDentity Provider (IDP) such as Okta, KeyCloak, Dex, Google, or Facebook for external management of user identities.",icon:(0,o.jsx)(t.XAi,{}),iconDescription:"Create Configurations"},{text:"Configuring an external IDP enables Single-Sign On workflows, where applications authenticate against the external IDP before accessing MinIO.",icon:null,iconDescription:""}],a={config_url:{required:!0,hasError:(e,r)=>!e&&r?"Config URL is required":"",label:"Config URL",tooltip:"Config URL for identity provider configuration",placeholder:"https://identity-provider-url/.well-known/openid-configuration",type:"text",editOnly:!1},client_id:{required:!0,hasError:(e,r)=>!e&&r?"Client ID is required":"",label:"Client ID",tooltip:"Identity provider Client ID",placeholder:"Enter Client ID",type:"text",editOnly:!1},client_secret:{required:!0,hasError:(e,r)=>!e&&r?"Client Secret is required":"",label:"Client Secret",tooltip:"Identity provider Client Secret",placeholder:"Enter Client Secret",type:"password",editOnly:!0},claim_name:{required:!1,label:"Claim Name",tooltip:"Claim from which MinIO will read the policy or role to use",placeholder:"Enter Claim Name",type:"text",hasError:(e,r)=>"",editOnly:!1},display_name:{required:!1,label:"Display Name",tooltip:"",placeholder:"Enter Display Name",type:"text",hasError:(e,r)=>"",editOnly:!1},claim_prefix:{required:!1,label:"Claim Prefix",tooltip:"",placeholder:"Enter Claim Prefix",type:"text",hasError:(e,r)=>"",editOnly:!1},scopes:{required:!1,label:"Scopes",tooltip:"",placeholder:"openid,profile,email",type:"text",hasError:(e,r)=>"",editOnly:!1},redirect_uri:{required:!1,label:"Redirect URI",tooltip:"",placeholder:"https://console-endpoint-url/oauth_callback",type:"text",hasError:(e,r)=>"",editOnly:!1},role_policy:{required:!1,label:"Role Policy",tooltip:"",placeholder:"readonly",type:"text",hasError:(e,r)=>"",editOnly:!1},claim_userinfo:{required:!1,label:"Claim User Info",tooltip:"",placeholder:"Claim User Info",type:"toggle",hasError:(e,r)=>"",editOnly:!1},redirect_uri_dynamic:{required:!1,label:"Redirect URI Dynamic",tooltip:"",placeholder:"Redirect URI Dynamic",type:"toggle",hasError:(e,r)=>"",editOnly:!1}},s={server_insecure:{required:!0,hasError:(e,r)=>!e&&r?"Server Address is required":"",label:"Server Insecure",tooltip:"Disable SSL certificate verification ",placeholder:"myldapserver.com:636",type:"toggle",editOnly:!1},server_addr:{required:!0,hasError:(e,r)=>!e&&r?"Server Address is required":"",label:"Server Address",tooltip:'AD/LDAP server address e.g. "myldapserver.com:636"',placeholder:"myldapserver.com:636",type:"text",editOnly:!1},lookup_bind_dn:{required:!0,hasError:(e,r)=>!e&&r?"Lookup Bind DN is required":"",label:"Lookup Bind DN",tooltip:"DN (Distinguished Name) for LDAP read-only service account used to perform DN and group lookups",placeholder:"cn=admin,dc=min,dc=io",type:"text",editOnly:!1},lookup_bind_password:{required:!0,hasError:(e,r)=>!e&&r?"Lookup Bind Password is required":"",label:"Lookup Bind Password",tooltip:"Password for LDAP read-only service account used to perform DN and group lookups",placeholder:"admin",type:"password",editOnly:!0},user_dn_search_base_dn:{required:!0,hasError:(e,r)=>!e&&r?"User DN Search Base DN is required":"",label:"User DN Search Base",tooltip:"",placeholder:"DC=example,DC=net",type:"text",editOnly:!1},user_dn_search_filter:{required:!0,hasError:(e,r)=>!e&&r?"User DN Search Filter is required":"",label:"User DN Search Filter",tooltip:"",placeholder:"(sAMAccountName=%s)",type:"text",editOnly:!1},group_search_base_dn:{required:!1,hasError:(e,r)=>"",label:"Group Search Base DN",tooltip:"",placeholder:"ou=swengg,dc=min,dc=io",type:"text",editOnly:!1},group_search_filter:{required:!1,hasError:(e,r)=>"",label:"Group Search Filter",tooltip:"",placeholder:"(&(objectclass=groupofnames)(member=%d))",type:"text",editOnly:!1}}}}]); ================================================ FILE: web-app/build/static/js/2643.b6d050d3.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2643],{42643:(e,a,l)=>{l.r(a),l.d(a,{default:()=>U});var t=l(89379),s=l(9950),u=l(28429),r=l(87946),n=l.n(r),o=l(89132),i=l(70444),c=l(48965),b=l(45246),v=l(60252),d=l(93598),S=l(49078),g=l(99491);const h=[{label:"US East (Ohio)",value:"us-east-2"},{label:"US East (N. Virginia)",value:"us-east-1"},{label:"US West (N. California)",value:"us-west-1"},{label:"US West (Oregon)",value:"us-west-2"},{label:"Africa (Cape Town)",value:"af-south-1"},{label:"Asia Pacific (Hong Kong)***",value:"ap-east-1"},{label:"Asia Pacific (Jakarta)",value:"ap-southeast-3"},{label:"Asia Pacific (Mumbai)",value:"ap-south-1"},{label:"Asia Pacific (Osaka)",value:"ap-northeast-3"},{label:"Asia Pacific (Seoul)",value:"ap-northeast-2"},{label:"Asia Pacific (Singapore)",value:"ap-southeast-1"},{label:"Asia Pacific (Sydney)",value:"ap-southeast-2"},{label:"Asia Pacific (Tokyo)",value:"ap-northeast-1"},{label:"Canada (Central)",value:"ca-central-1"},{label:"China (Beijing)",value:"cn-north-1"},{label:"China (Ningxia)",value:"cn-northwest-1"},{label:"Europe (Frankfurt)",value:"eu-central-1"},{label:"Europe (Ireland)",value:"eu-west-1"},{label:"Europe (London)",value:"eu-west-2"},{label:"Europe (Milan)",value:"eu-south-1"},{label:"Europe (Paris)",value:"eu-west-3"},{label:"Europe (Stockholm)",value:"eu-north-1"},{label:"South America (S\xe3o Paulo)",value:"sa-east-1"},{label:"Middle East (Bahrain)",value:"me-south-1"},{label:"AWS GovCloud (US-East)",value:"us-gov-east-1"},{label:"AWS GovCloud (US-West)",value:"us-gov-west-1"}],A=[{label:"Montr\xe9al",value:"NORTHAMERICA-NORTHEAST1"},{label:"Toronto",value:"NORTHAMERICA-NORTHEAST2"},{label:"Iowa",value:"US-CENTRAL1"},{label:"South Carolina",value:"US-EAST1"},{label:"Northern Virginia",value:"US-EAST4"},{label:"Oregon",value:"US-WEST1"},{label:"Los Angeles",value:"US-WEST2"},{label:"Salt Lake City",value:"US-WEST3"},{label:"Las Vegas",value:"US-WEST4"},{label:"S\xe3o Paulo",value:"SOUTHAMERICA-EAST1"},{label:"Santiago",value:"SOUTHAMERICA-WEST1"},{label:"Warsaw",value:"EUROPE-CENTRAL2"},{label:"Finland",value:"EUROPE-NORTH1"},{label:"Belgium",value:"EUROPE-WEST1"},{label:"London",value:"EUROPE-WEST2"},{label:"Frankfurt",value:"EUROPE-WEST3"},{label:"Netherlands",value:"EUROPE-WEST4"},{label:"Z\xfcrich",value:"EUROPE-WEST6"},{label:"Taiwan",value:"ASIA-EAST1"},{label:"Hong Kong",value:"ASIA-EAST2"},{label:"Tokyo",value:"ASIA-NORTHEAST1"},{label:"Osaka",value:"ASIA-NORTHEAST2"},{label:"Seoul",value:"ASIA-NORTHEAST3"},{label:"Mumbai",value:"ASIA-SOUTH1"},{label:"Delhi",value:"ASIA-SOUTH2"},{label:"Singapore",value:"ASIA-SOUTHEAST1"},{label:"Jakarta",value:"ASIA-SOUTHEAST2"},{label:"Sydney",value:"AUSTRALIA-SOUTHEAST1"},{label:"Melbourne",value:"AUSTRALIA-SOUTHEAST2"}],E=[{label:"Asia",value:"asia"},{label:"Asia Pacific",value:"asiapacific"},{label:"Australia",value:"australia"},{label:"Australia Central",value:"australiacentral"},{label:"Australia Central 2",value:"australiacentral2"},{label:"Australia East",value:"australiaeast"},{label:"Australia Southeast",value:"australiasoutheast"},{label:"Brazil",value:"brazil"},{label:"Brazil South",value:"brazilsouth"},{label:"Brazil Southeast",value:"brazilsoutheast"},{label:"Canada",value:"canada"},{label:"Canada Central",value:"canadacentral"},{label:"Canada East",value:"canadaeast"},{label:"Central India",value:"centralindia"},{label:"Central US",value:"centralus"},{label:"Central US (Stage)",value:"centralusstage"},{label:"Central US EUAP",value:"centraluseuap"},{label:"East Asia",value:"eastasia"},{label:"East Asia (Stage)",value:"eastasiastage"},{label:"East US",value:"eastus"},{label:"East US (Stage)",value:"eastusstage"},{label:"East US 2",value:"eastus2"},{label:"East US 2 (Stage)",value:"eastus2stage"},{label:"East US 2 EUAP",value:"eastus2euap"},{label:"Europe",value:"europe"},{label:"France",value:"france"},{label:"France Central",value:"francecentral"},{label:"France South",value:"francesouth"},{label:"Germany",value:"germany"},{label:"Germany North",value:"germanynorth"},{label:"Germany West Central",value:"germanywestcentral"},{label:"Global",value:"global"},{label:"India",value:"india"},{label:"Japan",value:"japan"},{label:"Japan East",value:"japaneast"},{label:"Japan West",value:"japanwest"},{label:"Jio India Central",value:"jioindiacentral"},{label:"Jio India West",value:"jioindiawest"},{label:"Korea",value:"korea"},{label:"Korea Central",value:"koreacentral"},{label:"Korea South",value:"koreasouth"},{label:"North Central US",value:"northcentralus"},{label:"North Central US (Stage)",value:"northcentralusstage"},{label:"North Europe",value:"northeurope"},{label:"Norway",value:"norway"},{label:"Norway East",value:"norwayeast"},{label:"Norway West",value:"norwaywest"},{label:"South Africa",value:"southafrica"},{label:"South Africa North",value:"southafricanorth"},{label:"South Africa West",value:"southafricawest"},{label:"South Central US",value:"southcentralus"},{label:"South Central US (Stage)",value:"southcentralusstage"},{label:"South India",value:"southindia"},{label:"Southeast Asia",value:"southeastasia"},{label:"Southeast Asia (Stage)",value:"southeastasiastage"},{label:"Sweden Central",value:"swedencentral"},{label:"Switzerland",value:"switzerland"},{label:"Switzerland North",value:"switzerlandnorth"},{label:"Switzerland West",value:"switzerlandwest"},{label:"UAE Central",value:"uaecentral"},{label:"UAE North",value:"uaenorth"},{label:"UK South",value:"uksouth"},{label:"UK West",value:"ukwest"},{label:"United Arab Emirates",value:"uae"},{label:"United Kingdom",value:"uk"},{label:"United States",value:"unitedstates"},{label:"United States EUAP",value:"unitedstateseuap"},{label:"West Central US",value:"westcentralus"},{label:"West Europe",value:"westeurope"},{label:"West India",value:"westindia"},{label:"West US",value:"westus"},{label:"West US (Stage)",value:"westusstage"},{label:"West US 2",value:"westus2"},{label:"West US 2 (Stage)",value:"westus2stage"},{label:"West US 3",value:"westus3"}];var p=l(44414);const m=e=>{let{label:a,onChange:l,type:t,tooltip:u="",required:r=!1,disabled:n,placeholder:i}=e;const c=(e=>{let a=[];return"s3"===e&&(a=h),"gcs"===e&&(a=A),"azure"===e&&(a=E),a.map(e=>({value:e.value,label:"".concat(e.label," - ").concat(e.value)}))})(t),[b,v]=(0,s.useState)("");return"minio"===t?(0,p.jsx)(o.cl_,{label:a,disabled:n,required:r,tooltip:u,value:b,placeholder:i,id:"region-list",onChange:e=>{v(e.target.value),l(e.target.value)}}):(0,p.jsx)(o.jT8,{label:a,disabled:n,required:r,tooltip:u,options:c,value:b,placeholder:i,id:"region-list",onChange:e=>{v(e),l(e)}})};var C=l(82817),T=l(70503);const U=()=>{const e=(0,g.jL)(),a=(0,u.Zp)(),l=(0,u.g)(),[r,h]=(0,s.useState)(!1),[A,E]=(0,s.useState)(""),[U,x]=(0,s.useState)(""),[w,f]=(0,s.useState)(""),[j,y]=(0,s.useState)(""),[k,N]=(0,s.useState)(""),[W,O]=(0,s.useState)(""),[R,I]=(0,s.useState)(""),[z,P]=(0,s.useState)(""),[H,K]=(0,s.useState)(""),[_,F]=(0,s.useState)(""),[q,M]=(0,s.useState)(""),[B,G]=(0,s.useState)(""),[L,J]=(0,s.useState)(""),Z=n()(l,"service","s3"),[D,X]=(0,s.useState)(!0),[V,$]=(0,s.useState)(""),Q=(0,s.useCallback)(()=>/^[A-Z0-9-_]+$/.test(A)?($(""),!0):($("Please verify that string is uppercase only and contains valid characters (numbers, dashes & underscores)."),!1),[A]);(0,s.useEffect)(()=>{if(r){let l={},s={name:A,endpoint:U,bucket:w,prefix:j,region:k},u=Z;switch(Z){case"minio":l={minio:(0,t.A)((0,t.A)({},s),{},{accesskey:R,secretkey:z})};break;case"s3":l={s3:(0,t.A)((0,t.A)({},s),{},{accesskey:R,secretkey:z,storageclass:W})};break;case"gcs":l={gcs:(0,t.A)((0,t.A)({},s),{},{creds:_})};break;case"azure":l={azure:(0,t.A)((0,t.A)({},s),{},{accountname:q,accountkey:B})}}let r=(0,t.A)({type:u},l);i.F.admin.addTier(r).then(()=>{h(!1),a(d.zZ.TIERS)}).catch(async a=>{const l=await a.json();h(!1),e((0,S.C9)((0,c.S)(l)))})}},[R,B,q,w,_,U,A,j,k,r,z,e,W,Z,a]),(0,s.useEffect)(()=>{let e=!0;""===Z&&(e=!1),""!==A&&Q()||(e=!1),""===U&&(e=!1),""===w&&(e=!1),""===k&&"minio"!==Z&&(e=!1),"s3"!==Z&&"minio"!==Z||(""===R&&(e=!1),""===z&&(e=!1)),"gcs"===Z&&""===_&&(e=!1),"azure"===Z&&(""===q&&(e=!1),""===B&&(e=!1)),X(e)},[R,B,q,w,_,U,D,A,j,k,z,W,Z,Q]),(0,s.useEffect)(()=>{switch(Z){case"gcs":x("https://storage.googleapis.com"),J("Google Cloud");break;case"s3":x("https://s3.amazonaws.com"),J("Amazon S3");break;case"azure":x("http://blob.core.windows.net"),J("Azure");break;case"minio":x(""),J("MinIO")}},[Z]);const Y=v._T.find(e=>e.serviceName===Z);return(0,s.useEffect)(()=>{e((0,S.ph)("add-tier-configuration"))},[]),(0,p.jsxs)(s.Fragment,{children:[(0,p.jsx)(C.A,{label:(0,p.jsx)(s.Fragment,{children:(0,p.jsx)(o.EGL,{label:"Add Tier",onClick:()=>a(d.zZ.TIERS_ADD)})}),actions:(0,p.jsx)(T.A,{})}),(0,p.jsx)(o.Mxu,{children:(0,p.jsx)(o.xA9,{item:!0,xs:12,sx:{border:"1px solid #eaeaea",padding:"25px"},children:(0,p.jsxs)("form",{noValidate:!0,onSubmit:e=>{e.preventDefault(),h(!0)},children:[""!==Z&&Y?(0,p.jsxs)(o._xt,{icon:Y.logo,sx:{marginBottom:20},children:[L||""," - Add Tier Configuration"]}):null,(0,p.jsx)(o.xA9,{item:!0,xs:12,sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gridAutoFlow:"row",gridRowGap:20,gridColumnGap:50,["@media (max-width: ".concat(o.nmC.sm,"px)")]:{gridTemplateColumns:"1fr",gridAutoFlow:"dense"}},children:""!==Z&&(0,p.jsxs)(s.Fragment,{children:[(0,p.jsx)(o.cl_,{id:"name",name:"name",label:"Name",placeholder:"Enter Name (Eg. REMOTE-TIER)",value:A,onChange:e=>{E(e.target.value.toUpperCase())},error:V,required:!0}),(0,p.jsx)(o.cl_,{id:"endpoint",name:"endpoint",label:"Endpoint",placeholder:"Enter Endpoint",value:U,onChange:e=>{x(e.target.value)},required:!0}),(Z===v.pW||Z===v.vH)&&(0,p.jsxs)(s.Fragment,{children:[(0,p.jsx)(o.cl_,{id:"accessKey",name:"accessKey",label:"Access Key",placeholder:"Enter Access Key",value:R,onChange:e=>{I(e.target.value)},required:!0}),(0,p.jsx)(o.cl_,{id:"secretKey",name:"secretKey",label:"Secret Key",placeholder:"Enter Secret Key",value:z,onChange:e=>{P(e.target.value)},required:!0})]}),Z===v.qA&&(0,p.jsx)(o.SxS,{accept:".json",id:"creds",label:"Credentials",name:"creds",returnEncodedData:!0,onChange:(e,a,l)=>{l&&(F(l),K(a))},value:H,required:!0}),Z===v.y&&(0,p.jsxs)(s.Fragment,{children:[(0,p.jsx)(o.cl_,{id:"accountName",name:"accountName",label:"Account Name",placeholder:"Enter Account Name",value:q,onChange:e=>{M(e.target.value)},required:!0}),(0,p.jsx)(o.cl_,{id:"accountKey",name:"accountKey",label:"Account Key",placeholder:"Enter Account Key",value:B,onChange:e=>{G(e.target.value)},required:!0})]}),(0,p.jsx)(o.cl_,{id:"bucket",name:"bucket",label:"Bucket",placeholder:"Enter Bucket",value:w,onChange:e=>{f(e.target.value)},required:!0}),(0,p.jsx)(o.cl_,{id:"prefix",name:"prefix",label:"Prefix",placeholder:"Enter Prefix",value:j,onChange:e=>{y(e.target.value)}}),(0,p.jsx)(m,{onChange:e=>{N(e)},required:"minio"!==Z,label:"Region",id:"region",type:Z}),Z===v.pW&&(0,p.jsx)(o.cl_,{id:"storageClass",name:"storageClass",label:"Storage Class",placeholder:"Enter Storage Class",value:W,onChange:e=>{O(e.target.value)}})]})}),(0,p.jsx)(o.xA9,{item:!0,xs:12,sx:b.Uz.modalButtonBar,children:(0,p.jsx)(o.$nd,{id:"save-tier-configuration",type:"submit",variant:"callAction",disabled:r||!D,label:"Save Tier Configuration"})})]})})})]})}},60252:(e,a,l)=>{l.d(a,{_T:()=>i,pW:()=>n,qA:()=>r,vH:()=>u,y:()=>o});var t=l(89132),s=l(44414);const u="minio",r="gcs",n="s3",o="azure",i=[{serviceName:u,targetTitle:"MinIO",logo:(0,s.jsx)(t.Wh8,{}),logoXs:(0,s.jsx)(t.$2v,{})},{serviceName:r,targetTitle:"Google Cloud Storage",logo:(0,s.jsx)(t.F7U,{}),logoXs:(0,s.jsx)(t.gwF,{})},{serviceName:n,targetTitle:"AWS S3",logo:(0,s.jsx)(t._tF,{}),logoXs:(0,s.jsx)(t.ZZX,{})},{serviceName:o,targetTitle:"Azure",logo:(0,s.jsx)(t.Nmx,{}),logoXs:(0,s.jsx)(t.Ubg,{})}]}}]); ================================================ FILE: web-app/build/static/js/2684.cee177f0.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2684],{32684:(e,t,a)=>{a.r(t),a.d(t,{default:()=>x});var n=a(9950),i=a(28429),s=a(89132),l=a(93598),c=a(49078),r=a(99491),o=a(82817),d=a(70503),p=a(70444),h=a(48965),u=a(66147),g=a(44414);const x=()=>{const e=(0,r.jL)(),t=(0,i.Zp)();let a=new URLSearchParams(document.location.search);const x=a.get("bucketName")||"",m=a.get("ruleID")||"";(0,n.useEffect)(()=>{e((0,c.ph)("bucket-replication-edit"))},[]);const f=l.zZ.BUCKETS+"/".concat(x,"/admin/replication"),[j,b]=(0,n.useState)(!0),[k,S]=(0,n.useState)(!1),[v,y]=(0,n.useState)("1"),[C,w]=(0,n.useState)(""),[E,D]=(0,n.useState)(""),[I,R]=(0,n.useState)(!1),[O,M]=(0,n.useState)(!1),[B,_]=(0,n.useState)(""),[A,T]=(0,n.useState)(""),[N,z]=(0,n.useState)(""),[P,F]=(0,n.useState)(!1),[G,J]=(0,n.useState)(!1),[L,V]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{j&&x&&m&&p.F.buckets.getBucketReplicationRule(x,m).then(e=>{var t;y(e.data.priority?e.data.priority.toString():"");const a=e.data.prefix||"",n=e.data.tags||"";D(a),_(n),T(n),w((null===(t=e.data.destination)||void 0===t?void 0:t.bucket)||""),R(e.data.delete_marker_replication||!1),z(e.data.storageClass||""),F(!!e.data.existingObjects),J(!!e.data.deletes_replication),V("Enabled"===e.data.status),M(!!e.data.metadata_replication),b(!1)}).catch(t=>{e((0,c.C9)((0,h.S)(t.error))),b(!1)})},[j,e,x,m]),(0,n.useEffect)(()=>{if(k&&x&&m){const a={arn:C,ruleState:L,prefix:E,tags:A,replicateDeleteMarkers:I,replicateDeletes:G,replicateExistingObjects:P,replicateMetadata:O,priority:parseInt(v),storageClass:N};p.F.buckets.updateMultiBucketReplication(x,m,a).then(()=>{t(f)}).catch(t=>{e((0,c.C9)((0,h.S)(t.error))),S(!1)})}},[k,x,m,C,E,A,I,v,G,P,L,O,N,e]),(0,g.jsxs)(n.Fragment,{children:[(0,g.jsx)(o.A,{label:(0,g.jsx)(s.EGL,{label:"Edit Bucket Replication",onClick:()=>t(f)}),actions:(0,g.jsx)(d.A,{})}),(0,g.jsx)(s.Mxu,{children:(0,g.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),S(!0)},children:(0,g.jsxs)(s.Hbc,{containerPadding:!1,withBorders:!1,helpBox:(0,g.jsx)(s.lVp,{iconComponent:(0,g.jsx)(s.WBh,{}),title:"Bucket Replication Configuration",help:(0,g.jsxs)(n.Fragment,{children:[(0,g.jsx)(s.azJ,{sx:{paddingTop:"10px"},children:"For each write operation to the bucket, MinIO checks all configured replication rules for the bucket and applies the matching rule with highest configured priority."}),(0,g.jsx)(s.azJ,{sx:{paddingTop:"10px"},children:"MinIO supports enabling replication of existing objects in a bucket."}),(0,g.jsx)(s.azJ,{sx:{paddingTop:"10px"},children:"MinIO does not enable existing object replication by default. Objects created before replication was configured or while replication is disabled are not synchronized to the target deployment unless replication of existing objects is enabled."}),(0,g.jsx)(s.azJ,{sx:{paddingTop:"10px"},children:"MinIO supports replicating delete operations, where MinIO synchronizes deleting specific object versions and new delete markers. Delete operation replication uses the same replication process as all other replication operations."})," "]})}),children:[(0,g.jsx)(s.dOG,{checked:L,id:"ruleState",name:"ruleState",label:"Rule State",onChange:e=>{V(e.target.checked)}}),(0,g.jsx)(s.EmB,{label:"Destination",sx:{width:"100%"},children:C}),(0,g.jsx)(s.cl_,{id:"priority",name:"priority",onChange:e=>{e.target.validity.valid&&y(e.target.value)},label:"Priority",value:v,pattern:"[0-9]*"}),(0,g.jsx)(s.cl_,{id:"storageClass",name:"storageClass",onChange:e=>{z(e.target.value)},placeholder:"STANDARD_IA,REDUCED_REDUNDANCY etc",label:"Storage Class",value:N}),(0,g.jsxs)("fieldset",{className:"inputItem",children:[(0,g.jsx)("legend",{children:"Object Filters"}),(0,g.jsx)(s.cl_,{id:"prefix",name:"prefix",onChange:e=>{D(e.target.value)},placeholder:"prefix",label:"Prefix",value:E}),(0,g.jsx)(u.A,{name:"tags",label:"Tags",elements:B,onChange:e=>{T(e)},keyPlaceholder:"Tag Key",valuePlaceholder:"Tag Value",withBorder:!0})]}),(0,g.jsxs)("fieldset",{className:"inputItem",children:[(0,g.jsx)("legend",{children:"Replication Options"}),(0,g.jsx)(s.dOG,{checked:P,id:"repExisting",name:"repExisting",label:"Existing Objects",onChange:e=>{F(e.target.checked)},description:"Replicate existing objects"}),(0,g.jsx)(s.dOG,{checked:O,id:"metadatataSync",name:"metadatataSync",label:"Metadata Sync",onChange:e=>{M(e.target.checked)},description:"Metadata Sync"}),(0,g.jsx)(s.dOG,{checked:I,id:"deleteMarker",name:"deleteMarker",label:"Delete Marker",onChange:e=>{R(e.target.checked)},description:"Replicate soft deletes"}),(0,g.jsx)(s.dOG,{checked:G,id:"repDelete",name:"repDelete",label:"Deletes",onChange:e=>{J(e.target.checked)},description:"Replicate versioned deletes"})]}),(0,g.jsxs)(s.xA9,{item:!0,xs:12,sx:{display:"flex",flexDirection:"row",justifyContent:"end",gap:10,paddingTop:10},children:[(0,g.jsx)(s.$nd,{id:"cancel-edit-replication",type:"button",variant:"regular",disabled:j||k,onClick:()=>{t(f)},label:"Cancel"}),(0,g.jsx)(s.$nd,{id:"save-replication",type:"submit",variant:"callAction",disabled:j||k,label:"Save"})]})]})})})]})}},66147:(e,t,a)=>{a.d(t,{A:()=>d});var n=a(9950),i=a(87946),s=a.n(i),l=a(95491),c=a.n(l),r=a(89132),o=a(44414);const d=e=>{let{elements:t,name:a,label:i,tooltip:l="",keyPlaceholder:d="",valuePlaceholder:p="",onChange:h,withBorder:u=!1}=e;const[g,x]=(0,n.useState)([""]),[m,f]=(0,n.useState)([""]),j=(0,n.createRef)();(0,n.useEffect)(()=>{if(1===g.length&&""===g[0]&&1===m.length&&""===m[0]&&t&&""!==t){const e=t.split("&");let a=[],n=[];e.forEach(e=>{const t=e.split("=");2===t.length&&(a.push(t[0]),n.push(t[1]))}),a.push(""),n.push(""),x(a),f(n)}},[g,m,t]),(0,n.useEffect)(()=>{const e=j.current;e&&g.length>1&&e.scrollIntoView(!1)},[g]);const b=(0,n.useRef)(!0);(0,n.useLayoutEffect)(()=>{b.current?b.current=!1:v()},[g,m]);const k=e=>{e.persist();let t=[...g];const a=s()(e.target,"dataset.index","0");t[parseInt(a)]=e.target.value,x(t)},S=e=>{e.persist();let t=[...m];const a=s()(e.target,"dataset.index","0");t[parseInt(a)]=e.target.value,f(t)},v=c()(()=>{let e="";g.forEach((t,a)=>{if(g[a]&&m[a]){let n="".concat(t,"=").concat(m[a]);0!==a&&(n="&".concat(n)),e="".concat(e).concat(n)}}),h(e)},500),y=m.map((e,t)=>(0,o.jsxs)(r.xA9,{item:!0,xs:12,className:"lineInputBoxes inputItem",children:[(0,o.jsx)(r.cl_,{id:"".concat(a,"-key-").concat(t.toString()),label:"",name:"".concat(a,"-").concat(t.toString()),value:g[t],onChange:k,index:t,placeholder:d}),(0,o.jsx)("span",{className:"queryDiv",children:":"}),(0,o.jsx)(r.cl_,{id:"".concat(a,"-value-").concat(t.toString()),label:"",name:"".concat(a,"-").concat(t.toString()),value:m[t],onChange:S,index:t,placeholder:p,overlayIcon:t===m.length-1?(0,o.jsx)(r.REV,{}):null,overlayAction:()=>{(()=>{if(""!==g[g.length-1].trim()&&""!==m[m.length-1].trim()){const e=[...g],t=[...m];e.push(""),t.push(""),x(e),f(t)}})()}})]},"query-pair-".concat(a,"-").concat(t.toString())));return(0,o.jsx)(n.Fragment,{children:(0,o.jsxs)(r.xA9,{item:!0,xs:12,sx:{"& .lineInputBoxes":{display:"flex"},"& .queryDiv":{alignSelf:"center",margin:"-15px 4px 0",fontWeight:600}},className:"inputItem",children:[(0,o.jsxs)(r.l1Y,{children:[i,""!==l&&(0,o.jsx)(r.azJ,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,o.jsx)(r.m_M,{tooltip:l,placement:"top",children:(0,o.jsx)(r.NTw,{style:{width:13,height:13}})})})]}),(0,o.jsxs)(r.azJ,{withBorders:u,sx:{padding:15,height:150,overflowY:"auto",position:"relative",marginTop:15},children:[y,(0,o.jsx)("div",{ref:j})]})]})})}}}]); ================================================ FILE: web-app/build/static/js/2797.c53d9c9c.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2797],{42797:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var n=a(9950),r=a(28429),s=a(98341),o=a(89132),l=a(32680),i=a(45246),c=a(99491),d=a(49078),h=a(44414);const p=(0,s.Ng)(e=>{let{objectBrowser:t}=e;return{simplePath:t.simplePath}})(e=>{let{modalOpen:t,folderName:a,bucketName:p,onClose:u,simplePath:m,limitedSubPath:f}=e;const x=(0,c.jL)(),w=(0,r.Zp)(),[b,j]=(0,n.useState)(""),[C,g]=(0,n.useState)(!1),[y,P]=(0,n.useState)(p),v=(0,s.d4)(e=>e.objectBrowser.records);(0,n.useEffect)(()=>{if(m){const e="".concat(p).concat(p.endsWith("/")||m.startsWith("/")?"":"/").concat(m);P(e)}},[m,p]);const k=()=>{let e="/";m&&(e=m.endsWith("/")?m:"".concat(m,"/"));if(-1!==v.findIndex(t=>t.name===e+b))return void x((0,d.Dy)({errorMessage:"Folder cannot have the same name as an existing file",detailedError:""}));const t=b.split("/").filter(e=>""!==e.trim()).join("/");"/"===e.slice(0,1)&&(e=e.slice(1));const a="/browser/".concat(encodeURIComponent(p),"/").concat(encodeURIComponent("".concat(e).concat(t,"/")));w(a),u()};(0,n.useEffect)(()=>{let e=!0;0===b.trim().length&&(e=!1),g(e)},[b]);return(0,h.jsx)(n.Fragment,{children:(0,h.jsx)(l.A,{modalOpen:t,title:"Choose or create a new path",onClose:u,titleIcon:(0,h.jsx)(o.DGR,{}),children:(0,h.jsxs)(o.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,h.jsxs)(o.azJ,{className:"inputItem",sx:{display:"flex",gap:8},children:[(0,h.jsx)("strong",{children:"Current Path:"})," ",(0,h.jsx)("br",{}),(0,h.jsx)(o.azJ,{sx:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:14,textAlign:"left"},dir:"rtl",children:y})]}),(0,h.jsx)(o.cl_,{value:b,label:"New Folder Path",id:"folderPath",name:"folderPath",placeholder:"Enter the new Folder Path",onChange:e=>{j(e.target.value)},onKeyPress:e=>{"Enter"===e.code&&""!==b&&k()},required:!0,tooltip:f?"You may only have write access on a limited set of subpaths within this path. Please carefully review your User permissions to understand the paths to which you may write.":""}),(0,h.jsxs)(o.xA9,{item:!0,xs:12,sx:i.Uz.modalButtonBar,children:[(0,h.jsx)(o.$nd,{id:"clear",type:"button",color:"primary",variant:"regular",onClick:()=>{j("")},label:"Clear"}),(0,h.jsx)(o.$nd,{id:"create",type:"submit",variant:"callAction",disabled:!C,onClick:k,label:"Create"})]})]})})})})}}]); ================================================ FILE: web-app/build/static/js/2896.27ff0208.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2896],{32680:(e,t,l)=>{l.d(t,{A:()=>d});var s=l(9950),i=l(98341),n=l(89132),o=l(99491),c=l(49078),a=l(96382),r=l(44414);const d=e=>{let{onClose:t,modalOpen:l,title:d,children:u,wideLimit:h=!0,titleIcon:p=null,iconColor:x="default",sx:m}=e;const v=(0,o.jL)(),[j,g]=(0,s.useState)(!1),y=(0,i.d4)(e=>e.system.modalSnackBar);(0,s.useEffect)(()=>{v((0,c.h0)(""))},[v]),(0,s.useEffect)(()=>{if(y){if(""===y.message)return void g(!1);"error"!==y.type&&g(!0)}},[y]);let f="";return y&&(f=y.detailedErrorMsg,(""===f||f&&f.length<5)&&(f=y.message)),(0,r.jsxs)(n.ngX,{onClose:t,open:l,title:d,titleIcon:p,widthLimit:h,sx:m,iconColor:x,children:[(0,r.jsx)(a.A,{isModal:!0}),(0,r.jsx)(n.qb_,{onClose:()=>{g(!1),v((0,c.h0)(""))},open:j,message:f,mode:"inline",variant:"error"===y.type?"error":"default",autoHideDuration:"error"===y.type?10:5,condensed:!0}),u]})}},32896:(e,t,l)=>{l.r(t),l.d(t,{default:()=>v});var s=l(9950),i=l(87946),n=l.n(i),o=l(98341),c=l(89132),a=l(49078),r=l(99491),d=l(45246),u=l(5887),h=l(32680),p=l(40038),x=l(2586),m=l(44414);const v=e=>{let{closeModalAndRefresh:t,selectedUser:l,selectedGroups:i,open:v}=e;const j=(0,r.jL)(),[g,y]=(0,s.useState)(!1),[f,b]=(0,s.useState)([]),[A,C]=(0,s.useState)([]),P=(0,o.d4)(e=>e.createUser.selectedPolicies);(0,s.useEffect)(()=>{if(v){if(1===(null===i||void 0===i?void 0:i.length))return void(1===(null===i||void 0===i?void 0:i.length)&&x.A.invoke("GET","/api/v1/group/".concat(encodeURIComponent(i[0]))).then(e=>{const t=n()(e,"policy","");b(t.split(",")),C(t.split(",")),j((0,u.Gy)(t.split(",")))}).catch(e=>{j((0,a.Dy)(e)),y(!1)}));const e=n()(l,"policy",[]);b(e),C(e),j((0,u.Gy)(e))}},[v,null===i||void 0===i?void 0:i.length,l]);const S=n()(l,"accessKey","");return(0,m.jsxs)(h.A,{onClose:()=>{t()},modalOpen:v,title:"Set Policies",children:[(0,m.jsxs)(c.Hbc,{withBorders:!1,containerPadding:!1,children:[(1===(null===i||void 0===i?void 0:i.length)||null!=l)&&(0,m.jsxs)(s.Fragment,{children:[(0,m.jsx)(c.EmB,{label:"Selected ".concat(null!==i?"Group":"User"),sx:{width:"100%"},children:null!==i?i[0]:S}),(0,m.jsx)(c.EmB,{label:"Current Policy",sx:{width:"100%"},children:f.join(", ")})]}),i&&(null===i||void 0===i?void 0:i.length)>1&&(0,m.jsx)(c.EmB,{label:"Selected Groups",sx:{width:"100%"},children:i.join(", ")}),(0,m.jsx)(c.xA9,{item:!0,xs:12,children:(0,m.jsx)(p.A,{selectedPolicy:A})})]}),(0,m.jsxs)(c.xA9,{item:!0,xs:12,sx:d.Uz.modalButtonBar,children:[(0,m.jsx)(c.$nd,{id:"reset",type:"button",variant:"regular",onClick:()=>{C(f),j((0,u.Gy)(f))},label:"Reset"}),(0,m.jsx)(c.$nd,{id:"save",type:"button",variant:"callAction",color:"primary",disabled:g,onClick:()=>{let e=null,s=null;null!==i?s=i:(e=[" "],null!==l&&(e=[l.accessKey])),y(!0),x.A.invoke("PUT","/api/v1/set-policy-multi",{name:P,groups:s,users:e}).then(()=>{y(!1),t()}).catch(e=>{y(!1),j((0,a.Dy)(e))})},label:"Save"})]}),g&&(0,m.jsx)(c.xA9,{item:!0,xs:12,children:(0,m.jsx)(c.z21,{})})]})}},40038:(e,t,l)=>{l.d(t,{A:()=>p});var s=l(9950),i=l(89132),n=l(20416),o=l(27428),c=l(49078),a=l(99491),r=l(5887),d=l(98341),u=l(70444),h=l(44414);const p=e=>{let{noTitle:t=!1}=e;const l=(0,a.jL)(),[p,x]=(0,s.useState)([]),[m,v]=(0,s.useState)(!1),[j,g]=(0,s.useState)(""),y=(0,d.d4)(e=>e.createUser.selectedPolicies),f=(0,s.useCallback)(()=>{v(!0),u.F.policies.listPolicies().then(e=>{var t;const l=null!==(t=e.data.policies)&&void 0!==t?t:[];v(!1),x(l.sort(n.Hw))}).catch(e=>{v(!1),l((0,c.Dy)(e))})},[l]);(0,s.useEffect)(()=>{v(!0)},[]),(0,s.useEffect)(()=>{m&&f()},[m,f]);const b=p.filter(e=>e.name.includes(j));return(0,h.jsxs)(i.xA9,{item:!0,xs:12,className:"inputItem",children:[m&&(0,h.jsx)(i.z21,{}),p.length>0?(0,h.jsxs)(s.Fragment,{children:[(0,h.jsx)(i.xA9,{item:!0,xs:12,className:"inputItem",children:(0,h.jsx)(o.A,{placeholder:"Start typing to search for a Policy",onChange:e=>{g(e)},value:j,label:t?"":"Assign Policies"})}),(0,h.jsx)(i.bQt,{columns:[{label:"Policy",elementKey:"name"}],onSelect:e=>{const t=e.target,s=t.value,i=t.checked;let n=[...y];i?n.push(s):n=n.filter(e=>e!==s),n=n.filter(e=>""!==e),l((0,r.Gy)(n))},selectedItems:y,isLoading:m,records:b,entityName:"Policies",idField:"name",customPaperHeight:"200px"})]}):(0,h.jsx)(i.azJ,{sx:{textAlign:"center",padding:"10px 0"},children:"No Policies Available"})]})}}}]); ================================================ FILE: web-app/build/static/js/2928.af13ae72.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2928],{12928:(e,n,s)=>{s.r(n),s.d(n,{default:()=>p});var t=s(9950),a=s(55604),l=s(82817),c=s(70503),r=s(49078),u=s(99491),i=s(44414);const o=(0,a.A)(t.lazy(()=>s.e(4517).then(s.bind(s,54517)))),p=()=>{const e=(0,u.jL)();return(0,t.useEffect)(()=>{e((0,r.ph)("event_destinations"))},[]),(0,i.jsxs)(t.Fragment,{children:[(0,i.jsx)(l.A,{label:"Event Destinations",actions:(0,i.jsx)(c.A,{})}),(0,i.jsx)(o,{})]})}},55604:(e,n,s)=>{s.d(n,{A:()=>c});var t=s(89379),a=s(9950),l=s(44414);const c=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(s){return(0,l.jsx)(a.Suspense,{fallback:n,children:(0,l.jsx)(e,(0,t.A)({},s))})}}}}]); ================================================ FILE: web-app/build/static/js/2979.d9dd067b.chunk.js ================================================ (self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2979],{7174:(e,t,o)=>{"use strict";o.d(t,{Ck:()=>a,PE:()=>l,Qm:()=>s,Xm:()=>c,uu:()=>u});var n=o(89379),r=(o(9950),o(89132)),i=o(44414);const a=[{icon:(0,i.jsx)(r.DzZ,{}),configuration_id:"region",configuration_label:"Region"},{icon:(0,i.jsx)(r.MZJ,{}),configuration_id:"compression",configuration_label:"Compression"},{icon:(0,i.jsx)(r.loI,{}),configuration_id:"api",configuration_label:"API"},{icon:(0,i.jsx)(r.qm4,{}),configuration_id:"heal",configuration_label:"Heal"},{icon:(0,i.jsx)(r.Pq3,{}),configuration_id:"scanner",configuration_label:"Scanner"},{icon:(0,i.jsx)(r.RYV,{}),configuration_id:"etcd",configuration_label:"Etcd"},{icon:(0,i.jsx)(r.D0K,{}),configuration_id:"logger_webhook",configuration_label:"Logger Webhook"},{icon:(0,i.jsx)(r.rBG,{}),configuration_id:"audit_webhook",configuration_label:"Audit Webhook"},{icon:(0,i.jsx)(r.Dk$,{}),configuration_id:"audit_kafka",configuration_label:"Audit Kafka"}],l={region:[{name:"name",required:!0,label:"Server Location",tooltip:'Name of the location of the server e.g. "us-west-rack2"',type:"string",placeholder:"e.g. us-west-rack-2"},{name:"comment",required:!1,label:"Comment",tooltip:"You can add a comment to this setting",type:"comment",placeholder:"Enter custom notes if any"}],compression:[{name:"extensions",required:!1,label:"Extensions",tooltip:'Extensions to compress e.g. ".txt", ".log" or ".csv" - you can write one per field',type:"csv",placeholder:"Enter an Extension",withBorder:!0},{name:"mime_types",required:!1,label:"Mime Types",tooltip:'Mime types e.g. "text/*", "application/json" or "application/xml" - you can write one per field',type:"csv",placeholder:"Enter a Mime Type",withBorder:!0}],api:[{name:"requests_max",required:!1,label:"Requests Max",tooltip:"Maximum number of concurrent requests, e.g. '1600'",type:"number",placeholder:"Enter Requests Max"},{name:"cors_allow_origin",required:!1,label:"Cors Allow Origin",tooltip:"List of origins allowed for CORS requests",type:"csv",placeholder:"Enter allowed origin e.g. https://example.com"},{name:"replication_workers",required:!1,label:"Replication Workers",tooltip:"Number of replication workers, defaults to 100",type:"number",placeholder:"Enter Replication Workers"},{name:"replication_failed_workers",required:!1,label:"Replication Failed Workers",tooltip:"Number of replication workers for recently failed replicas, defaults to 4",type:"number",placeholder:"Enter Replication Failed Workers"}],heal:[{name:"bitrotscan",required:!1,label:"Bitrot Scan",tooltip:"Perform bitrot scan on disks when checking objects during scanner",type:"on|off"},{name:"max_sleep",required:!1,label:"Max Sleep",tooltip:"Maximum sleep duration between objects to slow down heal operation, e.g. 2s",type:"duration",placeholder:"Enter Max Sleep Duration"},{name:"max_io",required:!1,label:"Max IO",tooltip:"Maximum IO requests allowed between objects to slow down heal operation, e.g. 3",type:"number",placeholder:"Enter Max IO"}],scanner:[{name:"delay",required:!1,label:"Delay Multiplier",tooltip:"Scanner delay multiplier, defaults to '10.0'",type:"number",placeholder:"Enter Delay"},{name:"max_wait",required:!1,label:"Max Wait",tooltip:"Maximum wait time between operations, defaults to '15s'",type:"duration",placeholder:"Enter Max Wait"},{name:"cycle",required:!1,label:"Cycle",tooltip:"Time duration between scanner cycles, defaults to '1m'",type:"duration",placeholder:"Enter Cycle"}],etcd:[{name:"endpoints",required:!0,label:"Endpoints",tooltip:'List of etcd endpoints e.g. "http://localhost:2379" - you can write one per field',type:"csv",placeholder:"Enter Endpoint"},{name:"path_prefix",required:!1,label:"Path Prefix",tooltip:'Namespace prefix to isolate tenants e.g. "customer1/"',type:"string",placeholder:"Enter Path Prefix"},{name:"coredns_path",required:!1,label:"Coredns Path",tooltip:'Shared bucket DNS records, default is "/skydns"',type:"string",placeholder:"Enter Coredns Path"},{name:"client_cert",required:!1,label:"Client Cert",tooltip:"Client cert for mTLS authentication",type:"string",placeholder:"Enter Client Cert"},{name:"client_cert_key",required:!1,label:"Client Cert Key",tooltip:"Client cert key for mTLS authentication",type:"string",placeholder:"Enter Client Cert Key"},{name:"comment",required:!1,label:"Comment",tooltip:"You can add a comment to this setting",type:"comment",multiline:!0,placeholder:"Enter custom notes if any"}],logger_webhook:[{name:"endpoint",required:!0,label:"Endpoint",type:"string",placeholder:"Enter Endpoint"},{name:"auth_token",required:!0,label:"Auth Token",type:"string",placeholder:"Enter Auth Token"}],audit_webhook:[{name:"endpoint",required:!0,label:"Endpoint",type:"string",placeholder:"Enter Endpoint"},{name:"auth_token",required:!0,label:"Auth Token",type:"string",placeholder:"Enter Auth Token"}],audit_kafka:[{name:"enable",required:!1,label:"Enable",tooltip:"Enable audit_kafka target",type:"on|off",customValueProcess:e=>""===e||"on"===e?"on":"off"},{name:"brokers",required:!0,label:"Brokers",type:"csv",placeholder:"Enter Kafka Broker"},{name:"topic",required:!1,label:"Topic",type:"string",placeholder:"Enter Kafka Topic",tooltip:"Kafka topic used for bucket notifications"},{name:"sasl",required:!1,label:"Use SASL",tooltip:"Enable SASL (Simple Authentication and Security Layer) authentication",type:"on|off"},{name:"sasl_username",required:!1,label:"SASL Username",type:"string",placeholder:"Enter SASL Username",tooltip:"Username for SASL/PLAIN or SASL/SCRAM authentication"},{name:"sasl_password",required:!1,label:"SASL Password",type:"password",placeholder:"Enter SASL Password",tooltip:"Password for SASL/PLAIN or SASL/SCRAM authentication"},{name:"sasl_mechanism",required:!1,label:"SASL Mechanism",type:"string",placeholder:"Enter SASL Mechanism",tooltip:"SASL authentication mechanism"},{name:"tls",required:!1,label:"Use TLS",tooltip:"Enable TLS (Transport Layer Security)",type:"on|off"},{name:"tls_skip_verify",required:!1,label:"Skip TLS Verification",tooltip:"Trust server TLS without verification",type:"on|off"},{name:"client_tls_cert",required:!1,label:"Client Cert",tooltip:"Client cert for mTLS authentication",type:"string",placeholder:"Enter Client Cert"},{name:"client_tls_key",required:!1,label:"Client Cert Key",tooltip:"Client cert key for mTLS authentication",type:"string",placeholder:"Enter Client Cert Key"},{name:"tls_client_auth",required:!1,label:"TLS Client Auth",tooltip:"ClientAuth determines the Kafka server's policy for TLS client authorization",type:"string"},{name:"version",required:!1,label:"Version",tooltip:"Specify the version of the Kafka cluster",type:"string"}]},c=e=>e.filter(e=>""!==e.value),s=(e,t,o)=>{const n=e.target,r=n.value;let i=[...o];return n.checked?i.push(r):i=i.filter(e=>e!==r),t(i),i},u=e=>{let t={};return e.forEach(e=>{if(e.env_override){const o={value:e.env_override.value||"",overrideEnv:e.env_override.name||""};t=(0,n.A)((0,n.A)({},t),{},{[e.key]:o})}}),t}},20416:(e,t,o)=>{"use strict";o.d(t,{Hw:()=>r,LA:()=>n,SO:()=>i,rY:()=>a});const n=(e,t)=>{if(e.accessKey&&t.accessKey){if(e.accessKey>t.accessKey)return 1;if(e.accessKeye.name>t.name?1:e.namee>t?1:ee.policy>t.policy?1:e.policy{"use strict";o.d(t,{A:()=>u});var n=o(9950),r=o(98341),i=o(89132),a=o(99491),l=o(49078),c=o(96382),s=o(44414);const u=e=>{let{onClose:t,modalOpen:o,title:u,children:p,wideLimit:d=!0,titleIcon:f=null,iconColor:m="default",sx:y}=e;const h=(0,a.jL)(),[b,g]=(0,n.useState)(!1),x=(0,r.d4)(e=>e.system.modalSnackBar);(0,n.useEffect)(()=>{h((0,l.h0)(""))},[h]),(0,n.useEffect)(()=>{if(x){if(""===x.message)return void g(!1);"error"!==x.type&&g(!0)}},[x]);let v="";return x&&(v=x.detailedErrorMsg,(""===v||v&&v.length<5)&&(v=x.message)),(0,s.jsxs)(i.ngX,{onClose:t,open:o,title:u,titleIcon:f,widthLimit:d,sx:y,iconColor:m,children:[(0,s.jsx)(c.A,{isModal:!0}),(0,s.jsx)(i.qb_,{onClose:()=>{g(!1),h((0,l.h0)(""))},open:b,message:v,mode:"inline",variant:"error"===x.type?"error":"default",autoHideDuration:"error"===x.type?10:5,condensed:!0}),p]})}},42677:(e,t,o)=>{"use strict";o.d(t,{X:()=>i});o(9950);var n=o(43217),r=o(44414);const i=[{label:"Access Key",elementKey:"accessKey"},{label:"Expiry",elementKey:"expiration",renderFunction:e=>{if("1970-01-01T00:00:00Z"!==e){const t=n.c9.fromISO(e).toUTC().toFormat("y/M/d hh:mm:ss z");return(0,r.jsx)("span",{title:t,children:t})}return(0,r.jsx)("span",{children:"no-expiry"})}},{label:"Status",elementKey:"accountStatus",renderFunction:e=>"off"===e?"Disabled":"Enabled"},{label:"Name",elementKey:"name"},{label:"Description",elementKey:"description"}]},43878:(e,t,o)=>{"use strict";o.d(t,{A:()=>p});var n=o(9950),r=o(89132),i=o(49534),a=o(49078),l=o(99491),c=o(70444),s=o(48965),u=o(44414);const p=e=>{let{closeDeleteModalAndRefresh:t,deleteOpen:o,selectedSAs:p}=e;const d=(0,l.jL)(),[f,m]=(0,n.useState)(!1);if(!p)return null;return(0,u.jsx)(i.A,{title:"Delete Access Keys",confirmText:"Delete",isOpen:o,titleIcon:(0,u.jsx)(r.xWY,{}),isLoading:f,onConfirm:()=>{m(!0),c.F.serviceAccounts.deleteMultipleServiceAccounts(p).then(e=>{t(!0)}).catch(async e=>{const o=await e.json();d((0,a.C9)((0,s.S)(o))),t(!1)}).finally(()=>m(!1))},onClose:()=>t(!1),confirmationContent:(0,u.jsxs)(n.Fragment,{children:["Are you sure you want to delete the selected ",p.length," ","Access Keys?"," "]})})}},55604:(e,t,o)=>{"use strict";o.d(t,{A:()=>a});var n=o(89379),r=o(9950),i=o(44414);const a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(o){return(0,i.jsx)(r.Suspense,{fallback:t,children:(0,i.jsx)(e,(0,n.A)({},o))})}}},59660:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,o=[],n=0;n{"use strict";var n=o(59660),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var o,i,a,l,c,s,u=!1;t||(t={}),o=t.debug||!1;try{if(a=n(),l=document.createRange(),c=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),"undefined"===typeof n.clipboardData){o&&console.warn("unable to use e.clipboardData"),o&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=r[t.format]||r.default;window.clipboardData.setData(i,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(s),l.selectNodeContents(s),c.addRange(l),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(p){o&&console.error("unable to copy using execCommand: ",p),o&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(p){o&&console.error("unable to copy using clipboardData: ",p),o&&console.error("falling back to prompt"),i=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(l):c.removeAllRanges()),s&&document.body.removeChild(s),a()}return u}},85743:(e,t,o)=>{"use strict";o.d(t,{A:()=>m});var n=o(9950),r=o(89132),i=o(70444),a=o(48965),l=o(94797),c=o(99491),s=o(49078),u=o(32680),p=o(45246),d=o(43217),f=o(44414);const m=e=>{let{open:t,selectedAccessKey:o,closeModalAndRefresh:m}=e;const y=(0,c.jL)(),[h,b]=(0,n.useState)(!1),[g,x]=(0,n.useState)(""),[v,C]=(0,n.useState)(""),[S,w]=(0,n.useState)(""),[j,k]=(0,n.useState)(),[E,_]=(0,n.useState)("enabled");(0,n.useEffect)(()=>{h||""===o||(b(!0),i.F.serviceAccounts.getServiceAccount(o||"").then(e=>{b(!1);const t=e.data;C((null===t||void 0===t?void 0:t.name)||""),null!==t&&void 0!==t&&t.expiration&&k(d.c9.fromISO(null===t||void 0===t?void 0:t.expiration)),w((null===t||void 0===t?void 0:t.description)||""),_(t.accountStatus),x(t.policy||"")}).catch(e=>{b(!1),y((0,s.Dy)((0,a.S)(e)))}))},[o]);return(0,f.jsx)(u.A,{title:"Edit details of - ".concat(o),modalOpen:t,onClose:()=>{m()},titleIcon:(0,f.jsx)(r.uYH,{}),children:(0,f.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{var t;t=g,e.preventDefault(),i.F.serviceAccounts.updateServiceAccount(o||"",{policy:t,description:S,expiry:j,name:v,status:E}).then(()=>{m()}).catch(async e=>{const t=await e.json();y((0,s.C9)((0,a.S)(t)))})},children:(0,f.jsxs)(r.xA9,{container:!0,children:[(0,f.jsx)(r.xA9,{item:!0,xs:12,children:(0,f.jsx)(l.A,{label:"Access Key Policy",value:g,onChange:e=>{x(e)},editorHeight:"350px",helptip:(0,f.jsx)(n.Fragment,{children:(0,f.jsx)("a",{target:"blank",href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/policy-based-access-control.html#policy-document-structure",children:"Guide to access policy structure"})})})}),(0,f.jsx)(r.azJ,{sx:{marginBottom:"15px",marginTop:"15px",display:"flex",width:"100%","& label":{width:"195px"}},children:(0,f.jsx)(r.e8j,{noLabelMinWidth:!0,value:j,onChange:e=>{k(e)},id:"expiryTime",label:"Expiry",timeFormat:"24h",secondsSelector:!1})}),(0,f.jsx)(r.xA9,{xs:12,sx:{marginBottom:"15px"},children:(0,f.jsx)(r.cl_,{value:v,size:120,label:"Name",id:"name",name:"name",type:"text",placeholder:"Enter a name",onChange:e=>{C(e.target.value)}})}),(0,f.jsx)(r.xA9,{xs:12,sx:{marginBottom:"15px"},children:(0,f.jsx)(r.cl_,{size:120,value:S,label:"Description",id:"description",name:"description",type:"text",placeholder:"Enter a description",onChange:e=>{w(e.target.value)}})}),(0,f.jsxs)(r.xA9,{xs:12,sx:{display:"flex",alignItems:"center",justifyContent:"start",fontWeight:600,color:"rgb(7, 25, 62)",gap:2,marginBottom:"15px"},children:[(0,f.jsx)("label",{style:{width:"150px"},children:"Status"}),(0,f.jsx)(r.azJ,{sx:{padding:"2px"},children:(0,f.jsx)(r.dOG,{style:{gap:"115px"},indicatorLabels:["Enabled","Disabled"],checked:"on"===E,id:"saStatus",name:"saStatus",label:"",onChange:e=>{_(e.target.checked?"on":"off")},value:"yes"})})]}),(0,f.jsxs)(r.xA9,{item:!0,xs:12,sx:p.Uz.modalButtonBar,children:[(0,f.jsx)(r.$nd,{id:"cancel-sa-policy",type:"button",variant:"regular",onClick:()=>{m()},disabled:h,label:"Cancel"}),(0,f.jsx)(r.$nd,{id:"save-sa-policy",type:"submit",variant:"callAction",color:"primary",disabled:h,label:"Update"})]})]})})})}},94702:(e,t,o)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.CopyToClipboard=void 0;var r=l(o(9950)),i=l(o(67243)),a=["text","onCopy","options","children"];function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function s(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}function p(e,t){for(var o=0;o{"use strict";o.d(t,{A:()=>s});var n=o(9950),r=o(89132),i=o(95189),a=o.n(i),l=o(30272),c=o(44414);const s=e=>{let{value:t,label:o="",tooltip:i="",mode:s="json",onChange:u,editorHeight:p=250,helptip:d,readOnly:f=!1,disabled:m=!1}=e;return(0,c.jsx)(r.BYM,{value:t,onChange:e=>u(e),mode:s,tooltip:i,editorHeight:p,label:o,readOnly:f,disabled:m,helpTools:(0,c.jsx)(n.Fragment,{children:(0,c.jsx)(l.A,{tooltip:"Copy to Clipboard",children:(0,c.jsx)(a(),{text:t,children:(0,c.jsx)(r.$nd,{type:"button",id:"copy-code-mirror",icon:(0,c.jsx)(r.TdU,{}),color:"primary",variant:"regular"})})})}),helpTip:d,helpTipPlacement:"right"})}},95189:(e,t,o)=>{"use strict";var n=o(94702).CopyToClipboard;n.CopyToClipboard=n,e.exports=n}}]); ================================================ FILE: web-app/build/static/js/3126.ab390859.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[3126],{23126:(e,n,s)=>{s.r(n),s.d(n,{default:()=>r});var t=s(9950),l=s(28429),a=s(20171),h=s(55604),c=s(44414);const p=(0,h.A)(t.lazy(()=>s.e(6242).then(s.bind(s,36242)))),u=(0,h.A)(t.lazy(()=>s.e(5238).then(s.bind(s,15238)))),r=()=>(0,c.jsxs)(l.BV,{children:[(0,c.jsx)(l.qh,{path:"/",element:(0,c.jsx)(p,{})}),(0,c.jsx)(l.qh,{path:":policyName",element:(0,c.jsx)(u,{})}),(0,c.jsx)(l.qh,{element:(0,c.jsx)(a.A,{})})]})},55604:(e,n,s)=>{s.d(n,{A:()=>h});var t=s(89379),l=s(9950),a=s(44414);const h=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(s){return(0,a.jsx)(l.Suspense,{fallback:n,children:(0,a.jsx)(e,(0,t.A)({},s))})}}}}]); ================================================ FILE: web-app/build/static/js/3214.fea55249.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[3214],{32680:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(9950),i=n(98341),o=n(89132),r=n(99491),l=n(49078),s=n(96382),c=n(44414);const d=e=>{let{onClose:t,modalOpen:n,title:d,children:u,wideLimit:m=!0,titleIcon:b=null,iconColor:p="default",sx:h}=e;const g=(0,r.jL)(),[j,f]=(0,a.useState)(!1),x=(0,i.d4)(e=>e.system.modalSnackBar);(0,a.useEffect)(()=>{g((0,l.h0)(""))},[g]),(0,a.useEffect)(()=>{if(x){if(""===x.message)return void f(!1);"error"!==x.type&&f(!0)}},[x]);let v="";return x&&(v=x.detailedErrorMsg,(""===v||v&&v.length<5)&&(v=x.message)),(0,c.jsxs)(o.ngX,{onClose:t,open:n,title:d,titleIcon:b,widthLimit:m,sx:h,iconColor:p,children:[(0,c.jsx)(s.A,{isModal:!0}),(0,c.jsx)(o.qb_,{onClose:()=>{f(!1),g((0,l.h0)(""))},open:j,message:v,mode:"inline",variant:"error"===x.type?"error":"default",autoHideDuration:"error"===x.type?10:5,condensed:!0}),u]})}},43214:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var a=n(9950),i=n(89132),o=n(70444),r=n(5501),l=n(48965),s=n(45246),c=n(49078),d=n(99491),u=n(32680),m=n(44414);const b=e=>{let{open:t,bucketName:n,closeModalAndRefresh:b}=e;const p=(0,d.jL)(),[h,g]=(0,a.useState)(!1),[j,f]=(0,a.useState)(!0),[x,v]=(0,a.useState)(r.BT.Compliance),[y,C]=(0,a.useState)(r.wg.Days),[k,S]=(0,a.useState)(1),[w,_]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{Number.isNaN(k)||(k||1)<1?_(!1):_(!0)},[k]),(0,a.useEffect)(()=>{j&&o.F.buckets.getBucketRetentionConfig(n).then(e=>{f(!1),v(e.data.mode),S(e.data.validity),C(e.data.unit)}).catch(()=>{f(!1)})},[j,n]),(0,m.jsx)(u.A,{title:"Set Retention Configuration",modalOpen:t,onClose:()=>{b()},children:j?(0,m.jsx)(i.aHM,{style:{width:16,height:16}}):(0,m.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),h||(g(!0),o.F.buckets.setBucketRetentionConfig(n,{mode:x||r.BT.Compliance,unit:y||r.wg.Days,validity:k||1}).then(()=>{g(!1),b()}).catch(e=>{g(!1),p((0,c.Dy)((0,l.S)(e.error)))}))},children:(0,m.jsxs)(i.Hbc,{containerPadding:!1,withBorders:!1,children:[(0,m.jsx)(i.z6M,{currentValue:x,id:"retention_mode",name:"retention_mode",label:"Retention Mode",onChange:e=>{v(e.target.value)},selectorOptions:[{value:"compliance",label:"Compliance"},{value:"governance",label:"Governance"}],helpTip:(0,m.jsxs)(a.Fragment,{children:[" ",(0,m.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-retention.html#compliance-mode",target:"blank",children:"Compliance"})," ","lock protects Objects from write operations by all users, including the MinIO root user.",(0,m.jsx)("br",{}),(0,m.jsx)("br",{}),(0,m.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-retention.html#governance-mode",target:"blank",children:"Governance"})," ","lock protects Objects from write operations by non-privileged users."]}),helpTipPlacement:"right"}),(0,m.jsx)(i.z6M,{currentValue:y,id:"retention_unit",name:"retention_unit",label:"Retention Unit",onChange:e=>{C(e.target.value)},selectorOptions:[{value:"days",label:"Days"},{value:"years",label:"Years"}]}),(0,m.jsx)(i.cl_,{type:"number",id:"retention_validity",name:"retention_validity",onChange:e=>{S(e.target.valueAsNumber)},label:"Retention Validity",value:String(k),required:!0,min:"1"}),(0,m.jsxs)(i.xA9,{item:!0,xs:12,sx:s.Uz.modalButtonBar,children:[(0,m.jsx)(i.$nd,{id:"cancel",type:"button",variant:"regular",disabled:h,onClick:()=>{b()},label:"Cancel"}),(0,m.jsx)(i.$nd,{id:"set",type:"submit",variant:"callAction",color:"primary",disabled:h||!w,label:"Set"})]}),h&&(0,m.jsx)(i.xA9,{item:!0,xs:12,children:(0,m.jsx)(i.z21,{})})]})})})}}}]); ================================================ FILE: web-app/build/static/js/3477.939cdb31.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[3477],{32680:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(9950),i=n(98341),s=n(89132),l=n(99491),o=n(49078),c=n(96382),r=n(44414);const d=e=>{let{onClose:t,modalOpen:n,title:d,children:p,wideLimit:x=!0,titleIcon:m=null,iconColor:h="default",sx:u}=e;const f=(0,l.jL)(),[j,b]=(0,a.useState)(!1),g=(0,i.d4)(e=>e.system.modalSnackBar);(0,a.useEffect)(()=>{f((0,o.h0)(""))},[f]),(0,a.useEffect)(()=>{if(g){if(""===g.message)return void b(!1);"error"!==g.type&&b(!0)}},[g]);let w="";return g&&(w=g.detailedErrorMsg,(""===w||w&&w.length<5)&&(w=g.message)),(0,r.jsxs)(s.ngX,{onClose:t,open:n,title:d,titleIcon:m,widthLimit:x,sx:u,iconColor:h,children:[(0,r.jsx)(c.A,{isModal:!0}),(0,r.jsx)(s.qb_,{onClose:()=>{b(!1),f((0,o.h0)(""))},open:j,message:w,mode:"inline",variant:"error"===g.type?"error":"default",autoHideDuration:"error"===g.type?10:5,condensed:!0}),p]})}},33477:(e,t,n)=>{n.r(t),n.d(t,{default:()=>f});var a=n(9950),i=n(89132),s=n(98341),l=n(59908),o=n(49078),c=n(99491),r=n(32680),d=n(88802),p=n(48374),x=n(82817),m=n(70503),h=n(44414);const u=e=>{let{volumeVal:t,pathVal:n}=e;return(0,h.jsx)(i.azJ,{className:"code-block-container",children:(0,h.jsxs)(i.azJ,{className:"example-code-block",children:[(0,h.jsxs)(i.azJ,{sx:{display:"flex",marginBottom:"5px",flexFlow:"row",["@media (max-width: ".concat(i.nmC.sm,"px)")]:{flexFlow:"column"}},children:[(0,h.jsx)("label",{children:"Volume/bucket Name :"})," ",(0,h.jsx)("code",{children:t})]}),(0,h.jsxs)(i.azJ,{sx:{display:"flex",flexFlow:"row",["@media (max-width: ".concat(i.nmC.sm,"px)")]:{flexFlow:"column"}},children:[(0,h.jsx)("label",{children:"Path : "}),(0,h.jsx)("code",{children:n})]})]})})},f=()=>{const e=(0,c.jL)(),t=(0,s.d4)(o.Rq),[n,f]=(0,a.useState)(""),[j,b]=(0,a.useState)(""),[g,w]=(0,a.useState)(!0),[y,v]=(0,a.useState)(""),[C,k]=(0,a.useState)(""),[z,S]=(0,a.useState)(!1),[T,J]=(0,a.useState)(""),[F,I]=(0,a.useState)("");(0,a.useEffect)(()=>{let e,t;e=n.trim().length>0,e?"/"===n.slice(0,1)&&(e=!1,J("Volume/Bucket name cannot start with /")):J("This field is required"),t=j.trim().length>0,j?"/"===j.slice(0,1)&&(t=!1,I("Path cannot start with /")):I("This field is required");const a=e&&t;e&&J(""),t&&I(""),S(a)},[n,j]);const V=async()=>{let t=document.baseURI.replace(window.location.origin,"");(async e=>await fetch(e,{method:"GET"}))("".concat(t,"api/v1/admin/inspect?volume=").concat(encodeURIComponent(n),"&file=").concat(encodeURIComponent(j),"&encrypt=").concat(g)).then(async t=>{if(!t.ok){const n=await t.json();e((0,o.C9)({errorMessage:n.message,detailedError:n.code}))}const n=await t.blob(),a=t.headers.get("content-disposition").split('"')[1],i=(0,l.UM)(a)||"";(0,l.OT)(n,a),k(a),v(i)}).catch(t=>{e((0,o.C9)(t))})},A=()=>{f(""),b(""),w(!0)};return(0,a.useEffect)(()=>{e((0,o.ph)("inspect"))},[]),(0,h.jsxs)(a.Fragment,{children:[(0,h.jsx)(x.A,{label:"Inspect",actions:(0,h.jsx)(m.A,{})}),(0,h.jsxs)(i.Mxu,{children:[t?(0,h.jsx)(i.Hbc,{helpBox:(0,h.jsx)(i.lVp,{title:"Learn more about the Inspect feature",iconComponent:(0,h.jsx)(i.nTF,{}),help:(0,h.jsxs)(a.Fragment,{children:[(0,h.jsx)(i.azJ,{sx:{marginTop:"16px",fontWeight:600,fontStyle:"italic",fontSize:"14px"},children:"Examples:"}),(0,h.jsxs)(i.azJ,{sx:{display:"flex",flexFlow:"column",fontSize:"14px",flex:"2","& .step-row":{fontSize:"14px",display:"flex",marginTop:"15px",marginBottom:"15px","&.step-text":{fontWeight:400},"&:before":{content:"' '",height:"7px",width:"7px",backgroundColor:"#2781B0",marginRight:"10px",marginTop:"7px",flexShrink:0}},"& .code-block-container":{flex:"1",marginTop:"15px",marginLeft:"35px","& input":{color:"#737373"}},"& .example-code-block label":{display:"inline-block",width:160,fontWeight:600,fontSize:14,["@media (max-width: ".concat(i.nmC.sm,"px)")]:{width:"100%"}},"& code":{width:100,paddingLeft:"10px",fontFamily:"monospace",paddingRight:"10px",paddingTop:"3px",paddingBottom:"3px",borderRadius:"2px",border:"1px solid #eaeaea",fontSize:"10px",fontWeight:500,["@media (max-width: ".concat(i.nmC.sm,"px)")]:{width:"100%"}},"& .spacer":{marginBottom:"5px"}},children:[(0,h.jsxs)(i.azJ,{children:[(0,h.jsx)(i.azJ,{className:"step-row",children:(0,h.jsx)("div",{className:"step-text",children:"To Download 'xl.meta' for a specific object from all the drives in a zip file:"})}),(0,h.jsx)(u,{pathVal:"test*/xl.meta",volumeVal:"test-bucket"})]}),(0,h.jsxs)(i.azJ,{children:[(0,h.jsx)(i.azJ,{className:"step-row",children:(0,h.jsx)("div",{className:"step-text",children:"To Download all constituent parts for a specific object, and optionally encrypt the downloaded zip:"})}),(0,h.jsx)(u,{pathVal:"test*/xl.meta",volumeVal:"test*/*/part.*"})]}),(0,h.jsxs)(i.azJ,{children:[(0,h.jsx)(i.azJ,{className:"step-row",children:(0,h.jsxs)("div",{className:"step-text",children:["To Download recursively all objects at a prefix.",(0,h.jsx)("br",{}),"NOTE: This can be an expensive operation use it with caution."]})}),(0,h.jsx)(u,{pathVal:"test*/xl.meta",volumeVal:"test/**"})]})]}),(0,h.jsxs)(i.azJ,{sx:{marginTop:"30px",marginLeft:"15px",fontSize:"14px"},children:["You can learn more at the"," ",(0,h.jsx)("a",{href:"https://github.com/minio/minio/tree/master/docs/debugging",target:"_blank",rel:"noopener",children:"documentation"}),"."]})]})}),children:(0,h.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),V()},children:[(0,h.jsx)(i.cl_,{id:"inspect_volume",name:"inspect_volume",onChange:e=>{f(e.target.value)},label:"Volume or Bucket Name",value:n,error:T,required:!0,placeholder:"test-bucket"}),(0,h.jsx)(i.cl_,{id:"inspect_path",name:"inspect_path",error:F,onChange:e=>{b(e.target.value)},label:"File or Path to inspect",value:j,required:!0,placeholder:"test*/xl.meta"}),(0,h.jsx)(i.dOG,{label:"Encrypt",indicatorLabels:["True","False"],checked:g,value:"true",id:"inspect_encrypt",name:"inspect_encrypt",onChange:()=>{w(!g)}}),(0,h.jsxs)(i.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:"55px"},children:[(0,h.jsx)(i.$nd,{id:"inspect-clear-button",style:{marginRight:"15px"},type:"button",variant:"regular","data-test-id":"inspect-clear-button",onClick:A,label:"Clear"}),(0,h.jsx)(i.$nd,{id:"inspect-start",type:"submit",variant:"callAction","data-test-id":"inspect-submit-button",disabled:!z,label:"Inspect"})]})]})}):(0,h.jsx)(d.A,{iconComponent:(0,h.jsx)(i.nTF,{}),entity:"Inspect"}),y?(0,h.jsx)(r.A,{modalOpen:!0,title:"Inspect Decryption Key",onClose:()=>{(0,l.Yj)(C),v(""),A()},titleIcon:(0,h.jsx)(i.aJN,{}),children:(0,h.jsxs)(a.Fragment,{children:[(0,h.jsxs)(i.azJ,{children:["This will be displayed only once. It cannot be recovered.",(0,h.jsx)("br",{}),"Use secure medium to share this key."]}),(0,h.jsx)("form",{noValidate:!0,onSubmit:()=>!1,children:(0,h.jsx)(p.A,{value:y})})]})}):null]})]})}},48374:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(9950),i=n(89132),s=n(44414);const l=e=>{let{value:t}=e;const[n,l]=(0,a.useState)(!1);return(0,s.jsxs)(i.azJ,{sx:{display:"flex",alignItems:"center",flexFlow:"row",["@media (max-width: ".concat(i.nmC.sm,"px)")]:{flexFlow:"column"}},children:[(0,s.jsx)(i.cl_,{id:"inspect-dec-key",name:"inspect-dec-key",placeholder:"",label:"",type:n?"text":"password",onChange:()=>{},value:t,overlayIcon:(0,s.jsx)(i.TdU,{}),readOnly:!0,overlayAction:()=>navigator.clipboard.writeText(t)}),(0,s.jsx)(i.$nd,{id:"show-hide-key",style:{marginLeft:"10px"},variant:"callAction",onClick:()=>l(!n),label:"Show/Hide"})]})}},88802:(e,t,n)=>{n.d(t,{A:()=>s});n(9950);var a=n(89132),i=n(44414);const s=e=>{let{iconComponent:t,entity:n}=e;return(0,i.jsx)(a.xA9,{container:!0,children:(0,i.jsx)(a.xA9,{item:!0,xs:12,children:(0,i.jsx)(a.lVp,{title:"".concat(n," not available"),iconComponent:t,help:(0,i.jsxs)(a.azJ,{sx:{fontSize:"14px",["@media (max-width: ".concat(a.nmC.sm,"px)")]:{display:"flex",flexFlow:"column"}},children:[(0,i.jsx)("span",{children:"This feature is not available for a single-disk setup.\xa0"}),(0,i.jsxs)("span",{children:["Please deploy a server in"," ",(0,i.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/operations/deployments/baremetal-deploy-minio-on-redhat-linux.html#create-the-minio-environment-file",target:"_blank",rel:"noopener",children:"Distributed Mode"})," ","to use this feature."]})]})})})})}}}]); ================================================ FILE: web-app/build/static/js/3541.34ae70ef.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[3541],{13541:(e,a,t)=>{t.r(a),t.d(a,{default:()=>o});var l=t(9950),n=t(89132),s=t(44414);const o=e=>{let{onChange:a}=e;const[t,o]=(0,l.useState)(!1),[r,u]=(0,l.useState)(""),[c,i]=(0,l.useState)(""),[d,m]=(0,l.useState)(""),[g,h]=(0,l.useState)(""),[b,p]=(0,l.useState)(""),[v,f]=(0,l.useState)(""),[x,j]=(0,l.useState)(" "),[C,S]=(0,l.useState)(""),[w,y]=(0,l.useState)("namespace"),[_,k]=(0,l.useState)(""),[E,q]=(0,l.useState)(""),[B,D]=(0,l.useState)(""),F=(0,l.useCallback)(()=>{let e="";return""!==c&&(e="".concat(e," host=").concat(c)),""!==d&&(e="".concat(e," dbname=").concat(d)),""!==b&&(e="".concat(e," user=").concat(b)),""!==v&&(e="".concat(e," password=").concat(v)),""!==g&&(e="".concat(e," port=").concat(g))," "!==x&&(e="".concat(e," sslmode=").concat(x)),e="".concat(e," "),e.trim()},[c,d,b,v,g,x]);return(0,l.useEffect)(()=>{if(""!==r){a([{key:"connection_string",value:r},{key:"table",value:C},{key:"format",value:w},{key:"queue_dir",value:_},{key:"queue_limit",value:E},{key:"comment",value:B}])}},[r,C,w,_,E,B,a]),(0,l.useEffect)(()=>{const e=F();u(e)},[b,d,v,g,x,c,u,F]),(0,l.useEffect)(()=>{if(t){const e=F();return void u(e)}const e=((e,a)=>{let t=[];for(const s of a){const a=e.indexOf(s+"=");-1!==a&&t.push(a)}t.sort((e,a)=>e-a);let l=new Map,n=new Array(t.length);for(let s=0;s{o(e.target.checked)},value:"manualString"}),t?(0,s.jsx)(l.Fragment,{children:(0,s.jsx)(n.cl_,{id:"connection-string",name:"connection_string",label:"Connection String",value:r,onChange:e=>{u(e.target.value)}})}):(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)(n.xA9,{item:!0,xs:12,children:(0,s.jsxs)(n.azJ,{withBorders:!0,useBackground:!0,sx:{overflowY:"auto",height:170,marginBottom:12},children:[(0,s.jsx)(n.cl_,{id:"host",name:"host",label:"",placeholder:"Enter Host",value:c,onChange:e=>{i(e.target.value)}}),(0,s.jsx)(n.cl_,{id:"db-name",name:"db-name",label:"",placeholder:"Enter DB Name",value:d,onChange:e=>{m(e.target.value)}}),(0,s.jsx)(n.cl_,{id:"port",name:"port",label:"",placeholder:"Enter Port",value:g,onChange:e=>{h(e.target.value)}}),(0,s.jsx)(n.l6P,{value:x,label:"",id:"sslmode",name:"sslmode",onChange:e=>{e&&j(e+"")},options:[{label:"Enter SSL Mode",value:" "},{label:"Require",value:"require"},{label:"Disable",value:"disable"},{label:"Verify CA",value:"verify-ca"},{label:"Verify Full",value:"verify-full"}]}),(0,s.jsx)(n.cl_,{id:"user",name:"user",label:"",placeholder:"Enter User",value:b,onChange:e=>{p(e.target.value)}}),(0,s.jsx)(n.cl_,{id:"password",name:"password",label:"",type:"password",placeholder:"Enter Password",value:v,onChange:e=>{f(e.target.value)}})]})}),(0,s.jsx)(n.EmB,{label:"Connection String",multiLine:!0,children:r})]}),(0,s.jsx)(n.cl_,{id:"table",name:"table",label:"Table",placeholder:"Enter Table Name",value:C,tooltip:"DB table name to store/update events, table is auto-created",onChange:e=>{S(e.target.value)}}),(0,s.jsx)(n.z6M,{currentValue:w,id:"format",name:"format",label:"Format",onChange:e=>{y(e.target.value)},tooltip:"'namespace' reflects current bucket/object list and 'access' reflects a journal of object operations, defaults to 'namespace'",selectorOptions:[{label:"Namespace",value:"namespace"},{label:"Access",value:"access"}]}),(0,s.jsx)(n.cl_,{id:"queue-dir",name:"queue_dir",label:"Queue Dir",placeholder:"Enter Queue Directory",value:_,tooltip:"Staging directory for undelivered messages e.g. '/home/events'",onChange:e=>{k(e.target.value)}}),(0,s.jsx)(n.cl_,{id:"queue-limit",name:"queue_limit",label:"Queue Limit",placeholder:"Enter Queue Limit",type:"number",value:E,tooltip:"Maximum limit for undelivered messages, defaults to '10000'",onChange:e=>{q(e.target.value)}}),(0,s.jsx)(n.hFj,{id:"comment",name:"comment",label:"Comment",placeholder:"Enter custom notes if any",value:B,onChange:e=>{D(e.target.value)}})]})}}}]); ================================================ FILE: web-app/build/static/js/3576.48953e5a.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[3576],{73576:(e,t,n)=>{n.r(t),n.d(t,{default:()=>R});var i=n(9950),l=n(98341),s=n(28429),c=n(89132),o=n(2586),r=n(26843),a=n(93598),d=n(49078),u=n(47304),h=n(99491),p=n(30272),b=n(55604),m=n(44414);const x=(0,b.A)(i.lazy(()=>n.e(5503).then(n.bind(n,15503)))),A=(0,b.A)(i.lazy(()=>n.e(116).then(n.bind(n,30116)))),j=(0,b.A)(i.lazy(()=>n.e(4599).then(n.bind(n,14599)))),R=()=>{const e=(0,h.jL)(),t=(0,s.g)(),n=(0,l.d4)(u.Nx),[b,R]=(0,i.useState)(!0),[_,O]=(0,i.useState)([]),[I,S]=(0,i.useState)(!1),[T,g]=(0,i.useState)(!1),[k,N]=(0,i.useState)(!1),[C,y]=(0,i.useState)(""),[f,P]=(0,i.useState)([]),[E,v]=(0,i.useState)(!1),F=t.bucketName||"",V=(0,r._)(F,[a.OV.S3_GET_REPLICATION_CONFIGURATION,a.OV.S3_GET_ACTIONS]);(0,i.useEffect)(()=>{e((0,d.ph)("bucket_detail_replication"))},[]),(0,i.useEffect)(()=>{n&&R(!0)},[n,R]),(0,i.useEffect)(()=>{b&&(V?o.A.invoke("GET","/api/v1/buckets/".concat(F,"/replication")).then(e=>{const t=e.rules?e.rules:[];t.sort((e,t)=>e.priority-t.priority),O(t),R(!1)}).catch(t=>{e((0,d.C9)(t)),R(!1)}):R(!1))},[b,e,F,V]);const w=function(){g(arguments.length>0&&void 0!==arguments[0]&&arguments[0])},U=(0,s.Zp)(),G=[{type:"delete",onClick:e=>{y(e.id),v(!1),S(!0)}},{type:"view",onClick:e=>{y(e.id),U("/buckets/edit-replication?bucketName=".concat(F,"&ruleID=").concat(e.id))},disableButtonFunction:!(0,r._)(F,[a.OV.S3_PUT_REPLICATION_CONFIGURATION,a.OV.S3_PUT_ACTIONS],!0)}];return(0,m.jsxs)(i.Fragment,{children:[T&&(0,m.jsx)(A,{closeModalAndRefresh:()=>{w(!1),R(!0)},open:T,bucketName:F,setReplicationRules:_}),I&&(0,m.jsx)(j,{deleteOpen:I,selectedBucket:F,closeDeleteModalAndRefresh:e=>{S(!1),e&&R(!0)},ruleToDelete:C,rulesToDelete:f,remainingRules:_.length,allSelected:_.length>0&&f.length===_.length,deleteSelectedRules:E}),k&&(0,m.jsx)(x,{closeModalAndRefresh:e=>{N(!1),e&&R(!0)},open:k,bucketName:F,ruleID:C}),(0,m.jsx)(c._xt,{separator:!0,sx:{marginBottom:15},actions:(0,m.jsxs)(c.azJ,{style:{display:"flex",gap:10},children:[(0,m.jsx)(r.R,{scopes:[a.OV.S3_PUT_REPLICATION_CONFIGURATION,a.OV.S3_PUT_ACTIONS],resource:F,matchAll:!0,errorProps:{disabled:!0},children:(0,m.jsx)(p.A,{tooltip:"Remove Selected Replication Rules",children:(0,m.jsx)(c.$nd,{id:"remove-bucket-replication-rule",onClick:()=>{y("selectedRules"),v(!0),S(!0)},label:"Remove Selected Rules",icon:(0,m.jsx)(c.ucK,{}),color:"secondary",disabled:0===f.length||0===_.length,variant:"secondary"})})}),(0,m.jsx)(r.R,{scopes:[a.OV.S3_PUT_REPLICATION_CONFIGURATION,a.OV.S3_PUT_ACTIONS],resource:F,matchAll:!0,errorProps:{disabled:!0},children:(0,m.jsx)(p.A,{tooltip:"Add Replication Rule",children:(0,m.jsx)(c.$nd,{id:"add-bucket-replication-rule",onClick:()=>{U(a.zZ.BUCKETS_ADD_REPLICATION+"?bucketName=".concat(F,"&nextPriority=").concat(_.length+1))},label:"Add Replication Rule",icon:(0,m.jsx)(c.REV,{}),variant:"callAction"})})})]}),children:(0,m.jsx)(c.V7x,{content:(0,m.jsxs)(i.Fragment,{children:["MinIO"," ",(0,m.jsx)("a",{target:"blank",href:"https://docs.min.io/community/minio-object-store/administration/bucket-replication.html",children:"server-side bucket replication"})," ","is an automatic bucket-level configuration that synchronizes objects between a source and destination bucket."]}),placement:"right",children:"Replication"})}),(0,m.jsxs)(c.xA9,{container:!0,children:[(0,m.jsx)(c.xA9,{item:!0,xs:12,children:(0,m.jsx)(r.R,{scopes:[a.OV.S3_GET_REPLICATION_CONFIGURATION,a.OV.S3_GET_ACTIONS],resource:F,errorProps:{disabled:!0},children:(0,m.jsx)(c.bQt,{itemActions:G,columns:[{label:"Priority",elementKey:"priority",width:55,contentTextAlign:"center"},{label:"Destination",elementKey:"destination",renderFunction:e=>(0,m.jsx)(i.Fragment,{children:e.bucket.replace("arn:aws:s3:::","")})},{label:"Prefix",elementKey:"prefix",width:200},{label:"Tags",elementKey:"tags",renderFunction:e=>(0,m.jsx)(i.Fragment,{children:e&&""!==e.tags?"Yes":"No"}),width:60},{label:"Status",elementKey:"status",width:100}],isLoading:b,records:_,entityName:"Replication Rules",idField:"id",customPaperHeight:"400px",textSelectable:!0,selectedItems:f,onSelect:e=>(e=>{const t=e.target,n=t.value,i=t.checked;let l=[...f];return i?l.push(n):l=l.filter(e=>e!==n),P(l),l})(e),onSelectAll:()=>{f.length!==_.length?P(_.map(e=>e.id)):P([])}})})}),(0,m.jsxs)(c.xA9,{item:!0,xs:12,children:[(0,m.jsx)("br",{}),(0,m.jsx)(c.lVp,{title:"Replication",iconComponent:(0,m.jsx)(c.brV,{}),help:(0,m.jsxs)(i.Fragment,{children:["MinIO supports server-side and client-side replication of objects between source and destination buckets.",(0,m.jsx)("br",{}),(0,m.jsx)("br",{}),"You can learn more at the"," ",(0,m.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/bucket-replication.html",target:"_blank",rel:"noopener",children:"documentation"}),"."]})})]})]})]})}}}]); ================================================ FILE: web-app/build/static/js/3697.280e7ecf.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[3697],{53697:(e,t,a)=>{a.r(t),a.d(t,{default:()=>w});var n=a(9950),s=a(43217),d=a(89132),o=a(98341),l=a(32680),r=a(99491),c=a(45536),i=a(45246),u=a(44414);const w=e=>{let{closeModalAndRefresh:t,open:a,bucketName:w}=e;const b=(0,r.jL)(),h=(0,o.d4)(e=>e.objectBrowser.rewind.rewindEnabled),x=(0,o.d4)(e=>e.objectBrowser.rewind.dateToRewind),[j,p]=(0,n.useState)(!1),[S,m]=(0,n.useState)(!0),[k,f]=(0,n.useState)(s.c9.fromJSDate(new Date));(0,n.useEffect)(()=>{h&&(m(!0),f(s.c9.fromISO(x||s.c9.now().toISO()||"")))},[h,x]);return(0,u.jsx)(l.A,{modalOpen:a,onClose:()=>{t()},title:"Rewind - ".concat(w),children:(0,u.jsxs)(d.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,u.jsx)(d.e8j,{value:k,onChange:e=>e?f(e):null,id:"rewind-selector",label:"Rewind to",timeFormat:"24h",secondsSelector:!1,disabled:!S}),h&&(0,u.jsx)(d.dOG,{value:"status",id:"status",name:"status",checked:S,onChange:e=>{m(e.target.checked)},label:"Current Status",indicatorLabels:["Enabled","Disabled"]}),(0,u.jsx)(d.xA9,{item:!0,xs:12,sx:i.Uz.modalButtonBar,children:(0,u.jsx)(d.$nd,{type:"button",variant:"callAction",disabled:j||!k&&S,onClick:()=>{!S&&h?b((0,c.rS)()):(p(!0),b((0,c.v8)({state:!0,bucket:w,dateRewind:k.toISO()}))),b((0,c.Yw)(!0)),t()},id:"rewind-apply-button",label:!S&&h?"Show Current Data":"Show Rewind Data"})}),j&&(0,u.jsx)(d.xA9,{item:!0,xs:12,children:(0,u.jsx)(d.z21,{})})]})})}}}]); ================================================ FILE: web-app/build/static/js/4043.e97d09a3.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4043],{54043:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var l=n(9950),o=n(49534),s=n(89132),c=n(49078),i=n(99491),r=n(70444),a=n(48965),u=n(44414);const p=e=>{let{closeDeleteModalAndRefresh:t,deleteOpen:n,selectedPolicy:p}=e;const d=(0,i.jL)(),[f,y]=(0,l.useState)(!1);if(!p)return null;return(0,u.jsx)(o.A,{title:"Delete Policy",confirmText:"Delete",isOpen:n,titleIcon:(0,u.jsx)(s.xWY,{}),isLoading:f,onConfirm:()=>{y(!0),r.F.policy.removePolicy(p).then(e=>{t(!0)}).catch(async e=>{const n=await e.json();d((0,c.C9)((0,a.S)(n))),t(!1)}).finally(()=>y(!1))},onClose:()=>t(!1),confirmationContent:(0,u.jsxs)(l.Fragment,{children:["Are you sure you want to delete policy ",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:p}),"?"]})})}}}]); ================================================ FILE: web-app/build/static/js/4121.672bbdc8.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4121],{14121:(e,t,n)=>{n.r(t),n.d(t,{default:()=>v});var r=n(9950),s=n(87946),i=n.n(s),o=n(98341),l=n(28429),a=n(89132),c=n(70444),d=n(48965),x=n(45246),u=n(93598),m=n(26843),j=n(60252),p=n(49078),h=n(99491),g=n(27428),b=n(55604),y=n(88802),f=n(30272),F=n(82817),T=n(70503),A=n(49534),C=n(44414);const O=e=>{let{open:t,closeModalAndRefresh:n,tierName:s}=e;const i=(0,h.jL)();return(0,C.jsx)(A.A,{title:"Delete Tier",confirmText:"Delete",isOpen:t,titleIcon:(0,C.jsx)(a.$rg,{}),isLoading:!1,onConfirm:()=>{""!==s?c.F.admin.removeTier(s).then(()=>{n(!0)}).catch(e=>{e.json().then(e=>{i((0,p.C9)({errorMessage:e.message,detailedError:e.detailedMessage}))}),n(!1)}):(0,p.C9)({errorMessage:"There was an error deleting the tier",detailedError:""})},onClose:()=>n(!1),confirmationContent:(0,C.jsxs)(r.Fragment,{children:["Are you sure you want to delete the tier ",(0,C.jsx)("strong",{children:s}),"?",(0,C.jsx)("br",{}),(0,C.jsx)("br",{}),(0,C.jsx)("strong",{children:" Please note"}),(0,C.jsx)("br",{})," Only empty tiers can be deleted. If the tier has had objects transitioned into it, it cannot be removed."]})})},I=(0,b.A)(r.lazy(()=>n.e(593).then(n.bind(n,30593)))),v=()=>{const e=(0,h.jL)(),t=(0,l.Zp)(),n=(0,o.d4)(p.Rq),[s,b]=(0,r.useState)([]),[A,v]=(0,r.useState)(""),[M,S]=(0,r.useState)(!0),[E,_]=(0,r.useState)(!1),[w,N]=(0,r.useState)(!1),[k,R]=(0,r.useState)({type:"unsupported",status:!1}),L=(0,m._)(u.Ms,[u.OV.ADMIN_SET_TIER]);(0,r.useEffect)(()=>{if(M)if(n){(()=>{c.F.admin.tiersList().then(e=>{b(e.data.items||[]),S(!1)}).catch(t=>{e((0,p.C9)((0,d.S)(t.error))),S(!1)})})()}else S(!1)},[M,e,n]);const D=s.filter(e=>{if(""===A)return!0;const t=i()(e,"".concat(e.type,".name"),""),n=i()(e,"type","");return t.indexOf(A)>=0||n.indexOf(A)>=0}),z=()=>{t(u.zZ.TIERS_ADD)};return(0,r.useEffect)(()=>{e((0,p.ph)("list-tiers-configuration"))},[]),(0,C.jsxs)(r.Fragment,{children:[E&&(0,C.jsx)(I,{open:E,tierData:k,closeModalAndRefresh:()=>{_(!1)}}),w&&(0,C.jsx)(O,{open:w,tierName:i()(k,"".concat(k.type,".name"),""),closeModalAndRefresh:()=>{N(!1),S(!0)}}),(0,C.jsx)(F.A,{label:"Tiers",actions:(0,C.jsx)(T.A,{})}),(0,C.jsx)(a.Mxu,{children:n?(0,C.jsxs)(r.Fragment,{children:[(0,C.jsxs)(a.xA9,{item:!0,xs:12,sx:x._0.actionsTray,children:[(0,C.jsx)(g.A,{placeholder:"Filter",onChange:v,value:A,sx:{marginRight:"auto",maxWidth:380}}),(0,C.jsxs)(a.azJ,{sx:{display:"flex",flexWrap:"nowrap",gap:5},children:[(0,C.jsx)(a.$nd,{id:"refresh-list",icon:(0,C.jsx)(a.fNY,{}),label:"Refresh List",onClick:()=>{S(!0)}}),(0,C.jsx)(f.A,{tooltip:L?"":"You require additional permissions in order to create a new Tier. Please ask your MinIO administrator to grant you "+u.OV.ADMIN_SET_TIER+" permission in order to create a Tier.",children:(0,C.jsx)(m.R,{scopes:[u.OV.ADMIN_SET_TIER],resource:u.Ms,errorProps:{disabled:!0},children:(0,C.jsx)(a.$nd,{id:"add-tier",icon:(0,C.jsx)(a.REV,{}),label:"Create Tier",onClick:z,variant:"callAction"})})})]})]}),M&&(0,C.jsx)(a.z21,{}),!M&&(0,C.jsxs)(r.Fragment,{children:[s.length>0&&(0,C.jsxs)(r.Fragment,{children:[(0,C.jsx)(a.xA9,{item:!0,xs:12,children:(0,C.jsx)(m.R,{scopes:[u.OV.ADMIN_LIST_TIERS],resource:u.Ms,errorProps:{disabled:!0},children:(0,C.jsx)(a.bQt,{itemActions:[{type:"edit",onClick:e=>{R(e),_(!0)}},{type:"delete",isDisabled:!(0,m._)("*",u.pC[u.ac.BUCKET_LIFECYCLE],!0),onClick:e=>{R(e),N(!0)}}],columns:[{label:"Tier Name",elementKey:"type",renderFunction:e=>{const t=i()(e,"".concat(e.type,".name"),"");return null!==t?(0,C.jsx)("b",{children:t}):""},renderFullObject:!0},{label:"Status",elementKey:"status",renderFunction:e=>e?(0,C.jsxs)(a.xA9,{container:!0,sx:{display:"flex",alignItems:"center",justifyItems:"start",color:"#4CCB92",fontSize:"8px",flexDirection:"column"},children:[(0,C.jsx)(a.JrA,{style:{fill:"#4CCB92",width:14,height:14}}),"ONLINE"]}):(0,C.jsxs)(a.xA9,{container:!0,sx:{display:"flex",flexDirection:"column",alignItems:"center",color:"#C83B51",fontSize:"8px"},children:[(0,C.jsx)(a.lgW,{style:{fill:"#C83B51",width:14,height:14}}),"OFFLINE"]}),width:50},{label:"Type",elementKey:"type",renderFunction:e=>{const{logoXs:t}=j._T.find(t=>t.serviceName===e)||{};return e?(0,C.jsx)(a.azJ,{sx:{display:"flex",alignItems:"center","& .min-icon":{width:"18px",height:"22px"}},children:t}):""},width:50},{label:"Endpoint",elementKey:"type",renderFunction:e=>{const t=i()(e,"".concat(e.type,".endpoint"),"");return null!==t?t:""},renderFullObject:!0},{label:"Bucket",elementKey:"type",renderFunction:e=>{const t=i()(e,"".concat(e.type,".bucket"),"");return null!==t?t:""},renderFullObject:!0},{label:"Prefix",elementKey:"type",renderFunction:e=>{const t=i()(e,"".concat(e.type,".prefix"),"");return null!==t?t:""},renderFullObject:!0},{label:"Region",elementKey:"type",renderFunction:e=>{const t=i()(e,"".concat(e.type,".region"),"");return null!==t?t:""},renderFullObject:!0},{label:"Usage",elementKey:"type",renderFunction:e=>{const t=i()(e,"".concat(e.type,".usage"),"");return null!==t?t:""},renderFullObject:!0},{label:"Objects",elementKey:"type",renderFunction:e=>{const t=i()(e,"".concat(e.type,".objects"),"");return null!==t?t:""},renderFullObject:!0},{label:"Versions",elementKey:"type",renderFunction:e=>{const t=i()(e,"".concat(e.type,".versions"),"");return null!==t?t:""},renderFullObject:!0}],isLoading:M,records:D,entityName:"Tiers",idField:"service_name",customPaperHeight:"400px"})})}),(0,C.jsx)(a.xA9,{item:!0,xs:12,sx:{marginTop:"15px"},children:(0,C.jsx)(a.lVp,{title:"Learn more about TIERS",iconComponent:(0,C.jsx)(a.fAn,{}),help:(0,C.jsxs)(r.Fragment,{children:["Tiers are used by the MinIO Object Lifecycle Management which allows creating rules for time or date based automatic transition or expiry of objects. For object transition, MinIO automatically moves the object to a configured remote storage tier.",(0,C.jsx)("br",{}),(0,C.jsx)("br",{}),"You can learn more at the"," ",(0,C.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-lifecycle-management.html",target:"_blank",rel:"noopener",children:"documentation"}),"."]})})})]}),0===s.length&&(0,C.jsx)(a.lVp,{title:"Tiers",iconComponent:(0,C.jsx)(a.fAn,{}),help:(0,C.jsxs)(r.Fragment,{children:["Tiers are used by the MinIO Object Lifecycle Management which allows creating rules for time or date based automatic transition or expiry of objects. For object transition, MinIO automatically moves the object to a configured remote storage tier.",(0,C.jsx)("br",{}),(0,C.jsx)("br",{}),L?(0,C.jsxs)("div",{children:["To get started,"," ",(0,C.jsx)(a.t53,{isLoading:!1,label:"",onClick:z,children:"Create Tier"}),"."]}):""]})})]})]}):(0,C.jsx)(y.A,{entity:"Tiers",iconComponent:(0,C.jsx)(a.zEc,{})})})]})}},55604:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(89379),s=n(9950),i=n(44414);const o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n){return(0,i.jsx)(s.Suspense,{fallback:t,children:(0,i.jsx)(e,(0,r.A)({},n))})}}},60252:(e,t,n)=>{n.d(t,{_T:()=>c,pW:()=>l,qA:()=>o,vH:()=>i,y:()=>a});var r=n(89132),s=n(44414);const i="minio",o="gcs",l="s3",a="azure",c=[{serviceName:i,targetTitle:"MinIO",logo:(0,s.jsx)(r.Wh8,{}),logoXs:(0,s.jsx)(r.$2v,{})},{serviceName:o,targetTitle:"Google Cloud Storage",logo:(0,s.jsx)(r.F7U,{}),logoXs:(0,s.jsx)(r.gwF,{})},{serviceName:l,targetTitle:"AWS S3",logo:(0,s.jsx)(r._tF,{}),logoXs:(0,s.jsx)(r.ZZX,{})},{serviceName:a,targetTitle:"Azure",logo:(0,s.jsx)(r.Nmx,{}),logoXs:(0,s.jsx)(r.Ubg,{})}]},88802:(e,t,n)=>{n.d(t,{A:()=>i});n(9950);var r=n(89132),s=n(44414);const i=e=>{let{iconComponent:t,entity:n}=e;return(0,s.jsx)(r.xA9,{container:!0,children:(0,s.jsx)(r.xA9,{item:!0,xs:12,children:(0,s.jsx)(r.lVp,{title:"".concat(n," not available"),iconComponent:t,help:(0,s.jsxs)(r.azJ,{sx:{fontSize:"14px",["@media (max-width: ".concat(r.nmC.sm,"px)")]:{display:"flex",flexFlow:"column"}},children:[(0,s.jsx)("span",{children:"This feature is not available for a single-disk setup.\xa0"}),(0,s.jsxs)("span",{children:["Please deploy a server in"," ",(0,s.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/operations/deployments/baremetal-deploy-minio-on-redhat-linux.html#create-the-minio-environment-file",target:"_blank",rel:"noopener",children:"Distributed Mode"})," ","to use this feature."]})]})})})})}}}]); ================================================ FILE: web-app/build/static/js/4169.3a4d800e.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4169],{32680:(e,t,n)=>{n.d(t,{A:()=>d});var s=n(9950),a=n(98341),i=n(89132),o=n(99491),l=n(49078),r=n(96382),c=n(44414);const d=e=>{let{onClose:t,modalOpen:n,title:d,children:m,wideLimit:u=!0,titleIcon:x=null,iconColor:p="default",sx:h}=e;const g=(0,o.jL)(),[j,b]=(0,s.useState)(!1),f=(0,a.d4)(e=>e.system.modalSnackBar);(0,s.useEffect)(()=>{g((0,l.h0)(""))},[g]),(0,s.useEffect)(()=>{if(f){if(""===f.message)return void b(!1);"error"!==f.type&&b(!0)}},[f]);let _="";return f&&(_=f.detailedErrorMsg,(""===_||_&&_.length<5)&&(_=f.message)),(0,c.jsxs)(i.ngX,{onClose:t,open:n,title:d,titleIcon:x,widthLimit:u,sx:h,iconColor:p,children:[(0,c.jsx)(r.A,{isModal:!0}),(0,c.jsx)(i.qb_,{onClose:()=>{b(!1),g((0,l.h0)(""))},open:j,message:_,mode:"inline",variant:"error"===f.type?"error":"default",autoHideDuration:"error"===f.type?10:5,condensed:!0}),m]})}},44169:(e,t,n)=>{n.r(t),n.d(t,{default:()=>A});var s=n(9950),a=n(87946),i=n.n(a),o=n(98341),l=n(89132),r=n(59908);const c={time:"Timestamp",api_name:"API Name",access_key:"Access Key",bucket:"Bucket",object:"Object",remote_host:"Remote Host",request_id:"Request ID",user_agent:"User Agent",response_status:"Response Status",response_status_code:"Response Status Code",request_content_length:"Request Content Length",response_content_length:"Response Content Length",time_to_response_ns:"Time to Response NS"};var d=n(93598),m=n(49078),u=n(86070),x=n(99491),p=n(26843),h=n(2586),g=n(44414);const j=e=>{let{label:t,onChange:n,value:a,placeholder:i="",id:o,name:r}=e;return(0,g.jsx)(s.Fragment,{children:(0,g.jsxs)(l.azJ,{sx:{flexGrow:1,margin:"0 15px"},children:[(0,g.jsx)(l.l1Y,{children:t}),(0,g.jsx)(l.cl_,{placeholder:i,id:o,name:r,label:"",onChange:e=>{n(e.target.value)},sx:{"& input":{height:30}},value:a})]})})};var b=n(32680);const f=e=>{let{modalOpen:t,logSearchElement:n,onClose:a}=e;const o=Object.keys(n);return(0,g.jsx)(s.Fragment,{children:(0,g.jsx)(b.A,{modalOpen:t,title:"Full Log Information",onClose:()=>{a()},children:(0,g.jsxs)(l.xA9,{container:!0,children:[(0,g.jsx)(l.xA9,{item:!0,xs:12,children:(0,g.jsx)("table",{children:(0,g.jsx)("tbody",{children:o.map((e,t)=>(0,g.jsxs)("tr",{children:[(0,g.jsx)("th",{style:{fontWeight:700,paddingRight:"10px",textAlign:"left"},children:i()(c,e,"".concat(e))}),(0,g.jsx)("td",{children:i()(n,e,"")})]},"logSearch-".concat(t.toString())))})})}),(0,g.jsx)(l.xA9,{item:!0,xs:12,sx:{display:"flex",justifyContent:"flex-end"},children:(0,g.jsx)(l.$nd,{id:"close-log-search",variant:"callAction",color:"primary",onClick:a,label:"Close"})})]})})})};var _=n(77517);const C=e=>{let{iconComponent:t,entity:n,documentationLink:a}=e;return(0,g.jsx)(l.xA9,{container:!0,sx:{justifyContent:"center",alignContent:"center",alignItems:"center"},children:(0,g.jsx)(l.xA9,{item:!0,xs:8,children:(0,g.jsx)(l.lVp,{title:"".concat(n," not available"),iconComponent:t,help:(0,g.jsxs)(s.Fragment,{children:["This feature is not available.",(0,g.jsx)("br",{}),"Please configure"," ",(0,g.jsx)("a",{href:a,target:"_blank",rel:"noopener",children:n})," ","first to use this feature."]})})})})};var y=n(82817),S=n(70503);const k={display:"flex",justifyContent:"space-between",marginBottom:12},A=()=>{const e=(0,x.jL)(),t=(0,o.d4)(u.s$),[n,a]=(0,s.useState)(!0),[b,A]=(0,s.useState)(null),[v,w]=(0,s.useState)(null),[E,T]=(0,s.useState)(!1),[F,I]=(0,s.useState)([]),[L,q]=(0,s.useState)(""),[R,z]=(0,s.useState)(""),[K,O]=(0,s.useState)(""),[J,B]=(0,s.useState)(""),[M,D]=(0,s.useState)(""),[N,P]=(0,s.useState)(""),[H,W]=(0,s.useState)(""),[U,$]=(0,s.useState)("DESC"),[G,Y]=(0,s.useState)(["time","api_name","access_key","bucket","object","remote_host","request_id","user_agent","response_status"]),[V,Q]=(0,s.useState)(0),[X,Z]=(0,s.useState)(!1),[ee,te]=(0,s.useState)(!1),[ne,se]=(0,s.useState)(null);let ae=null;const ie=t&&t.includes("log-search"),oe=(0,s.useCallback)(()=>{if(!X&&ie){Z(!0);let t="".concat(""!==L?"&fp=bucket:".concat(L):"").concat(""!==M?"&fp=object:".concat(M):"").concat(""!==R?"&fp=api_name:".concat(R):"").concat(""!==K?"&fp=access_key:".concat(K):"").concat(""!==N?"&fp=request_id:".concat(N):"").concat(""!==J?"&fp=user_agent:".concat(J):"").concat(""!==H?"&fp=response_status:".concat(H):"");t=t.trim(),t.endsWith(",")&&(t=t.slice(0,-1)),h.A.invoke("GET","/api/v1/logs/search?q=reqinfo".concat(""!==t?"".concat(t):"","&pageSize=100&pageNo=").concat(V,"&order=").concat("DESC"===U?"timeDesc":"timeAsc").concat(null!==b?"&timeStart=".concat(b.toUTC().toISO()):"").concat(null!==v?"&timeEnd=".concat(v.toUTC().toISO()):"")).then(e=>{const t=e.results||[];a(!1),Z(!1),I(t),Q(V+1),null!==ae&&ae()}).catch(t=>{a(!1),Z(!1),e((0,m.C9)(t))})}else a(!1),Z(!1)},[X,ie,L,M,R,K,N,J,H,V,U,b,v,ae,e]);(0,s.useEffect)(()=>{n&&(I([]),oe())},[n,U,oe]);return(0,s.useEffect)(()=>{e((0,m.ph)("audit_logs"))},[]),(0,g.jsxs)(s.Fragment,{children:[ee&&null!==ne&&(0,g.jsx)(f,{logSearchElement:ne,modalOpen:ee,onClose:()=>{se(null),te(!1)}}),(0,g.jsx)(y.A,{label:"Audit Logs",actions:(0,g.jsx)(S.A,{})}),(0,g.jsx)(l.Mxu,{children:ie?(0,g.jsxs)(s.Fragment,{children:[" ",(0,g.jsxs)(l.azJ,{withBorders:!0,sx:{marginBottom:15},children:[(0,g.jsxs)(l.xA9,{item:!0,xs:12,sx:{display:"flex",padding:15,["@media (max-width: ".concat(l.nmC.lg,"px)")]:{flexFlow:"column"}},children:[(0,g.jsx)(l.azJ,{children:(0,g.jsx)(_.A,{setTimeEnd:e=>w(e),setTimeStart:e=>A(e),timeEnd:v,timeStart:b})}),(0,g.jsx)(l.azJ,{sx:{display:"flex",alignItems:"center"},children:(0,g.jsx)(l.J2w,{label:"".concat(E?"Hide":"Show"," advanced Filters"),open:E,onClick:()=>{T(!E)}})})]}),(0,g.jsxs)(l.xA9,{item:!0,xs:12,sx:{display:E?"block":"none",overflowY:"hidden",marginBottom:E?12:0},children:[(0,g.jsxs)(l.azJ,{sx:{marginLeft:15,marginBottom:15,fontSize:12,color:"#9C9C9C"},children:["Enable your preferred options to get filtered records.",(0,g.jsx)("br",{}),"You can use '*' to match any character, '.' to signify a single character or '\\' to scape an special character (E.g. mybucket-*)"]}),(0,g.jsxs)(l.azJ,{sx:k,children:[(0,g.jsx)(j,{onChange:q,value:L,label:"Bucket",id:"bucket",name:"bucket"}),(0,g.jsx)(j,{onChange:z,value:R,label:"API Name",id:"api_name",name:"api_name"}),(0,g.jsx)(j,{onChange:O,value:K,label:"Access Key",id:"access_key",name:"access_key"}),(0,g.jsx)(j,{onChange:B,value:J,label:"User Agent",id:"user_agent",name:"user_agent"})]}),(0,g.jsxs)(l.azJ,{sx:k,children:[(0,g.jsx)(j,{onChange:D,value:M,label:"Object",id:"object",name:"object"}),(0,g.jsx)(j,{onChange:P,value:N,label:"Request ID",id:"request_id",name:"request_id"}),(0,g.jsx)(j,{onChange:W,value:H,label:"Response Status",id:"response_status",name:"response_status"})]})]}),(0,g.jsx)(l.xA9,{item:!0,xs:12,sx:{marginBottom:15,padding:"0 15px 0 15px",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:(0,g.jsx)(l.$nd,{id:"get-information",type:"button",variant:"callAction",onClick:()=>{Q(0),a(!0)},label:"Get Information"})})]}),(0,g.jsx)(l.xA9,{item:!0,xs:12,children:(0,g.jsx)(p.R,{scopes:[d.OV.ADMIN_HEALTH_INFO],resource:d.Ms,errorProps:{disabled:!0},children:(0,g.jsx)(l.bQt,{columns:[{label:c.time,elementKey:"time",enableSort:!0},{label:c.api_name,elementKey:"api_name"},{label:c.access_key,elementKey:"access_key"},{label:c.bucket,elementKey:"bucket"},{label:c.object,elementKey:"object"},{label:c.remote_host,elementKey:"remote_host"},{label:c.request_id,elementKey:"request_id"},{label:c.user_agent,elementKey:"user_agent"},{label:c.response_status,elementKey:"response_status",renderFunction:e=>(0,g.jsx)(s.Fragment,{children:(0,g.jsxs)("span",{children:[e.response_status_code," (",e.response_status,")"]})}),renderFullObject:!0},{label:c.request_content_length,elementKey:"request_content_length",renderFunction:r.nO},{label:c.response_content_length,elementKey:"response_content_length",renderFunction:r.nO},{label:c.time_to_response_ns,elementKey:"time_to_response_ns",renderFunction:r.Wi,contentTextAlign:"right"}],isLoading:n,records:F,entityName:"Logs",customEmptyMessage:"There is no information with this criteria",idField:"request_id",columnsSelector:!0,columnsShown:G,onColumnChange:e=>{let t;t=G.findIndex(t=>t===e)>=0?G.filter(t=>t!==e):[...G,e],Y(t)},customPaperHeight:E?"calc(100vh - 520px)":"calc(100vh - 320px)",sortEnabled:{currentSort:"time",currentDirection:U,onSortClick:e=>{const t=i()(e,"sortDirection","DESC");$(t),Q(0),a(!0)}},infiniteScrollConfig:{recordsCount:1e6,loadMoreRecords:e=>(oe(),new Promise(e=>{ae=e}))},itemActions:[{type:"view",onClick:e=>{se(e),te(!0)}}],textSelectable:!0})})})]}):(0,g.jsx)(C,{entity:"Audit Logs",iconComponent:(0,g.jsx)(l.WIv,{}),documentationLink:"https://docs.min.io/community/minio-object-store/operations/monitoring/minio-logging.html"})})]})}},77517:(e,t,n)=>{n.d(t,{A:()=>o});var s=n(9950),a=n(89132),i=n(44414);const o=e=>{let{timeStart:t,setTimeStart:n,timeEnd:o,setTimeEnd:l,triggerSync:r,label:c="Filter:",startLabel:d="Start Time:",endLabel:m="End Time:"}=e;return(0,i.jsx)(a.xA9,{item:!0,xs:12,sx:{"& .filter-date-input-label, .end-time-input-label":{display:"none"},"& .MuiInputBase-adornedEnd.filter-date-date-time-input":{width:"100%",border:"1px solid #eaeaea",paddingLeft:"8px",paddingRight:"8px",borderRadius:"1px"},"& .MuiInputAdornment-root button":{height:"20px",width:"20px",marginRight:"5px"},"& .filter-date-input-wrapper":{height:"30px",width:"100%","& .MuiTextField-root":{height:"30px",width:"90%","& input.Mui-disabled":{color:"#000000",WebkitTextFillColor:"#101010"}}}},children:(0,i.jsxs)(a.azJ,{sx:{display:"grid",height:40,alignItems:"center",gridTemplateColumns:"auto 2fr auto",padding:0,["@media (max-width: ".concat(a.nmC.sm,"px)")]:{padding:5},["@media (max-width: ".concat(a.nmC.md,"px)")]:{gridTemplateColumns:"1fr",height:"auto"},gap:"5px"},children:[(0,i.jsx)(a.azJ,{sx:{fontSize:"14px",fontWeight:500,marginRight:"5px"},className:"muted",children:c}),(0,i.jsxs)(a.azJ,{customBorderPadding:"0px",sx:{display:"grid",height:40,alignItems:"center",gridTemplateColumns:"1fr 1fr",gap:"8px",paddingLeft:"8px",paddingRight:"8px",["@media (max-width: ".concat(a.nmC.md,"px)")]:{height:"auto",gridTemplateColumns:"1fr"}},children:[(0,i.jsx)(a.e8j,{value:t,onChange:n,id:"stTime",secondsSelector:!1,pickerStartComponent:(0,i.jsxs)(s.Fragment,{children:[(0,i.jsx)(a.b1c,{}),(0,i.jsx)("span",{children:d})]})}),(0,i.jsx)(a.e8j,{value:o,onChange:l,id:"endTime",secondsSelector:!1,pickerStartComponent:(0,i.jsxs)(s.Fragment,{children:[(0,i.jsx)(a.b1c,{}),(0,i.jsx)("span",{children:m})]})})]}),r&&(0,i.jsx)(a.azJ,{sx:{alignItems:"flex-end",display:"flex",justifyContent:"flex-end"},children:(0,i.jsx)(a.$nd,{id:"sync",type:"button",variant:"callAction",onClick:r,icon:(0,i.jsx)(a.Fjq,{}),label:"Sync"})})]})})}}}]); ================================================ FILE: web-app/build/static/js/4186.1b3f78a1.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4186],{74186:(e,t,o)=>{o.r(t),o.d(t,{default:()=>i});var a=o(9950),c=o(28429),s=o(99491),n=o(59908),r=o(49078),l=o(86070),p=o(2586),u=o(98734),g=o(44414);const i=()=>{const e=(0,s.jL)(),t=(0,c.Zp)();return(0,a.useEffect)(()=>{const o=()=>{e((0,r.WQ)(!1)),e({type:"socket/OBDisconnect"}),localStorage.setItem("userLoggedIn",""),localStorage.setItem("redirect-path",""),e((0,l.wD)()),(0,n.q7)(),t("/login"),window.location.reload()};(()=>{const e=localStorage.getItem("auth-state");p.A.invoke("POST","/api/v1/logout",{state:e}).then(o).catch(e=>{console.error(e),o()})})()},[e,t]),(0,g.jsx)(u.A,{})}}}]); ================================================ FILE: web-app/build/static/js/4274.d6ff493f.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4274,7958],{5134:(e,s,t)=>{t.d(s,{A:()=>h});var n=t(9950),a=t(87946),r=t.n(a),o=t(89132),c=t(20416),i=t(49078),l=t(99491),d=t(2586),u=t(27428),x=t(44414);const h=e=>{let{selectedGroups:s,setSelectedGroups:t}=e;const a=(0,l.jL)(),[h,p]=(0,n.useState)([]),[m,j]=(0,n.useState)(!1),[y,g]=(0,n.useState)(""),A=(0,n.useCallback)(()=>{d.A.invoke("GET","/api/v1/groups").then(e=>{let s=r()(e,"groups",[]);s||(s=[]),p(s.sort(c.SO)),j(!1)}).catch(e=>{a((0,i.Dy)(e)),j(!1)})},[a]);(0,n.useEffect)(()=>{j(!0)},[]),(0,n.useEffect)(()=>{m&&A()},[m,A]);const b=s||[],f=h.filter(e=>e.includes(y));return(0,x.jsxs)(o.xA9,{item:!0,xs:12,className:"inputItem",children:[m&&(0,x.jsx)(o.z21,{}),null!==h&&h.length>0?(0,x.jsxs)(n.Fragment,{children:[(0,x.jsx)(o.xA9,{item:!0,xs:12,className:"inputItem",children:(0,x.jsx)(u.A,{placeholder:"Start typing to search for Groups",onChange:g,value:y,label:"Assign Groups"})}),(0,x.jsx)(o.bQt,{columns:[{label:"Group"}],onSelect:e=>{const s=e.target,n=s.value,a=s.checked;let r=[...b];return a?r.push(n):r=r.filter(e=>e!==n),t(r),r},selectedItems:b,isLoading:m,records:f,entityName:"Groups",idField:"",customPaperHeight:"200px"})]}):(0,x.jsx)(o.azJ,{sx:{textAlign:"center",padding:"10px 0"},children:"No Groups Available"})]})}},23701:(e,s,t)=>{t.d(s,{A:()=>b});var n=t(89379),a=t(9950),r=t(87946),o=t.n(r),c=t(19335),i=t(89132),l=t(32680),d=t(95189),u=t.n(d),x=t(49078),h=t(99491),p=t(44414);const m=e=>{let{label:s="",value:t=""}=e;const n=(0,h.jL)();return(0,p.jsxs)(i.azJ,{sx:{marginTop:12},children:[(0,p.jsx)(i.l1Y,{children:s}),(0,p.jsx)(i.EmB,{actionButton:(0,p.jsx)(u(),{text:t,children:(0,p.jsx)(i.$nd,{id:"copy-path",variant:"regular",onClick:()=>{n((0,x.h0)("".concat(s," copied to clipboard")))},style:{marginRight:"5px",width:"28px",height:"28px",padding:"0px"},icon:(0,p.jsx)(i.TdU,{})})}),children:t})]})};var j=t(30272),y=t(45246);const g=c.Ay.div(e=>{let{theme:s}=e;return{color:o()(s,"signalColors.danger","#C51B3F"),fontSize:".85rem",margin:".5rem 0 .5rem 0",display:"flex",alignItems:"center","& svg ":{marginRight:".3rem",height:16,width:16}}}),A=(e,s)=>{let t=document.createElement("a");t.setAttribute("href","data:text/plain;charset=utf-8,"+s),t.setAttribute("download",e),t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)},b=e=>{let{newServiceAccount:s,open:t,closeModal:r,entity:c}=e;if(!s)return null;const d=o()(s,"console",null),u=o()(s,"idp",!1);return(0,p.jsx)(l.A,{modalOpen:t,onClose:()=>{r()},title:"New ".concat(c," Created"),titleIcon:(0,p.jsx)(i.kQt,{}),children:(0,p.jsxs)(i.xA9,{container:!0,children:[(0,p.jsxs)(i.xA9,{item:!0,xs:12,children:["A new ",c," has been created with the following details:",!u&&d&&(0,p.jsx)(a.Fragment,{children:(0,p.jsxs)(i.xA9,{item:!0,xs:12,sx:{overflowY:"auto",maxHeight:350},children:[(0,p.jsx)(i.azJ,{sx:{padding:".8rem 0 0 0",fontWeight:600,fontSize:".9rem"},children:"Console Credentials"}),Array.isArray(d)&&d.map((e,s)=>(0,p.jsxs)(a.Fragment,{children:[(0,p.jsx)(m,{label:"Access Key",value:e.accessKey}),(0,p.jsx)(m,{label:"Secret Key",value:e.secretKey})]})),!Array.isArray(d)&&(0,p.jsxs)(a.Fragment,{children:[(0,p.jsx)(m,{label:"Access Key",value:d.accessKey}),(0,p.jsx)(m,{label:"Secret Key",value:d.secretKey})]})]})}),(null===d||void 0===d)&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(m,{label:"Access Key",value:s.accessKey||""}),(0,p.jsx)(m,{label:"Secret Key",value:s.secretKey||""})]}),u?(0,p.jsx)(g,{children:"Please Login via the configured external identity provider."}):(0,p.jsxs)(g,{children:[(0,p.jsx)(i.cJw,{}),(0,p.jsx)("span",{children:"Write these down, as this is the only time the secret will be displayed."})]})]}),(0,p.jsx)(i.xA9,{item:!0,xs:12,sx:(0,n.A)({},y.Uz.modalButtonBar),children:!u&&(0,p.jsxs)(a.Fragment,{children:[(0,p.jsx)(j.A,{tooltip:"Download credentials in a JSON file formatted for import using mc alias import. This will only include the default login credentials.",children:(0,p.jsx)(i.$nd,{id:"download-button",label:"Download for import",onClick:()=>{let e={};if(d)if(Array.isArray(d)){e=d.map(e=>({url:e.url,accessKey:e.accessKey,secretKey:e.secretKey,api:"s3v4",path:"auto"}))[0]}else e={url:d.url,accessKey:d.accessKey,secretKey:d.secretKey,api:"s3v4",path:"auto"};else e={url:s.url,accessKey:s.accessKey,secretKey:s.secretKey,api:"s3v4",path:"auto"};A("credentials.json",JSON.stringify((0,n.A)({},e)))},icon:(0,p.jsx)(i.s3U,{}),variant:"callAction"})}),Array.isArray(d)&&d.length>1&&(0,p.jsx)(j.A,{tooltip:"Download all access credentials to a JSON file. NOTE: This file is not formatted for import using mc alias import. If you plan to import this alias from the file, please use the Download for Import button. ",children:(0,p.jsx)(i.$nd,{id:"download-all-button",label:"Download all access credentials",onClick:()=>{let e={};if(d&&Array.isArray(d)&&d.length>1){e=d.map(e=>({accessKey:e.accessKey,secretKey:e.secretKey}))}A("all_credentials.json",JSON.stringify((0,n.A)({},e)))},icon:(0,p.jsx)(i.s3U,{}),variant:"callAction",color:"primary"})})]})})]})})}},33312:(e,s,t)=>{t.d(s,{A:()=>o});t(9950);var n=t(19335),a=t(44414);const r=n.Ay.h1(()=>({padding:0,margin:0,fontSize:".9rem"})),o=e=>{let{children:s}=e;return(0,a.jsx)(r,{children:s})}},40038:(e,s,t)=>{t.d(s,{A:()=>h});var n=t(9950),a=t(89132),r=t(20416),o=t(27428),c=t(49078),i=t(99491),l=t(5887),d=t(98341),u=t(70444),x=t(44414);const h=e=>{let{noTitle:s=!1}=e;const t=(0,i.jL)(),[h,p]=(0,n.useState)([]),[m,j]=(0,n.useState)(!1),[y,g]=(0,n.useState)(""),A=(0,d.d4)(e=>e.createUser.selectedPolicies),b=(0,n.useCallback)(()=>{j(!0),u.F.policies.listPolicies().then(e=>{var s;const t=null!==(s=e.data.policies)&&void 0!==s?s:[];j(!1),p(t.sort(r.Hw))}).catch(e=>{j(!1),t((0,c.Dy)(e))})},[t]);(0,n.useEffect)(()=>{j(!0)},[]),(0,n.useEffect)(()=>{m&&b()},[m,b]);const f=h.filter(e=>e.name.includes(y));return(0,x.jsxs)(a.xA9,{item:!0,xs:12,className:"inputItem",children:[m&&(0,x.jsx)(a.z21,{}),h.length>0?(0,x.jsxs)(n.Fragment,{children:[(0,x.jsx)(a.xA9,{item:!0,xs:12,className:"inputItem",children:(0,x.jsx)(o.A,{placeholder:"Start typing to search for a Policy",onChange:e=>{g(e)},value:y,label:s?"":"Assign Policies"})}),(0,x.jsx)(a.bQt,{columns:[{label:"Policy",elementKey:"name"}],onSelect:e=>{const s=e.target,n=s.value,a=s.checked;let r=[...A];a?r.push(n):r=r.filter(e=>e!==n),r=r.filter(e=>""!==e),t((0,l.Gy)(r))},selectedItems:A,isLoading:m,records:f,entityName:"Policies",idField:"name",customPaperHeight:"200px"})]}):(0,x.jsx)(a.azJ,{sx:{textAlign:"center",padding:"10px 0"},children:"No Policies Available"})]})}},77958:(e,s,t)=>{t.r(s),t.d(s,{default:()=>u});var n=t(9950),a=t(49534),r=t(89132),o=t(49078),c=t(99491),i=t(70444),l=t(48965),d=t(44414);const u=e=>{let{closeDeleteModalAndRefresh:s,deleteOpen:t,selectedServiceAccount:u}=e;const x=(0,c.jL)(),[h,p]=(0,n.useState)(!1);if(!u)return null;return(0,d.jsx)(a.A,{title:"Delete Access Key",confirmText:"Delete",isOpen:t,titleIcon:(0,d.jsx)(r.xWY,{}),isLoading:h,onConfirm:()=>{p(!0),i.F.serviceAccounts.deleteServiceAccount(u).then(e=>{s(!0)}).catch(async e=>{const t=await e.json();x((0,o.C9)((0,l.S)(t))),s(!1)}).finally(()=>p(!1))},onClose:()=>s(!1),confirmationContent:(0,d.jsxs)(n.Fragment,{children:["Are you sure you want to delete Access Key"," ",(0,d.jsx)("b",{style:{maxWidth:"200px",whiteSpace:"normal",wordWrap:"break-word"},children:u}),"?"]})})}},82646:(e,s,t)=>{t.r(s),t.d(s,{default:()=>h});var n=t(9950),a=t(28429),r=t(49078),o=t(89132),c=t(93598),i=t(49534),l=t(99491),d=t(70444),u=t(48965),x=t(44414);const h=e=>{let{closeDeleteModalAndRefresh:s,deleteOpen:t,selectedUsers:h}=e;const p=(0,a.Zp)(),m=(0,l.jL)(),j=()=>s(!1),[y,g]=(0,n.useState)(!0),[A,b]=(0,n.useState)(!1),[f,S]=(0,n.useState)([]),[v,C]=(0,n.useState)(!1),_=localStorage.getItem("userLoggedIn")||"";if((0,n.useEffect)(()=>{h&&d.F.users.checkUserServiceAccounts(h).then(e=>{var s;e.data&&(S(null!==(s=e.data.userServiceAccountList)&&void 0!==s?s:[]),e.data.hasSA&&b(!0))}).catch(e=>m((0,r.C9)((0,u.S)(e.error)))).finally(()=>g(!1))},[h,m]),!h)return null;const E=h.map(e=>(0,x.jsx)("div",{children:(0,x.jsx)("b",{children:e})},e)),U=[{type:"view",onClick:e=>{p("".concat(c.zZ.USERS,"/").concat(encodeURIComponent(e.userName))),j()}}],w="Are you sure you want to delete the following "+h.length+" user"+(h.length>1?"s?":"?");return(0,x.jsx)(i.A,{title:"Delete User".concat(h.length>1?"s":""),confirmText:"Delete",isOpen:t,titleIcon:(0,x.jsx)(o.xWY,{}),isLoading:v,onConfirm:()=>{for(let e of h)e===_?(m((0,r.C9)({errorMessage:"Cannot delete currently logged in user",detailedError:"Cannot delete currently logged in user ".concat(_)})),s(!0)):d.F.user.removeUser(e).then(e=>{s(!0),p("".concat(c.zZ.USERS))}).finally(()=>C(!1))},onClose:j,confirmationContent:y?(0,x.jsx)(o.aHM,{}):(0,x.jsx)(n.Fragment,{children:A?(0,x.jsxs)(n.Fragment,{children:[(0,x.jsx)(o.Wei,{variant:"warning",message:(0,x.jsxs)(n.Fragment,{children:["Click on a user to view the full listing of associated Access Keys. All Access Keys associated with a user will be deleted along with the user.",(0,x.jsx)("br",{}),(0,x.jsx)("br",{}),(0,x.jsx)("strong",{children:"Are you sure you want to continue?"})]}),title:"Warning: One or more users selected has associated Access Keys.",sx:{margin:"15px 0"}}),(0,x.jsx)(o.bQt,{itemActions:U,columns:[{label:"Username",elementKey:"userName"},{label:"# Associated Access Keys",elementKey:"numSAs"}],isLoading:y,records:f,entityName:"User Access Keys",idField:"userName",customPaperHeight:"250"})]}):(0,x.jsxs)(n.Fragment,{children:[w,E]})})})}},84274:(e,s,t)=>{t.r(s),t.d(s,{default:()=>se});var n=t(9950),a=t(28429),r=t(20171),o=t(89132),c=t(20416),i=t(45246),l=t(93598),d=t(2586),u=t(27428),x=t(55604),h=t(26843),p=t(49078),m=t(99491),j=t(30272),y=t(82817),g=t(70503),A=t(44414);const b=(0,x.A)(n.lazy(()=>Promise.resolve().then(t.bind(t,82646)))),f=(0,x.A)(n.lazy(()=>t.e(5465).then(t.bind(t,45465)))),S=()=>{const e=(0,m.jL)(),s=(0,a.Zp)(),[t,r]=(0,n.useState)([]),[x,S]=(0,n.useState)(!0),[v,C]=(0,n.useState)(!1),[_,E]=(0,n.useState)(!1),[U,w]=(0,n.useState)(""),[I,O]=(0,n.useState)([]),R=(0,h._)(l.Ms,l.x6),M=(0,h._)(l.Ms,l.Ld),K=(0,h._)(l.Ms,l.BD),D=(0,h._)(l.Ms,l.Dg);(0,n.useEffect)(()=>{x&&(R?d.A.invoke("GET","/api/v1/users").then(e=>{const s=null===e.users?[]:e.users;S(!1),r(s.sort(c.LA))}).catch(s=>{S(!1),e((0,p.C9)(s))}):S(!1))},[x,e,R]);const k=t.filter(e=>e.accessKey.includes(U)),P=e=>{s("".concat(l.zZ.USERS,"/").concat(encodeURIComponent(e.accessKey)))},z=[{type:"view",onClick:P,disableButtonFunction:()=>!M},{type:"edit",onClick:P,disableButtonFunction:()=>!M}];return(0,n.useEffect)(()=>{e((0,p.ph)("list_users"))},[]),(0,A.jsxs)(n.Fragment,{children:[v&&(0,A.jsx)(b,{deleteOpen:v,selectedUsers:I,closeDeleteModalAndRefresh:e=>{(e=>{C(!1),e&&(S(!0),O([]))})(e)}}),_&&(0,A.jsx)(f,{open:_,checkedUsers:I,closeModalAndRefresh:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];E(!1),e&&O([])}(e)}}),(0,A.jsx)(y.A,{label:"Users",actions:(0,A.jsx)(g.A,{})}),(0,A.jsx)(o.Mxu,{children:(0,A.jsxs)(o.xA9,{container:!0,children:[(0,A.jsxs)(o.xA9,{item:!0,xs:12,sx:i._0.actionsTray,children:[(0,A.jsx)(u.A,{placeholder:"Search Users",onChange:w,value:U,sx:{marginRight:"auto",maxWidth:380}}),(0,A.jsx)(h.R,{resource:l.Ms,scopes:[l.OV.ADMIN_DELETE_USER],matchAll:!0,errorProps:{disabled:!0},children:(0,A.jsx)(j.A,{tooltip:(0,h._)("console",[l.OV.ADMIN_DELETE_USER])?0===I.length?"Select Users to delete":"Delete Selected":(0,l.vj)([l.OV.ADMIN_DELETE_USER],"delete users"),children:(0,A.jsx)(o.$nd,{id:"delete-selected-users",onClick:()=>{C(!0)},label:"Delete Selected",icon:(0,A.jsx)(o.d7y,{}),disabled:0===I.length,variant:"secondary","aria-label":"delete-selected-users"})})}),(0,A.jsx)(h.R,{scopes:[l.OV.ADMIN_ADD_USER_TO_GROUP],resource:l.Ms,errorProps:{disabled:!0},children:(0,A.jsx)(j.A,{tooltip:(0,h._)("console",[l.OV.ADMIN_ADD_USER_TO_GROUP])?0===I.length?"Select Users to group":"Add to Group":(0,l.vj)([l.OV.ADMIN_ADD_USER_TO_GROUP],"add users to groups"),children:(0,A.jsx)(o.$nd,{id:"add-to-group",label:"Add to Group",icon:(0,A.jsx)(o.YXz,{}),disabled:I.length<=0,onClick:()=>{I.length>0&&E(!0)},variant:"regular"})})}),(0,A.jsx)(h.R,{scopes:[l.OV.ADMIN_CREATE_USER,l.OV.ADMIN_LIST_USER_POLICIES,l.OV.ADMIN_LIST_GROUPS],resource:l.HD,matchAll:!0,errorProps:{disabled:!0},children:(0,A.jsx)(j.A,{tooltip:(0,h._)("console-ui",[l.OV.ADMIN_CREATE_USER,l.OV.ADMIN_LIST_USER_POLICIES,l.OV.ADMIN_LIST_GROUPS,l.OV.ADMIN_ATTACH_USER_OR_GROUP_POLICY],!0)?"Create User":(0,l.vj)([l.OV.ADMIN_CREATE_USER,l.OV.ADMIN_LIST_USER_POLICIES,l.OV.ADMIN_LIST_GROUPS,l.OV.ADMIN_ATTACH_USER_OR_GROUP_POLICY],"create users"),children:(0,A.jsx)(o.$nd,{id:"create-user",label:"Create User",icon:(0,A.jsx)(o.REV,{}),onClick:()=>{s("".concat(l.zZ.USER_ADD))},variant:"callAction",disabled:!(0,h._)("console-ui",[l.OV.ADMIN_CREATE_USER,l.OV.ADMIN_LIST_USER_POLICIES,l.OV.ADMIN_LIST_GROUPS,l.OV.ADMIN_ATTACH_USER_OR_GROUP_POLICY],!0)})})})]}),x&&(0,A.jsx)(o.z21,{}),!x&&(0,A.jsxs)(n.Fragment,{children:[t.length>0&&(0,A.jsxs)(n.Fragment,{children:[(0,A.jsx)(o.xA9,{item:!0,xs:12,sx:{marginBottom:15},children:(0,A.jsx)(h.R,{scopes:[l.OV.ADMIN_LIST_USERS],resource:l.Ms,errorProps:{disabled:!0},children:(0,A.jsx)(o.bQt,{itemActions:z,columns:[{label:"Access Key",elementKey:"accessKey"}],onSelect:K||D?e=>{const{target:{value:s="",checked:t=!1}={}}=e;let n=[...I];return t?n.push(s):n=n.filter(e=>e!==s),O(n),n}:void 0,selectedItems:I,isLoading:x,records:k,entityName:"Users",idField:"accessKey"})})}),(0,A.jsx)(o.lVp,{title:"Users",iconComponent:(0,A.jsx)(o.c2u,{}),help:(0,A.jsxs)(n.Fragment,{children:["A MinIO user consists of a unique access key (username) and corresponding secret key (password). Clients must authenticate their identity by specifying both a valid access key (username) and the corresponding secret key (password) of an existing MinIO user.",(0,A.jsx)("br",{}),"Groups provide a simplified method for managing shared permissions among users with common access patterns and workloads.",(0,A.jsx)("br",{}),(0,A.jsx)("br",{}),"Users inherit access permissions to data and resources through the groups they belong to.",(0,A.jsx)("br",{}),"MinIO uses Policy-Based Access Control (PBAC) to define the authorized actions and resources to which an authenticated user has access. Each policy describes one or more actions and conditions that outline the permissions of a user or group of users.",(0,A.jsx)("br",{}),(0,A.jsx)("br",{}),"Each user can access only those resources and operations which are explicitly granted by the built-in role. MinIO denies access to any other resource or action by default.",(0,A.jsx)("br",{}),(0,A.jsx)("br",{}),"You can learn more at the"," ",(0,A.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/minio-user-management.html",target:"_blank",rel:"noopener",children:"documentation"}),"."]})})]}),0===t.length&&(0,A.jsx)(o.xA9,{container:!0,children:(0,A.jsx)(o.xA9,{item:!0,xs:8,children:(0,A.jsx)(o.lVp,{title:"Users",iconComponent:(0,A.jsx)(o.c2u,{}),help:(0,A.jsxs)(n.Fragment,{children:["A MinIO user consists of a unique access key (username) and corresponding secret key (password). Clients must authenticate their identity by specifying both a valid access key (username) and the corresponding secret key (password) of an existing MinIO user.",(0,A.jsx)("br",{}),"Groups provide a simplified method for managing shared permissions among users with common access patterns and workloads.",(0,A.jsx)("br",{}),(0,A.jsx)("br",{}),"Users inherit access permissions to data and resources through the groups they belong to.",(0,A.jsx)("br",{}),"MinIO uses Policy-Based Access Control (PBAC) to define the authorized actions and resources to which an authenticated user has access. Each policy describes one or more actions and conditions that outline the permissions of a user or group of users.",(0,A.jsx)("br",{}),(0,A.jsx)("br",{}),"Each user can access only those resources and operations which are explicitly granted by the built-in role. MinIO denies access to any other resource or action by default.",(0,A.jsxs)(h.R,{scopes:[l.OV.ADMIN_CREATE_USER,l.OV.ADMIN_LIST_USER_POLICIES,l.OV.ADMIN_LIST_GROUPS],matchAll:!0,resource:l.Ms,children:[(0,A.jsx)("br",{}),(0,A.jsx)("br",{}),"To get started,"," ",(0,A.jsx)(o.t53,{onClick:()=>{s("".concat(l.zZ.USER_ADD))},children:"Create a User"}),"."]})]})})})})]})]})})]})};var v=t(5134),C=t(32680);const _=e=>{let{closeModalAndRefresh:s,selectedUser:t,open:a}=e;const r=(0,m.jL)(),[c,l]=(0,n.useState)(!1),[u,x]=(0,n.useState)(""),[h,j]=(0,n.useState)(""),[y,g]=(0,n.useState)(!1),[b,f]=(0,n.useState)([]),S=(0,n.useCallback)(()=>{if(!t)return null;d.A.invoke("GET","/api/v1/user/".concat(encodeURIComponent(t))).then(e=>{l(!1),x(e.accessKey),f(e.memberOf||[]),g("enabled"===e.status)}).catch(e=>{l(!1),r((0,p.Dy)(e))})},[t,r]);(0,n.useEffect)(()=>{null===t?(x(""),j(""),f([])):S()},[t,S]);const _=""!==u.trim()&&(""!==h.trim()&&null===t||null!==t);return(0,A.jsx)(C.A,{onClose:()=>{s()},modalOpen:a,title:"Set Groups",titleIcon:(0,A.jsx)(o.WC,{}),children:(0,A.jsx)(n.Fragment,{children:(0,A.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),c||(l(!0),null!==t?d.A.invoke("PUT","/api/v1/user/".concat(encodeURIComponent(t)),{status:y?"enabled":"disabled",groups:b}).then(e=>{l(!1),s()}).catch(e=>{l(!1),r((0,p.Dy)(e))}):d.A.invoke("POST","/api/v1/users",{accessKey:u,secretKey:h,groups:b}).then(e=>{l(!1),s()}).catch(e=>{l(!1),r((0,p.Dy)(e))}))},children:[(0,A.jsx)(o.Hbc,{withBorders:!1,containerPadding:!1,children:(0,A.jsx)(v.A,{selectedGroups:b,setSelectedGroups:e=>{f(e)}})}),(0,A.jsxs)(o.azJ,{sx:i.Uz.modalButtonBar,children:[(0,A.jsx)(o.$nd,{id:"clear-change-user-groups",type:"button",variant:"regular",onClick:()=>{null===t?(x(""),j(""),f([])):f([])},label:"Clear"}),(0,A.jsx)(o.$nd,{id:"save-user-groups",type:"submit",variant:"callAction",disabled:c||!_,label:"Save"})]}),c&&(0,A.jsx)(o.xA9,{item:!0,xs:12,children:(0,A.jsx)(o.z21,{})})]})})})};var E=t(98341),U=t(5887),w=t(40038);const I=e=>{let{closeModalAndRefresh:s,selectedUser:t,currentPolicies:a,open:r}=e;const c=(0,m.jL)(),[l,u]=(0,n.useState)(!1),[x,h]=(0,n.useState)([]),j=(0,E.d4)(e=>e.createUser.selectedPolicies);return(0,n.useEffect)(()=>{if(r){const e=a.map(e=>e.policy);h(e),c((0,U.Gy)(e))}},[r,t]),(0,A.jsxs)(C.A,{onClose:()=>{s()},modalOpen:r,title:"Set Policies",titleIcon:(0,A.jsx)(o.n$X,{}),children:[(0,A.jsx)(o.Hbc,{withBorders:!1,containerPadding:!1,children:(0,A.jsx)(w.A,{selectedPolicy:j})}),(0,A.jsxs)(o.azJ,{sx:i.Uz.modalButtonBar,children:[(0,A.jsx)(o.$nd,{id:"reset-user-policies",type:"button",variant:"regular",color:"primary",onClick:()=>{c((0,U.Gy)(x))},label:"Reset"}),(0,A.jsx)(o.$nd,{id:"save-user-policy",type:"button",variant:"callAction",color:"primary",disabled:l,onClick:()=>{let e=t;u(!0),d.A.invoke("PUT","/api/v1/set-policy",{name:j,entityName:e,entityType:"user"}).then(()=>{u(!1),c((0,U.Gy)([])),s()}).catch(e=>{u(!1),c((0,p.Dy)(e))})},label:"Save"})]}),l&&(0,A.jsx)(o.xA9,{item:!0,xs:12,children:(0,A.jsx)(o.z21,{})})]})};var O=t(77958),R=t(23701),M=t(43878),K=t(7174),D=t(85743),k=t(42677);const P=e=>{let{user:s,hasPolicy:t}=e;const r=(0,m.jL)(),i=(0,a.Zp)(),[u,x]=(0,n.useState)([]),[y,g]=(0,n.useState)(!1),[b,f]=(0,n.useState)(!1),[S,v]=(0,n.useState)(null),[C,_]=(0,n.useState)(!1),[E,U]=(0,n.useState)(null),[w,I]=(0,n.useState)([]),[P,z]=(0,n.useState)(!1),[N,T]=(0,n.useState)(!1);(0,n.useEffect)(()=>{L()},[]),(0,n.useEffect)(()=>{y&&d.A.invoke("GET","/api/v1/user/".concat(encodeURIComponent(s),"/service-accounts")).then(e=>{g(!1);const s=e.sort(c.LA);x(s)}).catch(e=>{r((0,p.C9)(e)),g(!1)})},[y,g,x,s,r]);const L=()=>{g(!0)},F=e=>{v(e),T(!0)},G=[{type:"view",onClick:e=>{e&&F(e.accessKey)}},{type:"delete",onClick:e=>{e&&(e=>{v(e),f(!0)})(e.accessKey)}},{type:"edit",onClick:e=>{e&&F(e.accessKey)}}];return(0,n.useEffect)(()=>{r((0,p.ph)("user_details_accounts"))},[]),(0,A.jsxs)(n.Fragment,{children:[b&&(0,A.jsx)(O.default,{deleteOpen:b,selectedServiceAccount:S,closeDeleteModalAndRefresh:e=>{(e=>{f(!1),e&&L()})(e)}}),P&&(0,A.jsx)(M.A,{deleteOpen:P,selectedSAs:w,closeDeleteModalAndRefresh:e=>{z(!1),e&&(r((0,p.Hk)("Access Keys deleted successfully.")),I([]),g(!0))}}),C&&(0,A.jsx)(R.A,{newServiceAccount:E,open:C,closeModal:()=>{_(!1),U(null)},entity:"Access Key"}),N&&(0,A.jsx)(D.A,{open:N,selectedAccessKey:S,closeModalAndRefresh:()=>{T(!1),g(!0)}}),(0,A.jsx)(o._xt,{separator:!0,sx:{marginBottom:15},actions:(0,A.jsxs)(o.azJ,{sx:{display:"flex",justifyContent:"flex-end",gap:10},children:[(0,A.jsx)(j.A,{tooltip:"Delete Selected",children:(0,A.jsx)(o.$nd,{id:"delete-selected",onClick:()=>{z(!0)},label:"Delete Selected",icon:(0,A.jsx)(o.d7y,{}),disabled:0===w.length,variant:"secondary"})}),(0,A.jsx)(h.R,{scopes:[l.OV.ADMIN_CREATE_SERVICEACCOUNT,l.OV.ADMIN_UPDATE_SERVICEACCOUNT,l.OV.ADMIN_REMOVE_SERVICEACCOUNT,l.OV.ADMIN_LIST_SERVICEACCOUNTS],resource:l.Ms,matchAll:!0,errorProps:{disabled:!0},children:(0,A.jsx)(j.A,{tooltip:"Create Access Key",children:(0,A.jsx)(o.$nd,{id:"create-service-account",label:"Create Access Key",variant:"callAction",icon:(0,A.jsx)(o.REV,{}),onClick:()=>{i("/identity/users/new-user-sa/".concat(encodeURIComponent(s)))},disabled:!t})})})]}),children:"Access Keys"}),(0,A.jsx)(o.bQt,{itemActions:G,entityName:"Access Keys",columns:k.X,onSelect:e=>(0,K.Qm)(e,I,w),selectedItems:w,isLoading:y,records:u,idField:"accessKey"})]})};var z=t(70444),N=t(48965);const T=e=>{let{open:s,userName:t,closeModal:a}=e;const r=(0,m.jL)(),[c,l]=(0,n.useState)(""),[d,u]=(0,n.useState)(""),[x,h]=(0,n.useState)(!1);return s?(0,A.jsx)(C.A,{title:"Change User Password",modalOpen:s,onClose:()=>{l(""),u(""),a()},titleIcon:(0,A.jsx)(o.Fwq,{}),children:(0,A.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{(e=>{if(e.preventDefault(),x)return;if(h(!0),c.length<8)return r((0,p.Dy)({errorMessage:"Passwords must be at least 8 characters long",detailedError:""})),void h(!1);let s={selectedUser:t,newSecretKey:c};z.F.account.changeUserPassword(s).then(e=>{h(!1),l(""),u(""),r((0,p.Hk)("Successfully updated the password for the user ".concat(t,"."))),a()}).catch(async e=>{h(!1),l(""),u("");const s=await e.json();r((0,p.C9)((0,N.S)(s)))})})(e)},children:(0,A.jsxs)(o.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,A.jsxs)(o.azJ,{sx:{margin:"10px 0 20px"},children:["Change password for: ",(0,A.jsx)("strong",{children:t})]}),(0,A.jsx)(o.cl_,{id:"new-password",name:"new-password",onChange:e=>{l(e.target.value)},label:"New Password",type:"password",value:c}),(0,A.jsx)(o.cl_,{id:"re-new-password",name:"re-new-password",onChange:e=>{u(e.target.value)},label:"Type New Password Again",type:"password",value:d}),(0,A.jsx)(o.azJ,{sx:i.Uz.modalButtonBar,children:(0,A.jsx)(o.$nd,{id:"save-user-password",type:"submit",variant:"callAction",color:"primary",disabled:x||!(d.length>0&&c===d),label:"Save"})}),x&&(0,A.jsx)(o.azJ,{children:(0,A.jsx)(o.z21,{})})]})})}):null};var L=t(82646);const F=()=>{const e=(0,m.jL)(),s=(0,a.g)(),t=(0,a.Zp)(),[r,i]=(0,n.useState)(!1),[u,x]=(0,n.useState)(!1),[b,f]=(0,n.useState)(!1),[S,v]=(0,n.useState)(!1),[C,E]=(0,n.useState)(!1),[U,w]=(0,n.useState)([]),[O,R]=(0,n.useState)([]),[M,K]=(0,n.useState)([]),[D,k]=(0,n.useState)(!1),[z,N]=(0,n.useState)(!1),[F,G]=(0,n.useState)(!1),[J,B]=(0,n.useState)("groups"),V=(0,h._)(l.Ms,l.Ho)&&!C,$=(0,h._)(l.Ms,l.m0)&&C,H=s.userName||"",Y=localStorage.getItem("userLoggedIn")||"",Z=(0,h._)(l.Ms,l.$X,!0),W=(0,h._)(l.Ms,l.Lb,!0),Q=(0,h._)(l.Ms,l.Oh),q=(0,n.useCallback)(()=>{if(""===H)return null;i(!0),d.A.invoke("GET","/api/v1/user/".concat(encodeURIComponent(H))).then(e=>{v(!1);const s=e.memberOf||[];w(s);const t=s.map(e=>({group:e}));R(t);const n=e.policy.map(e=>({policy:e}));n.sort(c.rY),K(n),E("enabled"===e.status),G(e.hasPolicy),i(!1)}).catch(s=>{v(!1),i(!1),e((0,p.Dy)(s))})},[H,e]);(0,n.useEffect)(()=>{e((0,p.ph)("user_details_groups"))},[]),(0,n.useEffect)(()=>{q()},[q]);const X=[{type:"view",onClick:e=>{t("".concat(l.zZ.GROUPS,"/").concat(encodeURIComponent(e.group)))},disableButtonFunction:()=>!Q}];return(0,A.jsxs)(n.Fragment,{children:[u&&(0,A.jsx)(_,{open:u,selectedUser:H,closeModalAndRefresh:()=>{x(!1),q()}}),b&&(0,A.jsx)(I,{open:b,selectedUser:H,currentPolicies:M,closeModalAndRefresh:()=>{f(!1),q()}}),z&&(0,A.jsx)(L.default,{deleteOpen:z,selectedUsers:[H],closeDeleteModalAndRefresh:e=>{(e=>{N(!1),e&&q()})(e)}}),D&&(0,A.jsx)(T,{open:D,userName:H,closeModal:()=>k(!1)}),(0,A.jsx)(y.A,{label:(0,A.jsx)(n.Fragment,{children:(0,A.jsx)(o.EGL,{label:"Users",onClick:()=>t(l.zZ.USERS)})}),actions:(0,A.jsx)(g.A,{})}),(0,A.jsx)(o.Mxu,{children:(0,A.jsxs)(o.xA9,{container:!0,children:[(0,A.jsx)(o.xA9,{item:!0,xs:12,children:(0,A.jsx)(o.lcx,{icon:(0,A.jsx)(o.c2u,{width:40}),title:H,subTitle:"",actions:(0,A.jsxs)(n.Fragment,{children:[(0,A.jsx)("span",{style:{fontSize:".8rem",marginRight:".5rem"},children:"User Status:"}),(0,A.jsx)("span",{style:{fontWeight:"bold",fontSize:".9rem",marginRight:".5rem"},children:C?"Enabled":"Disabled"}),(0,A.jsx)(j.A,{tooltip:V||$?"":(0,h._)(l.Ms,l.Ho)?(0,l.vj)(l.m0,"disable users"):(0,h._)(l.Ms,l.m0)?(0,l.vj)(l.Ho,"enable users"):(0,l.vj)(l.ni,"enable or disable users"),children:(0,A.jsx)(o.dOG,{indicatorLabels:["Enabled","Disabled"],checked:C,value:"group_enabled",id:"group-status",name:"group-status",onChange:()=>{var s;E(!C),s=!C,S||(v(!0),d.A.invoke("PUT","/api/v1/user/".concat(encodeURIComponent(H)),{status:s?"enabled":"disabled",groups:U}).then(e=>{v(!1)}).catch(s=>{v(!1),e((0,p.Dy)(s))}))},switchOnly:!0,disabled:!V&&!$})}),(0,A.jsx)(j.A,{tooltip:(0,h._)(l.Ms,l.Dg)?Y===H?"You cannot delete the currently logged in User":"Delete User":(0,l.vj)(l.Dg,"delete user"),children:(0,A.jsx)(o.$nd,{id:"delete-user",onClick:()=>{N(!0)},icon:(0,A.jsx)(o.ucK,{}),variant:"secondary",disabled:!(0,h._)(l.Ms,l.Dg)||Y===H})}),(0,A.jsx)(j.A,{tooltip:"Change Password",children:(0,A.jsx)(o.$nd,{id:"change-user-password",onClick:()=>{k(!0)},icon:(0,A.jsx)(o.aJN,{}),variant:"regular",disabled:Y===H})})]}),sx:{marginBottom:15}})}),(0,A.jsx)(o.xA9,{item:!0,xs:12,children:(0,A.jsx)(o.tUM,{currentTabOrPath:J,onTabClick:B,options:[{tabConfig:{id:"groups",label:"Groups",disabled:!W},content:(0,A.jsxs)(n.Fragment,{children:[(0,A.jsx)(o.azJ,{onMouseMove:()=>e((0,p.ph)("user_details_groups")),children:(0,A.jsx)(o._xt,{separator:!0,sx:{marginBottom:15},actions:(0,A.jsx)(j.A,{tooltip:W?"Assign groups":(0,l.vj)(l.Lb,"add users to groups"),children:(0,A.jsx)(o.$nd,{id:"add-groups",label:"Add to Groups",onClick:()=>{x(!0)},icon:(0,A.jsx)(o.REV,{}),variant:"callAction",disabled:!W})}),children:"Groups"})}),(0,A.jsx)(o.xA9,{item:!0,xs:12,onMouseMove:()=>e((0,p.ph)("user_details_groups")),children:(0,A.jsx)(o.bQt,{itemActions:X,columns:[{label:"Name",elementKey:"group"}],isLoading:r,records:O,entityName:"Groups",idField:"group"})})]})},{tabConfig:{id:"service_accounts",label:"Service Accounts",disabled:!(0,h._)(l.Ms,l.xw)},content:(0,A.jsx)(P,{user:H,hasPolicy:F})},{tabConfig:{id:"policies",label:"Policies",disabled:!Z},content:(0,A.jsxs)(n.Fragment,{children:[(0,A.jsx)(o.azJ,{onMouseMove:()=>e((0,p.ph)("user_details_policies")),children:(0,A.jsx)(o._xt,{separator:!0,sx:{marginBottom:15},actions:(0,A.jsx)(j.A,{tooltip:Z?"Assign Policies":(0,l.vj)(l.$X,"assign policies"),children:(0,A.jsx)(o.$nd,{id:"assign-policies",label:"Assign Policies",onClick:()=>{f(!0)},icon:(0,A.jsx)(o.n$X,{}),variant:"callAction",disabled:!Z})}),children:"Policies"})}),(0,A.jsx)(o.azJ,{children:(0,A.jsx)(o.bQt,{itemActions:[{type:"view",onClick:e=>{t("".concat(l.zZ.POLICIES,"/").concat(encodeURIComponent(e.policy)))}}],columns:[{label:"Name",elementKey:"policy"}],isLoading:r,records:M,entityName:"Policies",idField:"policy"})})]})}]})})]})})]})};var G=t(31628);const J=e=>{let{icon:s,description:t}=e;return(0,A.jsxs)(o.azJ,{sx:{display:"flex","& .min-icon":{marginRight:"10px",height:"23px",width:"23px",marginBottom:"10px"}},children:[s," ",(0,A.jsx)("div",{style:{fontSize:"14px",fontStyle:"italic",color:"#5E5E5E"},children:t})]})},B=()=>(0,A.jsxs)(o.azJ,{sx:{flex:1,border:"1px solid #eaeaea",borderRadius:"2px",display:"flex",flexFlow:"column",padding:"20px",marginTop:0},children:[(0,A.jsxs)(o.azJ,{sx:{fontSize:"16px",fontWeight:600,display:"flex",alignItems:"center",marginBottom:"16px","& .min-icon":{height:"21px",width:"21px",marginRight:"15px"}},children:[(0,A.jsx)(o.nag,{}),(0,A.jsx)("div",{children:"Learn more about the Users feature"})]}),(0,A.jsxs)(o.azJ,{sx:{fontSize:"14px",marginBottom:"15px"},children:["A MinIO user consists of a unique access key (username) and corresponding secret key (password). Clients must authenticate their identity by specifying both a valid access key (username) and the corresponding secret key (password) of an existing MinIO user.",(0,A.jsx)("br",{}),(0,A.jsx)("br",{}),"Each user can have one or more assigned policies that explicitly list the actions and resources to which that user has access. Users can also inherit policies from the groups in which they have membership.",(0,A.jsx)("br",{})]}),(0,A.jsxs)(o.azJ,{sx:{display:"flex",flexFlow:"column"},children:[(0,A.jsx)(J,{icon:(0,A.jsx)(o.c2u,{}),description:"Create Users"}),(0,A.jsx)(J,{icon:(0,A.jsx)(o.YXz,{}),description:"Manage Groups"}),(0,A.jsx)(J,{icon:(0,A.jsx)(o.uYH,{}),description:"Assign Policies"})]})]}),V=()=>{const e=(0,m.jL)(),s=(0,E.d4)(e=>e.createUser.userName);return(0,A.jsx)(o.cl_,{id:"accesskey-input",name:"accesskey-input",label:"User Name",value:s,autoFocus:!0,onChange:s=>{e((0,U.ht)(s.target.value))}})},$=()=>{const e=(0,m.jL)(),s=(0,E.d4)(e=>e.createUser.secretKey);return(0,A.jsx)(o.cl_,{id:"standard-multiline-static",name:"standard-multiline-static",type:"password",label:"Password",value:s,onChange:s=>{e((0,U.ir)(s.target.value))},autoComplete:"current-password"})},H=()=>{const e=(0,m.jL)(),s=(0,E.d4)(e=>e.createUser.selectedPolicies),t=(0,E.d4)(e=>e.createUser.selectedGroups),r=(0,E.d4)(e=>e.createUser.addLoading),c=(0,E.d4)(e=>e.createUser.sendEnabled),d=(0,E.d4)(e=>e.createUser.secretKeylength),u=(0,a.Zp)();e((0,U.yt)());return(0,n.useEffect)(()=>{e((0,p.ph)("add_user"))},[]),(0,A.jsx)(n.Fragment,{children:(0,A.jsxs)(o.xA9,{item:!0,xs:12,children:[(0,A.jsx)(y.A,{label:(0,A.jsx)(o.EGL,{label:"Users",onClick:()=>u(l.zZ.USERS)}),actions:(0,A.jsx)(g.A,{})}),(0,A.jsx)(o.Mxu,{children:(0,A.jsx)(o.Hbc,{title:"Create User",icon:(0,A.jsx)(o.R$W,{}),helpBox:(0,A.jsx)(B,{}),children:(0,A.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:s=>{(s=>{if(s.preventDefault(),d<8)return e((0,p.C9)({errorMessage:"Passwords must be at least 8 characters long",detailedError:""})),void e((0,U.AE)(!1));r||(e((0,U.AE)(!0)),e((0,G.y)()).unwrap().then(()=>u("".concat(l.zZ.USERS))))})(s)},children:[(0,A.jsx)(V,{}),(0,A.jsx)($,{}),(0,A.jsx)(w.A,{selectedPolicy:s}),(0,A.jsx)(v.A,{selectedGroups:t,setSelectedGroups:s=>{e((0,U.yD)(s))}}),r&&(0,A.jsx)(o.xA9,{item:!0,xs:12,children:(0,A.jsx)(o.z21,{})}),(0,A.jsxs)(o.xA9,{item:!0,xs:12,sx:i.Uz.modalButtonBar,children:[(0,A.jsx)(o.$nd,{id:"clear-add-user",type:"button",variant:"regular",onClick:s=>{e((0,G.o)())},label:"Clear"}),(0,A.jsx)(o.$nd,{id:"save-user",type:"submit",variant:"callAction",color:"primary",disabled:r||!c,label:"Save"})]})]})})})]})})};var Y=t(89379),Z=t(59908),W=t(94797);const Q=e=>{let{icon:s,description:t}=e;return(0,A.jsxs)(o.azJ,{sx:{display:"flex","& .min-icon":{marginRight:"10px",height:"23px",width:"23px",marginBottom:"10px"}},children:[s," ",(0,A.jsx)("div",{style:{fontSize:"14px",fontStyle:"italic",color:"#5E5E5E"},children:t})]})},q=()=>(0,A.jsxs)(o.azJ,{sx:{flex:1,border:"1px solid #eaeaea",borderRadius:"2px",display:"flex",flexFlow:"column",padding:"20px",marginTop:0},children:[(0,A.jsxs)(o.azJ,{sx:{fontSize:"16px",fontWeight:600,display:"flex",alignItems:"center",marginBottom:"16px",paddingBottom:"20px","& .min-icon":{height:"21px",width:"21px",marginRight:"15px"}},children:[(0,A.jsx)(o.nag,{}),(0,A.jsx)("div",{children:"Learn more about Access Keys"})]}),(0,A.jsxs)(o.azJ,{sx:{fontSize:"14px",marginBottom:"15px"},children:[(0,A.jsxs)(o.azJ,{sx:{paddingBottom:"20px"},children:[(0,A.jsx)(Q,{icon:(0,A.jsx)(o.ehx,{}),description:"Create Access Keys"}),(0,A.jsx)(o.azJ,{sx:{paddingTop:"20px"},children:"Access Keys inherit the policies explicitly attached to the parent user, and the policies attached to each group in which the parent user has membership."})]}),(0,A.jsxs)(o.azJ,{sx:{paddingBottom:"20px"},children:[(0,A.jsx)(Q,{icon:(0,A.jsx)(o.aJN,{}),description:"Assign Custom Credentials"}),(0,A.jsx)(o.azJ,{sx:{paddingTop:"10px"},children:"Randomized access credentials are recommended, and provided by default. You may use your own custom Access Key and Secret Key by replacing the default values. After creation of any Access Key, you will be given the opportunity to view and download the account credentials."}),(0,A.jsx)(o.azJ,{sx:{paddingTop:"10px"},children:"Access Keys support programmatic access by applications. You cannot use a Access Key to log into the MinIO Console."})]}),(0,A.jsxs)(o.azJ,{sx:{paddingBottom:"20px"},children:[(0,A.jsx)(Q,{icon:(0,A.jsx)(o.n$X,{}),description:"Assign Access Policies"}),(0,A.jsx)(o.azJ,{sx:{paddingTop:"10px"},children:"You can specify an optional JSON-formatted IAM policy to further restrict Access Key access to a subset of the actions and resources explicitly allowed for the parent user. Additional access beyond that of the parent user cannot be implemented through these policies."}),(0,A.jsx)(o.azJ,{sx:{paddingTop:"10px"},children:"You cannot modify the optional Access Key IAM policy after saving."})]})]}),(0,A.jsx)(o.azJ,{sx:{display:"flex",flexFlow:"column"}})]});var X=t(33312);const ee=()=>{const e=(0,m.jL)(),s=(0,a.g)(),t=(0,a.Zp)(),[r,c]=(0,n.useState)(!1),[u,x]=(0,n.useState)((0,Z.$f)(20)),[h,j]=(0,n.useState)((0,Z.$f)(40)),[b,f]=(0,n.useState)(!1),[S,v]=(0,n.useState)(null),[C,_]=(0,n.useState)(""),E=s.userName||"",[U,w]=(0,n.useState)(""),[I,O]=(0,n.useState)(""),[M,K]=(0,n.useState)(""),[D,k]=(0,n.useState)();(0,n.useEffect)(()=>{if(r){const s=D?D.toJSDate().toISOString():null;d.A.invoke("POST","/api/v1/user/".concat(encodeURIComponent(E),"/service-account-credentials"),{policy:C,accessKey:u,secretKey:h,description:I,comment:M,name:U,expiry:s}).then(e=>{c(!1),v({accessKey:e.accessKey||"",secretKey:e.secretKey||"",url:e.url||""})}).catch(s=>{c(!1),e((0,p.C9)(s))})}},[r,c,e,C,E,u,h,U,I,D,M]),(0,n.useEffect)(()=>{b&&d.A.invoke("GET","/api/v1/user/".concat(encodeURIComponent(E),"/policies")).then(e=>{_(JSON.stringify(JSON.parse(e.policy),null,4))}).catch(e=>{(0,p.C9)(e)})},[b,E]);return(0,n.useEffect)(()=>{e((0,p.ph)("add_user_SA"))},[]),(0,A.jsxs)(n.Fragment,{children:[S&&(0,A.jsx)(R.A,{newServiceAccount:S,open:!0,closeModal:()=>{v(null),t("".concat(l.zZ.USERS,"/").concat(encodeURIComponent(E)))},entity:"Access Key"}),(0,A.jsxs)(o.xA9,{item:!0,xs:12,children:[(0,A.jsx)(y.A,{label:(0,A.jsx)(o.EGL,{onClick:()=>t("".concat(l.zZ.USERS,"/").concat(encodeURIComponent(E))),label:"User Details - "+E}),actions:(0,A.jsx)(g.A,{})}),(0,A.jsx)(o.Mxu,{children:(0,A.jsx)(o.Hbc,{helpBox:(0,A.jsx)(q,{}),icon:(0,A.jsx)(o.kQt,{}),title:"Create Access Key for ".concat(E),children:(0,A.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),(e=>{e.preventDefault(),c(!0)})(e)},children:[(0,A.jsx)(o.cl_,{value:u,label:"Access Key",id:"accessKey",name:"accessKey",placeholder:"Enter Access Key",onChange:e=>{x(e.target.value)},startIcon:(0,A.jsx)(o.ehx,{})}),(0,A.jsx)(o.cl_,{value:h,label:"Secret Key",id:"secretKey",name:"secretKey",type:"password",placeholder:"Enter Secret Key",onChange:e=>{j(e.target.value)},startIcon:(0,A.jsx)(o.aJN,{})}),(0,A.jsx)(o.dOG,{value:"serviceAccountPolicy",id:"serviceAccountPolicy",name:"serviceAccountPolicy",checked:b,onChange:e=>{f(e.target.checked)},label:"Restrict beyond user policy",description:"You can specify an optional JSON-formatted IAM policy to further restrict Access Key access to a subset of the actions and resources explicitly allowed for the parent user. Additional access beyond that of the parent user cannot be implemented through these policies."}),b&&(0,A.jsxs)(o.xA9,{item:!0,xs:12,children:[(0,A.jsx)(o.azJ,{children:(0,A.jsx)(o.V7x,{content:(0,A.jsx)(n.Fragment,{children:(0,A.jsx)("a",{target:"blank",href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/policy-based-access-control.html#policy-document-structure",children:"Guide to access policy structure"})}),placement:"right",children:(0,A.jsx)(X.A,{children:"Current User Policy - edit the JSON to remove permissions for this Access Key"})})}),(0,A.jsx)(o.xA9,{item:!0,xs:12,sx:(0,Y.A)({},i.Uz.formScrollable),children:(0,A.jsx)(W.A,{value:C,onChange:e=>{_(e)},editorHeight:"350px",helptip:(0,A.jsx)(n.Fragment,{children:(0,A.jsx)("a",{target:"blank",href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/policy-based-access-control.html#policy-document-structure",children:"Guide to access policy structure"})})})})]}),(0,A.jsx)(o.azJ,{sx:{marginBottom:"15px",marginTop:"15px",width:"100%","& label":{width:"180px"}},children:(0,A.jsx)(o.e8j,{noLabelMinWidth:!0,value:D,onChange:e=>{k(e)},id:"expiryTime",label:"Expiry",timeFormat:"24h",secondsSelector:!1})}),(0,A.jsx)(o.cl_,{value:U,label:"Name",id:"name",name:"name",type:"text",placeholder:"Enter a name",onChange:e=>{w(e.target.value)}}),(0,A.jsx)(o.cl_,{value:I,label:"Description",id:"description",name:"description",type:"text",placeholder:"Enter a description",onChange:e=>{O(e.target.value)}}),(0,A.jsx)(o.cl_,{value:M,label:"Comments",id:"comment",name:"comment",type:"text",placeholder:"Enter a comment",onChange:e=>{K(e.target.value)}}),(0,A.jsxs)(o.xA9,{item:!0,xs:12,sx:(0,Y.A)({},i.Uz.modalButtonBar),children:[(0,A.jsx)(o.$nd,{id:"clear",type:"button",variant:"regular",onClick:()=>{v(null),x(""),j("")},label:"Clear"}),(0,A.jsx)(o.$nd,{id:"create-sa",type:"submit",variant:"callAction",color:"primary",label:"Create"})]})]})})})]})]})},se=()=>(0,A.jsxs)(a.BV,{children:[(0,A.jsx)(a.qh,{path:"add-user",element:(0,A.jsx)(H,{})}),(0,A.jsx)(a.qh,{path:":userName",element:(0,A.jsx)(F,{})}),(0,A.jsx)(a.qh,{path:"new-user-sa/:userName",element:(0,A.jsx)(ee,{})}),(0,A.jsx)(a.qh,{path:"/",element:(0,A.jsx)(S,{})}),(0,A.jsx)(a.qh,{element:(0,A.jsx)(r.A,{})})]})}}]); ================================================ FILE: web-app/build/static/js/4388.c0e588bd.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4388],{94388:(e,s,i)=>{i.r(s),i.d(s,{default:()=>C});var t=i(89379),n=i(9950),a=i(28429),r=i(89132),l=i(1531),c=i(93598),d=i(49078),o=i(99491),p=i(98341),x=i(86070),h=i(30272),u=i(44414);const f=e=>{let{rowData:s,rowId:i,onFieldChange:t,onAddClick:a,onRemoveClick:l,canAdd:c=!0,canRemove:d=!0,showRowActions:o=!0,disabledFields:p=[],fieldErrors:x={}}=e;const{endpoint:f="",accessKey:j="",secretKey:g="",name:m=""}=s;return(0,u.jsxs)(n.Fragment,{children:[(0,u.jsx)(r.azJ,{children:(0,u.jsx)(r.cl_,{id:"add-rep-peer-site-".concat(i),name:"add-rep-peer-site-".concat(i),placeholder:"site-name",label:"",readOnly:p.includes("name"),value:m,onChange:e=>{t(e,"name",i)},"data-test-id":"add-site-rep-peer-site-".concat(i)})}),(0,u.jsx)(r.azJ,{children:(0,u.jsx)(r.cl_,{id:"add-rep-peer-site-ep-".concat(i),name:"add-rep-peer-site-ep-".concat(i),placeholder:"https://dr.minio-storage:900".concat(i),label:"",readOnly:p.includes("endpoint"),error:x.endpoint,value:f,onChange:e=>{t(e,"endpoint",i)},"data-test-id":"add-site-rep-peer-ep-".concat(i)})}),(0,u.jsx)(r.azJ,{children:(0,u.jsx)(r.cl_,{id:"add-rep-peer-site-ac-".concat(i),name:"add-rep-peer-site-ac-".concat(i),label:"",required:!0,disabled:p.includes("accessKey"),value:j,error:x.accessKey,onChange:e=>{t(e,"accessKey",i)},"data-test-id":"add-rep-peer-site-ac-".concat(i)})}),(0,u.jsx)(r.azJ,{children:(0,u.jsx)(r.cl_,{id:"add-rep-peer-site-sk-".concat(i),name:"add-rep-peer-site-sk-".concat(i),label:"",required:!0,type:"password",value:g,error:x.secretKey,disabled:p.includes("secretKey"),onChange:e=>{t(e,"secretKey",i)},"data-test-id":"add-rep-peer-site-sk-".concat(i)})}),(0,u.jsx)(r.xA9,{item:!0,xs:12,sx:{alignItems:"center",display:"flex"},children:(0,u.jsx)(r.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"center",alignSelf:"baseline",marginTop:"4px","& button":{borderColor:"#696969",color:"#696969",borderRadius:"50%"}},children:o?(0,u.jsxs)(n.Fragment,{children:[(0,u.jsx)(h.A,{tooltip:"Add a Row",children:(0,u.jsx)(r.$nd,{id:"add-row-".concat(i),variant:"regular",disabled:!c,icon:(0,u.jsx)(r.REV,{}),onClick:e=>{e.preventDefault(),null===a||void 0===a||a(i)},style:{width:25,height:25,padding:0}})}),(0,u.jsx)(h.A,{tooltip:"Remove Row",children:(0,u.jsx)(r.$nd,{id:"remove-row-".concat(i),variant:"regular",disabled:!d,icon:(0,u.jsx)(r.YPx,{}),onClick:e=>{e.preventDefault(),null===l||void 0===l||l(i)},style:{width:25,height:25,padding:0,marginLeft:8}})})]}):null})})]},"".concat(i))};var j=i(82817),g=i(70503);const m=e=>{let s=!1;try{new URL(e),s=!0}catch(i){s=!1}return s?"":"Invalid Endpoint"},y=e=>""===(null===e||void 0===e?void 0:e.trim()),K=()=>(0,u.jsxs)(n.Fragment,{children:[(0,u.jsx)(r.azJ,{children:(0,u.jsx)(r.l1Y,{children:"Site Name"})}),(0,u.jsx)(r.azJ,{children:(0,u.jsxs)(r.l1Y,{children:["Endpoint ","*"]})}),(0,u.jsx)(r.azJ,{children:(0,u.jsxs)(r.l1Y,{children:["Access Key ","*"]})}),(0,u.jsx)(r.azJ,{children:(0,u.jsxs)(r.l1Y,{children:["Secret Key ","*"]})}),(0,u.jsx)(r.azJ,{children:" "})]}),v=e=>{let{title:s}=e;return(0,u.jsx)(r.xA9,{item:!0,xs:12,children:(0,u.jsx)(r.azJ,{sx:{marginBottom:"15px",fontSize:"14px",fontWeight:600},children:s})})},C=()=>{const e=(0,o.jL)(),s=(0,a.Zp)(),{serverEndPoint:i=""}=(0,p.d4)(x.h0),[h,C]=(0,n.useState)([{endpoint:i,name:"",accessKey:"",secretKey:""}]),[w,A]=(0,n.useState)([]),b=()=>{A([{endpoint:"",name:"",accessKey:"",secretKey:""}])},[z,S]=(0,l.A)(e=>{const{sites:s,name:i}=e,n=s.findIndex(e=>e.name===i);if(-1!==n){let e=s[n];e=(0,t.A)((0,t.A)({},e),{},{isCurrent:!0,isSaved:!0}),C([e]),s.splice(n,1)}s.sort((e,s)=>e.name===i?-1:s.name===i?1:0);let a=s.map(e=>(0,t.A)((0,t.A)({},e),{},{accessKey:"",secretKey:"",isSaved:!0}));a.length?A(a):b()},e=>{b()}),k=()=>{S("GET","api/v1/admin/site-replication")};(0,n.useEffect)(()=>{k()},[]),(0,n.useEffect)(()=>{e((0,d.ph)("add-replication-sites"))},[]);const J=w.reduce((e,s,i)=>{const t=w[i].endpoint,n=m(t);return""===n&&""!==t&&e.push(n),e},[]),T=w.map(e=>!y(e.accessKey)&&!y(e.secretKey)).filter(Boolean),{accessKey:E,secretKey:R}=h[0],I=!y(E)&&!y(R),B=J.length===w.length,F=T.length===w.length;let L=I&&B&&F;const[_,q]=(0,l.A)(i=>{i.success?(e((0,d.Hk)(i.status)),O(),k(),s(c.zZ.SITE_REPLICATION)):e((0,d.C9)({errorMessage:"Error",detailedError:i.status}))},s=>{e((0,d.C9)(s))}),O=()=>{b(),C(e=>e.map((e,s)=>(0,t.A)((0,t.A)({},e),{},{accessKey:"",secretKey:"",name:""})))};return(0,u.jsxs)(n.Fragment,{children:[(0,u.jsx)(j.A,{label:(0,u.jsx)(r.EGL,{label:"Add Replication Site",onClick:()=>s(c.zZ.SITE_REPLICATION)}),actions:(0,u.jsx)(g.A,{})}),(0,u.jsx)(r.Mxu,{children:(0,u.jsxs)(r.azJ,{sx:{display:"grid",padding:"25px",gap:"25px",gridTemplateColumns:"1fr",border:"1px solid #eaeaea"},children:[(0,u.jsxs)(r.azJ,{children:[(0,u.jsx)(r._xt,{separator:!0,icon:(0,u.jsx)(r.pHQ,{}),children:"Add Sites for Replication"}),z||_?(0,u.jsx)(r.z21,{}):null,(0,u.jsx)(r.azJ,{sx:{fontSize:"14px",fontStyle:"italic",marginTop:"10px",marginBottom:"10px"},children:"Note: AccessKey and SecretKey values for every site is required while adding or editing peer sites"}),(0,u.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>(e.preventDefault(),(()=>{const e=null===h||void 0===h?void 0:h.map((e,s)=>({accessKey:e.accessKey,secretKey:e.secretKey,name:e.name,endpoint:e.endpoint.trim()})),s=w.reduce((e,s,i)=>(s.endpoint&&e.push({accessKey:s.accessKey,secretKey:s.secretKey,name:s.name||"dr-site-".concat(i),endpoint:s.endpoint.trim()}),e),[]),i=e.concat(s);q("POST","api/v1/admin/site-replication",i)})()),children:[(0,u.jsxs)(r.azJ,{sx:{marginTop:"15px"},children:[(0,u.jsx)(v,{title:"This Site"}),(0,u.jsxs)(r.azJ,{withBorders:!0,sx:{display:"grid",gridTemplateColumns:".8fr 1.2fr .8fr .8fr .2fr",padding:"15px",gap:"10px",maxHeight:"430px",overflowY:"auto"},children:[(0,u.jsx)(K,{}),h.map((e,s)=>{const i=y(e.accessKey)?"AccessKey is required":"",n=y(e.secretKey)?"SecretKey is required":"";return(0,u.jsx)(f,{rowData:e,rowId:s,fieldErrors:{accessKey:i,secretKey:n},onFieldChange:(e,s,i)=>{const n=e.target.value;""!==s&&C(e=>e.map((e,a)=>a===i?(0,t.A)((0,t.A)({},e),{},{[s]:n}):e))},showRowActions:!1},"current-".concat(s))})]})]}),(0,u.jsxs)(r.azJ,{sx:{marginTop:"25px"},children:[(0,u.jsx)(v,{title:"Peer Sites"}),(0,u.jsxs)(r.azJ,{withBorders:!0,sx:{display:"grid",gridTemplateColumns:".8fr 1.2fr .8fr .8fr .2fr",padding:"15px",gap:"10px",maxHeight:"430px",overflowY:"auto"},children:[(0,u.jsx)(K,{}),w.map((e,s)=>{const i=m(e.endpoint),n=y(e.accessKey)?"AccessKey is required":"",a=y(e.secretKey)?"SecretKey is required":"";return(0,u.jsx)(f,{rowData:e,rowId:s,fieldErrors:{endpoint:i,accessKey:n,secretKey:a},onFieldChange:(e,s,i)=>{const n=e.target.value;A(e=>e.map((e,a)=>a===i?(0,t.A)((0,t.A)({},e),{},{[s]:n}):e))},canAdd:!0,canRemove:s>0&&!e.isSaved,onAddClick:()=>{const e=[...w];e.splice(s+1,0,{name:"",endpoint:"",accessKey:"",secretKey:""}),A(e)},onRemoveClick:e=>{A(w.filter((s,i)=>i!==e))}},"exiting-".concat(s))})]})]}),(0,u.jsx)(r.xA9,{item:!0,xs:12,children:(0,u.jsxs)(r.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:"20px",gap:"15px"},children:[(0,u.jsx)(r.$nd,{id:"clear",type:"button",variant:"regular",disabled:_,onClick:O,label:"Clear"}),(0,u.jsx)(r.$nd,{id:"save",type:"submit",variant:"callAction",disabled:_||!L,label:"Save"})]})})]})]}),(0,u.jsx)(r.lVp,{title:"",iconComponent:null,help:(0,u.jsxs)(n.Fragment,{children:[(0,u.jsxs)(r.azJ,{sx:{marginTop:"-25px",fontSize:"16px",fontWeight:600,display:"flex",alignItems:"center",justifyContent:"flex-start",padding:"2px"},children:[(0,u.jsx)(r.azJ,{sx:{backgroundColor:"#07193E",height:"15px",width:"15px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",marginRight:"18px",padding:"3px",paddingLeft:"2px","& .min-icon":{height:"11px",width:"11px",fill:"#ffffff"}},children:(0,u.jsx)(r.pHQ,{})}),"About Site Replication"]}),(0,u.jsxs)(r.azJ,{sx:{display:"flex",flexFlow:"column",fontSize:"14px",flex:"2","& li":{fontSize:"14px",display:"flex",marginTop:"15px",marginBottom:"15px",width:"100%","&.step-text":{fontWeight:400}}},children:[(0,u.jsx)(r.azJ,{children:"The following changes are replicated to all other sites"}),(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:"Creation and deletion of buckets and objects"}),(0,u.jsx)("li",{children:"Creation and deletion of all IAM users, groups, policies and their mappings to users or groups"}),(0,u.jsx)("li",{children:"Creation of STS credentials"}),(0,u.jsx)("li",{children:"Creation and deletion of service accounts (except those owned by the root user)"}),(0,u.jsx)("li",{children:(0,u.jsxs)(r.azJ,{style:{display:"flex",flexFlow:"column",justifyContent:"flex-start"},children:[(0,u.jsx)("div",{style:{paddingTop:"1px"},children:"Changes to Bucket features such as"}),(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:"Bucket Policies"}),(0,u.jsx)("li",{children:"Bucket Tags"}),(0,u.jsx)("li",{children:"Bucket Object-Lock configurations"}),(0,u.jsx)("li",{children:"Bucket Encryption configuration"})]})]})}),(0,u.jsx)("li",{children:(0,u.jsxs)(r.azJ,{style:{display:"flex",flexFlow:"column",justifyContent:"flex-start"},children:[(0,u.jsx)("div",{style:{paddingTop:"1px"},children:"The following Bucket features will NOT be replicated"}),(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:"Bucket notification configuration"}),(0,u.jsx)("li",{children:"Bucket lifecycle (ILM) configuration"})]})]})})]})]})]})})]})})]})}}}]); ================================================ FILE: web-app/build/static/js/4402.d8bb81a3.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4402],{54402:(e,t,n)=>{n.r(t),n.d(t,{default:()=>a});var s=n(9950),l=n(89132),c=n(49078),o=n(99491),r=n(1531),i=n(49534),u=n(44414);const a=e=>{let{closeDeleteModalAndRefresh:t,deleteOpen:n,selectedBucket:a}=e;const d=(0,o.jL)(),[p,b]=(0,r.A)(()=>t(!0),e=>d((0,c.C9)(e)));if(!a)return null;return(0,u.jsx)(i.A,{title:"Delete Bucket",confirmText:"Delete",isOpen:n,titleIcon:(0,u.jsx)(l.xWY,{}),isLoading:p,onConfirm:()=>{b("DELETE","/api/v1/buckets/".concat(a),{name:a})},onClose:()=>t(!1),confirmationContent:(0,u.jsxs)(s.Fragment,{children:["Are you sure you want to delete bucket ",(0,u.jsx)("b",{children:a}),"? ",(0,u.jsx)("br",{}),"A bucket can only be deleted if it's empty."]})})}}}]); ================================================ FILE: web-app/build/static/js/4517.15f50225.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4517],{54517:(e,t,o)=>{o.r(t),o.d(t,{default:()=>k});var n=o(9950),a=o(89132),i=o(98341),r=o(28429),l=o(70444),s=o(48965),c=o(19335),p=o(87946),d=o.n(p),u=o(76356),m=o(45246),g=o(93598),h=o(49078),f=o(99491),y=o(19156),b=o(27428),S=o(49534),v=o(44414);const T=e=>{let{onConfirm:t,onClose:o,serviceName:i,status:r}=e;return(0,v.jsx)(S.A,{title:"Delete Endpoint",confirmText:"Delete",isOpen:!0,titleIcon:(0,v.jsx)(a.$rg,{}),isLoading:!1,onConfirm:t,onClose:o,confirmationContent:(0,v.jsxs)(n.Fragment,{children:["Are you sure you want to delete the event destination ?",(0,v.jsx)("br",{}),(0,v.jsx)("b",{children:i})," which is ",(0,v.jsx)("b",{children:r})]})})};var x=o(30272);const _=c.Ay.div(e=>{let{theme:t}=e;return{display:"flex",alignItems:"center","& svg":{width:16,marginRight:5,fill:d()(t,"signalColors.good","#4CCB92")},"& svg.offline":{fill:d()(t,"signalColors.danger","#C51B3F")}}}),k=()=>{const e=(0,f.jL)(),t=(0,r.Zp)(),o=(0,i.d4)(e=>e.destination.loading),[c,p]=(0,n.useState)([]),[d,S]=(0,n.useState)(""),[k,A]=(0,n.useState)(!1),[E,j]=(0,n.useState)();(0,n.useEffect)(()=>{if(o){(()=>{l.F.admin.notificationEndpointList().then(t=>{let o=[];t.data.notification_endpoints&&(o=t.data.notification_endpoints),p((0,u.Es)(o)),e((0,y.$)(!1))}).catch(t=>{e((0,h.C9)((0,s.S)(t.error))),e((0,y.$)(!1))})})()}},[o,e]),(0,n.useEffect)(()=>{e((0,y.$)(!0))},[e]);const C=[{type:"delete",onClick:e=>{j(e),A(!0)}}],L=c.filter(e=>""===d||e.service_name.indexOf(d)>=0);return(0,v.jsx)(n.Fragment,{children:(0,v.jsxs)(a.Mxu,{children:[(0,v.jsxs)(a.xA9,{item:!0,xs:12,sx:m._0.actionsTray,children:[(0,v.jsx)(b.A,{placeholder:"Search target",onChange:S,value:d,sx:{maxWidth:380}}),(0,v.jsxs)(a.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:5},children:[(0,v.jsx)(x.A,{tooltip:"Refresh List",children:(0,v.jsx)(a.$nd,{id:"reload-event-destinations",label:"Refresh",variant:"regular",icon:(0,v.jsx)(a.fNY,{}),onClick:()=>{e((0,y.$)(!0))}})}),(0,v.jsx)(x.A,{tooltip:"Add Event Destination",children:(0,v.jsx)(a.$nd,{id:"add-notification-target",label:"Add Event Destination",variant:"callAction",icon:(0,v.jsx)(a.REV,{}),onClick:()=>{t(g.zZ.EVENT_DESTINATIONS_ADD)}})})]})]}),o&&(0,v.jsx)(a.z21,{}),!o&&(0,v.jsxs)(n.Fragment,{children:[c.length>0&&(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)(a.azJ,{sx:{width:"100%"},children:(0,v.jsx)(a.bQt,{itemActions:C,columns:[{label:"Status",elementKey:"status",renderFunction:e=>(0,v.jsxs)(_,{children:[(0,v.jsx)(a.GQ2,{className:"Offline"===e?"offline":""}),e]}),width:150},{label:"Service",elementKey:"service_name"}],isLoading:o,records:L,entityName:"Event Destinations",idField:"service_name",customPaperHeight:"400px"})}),(0,v.jsx)(a.xA9,{item:!0,xs:12,sx:{marginTop:15},children:(0,v.jsx)(a.lVp,{title:"Event Destinations",iconComponent:(0,v.jsx)(a.PI5,{}),help:(0,v.jsxs)(n.Fragment,{children:["MinIO bucket notifications allow administrators to send notifications to supported external services on certain object or bucket events. MinIO supports bucket and object-level S3 events similar to the Amazon S3 Event Notifications.",(0,v.jsx)("br",{}),(0,v.jsx)("br",{}),"You can learn more at the"," ",(0,v.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/monitoring/bucket-notifications.html#minio-bucket-notifications",target:"_blank",rel:"noopener",children:"documentation"}),"."]})})})]}),0===c.length&&(0,v.jsx)(a.xA9,{container:!0,sx:{justifyContent:"center",alignContent:"center",alignItems:"center"},children:(0,v.jsx)(a.xA9,{item:!0,xs:8,children:(0,v.jsx)(a.lVp,{title:"Event Destinations",iconComponent:(0,v.jsx)(a.PI5,{}),help:(0,v.jsxs)(n.Fragment,{children:["MinIO bucket notifications allow administrators to send notifications to supported external services on certain object or bucket events. MinIO supports bucket and object-level S3 events similar to the Amazon S3 Event Notifications.",(0,v.jsx)("br",{}),(0,v.jsx)("br",{}),"To get started,"," ",(0,v.jsx)(a.t53,{onClick:()=>{t(g.zZ.EVENT_DESTINATIONS_ADD)},children:"Add an Event Destination"}),"."]})})})})]}),k?(0,v.jsx)(T,{onConfirm:()=>{(t=>{if(null!==t&&void 0!==t&&t.name){const o=(0,u.h4)(t.name);let n=":".concat(t.account_id);o?l.F.configs.resetConfig("".concat(o).concat(n)).then(()=>{e((0,h.YR)(!0)),j(null),A(!1),e((0,y.$)(!0))}).catch(t=>{A(!1),e((0,h.C9)((0,s.S)(t.error)))}):(j(null),A(!1),console.log("Unable to find Config key for ".concat(t.name)))}})(E)},status:"".concat(null===E||void 0===E?void 0:E.status),serviceName:"".concat(null===E||void 0===E?void 0:E.service_name),onClose:()=>{A(!1)}}):null]})})}},76356:(e,t,o)=>{o.d(t,{AU:()=>a,D3:()=>g,Es:()=>m,P4:()=>n,Xm:()=>b,bo:()=>f,fx:()=>S,h4:()=>T});const n="notify_postgres",a="notify_mysql",i="notify_kafka",r="notify_amqp",l="notify_mqtt",s="notify_redis",c="notify_nats",p="notify_elasticsearch",d="notify_webhook",u="notify_nsq",m=e=>e.map(e=>({service_name:"".concat(e.service,":").concat(e.account_id),name:e.service,account_id:e.account_id,status:e.status}));class g{}g.DB="database",g.Queue="queue",g.Func="functions";const h=()=>"".concat(document.baseURI),f=[{actionTrigger:n,targetTitle:"PostgreSQL",logo:"".concat(h(),"postgres-logo.svg"),category:g.DB},{actionTrigger:i,targetTitle:"Kafka",logo:"".concat(h(),"kafka-logo.svg"),category:g.Queue},{actionTrigger:r,targetTitle:"AMQP",logo:"".concat(h(),"amqp-logo.svg"),category:g.Queue},{actionTrigger:l,targetTitle:"MQTT",logo:"".concat(h(),"mqtt-logo.svg"),category:g.Queue},{actionTrigger:s,targetTitle:"Redis",logo:"".concat(h(),"redis-logo.svg"),category:g.Queue},{actionTrigger:c,targetTitle:"NATS",logo:"".concat(h(),"nats-logo.svg"),category:g.Queue},{actionTrigger:a,targetTitle:"Mysql",logo:"".concat(h(),"mysql-logo.svg"),category:g.DB},{actionTrigger:p,targetTitle:"Elastic Search",logo:"".concat(h(),"elasticsearch-logo.svg"),category:g.DB},{actionTrigger:d,targetTitle:"Webhook",logo:"".concat(h(),"webhooks-logo.svg"),category:g.Func},{actionTrigger:u,targetTitle:"NSQ",logo:"".concat(h(),"nsq-logo.svg"),category:g.Queue}],y=[{name:"queue_dir",label:"Queue Directory",required:!1,tooltip:"Staging directory for undelivered messages e.g. '/home/events'",type:"string",placeholder:"Enter Queue Directory"},{name:"queue_limit",label:"Queue Limit",required:!1,tooltip:"Maximum limit for undelivered messages, defaults to '10000'",type:"number",placeholder:"Enter Queue Limit"},{name:"comment",label:"Comment",required:!1,type:"comment",placeholder:"Enter custom notes if any"}],b=e=>e.filter(e=>""!==e.value),S={[i]:[{name:"brokers",label:"Brokers",required:!0,tooltip:"Comma separated list of Kafka broker addresses",type:"string",placeholder:"Enter Brokers"},{name:"topic",label:"Topic",tooltip:"Kafka topic used for bucket notifications",type:"string",placeholder:"Enter Topic"},{name:"sasl_username",label:"SASL Username",tooltip:"Username for SASL/PLAIN or SASL/SCRAM authentication",type:"string",placeholder:"Enter SASL Username"},{name:"sasl_password",label:"SASL Password",tooltip:"Password for SASL/PLAIN or SASL/SCRAM authentication",type:"string",placeholder:"Enter SASL Password"},{name:"sasl_mechanism",label:"SASL Mechanism",tooltip:"SASL authentication mechanism, default 'PLAIN'",type:"string"},{name:"tls_client_auth",label:"TLS Client Auth",tooltip:"Client Auth determines the Kafka server's policy for TLS client authorization",type:"string",placeholder:"Enter TLS Client Auth"},{name:"sasl",label:"SASL",tooltip:"Set to 'on' to enable SASL authentication",type:"on|off"},{name:"tls",label:"TLS",tooltip:"Set to 'on' to enable TLS",type:"on|off"},{name:"tls_skip_verify",label:"TLS skip verify",tooltip:'Trust server TLS without verification, defaults to "on" (verify)',type:"on|off"},{name:"client_tls_cert",label:"client TLS cert",tooltip:"Path to client certificate for mTLS authorization",type:"path",placeholder:"Enter TLS Client Cert"},{name:"client_tls_key",label:"client TLS key",tooltip:"Path to client key for mTLS authorization",type:"path",placeholder:"Enter TLS Client Key"},{name:"version",label:"Version",tooltip:"Specify the version of the Kafka cluster e.g '2.2.0'",type:"string",placeholder:"Enter Kafka Version"},...y],[r]:[{name:"url",required:!0,label:"URL",tooltip:"AMQP server endpoint e.g. `amqp://myuser:mypassword@localhost:5672`",type:"url"},{name:"exchange",label:"Exchange",tooltip:"Name of the AMQP exchange",type:"string",placeholder:"Enter Exchange"},{name:"exchange_type",label:"Exchange Type",tooltip:"AMQP exchange type",type:"string",placeholder:"Enter Exchange Type"},{name:"routing_key",label:"Routing Key",tooltip:"Routing key for publishing",type:"string",placeholder:"Enter Routing Key"},{name:"mandatory",label:"Mandatory",tooltip:"Quietly ignore undelivered messages when set to 'off', default is 'on'",type:"on|off"},{name:"durable",label:"Durable",tooltip:"Persist queue across broker restarts when set to 'on', default is 'off'",type:"on|off"},{name:"no_wait",label:"No Wait",tooltip:"Non-blocking message delivery when set to 'on', default is 'off'",type:"on|off"},{name:"internal",label:"Internal",tooltip:"Set to 'on' for exchange to be not used directly by publishers, but only when bound to other exchanges",type:"on|off"},{name:"auto_deleted",label:"Auto Deleted",tooltip:"Auto delete queue when set to 'on', when there are no consumers",type:"on|off"},{name:"delivery_mode",label:"Delivery Mode",tooltip:"Set to '1' for non-persistent or '2' for persistent queue",type:"number",placeholder:"Enter Delivery Mode"},...y],[s]:[{name:"address",required:!0,label:"Address",tooltip:"Redis server's address e.g. `localhost:6379`",type:"address",placeholder:"Enter Address"},{name:"key",required:!0,label:"Key",tooltip:"Redis key to store/update events, key is auto-created",type:"string",placeholder:"Enter Key"},{name:"password",label:"Password",tooltip:"Redis server password",type:"string",placeholder:"Enter Password"},...y],[l]:[{name:"broker",required:!0,label:"Broker",tooltip:"MQTT server endpoint e.g. `tcp://localhost:1883`",type:"uri",placeholder:"Enter Brokers"},{name:"topic",required:!0,label:"Topic",tooltip:"Name of the MQTT topic to publish",type:"string",placeholder:"Enter Topic"},{name:"username",label:"Username",tooltip:"MQTT username",type:"string",placeholder:"Enter Username"},{name:"password",label:"Password",tooltip:"MQTT password",type:"string",placeholder:"Enter Password"},{name:"qos",label:"QOS",tooltip:"Set the quality of service priority, defaults to '0'",type:"number",placeholder:"Enter QOS"},{name:"keep_alive_interval",label:"Keep Alive Interval",tooltip:"Keep-alive interval for MQTT connections in s,m,h,d",type:"duration",placeholder:"Enter Keep Alive Interval"},{name:"reconnect_interval",label:"Reconnect Interval",tooltip:"Reconnect interval for MQTT connections in s,m,h,d",type:"duration",placeholder:"Enter Reconnect Interval"},...y],[c]:[{name:"address",required:!0,label:"Address",tooltip:"NATS server address e.g. '0.0.0.0:4222'",type:"address",placeholder:"Enter Address"},{name:"subject",required:!0,label:"Subject",tooltip:"NATS subscription subject",type:"string",placeholder:"Enter NATS Subject"},{name:"username",label:"Username",tooltip:"NATS username",type:"string",placeholder:"Enter NATS Username"},{name:"password",label:"Password",tooltip:"NATS password",type:"string",placeholder:"Enter NATS password"},{name:"token",label:"Token",tooltip:"NATS token",type:"string",placeholder:"Enter NATS token"},{name:"tls",label:"TLS",tooltip:"Set to 'on' to enable TLS",type:"on|off"},{name:"tls_skip_verify",label:"TLS Skip Verify",tooltip:'Trust server TLS without verification, defaults to "on" (verify)',type:"on|off"},{name:"ping_interval",label:"Ping Interval",tooltip:"Client ping commands interval in s,m,h,d. Disabled by default",type:"duration",placeholder:"Enter Ping Interval"},{name:"streaming",label:"Streaming",tooltip:"Set to 'on' to use streaming NATS server",type:"on|off"},{name:"streaming_async",label:"Streaming async",tooltip:"Set to 'on' to enable asynchronous publish",type:"on|off"},{name:"streaming_max_pub_acks_in_flight",label:"Streaming max publish ACKS in flight",tooltip:"Number of messages to publish without waiting for ACKs",type:"number",placeholder:"Enter Streaming in flight value"},{name:"streaming_cluster_id",label:"Streaming Cluster ID",tooltip:"Unique ID for NATS streaming cluster",type:"string",placeholder:"Enter Streaming Cluster ID"},{name:"cert_authority",label:"Cert Authority",tooltip:"Path to certificate chain of the target NATS server",type:"string",placeholder:"Enter Cert Authority"},{name:"client_cert",label:"Client Cert",tooltip:"Client cert for NATS mTLS auth",type:"string",placeholder:"Enter Client Cert"},{name:"client_key",label:"Client Key",tooltip:"Client cert key for NATS mTLS authorization",type:"string",placeholder:"Enter Client Key"},...y],[p]:[{name:"url",required:!0,label:"URL",tooltip:"Elasticsearch server's address, with optional authentication info",type:"url",placeholder:"Enter URL"},{name:"index",required:!0,label:"Index",tooltip:"Elasticsearch index to store/update events, index is auto-created",type:"string",placeholder:"Enter Index"},{name:"format",required:!0,label:"Format",tooltip:"'namespace' reflects current bucket/object list and 'access' reflects a journal of object operations, defaults to 'namespace'",type:"enum",placeholder:"Enter Format"},...y],[d]:[{name:"endpoint",required:!0,label:"Endpoint",tooltip:"Webhook server endpoint e.g. http://localhost:8080/minio/events",type:"url",placeholder:"Enter Endpoint"},{name:"auth_token",label:"Auth Token",tooltip:"Opaque string or JWT authorization token",type:"string",placeholder:"Enter auth_token"},...y],[u]:[{name:"nsqd_address",required:!0,label:"NSQD Address",tooltip:"NSQ server address e.g. '127.0.0.1:4150'",type:"address",placeholder:"Enter nsqd_address"},{name:"topic",required:!0,label:"Topic",tooltip:"NSQ topic",type:"string",placeholder:"Enter Topic"},{name:"tls",label:"TLS",tooltip:"Set to 'on' to enable TLS",type:"on|off"},{name:"tls_skip_verify",label:"TLS Skip Verify",tooltip:'Trust server TLS without verification, defaults to "on" (verify)',type:"on|off"},...y]},v={webhook:"notify_webhook",amqp:"notify_amqp",kafka:"notify_kafka",mqtt:"notify_mqtt",nats:"notify_nats",nsq:"notify_nsq",mysql:"notify_mysql",postgresql:"notify_postgres",elasticsearch:"notify_elasticsearch",redis:"notify_redis"},T=e=>v[e]}}]); ================================================ FILE: web-app/build/static/js/4540.316758ac.chunk.js ================================================ (self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4540],{32680:(e,t,o)=>{"use strict";o.d(t,{A:()=>u});var n=o(9950),r=o(98341),a=o(89132),i=o(99491),l=o(49078),c=o(96382),s=o(44414);const u=e=>{let{onClose:t,modalOpen:o,title:u,children:p,wideLimit:d=!0,titleIcon:f=null,iconColor:y="default",sx:b}=e;const m=(0,i.jL)(),[h,g]=(0,n.useState)(!1),v=(0,r.d4)(e=>e.system.modalSnackBar);(0,n.useEffect)(()=>{m((0,l.h0)(""))},[m]),(0,n.useEffect)(()=>{if(v){if(""===v.message)return void g(!1);"error"!==v.type&&g(!0)}},[v]);let C="";return v&&(C=v.detailedErrorMsg,(""===C||C&&C.length<5)&&(C=v.message)),(0,s.jsxs)(a.ngX,{onClose:t,open:o,title:u,titleIcon:f,widthLimit:d,sx:b,iconColor:y,children:[(0,s.jsx)(c.A,{isModal:!0}),(0,s.jsx)(a.qb_,{onClose:()=>{g(!1),m((0,l.h0)(""))},open:h,message:C,mode:"inline",variant:"error"===v.type?"error":"default",autoHideDuration:"error"===v.type?10:5,condensed:!0}),p]})}},59660:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,o=[],n=0;n{"use strict";var n=o(59660),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var o,a,i,l,c,s,u=!1;t||(t={}),o=t.debug||!1;try{if(i=n(),l=document.createRange(),c=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),"undefined"===typeof n.clipboardData){o&&console.warn("unable to use e.clipboardData"),o&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var a=r[t.format]||r.default;window.clipboardData.setData(a,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(s),l.selectNodeContents(s),c.addRange(l),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(p){o&&console.error("unable to copy using execCommand: ",p),o&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(p){o&&console.error("unable to copy using clipboardData: ",p),o&&console.error("falling back to prompt"),a=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(a,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(l):c.removeAllRanges()),s&&document.body.removeChild(s),i()}return u}},84540:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>b});var n=o(9950),r=o(70444),a=o(5501),i=o(48965),l=o(89132),c=o(45246),s=o(49078),u=o(99491),p=o(96187),d=o(32680),f=o(94797),y=o(44414);const b=e=>{let{open:t,bucketName:o,actualPolicy:b,actualDefinition:m,closeModalAndRefresh:h}=e;const g=(0,u.jL)(),[v,C]=(0,n.useState)(!1),[j,x]=(0,n.useState)(""),[w,O]=(0,n.useState)(p.U);return(0,n.useEffect)(()=>{x(b),O(m?JSON.stringify(JSON.parse(m),null,4):p.U)},[x,b,O,m]),(0,y.jsx)(d.A,{title:"Change Access Policy",modalOpen:t,onClose:()=>{h()},titleIcon:(0,y.jsx)(l.uYH,{}),children:(0,y.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),!v&&j&&(C(!0),r.F.buckets.bucketSetPolicy(o,{access:j,definition:w}).then(()=>{C(!1),h()}).catch(e=>{C(!1),g((0,s.Dy)((0,i.S)(e.error)))}))},children:[(0,y.jsxs)(l.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,y.jsx)(l.l6P,{value:j,label:"Access Policy",id:"select-access-policy",name:"select-access-policy",onChange:e=>{x(e)},options:[{value:a.jz.PRIVATE,label:"Private"},{value:a.jz.PUBLIC,label:"Public"},{value:a.jz.CUSTOM,label:"Custom"}]}),"PUBLIC"===j&&(0,y.jsx)(l.azJ,{className:"muted",style:{marginTop:"25px",fontSize:"14px",fontStyle:"italic"},children:"* Warning: With Public access anyone will be able to upload, download and delete files from this Bucket *"}),"CUSTOM"===j&&(0,y.jsx)(l.xA9,{item:!0,xs:12,children:(0,y.jsx)(f.A,{label:"Write Policy",value:w,onChange:e=>{O(e)},editorHeight:"300px",helptip:(0,y.jsx)(n.Fragment,{children:(0,y.jsx)("a",{target:"blank",href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/policy-based-access-control.html#policy-document-structure",children:"Guide to access policy structure"})})})})]}),(0,y.jsxs)(l.azJ,{sx:c.Uz.modalButtonBar,children:[(0,y.jsx)(l.$nd,{id:"cancel",type:"button",variant:"regular",onClick:()=>{h()},disabled:v,label:"Cancel"}),(0,y.jsx)(l.$nd,{id:"set",type:"submit",variant:"callAction",disabled:v||"CUSTOM"===j&&!w,label:"Set"})]})]})})}},94702:(e,t,o)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.CopyToClipboard=void 0;var r=l(o(9950)),a=l(o(67243)),i=["text","onCopy","options","children"];function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function s(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}function p(e,t){for(var o=0;o{"use strict";o.d(t,{A:()=>s});var n=o(9950),r=o(89132),a=o(95189),i=o.n(a),l=o(30272),c=o(44414);const s=e=>{let{value:t,label:o="",tooltip:a="",mode:s="json",onChange:u,editorHeight:p=250,helptip:d,readOnly:f=!1,disabled:y=!1}=e;return(0,c.jsx)(r.BYM,{value:t,onChange:e=>u(e),mode:s,tooltip:a,editorHeight:p,label:o,readOnly:f,disabled:y,helpTools:(0,c.jsx)(n.Fragment,{children:(0,c.jsx)(l.A,{tooltip:"Copy to Clipboard",children:(0,c.jsx)(i(),{text:t,children:(0,c.jsx)(r.$nd,{type:"button",id:"copy-code-mirror",icon:(0,c.jsx)(r.TdU,{}),color:"primary",variant:"regular"})})})}),helpTip:d,helpTipPlacement:"right"})}},95189:(e,t,o)=>{"use strict";var n=o(94702).CopyToClipboard;n.CopyToClipboard=n,e.exports=n},96187:(e,t,o)=>{"use strict";o.d(t,{U:()=>n});const n='{\n "Version": "2012-10-17",\n "Statement": [\n \n ]\n}'}}]); ================================================ FILE: web-app/build/static/js/4599.93da78de.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4599],{14599:(e,t,l)=>{l.r(t),l.d(t,{default:()=>u});var n=l(9950),s=l(89132),r=l(49078),c=l(99491),i=l(1531),a=l(49534),o=l(44414);const u=e=>{let{closeDeleteModalAndRefresh:t,deleteOpen:l,selectedBucket:u,ruleToDelete:d,rulesToDelete:p,remainingRules:b,allSelected:x,deleteSelectedRules:h=!1}=e;const j=(0,c.jL)(),[m,f]=(0,n.useState)(""),[k,v]=(0,i.A)(()=>t(!0),e=>j((0,r.C9)(e)));if(!u)return null;return(0,o.jsx)(a.A,{title:h?"Delete Selected Replication Rules":"Delete Replication Rule",confirmText:"Delete",isOpen:l,titleIcon:(0,o.jsx)(s.xWY,{}),isLoading:k,onConfirm:()=>{let e="/api/v1/buckets/".concat(u,"/replication/").concat(d);if(h){if(!x)return e="/api/v1/buckets/".concat(u,"/delete-selected-replication-rules"),void v("DELETE",e,{rules:p});e="/api/v1/buckets/".concat(u,"/delete-all-replication-rules")}else 1===b&&(e="/api/v1/buckets/".concat(u,"/delete-all-replication-rules"));v("DELETE",e)},onClose:()=>t(!1),confirmButtonProps:{disabled:h&&"Yes, I am sure"!==m},confirmationContent:(0,o.jsx)(n.Fragment,{children:h?(0,o.jsxs)(n.Fragment,{children:["Are you sure you want to remove the selected replication rules for bucket ",(0,o.jsx)("b",{children:u}),"?",(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),"To continue please type ",(0,o.jsx)("b",{children:"Yes, I am sure"})," in the box.",(0,o.jsx)(s.xA9,{item:!0,xs:12,children:(0,o.jsx)(s.cl_,{id:"retype-tenant",name:"retype-tenant",onChange:e=>{f(e.target.value)},label:"",value:m})})]}):(0,o.jsxs)(n.Fragment,{children:["Are you sure you want to delete replication rule"," ",(0,o.jsx)("b",{children:d}),"?"]})})})}}}]); ================================================ FILE: web-app/build/static/js/4758.afaddc33.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4758],{80282:(e,n,t)=>{t.d(n,{A:()=>c});var a=t(9950),s=t(89132),r=t(44414);const c=e=>{let{helpText:n,contents:t}=e;return(0,r.jsx)(s.lVp,{iconComponent:(0,r.jsx)(s.nag,{}),title:n,help:(0,r.jsx)(a.Fragment,{children:t.map(e=>(0,r.jsx)(s.azJ,{sx:{paddingBottom:"20px"},children:e}))})})}},84758:(e,n,t)=>{t.r(n),t.d(n,{default:()=>y});var a=t(9950),s=t(89132),r=t(28429),c=t(93598),l=t(99491),i=t(45246),o=t(80282),x=t(70444),d=t(49078),p=t(48965),j=t(44414);const h=()=>{const e=(0,l.jL)(),n=(0,r.Zp)(),[t,h]=(0,a.useState)(""),[m,u]=(0,a.useState)(!1),y=""!==t.trim()&&-1===t.indexOf(" ");return(0,j.jsx)(s.Mxu,{children:(0,j.jsx)(s.Hbc,{title:"Create Key",icon:(0,j.jsx)(s.No_,{}),helpBox:(0,j.jsx)(o.A,{helpText:"Encryption Key",contents:["Create a new cryptographic key in the Key Management Service server connected to MINIO."]}),children:(0,j.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:a=>{a.preventDefault(),u(!0),x.F.kms.kmsCreateKey({key:t}).then(e=>{n("".concat(c.zZ.KMS_KEYS))}).catch(async n=>{const t=await n.json();e((0,d.C9)((0,p.S)(t)))}).finally(()=>u(!1))},children:(0,j.jsxs)(s.xA9,{container:!0,children:[(0,j.jsx)(s.xA9,{item:!0,xs:12,children:(0,j.jsx)(s.cl_,{id:"key-name",name:"key-name",label:"Key Name",autoFocus:!0,value:t,error:(e=>-1!==e.indexOf(" ")?"Key name cannot contain spaces":"")(t),onChange:e=>{h(e.target.value)}})}),(0,j.jsxs)(s.xA9,{item:!0,xs:12,sx:i.Uz.modalButtonBar,children:[(0,j.jsx)(s.$nd,{id:"clear",type:"button",variant:"regular",onClick:()=>{h("")},label:"Clear"}),(0,j.jsx)(s.$nd,{id:"save-key",type:"submit",variant:"callAction",color:"primary",disabled:m||!y,label:"Save"})]})]})})})})};var m=t(82817),u=t(70503);const y=()=>{const e=(0,l.jL)(),n=(0,r.Zp)();return(0,a.useEffect)(()=>{e((0,d.ph)("add_key"))},[]),(0,j.jsx)(a.Fragment,{children:(0,j.jsxs)(s.xA9,{item:!0,xs:12,children:[(0,j.jsx)(m.A,{label:(0,j.jsx)(s.EGL,{label:"Keys",onClick:()=>n(c.zZ.KMS_KEYS)}),actions:(0,j.jsx)(u.A,{})}),(0,j.jsx)(h,{})]})})}}}]); ================================================ FILE: web-app/build/static/js/4803.2a486f1b.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4803],{74803:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var s=n(9950),o=n(89132),l=n(49078),c=n(99491),r=n(70444),u=n(48965),a=n(49534),i=n(44414);const p=e=>{let{onClose:t,modalOpen:n,bucket:p,toDelete:f}=e;const h=(0,c.jL)(),[d,k]=(0,s.useState)(!1);return(0,i.jsx)(a.A,{title:"Delete Anonymous Access Rule",confirmText:"Delete",isOpen:n,isLoading:d,onConfirm:()=>{k(!0);let e={prefix:f};r.F.bucket.deleteAccessRuleWithBucket(p,e).then(()=>{t()}).catch(e=>{h((0,l.C9)((0,u.S)(e.error))),t()}).finally(()=>k(!1))},titleIcon:(0,i.jsx)(o.xWY,{}),onClose:t,confirmationContent:(0,i.jsx)(s.Fragment,{children:"Are you sure you want to delete this access rule?"})})}}}]); ================================================ FILE: web-app/build/static/js/4857.67bcd6f9.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4857],{58093:(e,t,a)=>{a.d(t,{A:()=>d});var n=a(9950),l=a(89132),i=a(19335),s=a(87946),r=a.n(s),c=a(44414);const o=i.Ay.button(e=>{let{theme:t}=e;return{border:"1px solid ".concat(r()(t,"borderColor","#E2E2E2")),borderRadius:3,color:r()(t,"secondaryText","#5B5C5C"),backgroundColor:r()(t,"boxBackground","#FBFAFA"),fontSize:12}}),d=e=>{let{id:t,unitSelected:a,unitsList:i,disabled:s=!1,onUnitChange:r}=e;const[d,h]=n.useState(null),u=Boolean(d),p=e=>{h(null),""!==e&&r&&r(e)};return(0,c.jsxs)(n.Fragment,{children:[(0,c.jsx)(o,{id:"".concat(t,"-button"),"aria-controls":"".concat(t,"-menu"),"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:e=>{h(e.currentTarget)},disabled:s,type:"button",children:a}),(0,c.jsx)(l.Vey,{id:"upload-main-menu",options:i,selectedOption:"",onSelect:e=>p(e),hideTriggerAction:()=>{p("")},open:u,anchorEl:d,anchorOrigin:"end"})]})}},66147:(e,t,a)=>{a.d(t,{A:()=>d});var n=a(9950),l=a(87946),i=a.n(l),s=a(95491),r=a.n(s),c=a(89132),o=a(44414);const d=e=>{let{elements:t,name:a,label:l,tooltip:s="",keyPlaceholder:d="",valuePlaceholder:h="",onChange:u,withBorder:p=!1}=e;const[g,x]=(0,n.useState)([""]),[m,b]=(0,n.useState)([""]),j=(0,n.createRef)();(0,n.useEffect)(()=>{if(1===g.length&&""===g[0]&&1===m.length&&""===m[0]&&t&&""!==t){const e=t.split("&");let a=[],n=[];e.forEach(e=>{const t=e.split("=");2===t.length&&(a.push(t[0]),n.push(t[1]))}),a.push(""),n.push(""),x(a),b(n)}},[g,m,t]),(0,n.useEffect)(()=>{const e=j.current;e&&g.length>1&&e.scrollIntoView(!1)},[g]);const y=(0,n.useRef)(!0);(0,n.useLayoutEffect)(()=>{y.current?y.current=!1:S()},[g,m]);const v=e=>{e.persist();let t=[...g];const a=i()(e.target,"dataset.index","0");t[parseInt(a)]=e.target.value,x(t)},f=e=>{e.persist();let t=[...m];const a=i()(e.target,"dataset.index","0");t[parseInt(a)]=e.target.value,b(t)},S=r()(()=>{let e="";g.forEach((t,a)=>{if(g[a]&&m[a]){let n="".concat(t,"=").concat(m[a]);0!==a&&(n="&".concat(n)),e="".concat(e).concat(n)}}),u(e)},500),C=m.map((e,t)=>(0,o.jsxs)(c.xA9,{item:!0,xs:12,className:"lineInputBoxes inputItem",children:[(0,o.jsx)(c.cl_,{id:"".concat(a,"-key-").concat(t.toString()),label:"",name:"".concat(a,"-").concat(t.toString()),value:g[t],onChange:v,index:t,placeholder:d}),(0,o.jsx)("span",{className:"queryDiv",children:":"}),(0,o.jsx)(c.cl_,{id:"".concat(a,"-value-").concat(t.toString()),label:"",name:"".concat(a,"-").concat(t.toString()),value:m[t],onChange:f,index:t,placeholder:h,overlayIcon:t===m.length-1?(0,o.jsx)(c.REV,{}):null,overlayAction:()=>{(()=>{if(""!==g[g.length-1].trim()&&""!==m[m.length-1].trim()){const e=[...g],t=[...m];e.push(""),t.push(""),x(e),b(t)}})()}})]},"query-pair-".concat(a,"-").concat(t.toString())));return(0,o.jsx)(n.Fragment,{children:(0,o.jsxs)(c.xA9,{item:!0,xs:12,sx:{"& .lineInputBoxes":{display:"flex"},"& .queryDiv":{alignSelf:"center",margin:"-15px 4px 0",fontWeight:600}},className:"inputItem",children:[(0,o.jsxs)(c.l1Y,{children:[l,""!==s&&(0,o.jsx)(c.azJ,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,o.jsx)(c.m_M,{tooltip:s,placement:"top",children:(0,o.jsx)(c.NTw,{style:{width:13,height:13}})})})]}),(0,o.jsxs)(c.azJ,{withBorders:p,sx:{padding:15,height:150,overflowY:"auto",position:"relative",marginTop:15},children:[C,(0,o.jsx)("div",{ref:j})]})]})})}},84857:(e,t,a)=>{a.r(t),a.d(t,{default:()=>y});var n=a(9950),l=a(28429),i=a(89132),s=a(93598),r=a(49078),c=a(99491),o=a(82817),d=a(70503),h=a(70444),u=a(48965),p=a(66147),g=a(59908),x=a(87946),m=a.n(x),b=a(58093),j=a(44414);const y=()=>{const e=(0,c.jL)(),t=(0,l.Zp)();let a=new URLSearchParams(document.location.search);const x=a.get("bucketName")||"",y=a.get("nextPriority")||"1",[v,f]=(0,n.useState)(!1),[S,C]=(0,n.useState)(y),[k,w]=(0,n.useState)(""),[R,E]=(0,n.useState)(""),[A,B]=(0,n.useState)(""),[T,_]=(0,n.useState)(""),[I,D]=(0,n.useState)(""),[M,O]=(0,n.useState)(""),[L,N]=(0,n.useState)(""),[z,K]=(0,n.useState)(!0),[P,U]=(0,n.useState)(!0),[F,G]=(0,n.useState)(!0),[J,V]=(0,n.useState)(!0),[q,W]=(0,n.useState)(!0),[Y,H]=(0,n.useState)(""),[Z,$]=(0,n.useState)("async"),[Q,X]=(0,n.useState)("100"),[ee,te]=(0,n.useState)("Gi"),[ae,ne]=(0,n.useState)("60"),[le,ie]=(0,n.useState)(!1),se=s.zZ.BUCKETS+"/".concat(x,"/admin/replication");(0,n.useEffect)(()=>{e((0,r.ph)("bucket-replication-add"))},[]);return(0,n.useEffect)(()=>{!le&&k.length>=3&&R.length>=8&&M.length>=3&&A.length>0&&ie(!0)},[A,k,R,M,le]),(0,n.useEffect)(()=>{le&&(k.length<3||R.length<8||M.length<3||A.length<1)&&ie(!1)},[A,k,R,M,le]),(0,j.jsxs)(n.Fragment,{children:[(0,j.jsx)(o.A,{label:(0,j.jsx)(i.EGL,{label:"Add Bucket Replication Rule - "+x,onClick:()=>t(se)}),actions:(0,j.jsx)(d.A,{})}),(0,j.jsx)(i.Mxu,{children:(0,j.jsx)(i.Hbc,{title:"Add Replication Rule",icon:(0,j.jsx)(i.WBh,{}),helpBox:(0,j.jsx)(i.lVp,{iconComponent:(0,j.jsx)(i.WBh,{}),title:"Bucket Replication Configuration",help:(0,j.jsxs)(n.Fragment,{children:[(0,j.jsx)(i.azJ,{sx:{paddconngTop:"10px"},children:"The bucket selected in this deployment acts as the \u201csource\u201d while the configured remote deployment acts as the \u201ctarget\u201d."}),(0,j.jsx)(i.azJ,{sx:{paddingTop:"10px"},children:'For each write operation to this "source" bucket, MinIO checks all configured replication rules and applies the matching rule with highest configured priority.'}),(0,j.jsx)(i.azJ,{sx:{paddingTop:"10px"},children:"MinIO supports automatically replicating existing objects in a bucket; this setting is enabled by default. Please note that objects created before replication was configured or while replication is disabled are not synchronized to the target deployment in case this setting is not enabled."}),(0,j.jsx)(i.azJ,{sx:{paddingTop:"10px"},children:"MinIO supports replicating delete operations, where MinIO synchronizes deleting specific object versions and new delete markers. Delete operation replication uses the same replication process as all other replication operations."})," "]})}),children:(0,j.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:a=>{a.preventDefault(),f(!0),(()=>{const a=[{originBucket:x,destinationBucket:M}],n=parseInt(ae),l="".concat(z?"https://":"http://").concat(A),i={accessKey:k,secretKey:R,targetURL:l,region:L,bucketsRelation:a,syncMode:Z,bandwidth:"async"===Z?parseInt((0,g.q5)(Q,ee,!0)):0,healthCheckPeriod:n,prefix:I,tags:Y,replicateDeleteMarkers:P,replicateDeletes:F,replicateExistingObjects:q,priority:parseInt(S),storageClass:T,replicateMetadata:J};h.F.bucketsReplication.setMultiBucketReplication(i).then(a=>{f(!1);const n=m()(a.data,"replicationState",[]);if(n.length>0){const a=n[0];return f(!1),a.errorString&&""!==a.errorString?void e((0,r.C9)({errorMessage:"There was an error",detailedError:a.errorString})):void t(se)}e((0,r.C9)({errorMessage:"No changes applied",detailedError:""}))}).catch(t=>{console.log("this is an error!"),f(!1),e((0,r.C9)((0,u.S)(t.error)))})})()},children:[(0,j.jsx)(i.cl_,{id:"priority",name:"priority",onChange:e=>{e.target.validity.valid&&C(e.target.value)},label:"Priority",value:S,pattern:"[0-9]*"}),(0,j.jsx)(i.cl_,{id:"targetURL",name:"targetURL",onChange:e=>{B(e.target.value)},placeholder:"play.min.io",label:"Target URL",value:A}),(0,j.jsx)(i.dOG,{checked:z,id:"useTLS",name:"useTLS",label:"Use TLS",onChange:e=>{K(e.target.checked)},value:"yes"}),(0,j.jsx)(i.cl_,{id:"accessKey",name:"accessKey",onChange:e=>{w(e.target.value)},label:"Access Key",value:k}),(0,j.jsx)(i.cl_,{id:"secretKey",name:"secretKey",onChange:e=>{E(e.target.value)},label:"Secret Key",value:R}),(0,j.jsx)(i.cl_,{id:"targetBucket",name:"targetBucket",onChange:e=>{O(e.target.value)},label:"Target Bucket",value:M}),(0,j.jsx)(i.cl_,{id:"region",name:"region",onChange:e=>{N(e.target.value)},label:"Region",value:L}),(0,j.jsx)(i.l6P,{id:"replication_mode",name:"replication_mode",onChange:e=>{$(e)},label:"Replication Mode",value:Z,options:[{label:"Asynchronous",value:"async"},{label:"Synchronous",value:"sync"}]}),"async"===Z&&(0,j.jsx)(i.azJ,{className:"inputItem",children:(0,j.jsx)(i.cl_,{type:"number",id:"bandwidth_scalar",name:"bandwidth_scalar",onChange:e=>{e.target.validity.valid&&X(e.target.value)},label:"Bandwidth",value:Q,min:"0",pattern:"[0-9]*",overlayObject:(0,j.jsx)(b.A,{id:"quota_unit",onUnitChange:e=>{te(e)},unitSelected:ee,unitsList:(0,g.l9)(["Ki"]),disabled:!1})})}),(0,j.jsx)(i.cl_,{id:"healthCheck",name:"healthCheck",onChange:e=>{ne(e.target.value)},label:"Health Check Duration",value:ae}),(0,j.jsx)(i.cl_,{id:"storageClass",name:"storageClass",onChange:e=>{_(e.target.value)},placeholder:"STANDARD_IA,REDUCED_REDUNDANCY etc",label:"Storage Class",value:T}),(0,j.jsxs)("fieldset",{className:"inputItem",children:[(0,j.jsx)("legend",{children:"Object Filters"}),(0,j.jsx)(i.cl_,{id:"prefix",name:"prefix",onChange:e=>{D(e.target.value)},placeholder:"prefix",label:"Prefix",value:I}),(0,j.jsx)(p.A,{name:"tags",label:"Tags",elements:"",onChange:e=>{H(e)},keyPlaceholder:"Tag Key",valuePlaceholder:"Tag Value",withBorder:!0})]}),(0,j.jsxs)("fieldset",{className:"inputItem",children:[(0,j.jsx)("legend",{children:"Replication Options"}),(0,j.jsx)(i.dOG,{checked:q,id:"repExisting",name:"repExisting",label:"Existing Objects",onChange:e=>{W(e.target.checked)},description:"Replicate existing objects"}),(0,j.jsx)(i.dOG,{checked:J,id:"metadatataSync",name:"metadatataSync",label:"Metadata Sync",onChange:e=>{V(e.target.checked)},description:"Metadata Sync"}),(0,j.jsx)(i.dOG,{checked:P,id:"deleteMarker",name:"deleteMarker",label:"Delete Marker",onChange:e=>{U(e.target.checked)},description:"Replicate soft deletes"}),(0,j.jsx)(i.dOG,{checked:F,id:"repDelete",name:"repDelete",label:"Deletes",onChange:e=>{G(e.target.checked)},description:"Replicate versioned deletes"})]}),(0,j.jsxs)(i.xA9,{item:!0,xs:12,sx:{display:"flex",flexDirection:"row",justifyContent:"end",gap:10,paddingTop:10},children:[(0,j.jsx)(i.$nd,{id:"cancel",type:"button",variant:"regular",disabled:v,onClick:()=>{t(se)},label:"Cancel"}),(0,j.jsx)(i.$nd,{id:"submit",type:"submit",variant:"callAction",color:"primary",disabled:v||!le,label:"Save"})]})]})})})]})}}}]); ================================================ FILE: web-app/build/static/js/4860.8173be96.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4860],{74860:(e,s,l)=>{l.r(s),l.d(s,{default:()=>d});var n=l(9950),a=l(28429),h=l(20171),j=l(98734),t=l(93598),x=l(44414);const c=n.lazy(()=>l.e(9506).then(l.bind(l,49506))),p=n.lazy(()=>l.e(1004).then(l.bind(l,51004))),b=n.lazy(()=>l.e(5169).then(l.bind(l,95169))),d=()=>(0,x.jsxs)(a.BV,{children:[(0,x.jsx)(a.qh,{path:t.zZ.ADD_BUCKETS,element:(0,x.jsx)(n.Suspense,{fallback:(0,x.jsx)(j.A,{}),children:(0,x.jsx)(b,{})})}),(0,x.jsx)(a.qh,{path:"/",element:(0,x.jsx)(n.Suspense,{fallback:(0,x.jsx)(j.A,{}),children:(0,x.jsx)(c,{})})}),(0,x.jsx)(a.qh,{path:":bucketName/admin/*",element:(0,x.jsx)(n.Suspense,{fallback:(0,x.jsx)(j.A,{}),children:(0,x.jsx)(p,{})})}),(0,x.jsx)(a.qh,{element:(0,x.jsx)(a.C5,{to:"/buckets"}),path:"*"}),(0,x.jsx)(a.qh,{element:(0,x.jsx)(n.Suspense,{fallback:(0,x.jsx)(j.A,{}),children:(0,x.jsx)(h.A,{})})})]})}}]); ================================================ FILE: web-app/build/static/js/4945.b4f6f750.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4945],{32680:(e,t,l)=>{l.d(t,{A:()=>d});var a=l(9950),s=l(98341),r=l(89132),n=l(99491),o=l(49078),i=l(96382),c=l(44414);const d=e=>{let{onClose:t,modalOpen:l,title:d,children:u,wideLimit:p=!0,titleIcon:h=null,iconColor:f="default",sx:x}=e;const b=(0,n.jL)(),[m,y]=(0,a.useState)(!1),v=(0,s.d4)(e=>e.system.modalSnackBar);(0,a.useEffect)(()=>{b((0,o.h0)(""))},[b]),(0,a.useEffect)(()=>{if(v){if(""===v.message)return void y(!1);"error"!==v.type&&y(!0)}},[v]);let C="";return v&&(C=v.detailedErrorMsg,(""===C||C&&C.length<5)&&(C=v.message)),(0,c.jsxs)(r.ngX,{onClose:t,open:l,title:d,titleIcon:h,widthLimit:p,sx:x,iconColor:f,children:[(0,c.jsx)(i.A,{isModal:!0}),(0,c.jsx)(r.qb_,{onClose:()=>{y(!1),b((0,o.h0)(""))},open:m,message:C,mode:"inline",variant:"error"===v.type?"error":"default",autoHideDuration:"error"===v.type?10:5,condensed:!0}),u]})}},54945:(e,t,l)=>{l.r(t),l.d(t,{default:()=>p});var a=l(9950),s=l(32680),r=l(89132),n=l(70444),o=l(48965),i=l(45246),c=l(49078),d=l(99491),u=l(44414);const p=e=>{let{modalOpen:t,onClose:l,bucket:p,prefilledRoute:h}=e;const f=(0,d.jL)(),[x,b]=(0,a.useState)(""),[m,y]=(0,a.useState)("readonly");(0,a.useEffect)(()=>{h&&b(h)},[h]);return(0,u.jsx)(s.A,{modalOpen:t,title:"Add Anonymous Access Rule",onClose:l,titleIcon:(0,u.jsx)(r.No_,{}),children:(0,u.jsxs)(r.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,u.jsx)(r.cl_,{value:x,label:"Prefix",id:"prefix",name:"prefix",placeholder:"Enter Prefix",onChange:e=>{b(e.target.value)},tooltip:"Enter '/' to apply the rule to all prefixes and objects at the bucket root. Do not include the wildcard asterisk '*' as part of the prefix *unless* it is an explicit part of the prefix name. The Console automatically appends an asterisk to the appropriate sections of the resulting IAM policy."}),(0,u.jsx)(r.l6P,{id:"access",name:"Access",onChange:e=>{y(e)},label:"Access",value:m,options:[{label:"readonly",value:"readonly"},{label:"writeonly",value:"writeonly"},{label:"readwrite",value:"readwrite"}],disabled:!1,helpTip:(0,u.jsx)(a.Fragment,{children:"Select the desired level of access available to unauthenticated Users"}),helpTipPlacement:"right"}),(0,u.jsxs)(r.xA9,{item:!0,xs:12,sx:i.Uz.modalButtonBar,children:[(0,u.jsx)(r.$nd,{id:"clear",type:"button",variant:"regular",onClick:()=>{b(""),y("readonly")},label:"Clear"}),(0,u.jsx)(r.$nd,{id:"add-access-save",type:"submit",variant:"callAction",disabled:""===x.trim(),onClick:()=>{n.F.bucket.setAccessRuleWithBucket(p,{prefix:x,access:m}).then(e=>{f((0,c.Hk)("Access Rule added successfully")),l()}).catch(e=>{f((0,c.C9)((0,o.S)(e.error))),l()})},label:"Save"})]})]})})}}}]); ================================================ FILE: web-app/build/static/js/4964.f7712fa8.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[4964],{10734:(e,t,n)=>{n.d(t,{G:()=>_});var r,i=n(9950),a=n(72004),o=n(77437),c=n(93008),l=n.n(c),u=n(62780),s=n.n(u),p=n(40821),f=n.n(p),h=n(21099),y=n.n(h),d=n(59418),m=n.n(d),b=n(76653),v=n(42143),g=n(62775),O=n(67628),A=n(91792),w=n(21570),x=n(95912),j=n(675),P=["layout","type","stroke","connectNulls","isRange","ref"],E=["key"];function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function k(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!m()(c,r)||!m()(l,i))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,i,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,r=t.dot,o=t.points,c=t.className,l=t.top,u=t.left,s=t.xAxis,p=t.yAxis,h=t.width,y=t.height,d=t.isAnimationActive,m=t.id;if(n||!o||!o.length)return null;var b=this.state.isAnimationFinished,v=1===o.length,A=(0,a.A)("recharts-area",c),w=s&&s.allowDataOverflow,x=p&&p.allowDataOverflow,P=w||x,E=f()(m)?this.id:m,S=null!==(e=(0,j.J9)(r,!1))&&void 0!==e?e:{r:3,strokeWidth:2},k=S.r,D=void 0===k?3:k,M=S.strokeWidth,R=void 0===M?2:M,C=((0,j.sT)(r)?r:{}).clipDot,N=void 0===C||C,W=2*D+R;return i.createElement(g.W,{className:A},w||x?i.createElement("defs",null,i.createElement("clipPath",{id:"clipPath-".concat(E)},i.createElement("rect",{x:w?u:u-h/2,y:x?l:l-y/2,width:w?h:2*h,height:x?y:2*y})),!N&&i.createElement("clipPath",{id:"clipPath-dots-".concat(E)},i.createElement("rect",{x:u-W/2,y:l-W/2,width:h+W,height:y+W}))):null,v?null:this.renderArea(P,E),(r||v)&&this.renderDots(P,N,E),(!d||b)&&O.Z.renderCallByParent(this.props,o))}}])&&C(n.prototype,r),c&&C(n,c),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,c}(i.PureComponent);r=_,T(_,"displayName","Area"),T(_,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!A.m.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"}),T(_,"getBaseValue",function(e,t,n,r){var i=e.layout,a=e.baseValue,o=t.props.baseValue,c=null!==o&&void 0!==o?o:a;if((0,w.Et)(c)&&"number"===typeof c)return c;var l="horizontal"===i?r:n,u=l.scale.domain();if("number"===l.type){var s=Math.max(u[0],u[1]),p=Math.min(u[0],u[1]);return"dataMin"===c?p:"dataMax"===c||s<0?s:Math.max(Math.min(u[0],u[1]),0)}return"dataMin"===c?u[0]:"dataMax"===c?u[1]:u[0]}),T(_,"getComposedData",function(e){var t,n=e.props,i=e.item,a=e.xAxis,o=e.yAxis,c=e.xAxisTicks,l=e.yAxisTicks,u=e.bandSize,s=e.dataKey,p=e.stackedData,f=e.dataStartIndex,h=e.displayedData,y=e.offset,d=n.layout,m=p&&p.length,b=r.getBaseValue(n,i,a,o),v="horizontal"===d,g=!1,O=h.map(function(e,t){var n;m?n=p[f+t]:(n=(0,x.kr)(e,s),Array.isArray(n)?g=!0:n=[b,n]);var r=null==n[1]||m&&null==(0,x.kr)(e,s);return v?{x:(0,x.nb)({axis:a,ticks:c,bandSize:u,entry:e,index:t}),y:r?null:o.scale(n[1]),value:n,payload:e}:{x:r?null:a.scale(n[1]),y:(0,x.nb)({axis:o,ticks:l,bandSize:u,entry:e,index:t}),value:n,payload:e}});return t=m||g?O.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:null!=t&&null!=e.y?o.scale(t):null}:{x:null!=t?a.scale(t):null,y:e.y}}):v?o.scale(b):a.scale(b),R({points:O,baseLine:t,layout:d,isRange:g},y)}),T(_,"renderDotItem",function(e,t){var n;if(i.isValidElement(e))n=i.cloneElement(e,t);else if(l()(e))n=e(t);else{var r=(0,a.A)("recharts-area-dot","boolean"!==typeof e?e.className:""),o=t.key,c=k(t,E);n=i.createElement(v.c,D({},c,{key:o,className:r}))}return n})},68354:(e,t,n)=>{n.d(t,{Q:()=>l});var r=n(3864),i=n(10734),a=n(60158),o=n(44813),c=n(71052),l=(0,r.gu)({chartName:"AreaChart",GraphicalChild:i.G,axisComponents:[{axisType:"xAxis",AxisComp:a.W},{axisType:"yAxis",AxisComp:o.h}],formatAxisMap:c.pr})},81095:(e,t,n)=>{n.d(t,{u:()=>m});var r=n(72004),i=n(9950),a=n(80492),o=n.n(a),c=n(21570),l=n(84824),u=n(675);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(e=o()(e,x,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=D.current.getBoundingClientRect(),r=n.width,i=n.height;return W(r,i),t.observe(D.current),function(){t.disconnect()}},[W,x]);var I=(0,i.useMemo)(function(){var e=C.containerWidth,t=C.containerHeight;if(e<0||t<0)return null;(0,l.R)((0,c._3)(h)||(0,c._3)(m),"The width(%s) and height(%s) are both fixed numbers,\n maybe you don't need to use a ResponsiveContainer.",h,m),(0,l.R)(!n||n>0,"The aspect(%s) must be greater than zero.",n);var r=(0,c._3)(h)?e:h,a=(0,c._3)(m)?t:m;n&&n>0&&(r?a=r/n:a&&(r=a*n),O&&a>O&&(a=O)),(0,l.R)(r>0||a>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",r,a,h,m,v,g,n);var o=!Array.isArray(A)&&(0,u.Mn)(A.type).endsWith("Chart");return i.Children.map(A,function(e){return i.isValidElement(e)?(0,i.cloneElement)(e,f({width:r,height:a},o?{style:f({height:"100%",width:"100%",maxHeight:a,maxWidth:r},e.props.style)}:{})):e})},[n,A,m,O,g,v,C,h]);return i.createElement("div",{id:j?"".concat(j):void 0,className:(0,r.A)("recharts-responsive-container",P),style:f(f({},k),{},{width:h,height:m,minWidth:v,minHeight:g,maxHeight:O}),ref:D},I)})}}]); ================================================ FILE: web-app/build/static/js/5028.833420c4.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5028],{55028:(e,s,n)=>{n.r(s),n.d(s,{default:()=>v});var t=n(9950),l=n(89132),i=n(98341),o=n(99491),r=n(31690),a=n(54576),d=n(49078),c=n(27428),x=n(2586),g=n(43217),h=n(87946),p=n.n(h),j=n(44414);const m="HH:mm:ss ZZZZ MM/dd/yyyy",u=e=>{const{log:s}=e,[n,i]=(0,t.useState)(!1),o=e=>p()(s,e,"");let r="",a=o("ConsoleMsg"),d=o("error.message");""!==a?r=a:""!==d&&(r=d);let c=(r||"").replace(/\u2501|\u250f|\u2513|\u2503|\u2517|\u251b/g,"");c=c.replace(/([^\x20-\x7F])/g,"");let x=(0,j.jsx)(t.Fragment,{});""!==a?x=(e=>{let s=e.ConsoleMsg;return s=s.replace(/\x1B/g," "),s=s.replace(/((\[[0-9;]+m))/g,""),(0,j.jsx)("div",{style:{display:"table",tableLayout:"fixed",width:"100%",paddingLeft:10,paddingRight:10},children:(0,j.jsx)("div",{style:{display:"table-cell",whiteSpace:"nowrap",textOverflow:"ellipsis",overflowX:"auto"},children:(0,j.jsx)("pre",{children:s})})})})(s):""!==d&&(x=(e=>{const s={color:"#C83B51",fontWeight:400,fontFamily:"monospace",fontSize:"12px"},n={fontFamily:"monospace",fontSize:"12px"},l=s=>p()(e,s,""),i=g.c9.fromFormat(e.time.toString(),"HH:mm:ss z MM/dd/yyyy",{zone:"UTC"});return(0,j.jsxs)(t.Fragment,{children:[(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"API:\xa0"}),(0,j.jsx)("span",{style:s,children:l("api.name")})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"Time:\xa0"}),(0,j.jsx)("span",{style:s,children:i.toFormat(m)})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"DeploymentID:\xa0"}),(0,j.jsx)("span",{style:s,children:l("deploymentid")})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"RequestID:\xa0"}),(0,j.jsx)("span",{style:s,children:l("requestID")})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"RemoteHost:\xa0"}),(0,j.jsx)("span",{style:s,children:l("remotehost")})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"UserAgent:\xa0"}),(0,j.jsx)("span",{style:s,children:l("userAgent")})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"Error:\xa0"}),(0,j.jsx)("span",{style:s,children:l("error.message")})]}),(0,j.jsx)("br",{}),(0,j.jsx)("div",{children:(0,j.jsx)("b",{style:n,children:"Backtrace:\xa0"})}),(e.error.source||[]).map((e,t)=>(0,j.jsxs)("div",{children:[(0,j.jsxs)("b",{style:n,children:[t,":\xa0"]}),(0,j.jsx)("span",{style:s,children:e})]}))]})})(s)),c=(c||"").replace(/((\[[0-9;]+m))/g,"");const h=g.c9.fromFormat(s.time.toString(),"HH:mm:ss z MM/dd/yyyy",{zone:"UTC"}),u=h.toJSDate();let y=(0,j.jsx)(t.Fragment,{children:h.toFormat(m)});return 1===u.getFullYear()&&(y=(0,j.jsx)(t.Fragment,{children:"n/a"})),(0,j.jsxs)(t.Fragment,{children:[(0,j.jsxs)(l.Hjg,{sx:{cursor:"pointer",borderLeft:"0",borderRight:"0"},children:[(0,j.jsx)(l.nA6,{onClick:()=>i(!n),sx:{width:280,color:"#989898",fontSize:12},children:(0,j.jsxs)(l.azJ,{sx:{display:"flex",gap:1,alignItems:"center","& .min-icon":{width:12,marginRight:1},fontWeight:"bold",lineHeight:1},children:[(0,j.jsx)(l.uwE,{}),(0,j.jsx)("div",{children:y})]})}),(0,j.jsx)(l.nA6,{onClick:()=>i(!n),sx:{width:200,color:"#989898",fontSize:12},children:(0,j.jsx)(l.azJ,{sx:{"& .min-icon":{width:12,marginRight:1},fontWeight:"bold",lineHeight:1},children:s.errKind})}),(0,j.jsx)(l.nA6,{onClick:()=>i(!n),children:(0,j.jsx)(l.azJ,{sx:{display:"table",tableLayout:"fixed",width:"100%",paddingLeft:10,paddingRight:10},children:(0,j.jsx)(l.azJ,{sx:{display:"table-cell",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},children:c})})}),(0,j.jsx)(l.nA6,{onClick:()=>i(!n),sx:{width:40},children:(0,j.jsx)(l.azJ,{sx:{"& .min-icon":{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"2px"},"&:hover .min-icon":{fill:"#eaeaea"}},children:n?(0,j.jsx)(l.Clq,{}):(0,j.jsx)(l.FZk,{})})})]}),n?(0,j.jsxs)(l.Hjg,{children:[(0,j.jsx)(l.nA6,{sx:{paddingBottom:0,paddingTop:0,width:200,textTransform:"uppercase",verticalAlign:"top",textAlign:"right",color:"#8399AB",fontWeight:"bold"},children:(0,j.jsx)(l.azJ,{sx:{marginTop:10},children:"Log Details"})}),(0,j.jsx)(l.nA6,{sx:{paddingBottom:0,paddingTop:0},colSpan:2,children:(0,j.jsx)(l.azJ,{sx:{margin:1,padding:4,fontSize:14},withBorders:!0,useBackground:!0,children:x})}),(0,j.jsx)(l.nA6,{sx:{paddingBottom:0,paddingTop:0,width:40}})]}):null]},h.toString())};var y=n(82817),b=n(70503),f=null;const v=()=>{const e=(0,o.jL)(),s=(0,i.d4)(e=>e.logs.logMessages),n=(0,i.d4)(e=>e.logs.logsStarted),[g,h]=(0,t.useState)(""),[p,m]=(0,t.useState)([""]),[v,w]=(0,t.useState)("all"),[A,S]=(0,t.useState)("Select user agent"),[C,k]=(0,t.useState)(["All User Agents"]),[z,L]=(0,t.useState)("all"),[F,B]=(0,t.useState)(!1),I=g.toLowerCase();let M=s.filter(e=>(e.userAgent===A||"All User Agents"===A||"Select user agent"===A)&&(""===g||(e.ConsoleMsg.toLowerCase().indexOf(I)>=0||(!!(e.error&&e.error.source&&e.error.source.filter(e=>e.toLowerCase().indexOf(I)>=0).length>0)||(!!(e.error&&e.error.message.toLowerCase().indexOf(I)>=0)||!!(e.api&&e.api.name.toLowerCase().indexOf(I)>=0))))));return(0,t.useEffect)(()=>{B(!0),x.A.invoke("GET","/api/v1/nodes").then(e=>{m(e),B(!1)}).catch(e=>{B(!1)})},[]),(0,t.useEffect)(()=>{e((0,d.ph)("error_logs"))},[]),(0,j.jsxs)(t.Fragment,{children:[(0,j.jsx)(y.A,{label:"Logs",actions:(0,j.jsx)(b.A,{})}),(0,j.jsx)(l.Mxu,{children:(0,j.jsxs)(l.xA9,{container:!0,sx:{gap:15},children:[(0,j.jsx)(l.xA9,{item:!0,xs:3,children:F?(0,j.jsx)("h3",{children:" Loading nodes"}):(0,j.jsx)(l.l6P,{id:"node-selector",name:"node","data-test-id":"node-selector",value:v,onChange:e=>{w(e)},disabled:F||n,options:[{label:"All Nodes",value:"all"},...p.map(e=>({label:e,value:e}))]})}),(0,j.jsx)(l.xA9,{item:!0,xs:3,children:(0,j.jsx)(l.l6P,{id:"logType",name:"logType","data-test-id":"log-type",value:z,onChange:e=>{L(e)},disabled:F||n,options:[{value:"all",label:"All Log Types"},{value:"minio",label:"MinIO"},{value:"application",label:"Application"}]})}),(0,j.jsx)(l.xA9,{item:!0,xs:3,children:C.length>1&&(0,j.jsx)(l.l6P,{id:"userAgent",name:"userAgent","data-test-id":"user-agent",value:A,onChange:e=>{S(e)},disabled:C.length<1||n,options:C.map(e=>({label:e,value:e}))})}),(0,j.jsxs)(l.xA9,{item:!0,xs:2,sx:{display:"flex",justifyContent:"flex-end"},children:[!n&&(0,j.jsx)(l.$nd,{id:"start-logs",type:"submit",variant:"callAction",disabled:!1,onClick:()=>{e((0,a.Ib)());const s=new URL(window.location.toString()),n=s.port,t=(0,r.nw)(s.protocol),l=new URL(document.baseURI).pathname;f=new WebSocket("".concat(t,"://").concat(s.hostname,":").concat(n).concat(l,"ws/console/?logType=").concat(z,"&node=").concat("Select node"===v?"":v));let i=null;if(null!==f)return f.onopen=()=>{console.log("WebSocket Client Connected"),e((0,a.xW)(!0)),f.send("ok"),i=setInterval(()=>{f.send("ok")},1e4)},f.onmessage=s=>{let n=JSON.parse(s.data.toString()),t=!0;""===n.level&&""===n.errKind&&"00:00:00 UTC 01/01/0001"===n.time&&""===n.ConsoleMsg&&""===n.node&&(t=!1),n.key=Math.random(),C.indexOf(n.userAgent)<0&&void 0!==n.userAgent&&(C.push(n.userAgent),k(C)),t&&e((0,a.Jb)(n))},f.onclose=()=>{clearInterval(i),console.log("connection closed by server"),e((0,a.xW)(!1))},()=>{f.close(1e3),clearInterval(i),console.log("closing websockets"),e((0,a.xW)(!1))}},label:"Start Logs"}),n&&(0,j.jsx)(l.$nd,{id:"stop-logs",type:"button",variant:"callAction",onClick:()=>{null!==f&&void 0!==f&&(f.close(1e3),e((0,a.xW)(!1)))},label:"Stop Logs"})]}),(0,j.jsx)(l.xA9,{item:!0,xs:12,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem","& button":{flexGrow:0,marginLeft:8,marginBottom:0}},children:(0,j.jsx)(c.A,{placeholder:"Filter",onChange:e=>{h(e)},value:g})}),(0,j.jsx)(l.xA9,{item:!0,xs:12,children:(0,j.jsx)(l.azJ,{id:"logs-container","data-test-id":"logs-list-container",sx:{minHeight:400,height:"calc(100vh - 200px)",overflow:"auto",fontSize:13,borderRadius:4},children:(0,j.jsxs)(l.azJ,{withBorders:!0,customBorderPadding:"0px",useBackground:!0,children:[(0,j.jsx)(l.XIK,{"aria-label":"collapsible table",children:(0,j.jsx)(l.BFY,{children:M.map(e=>(0,j.jsx)(u,{log:e}))})}),0===M.length&&(0,j.jsx)(l.azJ,{sx:{padding:20,textAlign:"center"},children:"No logs to display"})]})})})]})})]})}}}]); ================================================ FILE: web-app/build/static/js/5169.56e4888a.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5169],{54235:(e,t,n)=>{n.d(t,{A:()=>l});var i=n(9950),s=n(87946),r=n.n(s),a=n(89132),o=n(44414);const l=e=>{let{elements:t,name:n,label:s,tooltip:l="",commonPlaceholder:c="",onChange:d,withBorder:u=!1}=e;const[x,h]=(0,i.useState)([""]),m=(0,i.createRef)();(0,i.useEffect)(()=>{if(1===x.length&&""===x[0]&&t&&""!==t){const e=t.split(",");e.push(""),h(e)}},[t,x]),(0,i.useEffect)(()=>{if(x.length>1){const e=m.current;e&&e.scrollIntoView(!1)}},[x,m]);const b=(0,i.useCallback)(e=>{d(e)},[d]),j=(0,i.useRef)(!0);(0,i.useEffect)(()=>{if(j.current)return void(j.current=!1);const e=x.filter(e=>""!==e.trim()).join(",");b(e)},[x]);const g=e=>{e.persist();let t=[...x];const n=r()(e.target,"dataset.index","0");t[parseInt(n)]=e.target.value,h(t)},p=x.map((e,t)=>(0,o.jsx)(a.cl_,{id:"".concat(n,"-").concat(t.toString()),label:"",name:"".concat(n,"-").concat(t.toString()),value:x[t],onChange:g,index:t,placeholder:c,overlayIcon:t===x.length-1?(0,o.jsx)(a.REV,{}):null,overlayAction:()=>{(e=>{if(""!==e[e.length-1].trim()){const t=[...e];t.push(""),h(t)}})(x)}},"csv-multi-".concat(n,"-").concat(t.toString())));return(0,o.jsx)(i.Fragment,{children:(0,o.jsxs)(a.azJ,{sx:{display:"flex"},className:"inputItem",children:[(0,o.jsxs)(a.l1Y,{sx:{alignItems:"flex-start"},children:[(0,o.jsx)("span",{children:s}),""!==l&&(0,o.jsx)(a.azJ,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,o.jsx)(a.m_M,{tooltip:l,placement:"top",children:(0,o.jsx)(a.azJ,{className:l,children:(0,o.jsx)(a.NTw,{})})})})]}),(0,o.jsxs)(a.azJ,{withBorders:u,sx:{width:"100%",overflowY:"auto",height:150,position:"relative"},children:[p,(0,o.jsx)("div",{ref:m})]})]})})}},58093:(e,t,n)=>{n.d(t,{A:()=>d});var i=n(9950),s=n(89132),r=n(19335),a=n(87946),o=n.n(a),l=n(44414);const c=r.Ay.button(e=>{let{theme:t}=e;return{border:"1px solid ".concat(o()(t,"borderColor","#E2E2E2")),borderRadius:3,color:o()(t,"secondaryText","#5B5C5C"),backgroundColor:o()(t,"boxBackground","#FBFAFA"),fontSize:12}}),d=e=>{let{id:t,unitSelected:n,unitsList:r,disabled:a=!1,onUnitChange:o}=e;const[d,u]=i.useState(null),x=Boolean(d),h=e=>{u(null),""!==e&&o&&o(e)};return(0,l.jsxs)(i.Fragment,{children:[(0,l.jsx)(c,{id:"".concat(t,"-button"),"aria-controls":"".concat(t,"-menu"),"aria-haspopup":"true","aria-expanded":x?"true":void 0,onClick:e=>{u(e.currentTarget)},disabled:a,type:"button",children:n}),(0,l.jsx)(s.Vey,{id:"upload-main-menu",options:r,selectedOption:"",onSelect:e=>h(e),hideTriggerAction:()=>{h("")},open:x,anchorEl:d,anchorOrigin:"end"})]})}},95169:(e,t,n)=>{n.r(t),n.d(t,{default:()=>w});var i=n(9950),s=n(19335),r=n(87946),a=n.n(r),o=n(28429),l=n(89132),c=n(59908),d=n(99491),u=n(98341),x=n(49078),h=n(58093),m=n(30272),b=n(43785),j=n(24157),g=n(44414);const p=e=>{let{hasErrors:t}=e;const n=(0,d.jL)(),i=(0,u.d4)(e=>e.addBucket.name);return(0,g.jsx)(l.cl_,{id:"bucket-name",name:"bucket-name",error:t?"Invalid bucket name":"",onFocus:()=>{n((0,b.Xb)(!0))},onChange:e=>{n((0,b.i)(e.target.value))},label:"Bucket Name",value:i,required:!0})};var f=n(93598),k=n(26843);const y=e=>{let{ruleText:t}=e;return(0,g.jsx)(i.Fragment,{children:(0,g.jsxs)(l.xA9,{container:!0,style:{display:"flex",justifyContent:"flex-start"},children:[(0,g.jsx)(l.xA9,{item:!0,xs:1,children:(0,g.jsx)(l.$rg,{width:"16px",height:"16px",style:{color:"#18BF42"}})}),(0,g.jsx)(l.xA9,{item:!0,xs:9,sx:{color:"#8f949c",display:"flex",justifyContent:"flex-start"},children:t})]})})},v=e=>{let{ruleText:t}=e;return(0,g.jsx)(i.Fragment,{children:(0,g.jsxs)(l.xA9,{container:!0,sx:{color:"#C83B51",display:"flex",justifyContent:"flex-start"},children:[(0,g.jsx)(l.xA9,{item:!0,xs:1,sx:{paddingRight:1},children:(0,g.jsx)(l.xWY,{width:"16px",height:"16px"})}),(0,g.jsx)(l.xA9,{item:!0,xs:9,sx:{color:"#C83B51",display:"flex",justifyContent:"flex-start",paddingLeft:1},children:t})]})})},T=e=>{let{ruleText:t}=e;return(0,g.jsx)(i.Fragment,{children:(0,g.jsxs)(l.xA9,{container:!0,sx:{display:"flex",justifyContent:"flex-start"},children:[(0,g.jsx)(l.xA9,{item:!0,xs:1,children:(0,g.jsx)(l.GQ2,{width:"12px",height:"12px",style:{color:"#8f949c"}})}),(0,g.jsx)(l.xA9,{item:!0,xs:9,sx:{color:"#8f949c",display:"flex",justifyContent:"flex-start"},style:{},children:t})]})})},C=e=>{let{errorList:t}=e;const n="Bucket names must be between 3 (min) and 63 (max) characters long.",s="Bucket names can consist only of lowercase letters, numbers, dots (.), and hyphens (-).",r="Bucket names must not contain two adjacent periods, or a period adjacent to a hyphen.",a="Bucket names must not be formatted as an IP address (for example, 192.168.5.4).",o="Bucket names must not start with the prefix xn--.",c="Bucket names must not end with the suffix -s3alias. This suffix is reserved for access point alias names.",d="Bucket names must be unique within a partition.",x=(0,u.d4)(e=>e.addBucket.name),[h,m]=(0,i.useState)(!1),b=(0,u.d4)(e=>e.addBucket.loading),[j,p,f,k,C,B,_]=t;return(0,g.jsxs)(i.Fragment,{children:[(0,g.jsx)(l.J2w,{id:"toggle-naming-rules",type:"button",open:h,label:"".concat(h?"Hide":"View"," Bucket Naming Rules"),onClick:()=>{m(!h)}}),h&&(0,g.jsxs)(l.xA9,{container:!0,sx:{fontSize:14,paddingTop:12},children:[(0,g.jsxs)(l.xA9,{item:!0,xs:6,children:[0===x.length?(0,g.jsx)(T,{ruleText:n}):j?(0,g.jsx)(y,{ruleText:n}):(0,g.jsx)(v,{ruleText:n}),0===x.length?(0,g.jsx)(T,{ruleText:s}):p?(0,g.jsx)(y,{ruleText:s}):(0,g.jsx)(v,{ruleText:s}),0===x.length?(0,g.jsx)(T,{ruleText:r}):f?(0,g.jsx)(y,{ruleText:r}):(0,g.jsx)(v,{ruleText:r}),0===x.length?(0,g.jsx)(T,{ruleText:a}):k?(0,g.jsx)(y,{ruleText:a}):(0,g.jsx)(v,{ruleText:a})]}),(0,g.jsxs)(l.xA9,{item:!0,xs:6,children:[0===x.length?(0,g.jsx)(T,{ruleText:o}):C?(0,g.jsx)(y,{ruleText:o}):(0,g.jsx)(v,{ruleText:o}),0===x.length?(0,g.jsx)(T,{ruleText:c}):B?(0,g.jsx)(y,{ruleText:c}):(0,g.jsx)(v,{ruleText:c}),0===x.length?(0,g.jsx)(T,{ruleText:d}):_?(0,g.jsx)(y,{ruleText:d}):(0,g.jsx)(v,{ruleText:d})]})]}),b&&(0,g.jsx)(l.xA9,{item:!0,xs:12,children:(0,g.jsx)(l.z21,{})})]})};var B=n(82817),_=n(70444),O=n(48965),S=n(70503),A=n(54235);const E=s.Ay.div(e=>{let{theme:t}=e;return{color:a()(t,"signalColors.danger","#C51B3F"),border:"1px solid ".concat(a()(t,"signalColors.danger","#C51B3F")),padding:8,borderRadius:3}}),w=()=>{const e=(0,d.jL)(),t=(0,o.Zp)(),n=new RegExp("^[a-z0-9][a-z0-9\\.\\-]{1,61}[a-z0-9]$"),s=new RegExp("^(\\d+\\.){3}\\d+$"),r=(0,u.d4)(e=>e.addBucket.name),a=(0,u.d4)(e=>e.addBucket.isDirty),[y,v]=(0,i.useState)([]),T=y.filter(e=>!e).length>0,[w,F]=(0,i.useState)([]),V=(0,u.d4)(e=>e.addBucket.versioningEnabled),I=(0,u.d4)(e=>e.addBucket.excludeFolders),N=(0,u.d4)(e=>e.addBucket.excludedPrefixes),P=(0,u.d4)(e=>e.addBucket.lockingEnabled),U=(0,u.d4)(e=>e.addBucket.quotaEnabled),R=(0,u.d4)(e=>e.addBucket.quotaSize),q=(0,u.d4)(e=>e.addBucket.quotaUnit),z=(0,u.d4)(e=>e.addBucket.retentionEnabled),L=(0,u.d4)(e=>e.addBucket.retentionMode),G=(0,u.d4)(e=>e.addBucket.retentionUnit),M=(0,u.d4)(e=>e.addBucket.retentionValidity),J=(0,u.d4)(e=>e.addBucket.loading),K=(0,u.d4)(e=>e.addBucket.error),Y=(0,u.d4)(e=>e.addBucket.invalidFields),D=(0,u.d4)(e=>e.addBucket.lockingFieldDisabled),$=(0,u.d4)(x.Rq),Q=(0,u.d4)(x.nM),W=(0,u.d4)(e=>e.addBucket.navigateTo),H=(0,k._)("*",[f.OV.S3_PUT_BUCKET_VERSIONING,f.OV.S3_PUT_BUCKET_OBJECT_LOCK_CONFIGURATION,f.OV.S3_PUT_ACTIONS],!0),X=(0,k._)("*",[f.OV.S3_PUT_BUCKET_VERSIONING,f.OV.S3_PUT_ACTIONS]);(0,i.useEffect)(()=>{K&&e((0,x.C9)((0,O.S)(K)))},[K,e]),(0,i.useEffect)(()=>{const e=[!(a&&(r.length<3||r.length>63)),n.test(r),!(r.includes(".-")||r.includes("-.")||r.includes("..")),!s.test(r),!r.startsWith("xn--"),!r.endsWith("-s3alias"),!w.includes(r)];v(e)},[r,a]),(0,i.useEffect)(()=>{e((0,b.i)("")),e((0,b.Xb)(!1));_.F.buckets.listBuckets().then(t=>{if(t.data){var n=[];null!=t.data.buckets&&t.data.buckets.length>0&&t.data.buckets.forEach(e=>{n.push(e.name)}),F(n)}else t.error&&e((0,x.C9)((0,O.S)(t.error)))}).catch(t=>{e((0,x.C9)((0,O.S)(t)))})},[e]);return(0,i.useEffect)(()=>{if(""!==W){const n="".concat(W);e((0,b.E2)()),t(n)}},[W,t,e]),(0,i.useEffect)(()=>{e((0,x.ph)("add_bucket"))},[]),(0,g.jsxs)(i.Fragment,{children:[(0,g.jsx)(B.A,{label:(0,g.jsx)(l.EGL,{label:"Buckets",onClick:()=>t("/buckets")}),actions:(0,g.jsx)(S.A,{})}),(0,g.jsx)(l.Mxu,{children:(0,g.jsx)(l.Hbc,{title:"Create Bucket",icon:(0,g.jsx)(l.brV,{}),helpBox:(0,g.jsx)(l.lVp,{iconComponent:(0,g.jsx)(l.brV,{}),title:"Buckets",help:(0,g.jsxs)(i.Fragment,{children:["MinIO uses buckets to organize objects. A bucket is similar to a folder or directory in a filesystem, where each bucket can hold an arbitrary number of objects.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),(0,g.jsx)("b",{children:"Versioning"})," allows to keep multiple versions of the same object under the same key.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),(0,g.jsx)("b",{children:"Object Locking"})," prevents objects from being deleted. Required to support retention and legal hold. Can only be enabled at bucket creation.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),(0,g.jsx)("b",{children:"Quota"})," limits the amount of data in the bucket.",H&&(0,g.jsxs)(i.Fragment,{children:[(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),(0,g.jsx)("b",{children:"Retention"})," imposes rules to prevent object deletion for a period of time. Versioning must be enabled in order to set bucket retention policies."]}),(0,g.jsx)("br",{}),(0,g.jsx)("br",{})]})}),children:(0,g.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:t=>{t.preventDefault(),e((0,j._)())},children:[(0,g.jsxs)(l.azJ,{children:[(0,g.jsx)(p,{hasErrors:T}),(0,g.jsx)(l.azJ,{sx:{margin:"10px 0"},children:(0,g.jsx)(C,{errorList:y})}),(0,g.jsx)(l._xt,{separator:!0,children:"Features"}),(0,g.jsxs)(l.azJ,{sx:{marginTop:10},children:[!$&&(0,g.jsxs)(i.Fragment,{children:[(0,g.jsxs)(E,{children:["These features are unavailable in a single-disk setup.",(0,g.jsx)("br",{}),"Please deploy a server in"," ",(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/operations/concepts/architecture.html#distributed-minio-deployments",target:"_blank",rel:"noopener",children:"Distributed Mode"})," ","to use these features."]}),(0,g.jsx)("br",{}),(0,g.jsx)("br",{})]}),Q.enabled&&(0,g.jsxs)(i.Fragment,{children:[(0,g.jsx)("br",{}),(0,g.jsxs)(l.azJ,{withBorders:!0,sx:{display:"flex",alignItems:"center",padding:"10px","& > .min-icon ":{width:20,height:20,marginRight:10}},children:[(0,g.jsx)(l.mo0,{})," Versioning setting cannot be changed as cluster replication is enabled for this site."]}),(0,g.jsx)("br",{})]}),(0,g.jsx)(l.dOG,{value:"versioned",id:"versioned",name:"versioned",checked:V,onChange:t=>{e((0,b.tr)(t.target.checked))},label:"Versioning",disabled:!$||P||Q.enabled||!X,tooltip:X?"":(0,f.vj)([f.OV.S3_PUT_BUCKET_VERSIONING,f.OV.S3_PUT_ACTIONS],"Versioning"),helpTip:(0,g.jsxs)(i.Fragment,{children:[P&&V&&(0,g.jsxs)("strong",{children:[" ","You must disable Object Locking before Versioning can be disabled ",(0,g.jsx)("br",{})]}),"MinIO supports keeping multiple"," ",(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-versioning.html#bucket-versioning",target:"blank",children:"versions"})," ","of an object in a single bucket.",(0,g.jsx)("br",{}),"Versioning is required to enable"," ",(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-retention.html",target:"blank",children:"Object Locking"})," ","and"," ",(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-retention.html#object-retention-modes",target:"blank",children:"Retention"}),"."]}),helpTipPlacement:"right"}),V&&$&&!P&&(0,g.jsxs)(i.Fragment,{children:[(0,g.jsx)(l.dOG,{id:"excludeFolders",label:"Exclude Folders",checked:I,onChange:t=>{e((0,b.uQ)(t.target.checked))},indicatorLabels:["Enabled","Disabled"],helpTip:(0,g.jsxs)(i.Fragment,{children:["You can choose to"," ",(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-versioning.html#exclude-folders-from-versioning",children:"exclude folders and prefixes"})," ","from versioning if Object Locking is not enabled.",(0,g.jsx)("br",{}),"MinIO requires versioning to support replication.",(0,g.jsx)("br",{}),"Objects in excluded prefixes do not replicate to any peer site or remote site."]}),helpTipPlacement:"right"}),(0,g.jsx)(A.A,{elements:N,label:"Excluded Prefixes",name:"excludedPrefixes",onChange:t=>{let n="";n=Array.isArray(t)?t.join(","):t,e((0,b.pw)(n))},withBorder:!0})]}),(0,g.jsx)(l.dOG,{value:"locking",id:"locking",name:"locking",disabled:D||!$||!H,checked:P,onChange:t=>{e((0,b.SO)(t.target.checked)),t.target.checked&&!Q.enabled&&e((0,b.tr)(!0))},label:"Object Locking",tooltip:H?"":(0,f.vj)([f.OV.S3_PUT_BUCKET_VERSIONING,f.OV.S3_PUT_BUCKET_OBJECT_LOCK_CONFIGURATION,f.OV.S3_PUT_ACTIONS],"Locking"),helpTip:(0,g.jsxs)(i.Fragment,{children:[z&&(0,g.jsxs)("strong",{children:[" ","You must disable Retention before Object Locking can be disabled ",(0,g.jsx)("br",{})]}),"You can only enable"," ",(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management.html#object-retention",target:"blank",children:"Object Locking"})," ","when first creating a bucket.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-versioning.html#exclude-folders-from-versioning",children:"Exclude folders and prefixes"})," ","options will not be available if this option is enabled."]}),helpTipPlacement:"right"}),(0,g.jsx)(l.dOG,{value:"bucket_quota",id:"bucket_quota",name:"bucket_quota",checked:U,onChange:t=>{e((0,b.N2)(t.target.checked))},label:"Quota",disabled:!$,helpTip:(0,g.jsxs)(i.Fragment,{children:["Setting a"," ",(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/reference/deprecated/mc-quota-set.html",target:"blank",children:"quota"})," ","assigns a hard limit to a bucket beyond which MinIO does not allow writes."]}),helpTipPlacement:"right"}),U&&$&&(0,g.jsx)(i.Fragment,{children:(0,g.jsx)(l.cl_,{type:"string",id:"quota_size",name:"quota_size",onChange:t=>{e((0,b.A1)(t.target.value))},label:"Capacity",value:R,required:!0,min:"1",overlayObject:(0,g.jsx)(h.A,{id:"quota_unit",onUnitChange:t=>{e((0,b.rS)(t))},unitSelected:q,unitsList:(0,c.l9)(["Ki"]),disabled:!1}),error:Y.includes("quotaSize")?"Please enter a valid quota":""})}),V&&$&&H&&(0,g.jsx)(l.dOG,{value:"bucket_retention",id:"bucket_retention",name:"bucket_retention",checked:z,onChange:t=>{e((0,b.VB)(t.target.checked))},label:"Retention",helpTip:(0,g.jsxs)(i.Fragment,{children:["MinIO supports setting both"," ",(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-retention.html#configure-bucket-default-object-retention",target:"blank",children:"bucket-default"})," ","and per-object retention rules.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{})," For per-object retention settings, defer to the documentation for the PUT operation used by your preferred SDK."]}),helpTipPlacement:"right"}),z&&$&&(0,g.jsxs)(i.Fragment,{children:[(0,g.jsx)(l.z6M,{currentValue:L,id:"retention_mode",name:"retention_mode",label:"Mode",onChange:t=>{e((0,b.Og)(t.target.value))},selectorOptions:[{value:"compliance",label:"Compliance"},{value:"governance",label:"Governance"}],helpTip:(0,g.jsxs)(i.Fragment,{children:[" ",(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-retention.html#compliance-mode",target:"blank",children:"Compliance"})," ","lock protects Objects from write operations by all users, including the MinIO root user.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/object-retention.html#governance-mode",target:"blank",children:"Governance"})," ","lock protects Objects from write operations by non-privileged users."]}),helpTipPlacement:"right"}),(0,g.jsx)(l.cl_,{type:"number",id:"retention_validity",name:"retention_validity",onChange:t=>{e((0,b.VY)(t.target.valueAsNumber))},label:"Validity",value:String(M),required:!0,overlayObject:(0,g.jsx)(h.A,{id:"retention_unit",onUnitChange:t=>{e((0,b.JW)(t))},unitSelected:G,unitsList:[{value:"days",label:"Days"},{value:"years",label:"Years"}],disabled:!1})})]})]})]}),(0,g.jsxs)(l.xA9,{item:!0,xs:12,sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:10,marginTop:15},children:[(0,g.jsx)(l.$nd,{id:"clear",type:"button",variant:"regular",className:"clearButton",onClick:()=>{e((0,b.E2)())},label:"Clear"}),(0,g.jsx)(m.A,{tooltip:Y.length>0||!a||T?"You must apply a valid name to the bucket":"",children:(0,g.jsx)(l.$nd,{id:"create-bucket",type:"submit",variant:"callAction",color:"primary",disabled:J||Y.length>0||!a||T,label:"Create Bucket"})})]}),J&&(0,g.jsx)(l.xA9,{item:!0,xs:12,children:(0,g.jsx)(l.z21,{})})]})})})]})}}}]); ================================================ FILE: web-app/build/static/js/5238.898e912e.chunk.js ================================================ (self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5238],{15238:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>S});var o=n(89379),r=n(9950),i=n(98341),a=n(28429),s=n(89132),c=n(45246),l=n(94797),d=n(93598),p=n(26843),u=n(55604),x=n(27428),h=n(75054),f=n(44414);const y={display:"grid",gridTemplateColumns:"70px 1fr",gap:15},m=e=>{let{search:t="",children:n=""}=e;const o=new RegExp("(".concat(function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}(t),")"),"i"),r=String(n).split(o);return t?r.map((e,t)=>o.test(e)?(0,f.jsx)("mark",{children:e},t):e):n},b=e=>{let{policyStatements:t}=e;const[n,o]=(0,r.useState)("");return(0,f.jsxs)(s.xA9,{container:!0,children:[(0,f.jsx)(s.xA9,{item:!0,xs:12,children:(0,f.jsxs)(s.xA9,{container:!0,sx:{display:"flex",alignItems:"center"},children:[(0,f.jsx)(s.V7x,{content:(0,f.jsxs)(r.Fragment,{children:["Define which actions are permitted on a specified resource. Learn more about"," ",(0,f.jsx)("a",{target:"blank",href:"https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html",children:"IAM conditional statements"}),"."]}),placement:"right",children:(0,f.jsx)(s.xA9,{item:!0,xs:12,sm:6,sx:{fontWeight:"bold"},children:"Statements"})}),(0,f.jsx)(s.xA9,{item:!0,xs:12,sm:6,sx:{display:"flex",justifyContent:"flex-end"},children:(0,f.jsx)(x.A,{placeholder:"Search",onChange:o,value:n,sx:{maxWidth:380}})})]})}),!t&&(0,f.jsx)(r.Fragment,{children:"Policy has no statements"}),t&&(0,f.jsx)(s.xA9,{item:!0,xs:12,sx:{"& .policy-row":{borderBottom:"1px solid #eaeaea"},"& .policy-row:first-child":{borderTop:"1px solid #eaeaea"},"& .policy-row:last-child":{borderBottom:"0px"},paddingTop:"15px","& mark":{color:"#000000",fontWeight:500}},children:t.map((e,t)=>{const o=e.Effect,r="Allow"===o;return(0,f.jsxs)(s.azJ,{className:"policy-row",sx:{display:"grid",gridTemplateColumns:"1fr",gap:"15px",fontSize:"14px",padding:"10px 0 10px 0","& .label":{fontWeight:600}},children:[(0,f.jsxs)(s.azJ,{sx:y,children:[(0,f.jsx)(s.azJ,{className:"label",children:"Effect:"}),(0,f.jsxs)(s.azJ,{sx:{display:"flex",alignItems:"center","& .min-icon":{marginRight:"5px",fill:r?h.Ez.GREEN:h.Ez.RED,height:"14px",width:"14px"}},children:[r?(0,f.jsx)(s.xhy,{}):(0,f.jsx)(s.aaC,{}),o]})]}),(0,f.jsxs)(s.xA9,{container:!0,sx:{gap:15},children:[(0,f.jsxs)(s.xA9,{item:!0,xs:12,sm:6,sx:y,children:[(0,f.jsx)(s.azJ,{className:"label",children:"Actions:"}),(0,f.jsx)(s.azJ,{children:e.Action&&e.Action.map((e,o)=>(0,f.jsx)("div",{children:(0,f.jsx)(m,{search:n,children:e})},"".concat(t,"-r-").concat(o)))})]}),(0,f.jsxs)(s.xA9,{item:!0,xs:12,sm:6,sx:y,children:[(0,f.jsx)(s.azJ,{className:"label",children:"Resources:"}),(0,f.jsx)(s.azJ,{children:e.Resource&&e.Resource.map((e,o)=>(0,f.jsxs)("div",{children:[" ",(0,f.jsx)(m,{search:n,children:e})]},"".concat(t,"-r-").concat(o)))})]})]})]},"".concat(t))})})]})};var g=n(49078),j=n(86070),v=n(99491),C=n(30272),w=n(82817),A=n(70444),O=n(70503);const P=(0,u.A)(r.lazy(()=>n.e(4043).then(n.bind(n,54043)))),S=()=>{const e=(0,v.jL)(),t=(0,a.Zp)(),n=(0,a.g)(),u=(0,i.d4)(j.s$),[h,y]=(0,r.useState)(null),[m,S]=(0,r.useState)([]),[_,E]=(0,r.useState)([]),[R,k]=(0,r.useState)([]),[D,M]=(0,r.useState)(!1),T=n.policyName||"",[F,z]=(0,r.useState)(""),[I,N]=(0,r.useState)(!0),[U,B]=(0,r.useState)(""),[J,L]=(0,r.useState)(!0),[G,$]=(0,r.useState)(""),[H,W]=(0,r.useState)(!0),[Z,V]=(0,r.useState)(!1),[Y,K]=(0,r.useState)("summary"),Q=u&&u.includes("ldap-idp")||!1,X=(0,p._)(d.Ms,d.qA,!0),q=(0,p._)(d.Ms,d.Oh,!0),ee=(0,p._)(d.Ms,d.x6,!0),te=(0,p._)(d.Ms,d.Ld,!0),ne=(0,p._)(d.Ms,d.yv,!0),oe=(0,p._)(d.Ms,d.uA,!0),re=(0,p._)(d.Ms,d.nr,!0);(0,r.useEffect)(()=>{I&&(I&&(ne?A.F.policy.policyInfo(T).then(e=>{if(e.data){var t,n;y(e.data),z(e?JSON.stringify(JSON.parse(null===(t=e.data)||void 0===t?void 0:t.policy),null,4):"");const o=JSON.parse(null===(n=e.data)||void 0===n?void 0:n.policy);S(o.Statement)}N(!1)}).catch(t=>{e((0,g.C9)(t)),N(!1)}):N(!1)),J&&(ee&&!Q?A.F.policies.listUsersForPolicy(T).then(e=>{var t;E(null!==(t=e.data)&&void 0!==t?t:[]),L(!1)}).catch(t=>{e((0,g.C9)(t)),L(!1)}):L(!1)),H&&(X&&!Q?A.F.policies.listGroupsForPolicy(T).then(e=>{var t;k(null!==(t=e.data)&&void 0!==t?t:[]),W(!1)}).catch(t=>{e((0,g.C9)(t)),W(!1)}):W(!1)))},[T,I,J,H,E,k,z,y,L,W,ee,X,ne,Q,e]);const ie=""!==T.trim(),ae=[{type:"view",onClick:e=>{t("".concat(d.zZ.USERS,"/").concat(encodeURIComponent(e)))},disableButtonFunction:()=>!te}],se=_.filter(e=>e.includes(U)),ce=[{type:"view",onClick:e=>{t("".concat(d.zZ.GROUPS,"/").concat(encodeURIComponent(e)))},disableButtonFunction:()=>!q}],le=R.filter(e=>e.includes(G)),de=()=>{L(!0),W(!0),N(!0)};return(0,r.useEffect)(()=>{e((0,g.ph)("policy_details_summary"))},[]),(0,f.jsxs)(r.Fragment,{children:[Z&&(0,f.jsx)(P,{deleteOpen:Z,selectedPolicy:T,closeDeleteModalAndRefresh:e=>{V(!1),t(d.zZ.POLICIES)}}),(0,f.jsx)(w.A,{label:(0,f.jsx)(r.Fragment,{children:(0,f.jsx)(s.EGL,{label:"Policy",onClick:()=>t(d.zZ.POLICIES)})}),actions:(0,f.jsx)(O.A,{})}),(0,f.jsxs)(s.Mxu,{children:[(0,f.jsx)(s.lcx,{icon:(0,f.jsx)(s.n$X,{width:40}),title:T,subTitle:(0,f.jsx)(r.Fragment,{children:"IAM Policy"}),actions:(0,f.jsxs)(r.Fragment,{children:[(0,f.jsx)(p.R,{scopes:[d.OV.ADMIN_DELETE_POLICY],resource:d.Ms,errorProps:{disabled:!0},children:(0,f.jsx)(C.A,{tooltip:oe?"":(0,d.vj)(d.uA,"delete Policies"),children:(0,f.jsx)(s.$nd,{id:"delete-policy",label:"Delete Policy",variant:"secondary",icon:(0,f.jsx)(s.ucK,{}),onClick:()=>{V(!0)},disabled:!oe})})}),(0,f.jsx)(C.A,{tooltip:"Refresh",children:(0,f.jsx)(s.$nd,{id:"refresh-policy",label:"Refresh",variant:"regular",icon:(0,f.jsx)(s.fNY,{}),onClick:()=>{de()}})})]}),sx:{marginBottom:15}}),(0,f.jsx)(s.azJ,{children:(0,f.jsx)(s.tUM,{options:[{tabConfig:{label:"Summary",disabled:!ne,id:"summary"},content:(0,f.jsx)(r.Fragment,{children:(0,f.jsxs)(s.xA9,{onMouseMove:()=>e((0,g.ph)("policy_details_summary")),children:[(0,f.jsx)(s._xt,{separator:!0,sx:{marginBottom:15},children:"Policy Summary"}),(0,f.jsx)(s.azJ,{withBorders:!0,children:(0,f.jsx)(b,{policyStatements:m})})]})})},{tabConfig:{label:"Users",disabled:!ee||Q,id:"users"},content:(0,f.jsx)(r.Fragment,{children:(0,f.jsxs)(s.xA9,{onMouseMove:()=>e((0,g.ph)("policy_details_users")),children:[(0,f.jsx)(s._xt,{separator:!0,sx:{marginBottom:15},children:"Users"}),(0,f.jsxs)(s.xA9,{container:!0,children:[_.length>0&&(0,f.jsx)(s.xA9,{item:!0,xs:12,sx:(0,o.A)((0,o.A)({},c._0.actionsTray),{},{marginBottom:15}),children:(0,f.jsx)(x.A,{value:U,placeholder:"Search Users",id:"search-resource",onChange:e=>{B(e)}})}),(0,f.jsx)(s.bQt,{itemActions:ae,columns:[{label:"Name",elementKey:"name"}],isLoading:J,records:se,entityName:"Users with this Policy associated",idField:"name",customPaperHeight:"500px"})]})]})})},{tabConfig:{label:"Groups",disabled:!X||Q,id:"groups"},content:(0,f.jsx)(r.Fragment,{children:(0,f.jsxs)(s.xA9,{onMouseMove:()=>e((0,g.ph)("policy_details_groups")),children:[(0,f.jsx)(s._xt,{separator:!0,sx:{marginBottom:15},children:"Groups"}),(0,f.jsxs)(s.xA9,{container:!0,children:[R.length>0&&(0,f.jsx)(s.xA9,{item:!0,xs:12,sx:(0,o.A)((0,o.A)({},c._0.actionsTray),{},{marginBottom:15}),children:(0,f.jsx)(x.A,{value:U,placeholder:"Search Groups",id:"search-resource",onChange:e=>{$(e)}})}),(0,f.jsx)(s.bQt,{itemActions:ce,columns:[{label:"Name",elementKey:"name"}],isLoading:H,records:le,entityName:"Groups with this Policy associated",idField:"name",customPaperHeight:"500px"})]})]})})},{tabConfig:{label:"Raw Policy",disabled:!ne,id:"raw-policy"},content:(0,f.jsx)(r.Fragment,{children:(0,f.jsxs)(s.xA9,{onMouseMove:()=>e((0,g.ph)("policy_details_policy")),children:[(0,f.jsx)(s.V7x,{content:(0,f.jsx)(r.Fragment,{children:(0,f.jsx)("a",{target:"blank",href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/policy-based-access-control.html#policy-document-structure",children:"Guide to access policy structure"})}),placement:"right",children:(0,f.jsx)(s._xt,{children:"Raw Policy"})}),(0,f.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:t=>{t.preventDefault(),D||(M(!0),re?A.F.policies.addPolicy({name:T,policy:F}).then(t=>{M(!1),e((0,g.Hk)("Policy successfully updated")),de()}).catch(t=>{M(!1),e((0,g.C9)({errorMessage:"There was an error updating the Policy ",detailedError:"There was an error updating the Policy: "+(t.error.detailedMessage||"")+". Please check Policy syntax."}))}):M(!1))},children:(0,f.jsxs)(s.xA9,{container:!0,children:[(0,f.jsx)(s.xA9,{item:!0,xs:12,children:(0,f.jsx)(l.A,{value:F,onChange:e=>{re&&z(e)},editorHeight:"350px",helptip:(0,f.jsx)(r.Fragment,{children:(0,f.jsx)("a",{target:"blank",href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/policy-based-access-control.html#policy-document-structure",children:"Guide to access policy structure"})})})}),(0,f.jsxs)(s.xA9,{item:!0,xs:12,sx:{display:"flex",justifyContent:"flex-end",paddingTop:16,gap:8},children:[!h&&(0,f.jsx)(s.$nd,{type:"button",variant:"regular",id:"clear-policy",onClick:()=>{z("{}")},children:"Clear"}),(0,f.jsx)(p.R,{scopes:[d.OV.ADMIN_CREATE_POLICY],resource:d.Ms,errorProps:{disabled:!0},children:(0,f.jsx)(C.A,{tooltip:re?"":(0,d.vj)(d.nr,"edit a Policy"),children:(0,f.jsx)(s.$nd,{id:"save",type:"submit",variant:"callAction",color:"primary",disabled:D||!ie||!re,label:"Save"})})})]}),D&&(0,f.jsx)(s.xA9,{item:!0,xs:12,children:(0,f.jsx)(s.z21,{})})]})})]})})}],currentTabOrPath:Y,onTabClick:e=>K(e)})})]})]})}},59660:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],o=0;o{"use strict";var o=n(59660),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,i,a,s,c,l,d=!1;t||(t={}),n=t.debug||!1;try{if(a=o(),s=document.createRange(),c=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",function(o){if(o.stopPropagation(),t.format)if(o.preventDefault(),"undefined"===typeof o.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=r[t.format]||r.default;window.clipboardData.setData(i,e)}else o.clipboardData.clearData(),o.clipboardData.setData(t.format,e);t.onCopy&&(o.preventDefault(),t.onCopy(o.clipboardData))}),document.body.appendChild(l),s.selectNodeContents(l),c.addRange(s),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");d=!0}catch(p){n&&console.error("unable to copy using execCommand: ",p),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),d=!0}catch(p){n&&console.error("unable to copy using clipboardData: ",p),n&&console.error("falling back to prompt"),i=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(s):c.removeAllRanges()),l&&document.body.removeChild(l),a()}return d}},75054:(e,t,n)=>{"use strict";n.d(t,{CS:()=>a,Ez:()=>o,WJ:()=>r,Zb:()=>i});const o={RED:"#C83B51",GREEN:"#4CCB92",YELLOW:"#FFBD62"},r=(e,t)=>e<=t/2?"bad":2!==t&&e===t/2+1?"warn":e===t?"good":void 0,i=e=>{switch(e){case"offline":return"bad";case"online":return"good";default:return"warn"}},a=(e,t)=>e<=t/2?"bad":e===t/2+1?"warn":e===t?"good":void 0},94702:(e,t,n)=>{"use strict";function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.CopyToClipboard=void 0;var r=s(n(9950)),i=s(n(67243)),a=["text","onCopy","options","children"];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function p(e,t){for(var n=0;n{"use strict";n.d(t,{A:()=>l});var o=n(9950),r=n(89132),i=n(95189),a=n.n(i),s=n(30272),c=n(44414);const l=e=>{let{value:t,label:n="",tooltip:i="",mode:l="json",onChange:d,editorHeight:p=250,helptip:u,readOnly:x=!1,disabled:h=!1}=e;return(0,c.jsx)(r.BYM,{value:t,onChange:e=>d(e),mode:l,tooltip:i,editorHeight:p,label:n,readOnly:x,disabled:h,helpTools:(0,c.jsx)(o.Fragment,{children:(0,c.jsx)(s.A,{tooltip:"Copy to Clipboard",children:(0,c.jsx)(a(),{text:t,children:(0,c.jsx)(r.$nd,{type:"button",id:"copy-code-mirror",icon:(0,c.jsx)(r.TdU,{}),color:"primary",variant:"regular"})})})}),helpTip:u,helpTipPlacement:"right"})}},95189:(e,t,n)=>{"use strict";var o=n(94702).CopyToClipboard;o.CopyToClipboard=o,e.exports=o}}]); ================================================ FILE: web-app/build/static/js/5354.36064e92.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5354],{75354:(e,t,o)=>{o.r(t),o.d(t,{default:()=>m});var r=o(9950),a=o(19335),i=o(28429),n=o(2586),s=o(77663),l=o(89132),c=o(32393),p=o(87946),d=o.n(p),h=o(44414);const g=a.Ay.div(e=>{let{theme:t}=e;return{"& .errorDescription":{fontStyle:"italic",transition:"all .2s ease-in-out",padding:"0 15px",marginTop:5,overflow:"auto"},"& .errorLabel":{color:d()(t,"fontColor","#000"),fontSize:18,fontWeight:"bold",marginLeft:5},"& .simpleError":{marginTop:5,padding:"2px 5px",fontSize:16,color:d()(t,"fontColor","#000")},"& .messageIcon":{color:d()(t,"signalColors.danger","#C72C48"),display:"flex","& svg":{width:32,height:32}},"& .errorTitle":{display:"flex",alignItems:"center",borderBottom:15}}}),m=()=>{const e=(0,i.Zp)(),[t,o]=(0,r.useState)(""),[a,p]=(0,r.useState)(""),[d,m]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{if(d){const t=window.location.search,r=new URLSearchParams(t),a=r.get("code"),i=r.get("state"),s=r.get("error"),l=r.get("errorDescription");s||l?(o(s||""),p(l||""),m(!1)):n.A.invoke("POST","/api/v1/login/oauth2/auth",{code:a,state:i}).then(()=>{let t="/";localStorage.getItem("redirect-path")&&""!==localStorage.getItem("redirect-path")&&(t="".concat(localStorage.getItem("redirect-path")),localStorage.setItem("redirect-path","")),i&&localStorage.setItem("auth-state",i),m(!1),e(t)}).catch(e=>{o(e.errorMessage),p(e.detailedError),m(!1)})}},[d,e]),""!==t||""!==a?(0,h.jsx)(r.Fragment,{children:(0,h.jsx)(l.ndn,{logoProps:{applicationName:(0,c.R)(),subVariant:(0,c.v)()},form:(0,h.jsxs)(g,{children:[(0,h.jsxs)("div",{className:"errorTitle",children:[(0,h.jsx)("span",{className:"messageIcon",children:(0,h.jsx)(l.cJw,{})}),(0,h.jsx)("span",{className:"errorLabel",children:"Error from IDP"})]}),(0,h.jsx)("div",{className:"simpleError",children:t}),(0,h.jsx)(l.azJ,{className:"errorDescription",children:a}),(0,h.jsx)(l.$nd,{id:"back-to-login",onClick:()=>{window.location.href="".concat(s.p,"login")},type:"submit",variant:"callAction",fullWidth:!0,children:"Back to Login"})]}),promoHeader:(0,h.jsxs)("span",{style:{fontSize:"clamp(6px, 6vw, 115px)",lineHeight:1,display:"inline-block",width:"100%"},children:["Welcome to",(0,h.jsx)("br",{}),(0,h.jsx)("span",{style:{fontSize:"clamp(6px, 8vw, 200px)"},children:"CONSOLE"})]}),promoInfo:(0,h.jsxs)("span",{style:{fontSize:14,lineHeight:1},children:["This is just a fork of the MinIO Console for my own personal educational purposes, and therefore it incorporates MinIO\xae source code. You may also want to look for other maintained forks.",(0,h.jsx)("br",{}),"It is important to note that ",(0,h.jsx)("strong",{children:"MINIO"})," is a registered trademark of the MinIO Corporation. Consequently, this project is not affiliated with or endorsed by the MinIO Corporation."]})})}):null}}}]); ================================================ FILE: web-app/build/static/js/5412.b0127d7a.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5412],{2311:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setUpSocketIOPing=t.appendQueryParams=t.parseSocketIOUrl=void 0;var r=n(94494);t.parseSocketIOUrl=function(e){if(e){var t=/^https|wss/.test(e),n=e.replace(/^(https?|wss?)(:\/\/)?/,"").replace(/\/$/,"");return"".concat(o=t?"wss":"ws","://").concat(n).concat(r.SOCKET_IO_PATH)}if(""===e){var o=(t=/^https/.test(window.location.protocol))?"wss":"ws",a=window.location.port?":".concat(window.location.port):"";return"".concat(o,"://").concat(window.location.hostname).concat(a).concat(r.SOCKET_IO_PATH)}return e};t.appendQueryParams=function(e,t){void 0===t&&(t={});var n=/\?([\w]+=[\w]+)/.test(e),r="".concat(Object.entries(t).reduce(function(e,t){var n=t[0],r=t[1];return e+"".concat(n,"=").concat(r,"&")},"").slice(0,-1));return"".concat(e).concat(n?"&":"?").concat(r)};t.setUpSocketIOPing=function(e,t){void 0===t&&(t=r.SOCKET_IO_PING_INTERVAL);return window.setInterval(function(){return e(r.SOCKET_IO_PING_CODE)},t)}},2915:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsWebSocket=function(e,t){if(!t&&e instanceof WebSocket===!1)throw new Error("")},t.resetGlobalState=function(e){(0,o.resetSubscribers)(e),(0,r.resetWebSockets)(e)};var r=n(64035),o=n(38642)},5412:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var r=n(9950),o=n(43217),a=n(98341),c=n(89132),s=n(99491),u=n(59908),i=n(31690),l=n(64928),d=n(49078),f=n(30272),p=n(82817),v=n(70503),h=n(36811),S=n(44414);const b=()=>{const e=(0,s.jL)(),t=(0,a.d4)(e=>e.trace.messages),n=(0,a.d4)(e=>e.trace.traceStarted),[b,y]=(0,r.useState)(""),[E,O]=(0,r.useState)(""),[m,g]=(0,r.useState)(""),[_,T]=(0,r.useState)(""),[w,N]=(0,r.useState)(0),[C,x]=(0,r.useState)(!1),[R,I]=(0,r.useState)(!0),[k,A]=(0,r.useState)(!1),[j,P]=(0,r.useState)(!1),[L,M]=(0,r.useState)(!1),[D,W]=(0,r.useState)(!1),[U,F]=(0,r.useState)(!1),[J,G]=(0,r.useState)(!1),[B,z]=(0,r.useState)("");(0,r.useEffect)(()=>{const e=new URL(window.location.toString()),t=(0,i.nw)(e.protocol),n=e.port,r=C?"all":(()=>{const e=[];return R&&e.push("s3"),k&&e.push("internal"),j&&e.push("storage"),L&&e.push("os"),e.join(",")})(),o=new URL(document.baseURI).pathname,a=new URL("".concat(t,"://").concat(e.hostname,":").concat(n).concat(o,"ws/trace"));a.searchParams.append("calls",r),a.searchParams.append("threshold",w.toString()),a.searchParams.append("onlyErrors",D?"yes":"no"),a.searchParams.append("statusCode",b),a.searchParams.append("method",E),a.searchParams.append("funcname",m),a.searchParams.append("path",_),z(a.href)},[C,R,k,j,L,w,D,b,E,m,_]);const{sendMessage:H,lastJsonMessage:K,readyState:V}=(0,h.Ay)(B,{heartbeat:{message:"ok",interval:1e4,timeout:31536e6}},J);return(0,r.useEffect)(()=>{V===h.vj.CONNECTING?e((0,l.rZ)()):V===h.vj.OPEN?e((0,l.p)(!0)):V===h.vj.CLOSED&&e((0,l.p)(!1))},[V,e,H]),(0,r.useEffect)(()=>{K&&(K.ptime=o.c9.fromISO(K.time).toJSDate(),K.key=Math.random(),e((0,l.cI)(K)))},[K,e]),(0,r.useEffect)(()=>{e((0,d.ph)("trace"))},[]),(0,S.jsxs)(r.Fragment,{children:[(0,S.jsx)(p.A,{label:"Trace",actions:(0,S.jsx)(v.A,{})}),(0,S.jsx)(c.Mxu,{children:(0,S.jsx)(c.azJ,{withBorders:!0,children:(0,S.jsxs)(c.xA9,{container:!0,children:[(0,S.jsxs)(c.xA9,{item:!0,xs:12,sx:{display:"flex",flexFlow:"column","& .trace-Checkbox-label":{fontSize:"14px",fontWeight:"normal"}},children:[(0,S.jsx)(c.azJ,{sx:{fontSize:"16px",fontWeight:600,padding:"20px 0px 20px 0"},children:"Calls to Trace"}),(0,S.jsxs)(c.azJ,{className:"".concat(n?"inactive-state":""),sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,S.jsxs)(c.azJ,{sx:{display:"flex",flexFlow:"row","& .trace-checked-icon":{border:"1px solid red"},["@media (min-width: ".concat(c.nmC.md,"px)")]:{gap:30}},children:[(0,S.jsx)(c.Sc0,{checked:C,id:"all_calls",name:"all_calls",label:"All",onChange:()=>x(!C),value:"all",disabled:n}),(0,S.jsx)(c.Sc0,{checked:R||C,id:"s3_calls",name:"s3_calls",label:"S3",onChange:()=>I(!R),value:"s3",disabled:C||n}),(0,S.jsx)(c.Sc0,{checked:k||C,id:"internal_calls",name:"internal_calls",label:"Internal",onChange:()=>A(!k),value:"internal",disabled:C||n}),(0,S.jsx)(c.Sc0,{checked:j||C,id:"storage_calls",name:"storage_calls",label:"Storage",onChange:()=>P(!j),value:"storage",disabled:C||n}),(0,S.jsx)(c.Sc0,{checked:L||C,id:"os_calls",name:"os_calls",label:"OS",onChange:()=>M(!L),value:"os",disabled:C||n})]}),(0,S.jsxs)(c.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"15px"},children:[(0,S.jsx)(f.A,{tooltip:"More filter options",children:(0,S.jsx)(c.$nd,{id:"filter-toggle",onClick:()=>F(!U),label:"Filters",icon:(0,S.jsx)(c.YGH,{}),variant:"regular",className:"filters-toggle-button",style:{width:"118px",background:U?"rgba(8, 28, 66, 0.04)":""}})}),!n&&(0,S.jsx)(c.$nd,{id:"start-trace",label:"Start","data-test-id":"trace-start-button",variant:"callAction",onClick:()=>G(!0),style:{width:"118px"}}),n&&(0,S.jsx)(c.$nd,{id:"stop-trace",label:"Stop Trace","data-test-id":"trace-stop-button",variant:"callAction",onClick:()=>G(!1),style:{width:"118px"}})]})]})]}),U?(0,S.jsxs)(c.azJ,{useBackground:!0,className:"".concat(n?"inactive-state":""),sx:{marginTop:"25px",display:"flex",flexFlow:"column",padding:"30px",width:"100%","& .orient-vertical":{flexFlow:"column","& label":{marginBottom:"10px",fontWeight:600},"& .inputRebase":{width:"90%"}},"& .trace-Checkbox-label":{fontSize:"14px",fontWeight:"normal"}},children:[(0,S.jsxs)(c.azJ,{sx:{display:"flex"},children:[(0,S.jsx)(c.cl_,{className:"orient-vertical",id:"trace-status-code",name:"trace-status-code",label:"Status Code",placeholder:"e.g. 503",value:b,onChange:e=>y(e.target.value),disabled:n}),(0,S.jsx)(c.cl_,{className:"orient-vertical",id:"trace-function-name",name:"trace-function-name",label:"Function Name",placeholder:"e.g. FunctionName2055",value:m,onChange:e=>g(e.target.value),disabled:n}),(0,S.jsx)(c.cl_,{className:"orient-vertical",id:"trace-method",name:"trace-method",label:"Method",placeholder:"e.g. Method 2056",value:E,onChange:e=>O(e.target.value),disabled:n})]}),(0,S.jsxs)(c.azJ,{sx:{gap:"30px",display:"grid",gridTemplateColumns:"2fr 1fr",width:"100%",marginTop:"33px"},children:[(0,S.jsx)(c.azJ,{sx:{flex:2,width:"calc( 100% + 10px)"},children:(0,S.jsx)(c.cl_,{className:"orient-vertical",id:"trace-path",name:"trace-path",label:"Path",placeholder:"e.g. my-bucket/my-prefix/*",value:_,onChange:e=>T(e.target.value),disabled:n})}),(0,S.jsx)(c.azJ,{sx:{marginLeft:"15px"},children:(0,S.jsx)(c.cl_,{className:"orient-vertical",id:"trace-fthreshold",name:"trace-fthreshold",label:"Response Threshold",type:"number",placeholder:"e.g. website.io.3249.114.12",value:"".concat(w),onChange:e=>N(parseInt(e.target.value)),disabled:n})})]}),(0,S.jsx)(c.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",marginTop:"40px"},children:(0,S.jsx)(c.Sc0,{checked:D,id:"only_errors",name:"only_errors",label:"Display only Errors",onChange:()=>W(!D),value:"only_errors",disabled:n})})]}):null,(0,S.jsx)(c.xA9,{item:!0,xs:12,children:(0,S.jsx)(c.azJ,{sx:{fontSize:"16px",fontWeight:600,marginBottom:"30px",marginTop:"30px"},children:"Trace Results"})}),(0,S.jsx)(c.xA9,{item:!0,xs:12,children:(0,S.jsx)(c.bQt,{columns:[{label:"Time",elementKey:"ptime",renderFunction:e=>{const t=new Date(e);return(0,u.cj)(t)},width:100},{label:"Name",elementKey:"api"},{label:"Status",elementKey:"",renderFunction:e=>"".concat(e.statusCode," ").concat(e.statusMsg),renderFullObject:!0},{label:"Location",elementKey:"configuration_id",renderFunction:e=>"".concat(e.host," ").concat(e.client),renderFullObject:!0},{label:"Load Time",elementKey:"callStats.duration",width:150},{label:"Upload",elementKey:"callStats.rx",renderFunction:u.nO,width:150},{label:"Download",elementKey:"callStats.tx",renderFunction:u.nO,width:150}],isLoading:!1,records:t,entityName:"Traces",idField:"api",customEmptyMessage:n?"No Traced elements received yet":"Trace is not started yet",customPaperHeight:"calc(100vh - 292px)",autoScrollToBottom:!0})})]})})})]})}},5605:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{Object.defineProperty(t,"__esModule",{value:!0}),t.websocketWrapper=void 0;t.websocketWrapper=function(e,t){return new Proxy(e,{get:function(e,n){var r=e[n];return"reconnect"===n?t:"function"===typeof r?(console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."),function(){}):r},set:function(e,t,n){return/^on/.test(t)?(console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."),!1):(e[t]=n,!0)}})},t.default=t.websocketWrapper},30426:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createOrJoinSocket=void 0;var r=n(64035),o=n(94494),a=n(18911),c=n(87434),s=n(38642);t.createOrJoinSocket=function(e,t,n,u,i,l,d,f,p){if(!o.isEventSourceSupported&&u.current.eventSourceOptions)throw o.isReactNative?new Error("EventSource is not supported in ReactNative"):new Error("EventSource is not supported");if(u.current.share){var v=null;void 0===r.sharedWebSockets[t]?(r.sharedWebSockets[t]=u.current.eventSourceOptions?new EventSource(t,u.current.eventSourceOptions):new WebSocket(t,u.current.protocols),e.current=r.sharedWebSockets[t],n(o.ReadyState.CONNECTING),v=(0,c.attachSharedListeners)(r.sharedWebSockets[t],t,u,p)):(e.current=r.sharedWebSockets[t],n(r.sharedWebSockets[t].readyState));var h={setLastMessage:i,setReadyState:n,optionsRef:u,reconnectCount:d,lastMessageTime:f,reconnect:l};return(0,s.addSubscriber)(t,h),function(e,t,n,a,c){return function(){if((0,s.removeSubscriber)(e,t),!(0,s.hasSubscribers)(e)){try{var u=r.sharedWebSockets[e];u instanceof WebSocket&&(u.onclose=function(e){n.current.onClose&&n.current.onClose(e),a(o.ReadyState.CLOSED)}),u.close()}catch(i){}c&&c(),delete r.sharedWebSockets[e]}}}(t,h,u,n,v)}if(e.current=u.current.eventSourceOptions?new EventSource(t,u.current.eventSourceOptions):new WebSocket(t,u.current.protocols),n(o.ReadyState.CONNECTING),!e.current)throw new Error("WebSocket failed to be created");return(0,a.attachListeners)(e.current,{setLastMessage:i,setReadyState:n},u,l.current,d,f,p)}},36811:(e,t,n)=>{t.vj=t.Ay=void 0;var r=n(44574);Object.defineProperty(t,"Ay",{enumerable:!0,get:function(){return r.useWebSocket}});var o=n(5605);var a=n(94494);Object.defineProperty(t,"vj",{enumerable:!0,get:function(){return a.ReadyState}});var c=n(77995);var s=n(2915)},38642:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resetSubscribers=t.removeSubscriber=t.addSubscriber=t.hasSubscribers=t.getSubscribers=void 0;var n={},r=[];t.getSubscribers=function(e){return(0,t.hasSubscribers)(e)?Array.from(n[e]):r};t.hasSubscribers=function(e){var t;return(null===(t=n[e])||void 0===t?void 0:t.size)>0};t.addSubscriber=function(e,t){n[e]=n[e]||new Set,n[e].add(t)};t.removeSubscriber=function(e,t){n[e].delete(t)};t.resetSubscribers=function(e){if(e&&n.hasOwnProperty(e))delete n[e];else for(var t in n)n.hasOwnProperty(t)&&delete n[t]}},44574:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]{Object.defineProperty(t,"__esModule",{value:!0}),t.resetWebSockets=t.sharedWebSockets=void 0,t.sharedWebSockets={};t.resetWebSockets=function(e){if(e&&t.sharedWebSockets.hasOwnProperty(e))delete t.sharedWebSockets[e];else for(var n in t.sharedWebSockets)t.sharedWebSockets.hasOwnProperty(n)&&delete t.sharedWebSockets[n]}},73647:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.heartbeat=function(e,t,n){var o=n||{},a=o.interval,c=void 0===a?r.DEFAULT_HEARTBEAT.interval:a,s=o.timeout,u=void 0===s?r.DEFAULT_HEARTBEAT.timeout:s,i=o.message,l=void 0===i?r.DEFAULT_HEARTBEAT.message:i,d=Math.max(100,c/10),f=Date.now(),p=setInterval(function(){var n=Date.now(),r=function(e){if(Array.isArray(e))return e.reduce(function(e,t){return e.current>t.current?e:t}).current;return e.current}(t);if(r+u<=n)console.warn("Heartbeat timed out, closing connection, last message received ".concat(n-r,"ms ago, last ping sent ").concat(n-f,"ms ago")),e.close();else if(r+c<=n&&f+c<=n)try{"function"===typeof l?e.send(l()):e.send(l),f=n}catch(o){console.error("Heartbeat failed, closing connection",o instanceof Error?o.message:o),e.close()}},d);return e.addEventListener("close",function(){clearInterval(p)}),function(){}};var r=n(94494)},77995:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]{Object.defineProperty(t,"__esModule",{value:!0}),t.isEventSourceSupported=t.isReactNative=t.ReadyState=t.DEFAULT_HEARTBEAT=t.UNPARSABLE_JSON_OBJECT=t.DEFAULT_RECONNECT_INTERVAL_MS=t.DEFAULT_RECONNECT_LIMIT=t.SOCKET_IO_PING_CODE=t.SOCKET_IO_PATH=t.SOCKET_IO_PING_INTERVAL=t.DEFAULT_EVENT_SOURCE_OPTIONS=t.EMPTY_EVENT_HANDLERS=t.DEFAULT_OPTIONS=void 0;var n;t.DEFAULT_OPTIONS={},t.EMPTY_EVENT_HANDLERS={},t.DEFAULT_EVENT_SOURCE_OPTIONS={withCredentials:!1,events:t.EMPTY_EVENT_HANDLERS},t.SOCKET_IO_PING_INTERVAL=25e3,t.SOCKET_IO_PATH="/socket.io/?EIO=3&transport=websocket",t.SOCKET_IO_PING_CODE="2",t.DEFAULT_RECONNECT_LIMIT=20,t.DEFAULT_RECONNECT_INTERVAL_MS=5e3,t.UNPARSABLE_JSON_OBJECT={},t.DEFAULT_HEARTBEAT={message:"ping",timeout:6e4,interval:25e3},function(e){e[e.UNINSTANTIATED=-1]="UNINSTANTIATED",e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(n||(t.ReadyState=n={}));t.isReactNative="undefined"!==typeof navigator&&"ReactNative"===navigator.product,t.isEventSourceSupported=!t.isReactNative&&function(){try{return"EventSource"in globalThis}catch(e){return!1}}()}}]); ================================================ FILE: web-app/build/static/js/5465.15dfdf24.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5465],{45465:(e,s,t)=>{t.r(s),t.d(s,{default:()=>h});var r=t(9950),l=t(89132),a=t(45246),n=t(2586),o=t(5134),d=t(32680),i=t(49078),c=t(99491),u=t(44414);const h=e=>{let{open:s,checkedUsers:t,closeModalAndRefresh:h}=e;const p=(0,c.jL)(),[x,j]=(0,r.useState)(!1),[b,g]=(0,r.useState)(!1),[m,f]=(0,r.useState)([]);(0,r.useEffect)(()=>{x&&(m.length>0?n.A.invoke("PUT","/api/v1/users-groups-bulk",{groups:m,users:t}).then(()=>{j(!1),g(!0)}).catch(e=>{j(!1),p((0,i.Dy)(e))}):(j(!1),p((0,i.Dy)({errorMessage:"You need to select at least one group to assign",detailedError:""}))))},[x,j,h,m,t,p]);return(0,u.jsx)(d.A,{modalOpen:s,onClose:()=>{h(b)},title:b?"The selected users were added to the following groups.":"Add Users to Group",titleIcon:(0,u.jsx)(l.WC,{}),children:b?(0,u.jsx)(r.Fragment,{children:(0,u.jsxs)(l.Hbc,{withBorders:!1,containerPadding:!1,sx:{margin:"30px 0"},children:[(0,u.jsx)(l.EmB,{label:"Groups",sx:{width:"100%"},children:m.join(", ")}),(0,u.jsxs)(l.EmB,{label:"Users",sx:{width:"100%"},children:[" ",t.join(", ")," "]})]})}):(0,u.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),j(!0)},children:[(0,u.jsxs)(l.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,u.jsx)(l.EmB,{label:"Selected Users",sx:{width:"100%"},children:t.join(", ")}),(0,u.jsx)(o.A,{selectedGroups:m,setSelectedGroups:f})]}),(0,u.jsxs)(l.xA9,{item:!0,xs:12,sx:a.Uz.modalButtonBar,children:[(0,u.jsx)(l.$nd,{id:"clear-bulk-add-group",type:"button",variant:"regular",color:"primary",onClick:()=>{f([])},label:"Clear"}),(0,u.jsx)(l.$nd,{id:"save-add-group",type:"submit",variant:"callAction",disabled:x||m.length<1,label:"Save"})]}),x&&(0,u.jsx)(l.xA9,{item:!0,xs:12,children:(0,u.jsx)(l.z21,{})})]})})}}}]); ================================================ FILE: web-app/build/static/js/5503.a9d9da00.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5503],{15503:(e,t,a)=>{a.r(t),a.d(t,{default:()=>h});var n=a(9950),l=a(89132),s=a(32680),i=a(66147),r=a(45246),c=a(49078),o=a(99491),d=a(70444),u=a(48965),p=a(44414);const h=e=>{let{closeModalAndRefresh:t,open:a,bucketName:h,ruleID:g}=e;const x=(0,o.jL)(),[m,f]=(0,n.useState)(!0),[j,S]=(0,n.useState)(!1),[b,v]=(0,n.useState)("1"),[y,k]=(0,n.useState)(""),[C,E]=(0,n.useState)(""),[D,I]=(0,n.useState)(!1),[w,R]=(0,n.useState)(!1),[A,_]=(0,n.useState)(""),[B,M]=(0,n.useState)(""),[O,N]=(0,n.useState)(""),[P,L]=(0,n.useState)(!1),[T,G]=(0,n.useState)(!1),[q,F]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{m&&d.F.buckets.getBucketReplicationRule(h,g).then(e=>{var t;v(e.data.priority?e.data.priority.toString():"");const a=e.data.prefix||"",n=e.data.tags||"";E(a),_(n),M(n),k((null===(t=e.data.destination)||void 0===t?void 0:t.bucket)||""),I(e.data.delete_marker_replication||!1),N(e.data.storageClass||""),L(!!e.data.existingObjects),G(!!e.data.deletes_replication),F("Enabled"===e.data.status),R(!!e.data.metadata_replication),f(!1)}).catch(e=>{x((0,c.Dy)((0,u.S)(e.error))),f(!1)})},[m,x,h,g]),(0,n.useEffect)(()=>{if(j){const e={arn:y,ruleState:q,prefix:C,tags:B,replicateDeleteMarkers:D,replicateDeletes:T,replicateExistingObjects:P,replicateMetadata:w,priority:parseInt(b),storageClass:O};d.F.buckets.updateMultiBucketReplication(h,g,e).then(()=>{S(!1),t(!0)}).catch(e=>{x((0,c.Dy)((0,u.S)(e.error))),S(!1)})}},[j,h,g,y,C,B,D,b,T,P,q,w,O,t,x]),(0,p.jsx)(s.A,{modalOpen:a,onClose:()=>{t(!1)},title:"Edit Bucket Replication",titleIcon:(0,p.jsx)(l.WBh,{}),children:(0,p.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),S(!0)},children:(0,p.jsxs)(l.Hbc,{containerPadding:!1,withBorders:!1,children:[(0,p.jsx)(l.dOG,{checked:q,id:"ruleState",name:"ruleState",label:"Rule State",onChange:e=>{F(e.target.checked)}}),(0,p.jsx)(l.EmB,{label:"Destination",sx:{width:"100%"},children:y}),(0,p.jsx)(l.cl_,{id:"priority",name:"priority",onChange:e=>{e.target.validity.valid&&v(e.target.value)},label:"Priority",value:b,pattern:"[0-9]*"}),(0,p.jsx)(l.cl_,{id:"storageClass",name:"storageClass",onChange:e=>{N(e.target.value)},placeholder:"STANDARD_IA,REDUCED_REDUNDANCY etc",label:"Storage Class",value:O}),(0,p.jsxs)("fieldset",{className:"inputItem",children:[(0,p.jsx)("legend",{children:"Object Filters"}),(0,p.jsx)(l.cl_,{id:"prefix",name:"prefix",onChange:e=>{E(e.target.value)},placeholder:"prefix",label:"Prefix",value:C}),(0,p.jsx)(i.A,{name:"tags",label:"Tags",elements:A,onChange:e=>{M(e)},keyPlaceholder:"Tag Key",valuePlaceholder:"Tag Value",withBorder:!0})]}),(0,p.jsxs)("fieldset",{className:"inputItem",children:[(0,p.jsx)("legend",{children:"Replication Options"}),(0,p.jsx)(l.dOG,{checked:P,id:"repExisting",name:"repExisting",label:"Existing Objects",onChange:e=>{L(e.target.checked)},description:"Replicate existing objects"}),(0,p.jsx)(l.dOG,{checked:w,id:"metadatataSync",name:"metadatataSync",label:"Metadata Sync",onChange:e=>{R(e.target.checked)},description:"Metadata Sync"}),(0,p.jsx)(l.dOG,{checked:D,id:"deleteMarker",name:"deleteMarker",label:"Delete Marker",onChange:e=>{I(e.target.checked)},description:"Replicate soft deletes"}),(0,p.jsx)(l.dOG,{checked:T,id:"repDelete",name:"repDelete",label:"Deletes",onChange:e=>{G(e.target.checked)},description:"Replicate versioned deletes"})]}),(0,p.jsxs)(l.xA9,{item:!0,xs:12,sx:r.Uz.modalButtonBar,children:[(0,p.jsx)(l.$nd,{id:"cancel-edit-replication",type:"button",variant:"regular",disabled:m||j,onClick:()=>{t(!1)},label:"Cancel"}),(0,p.jsx)(l.$nd,{id:"save-replication",type:"submit",variant:"callAction",disabled:m||j,label:"Save"})]})]})})})}},32680:(e,t,a)=>{a.d(t,{A:()=>d});var n=a(9950),l=a(98341),s=a(89132),i=a(99491),r=a(49078),c=a(96382),o=a(44414);const d=e=>{let{onClose:t,modalOpen:a,title:d,children:u,wideLimit:p=!0,titleIcon:h=null,iconColor:g="default",sx:x}=e;const m=(0,i.jL)(),[f,j]=(0,n.useState)(!1),S=(0,l.d4)(e=>e.system.modalSnackBar);(0,n.useEffect)(()=>{m((0,r.h0)(""))},[m]),(0,n.useEffect)(()=>{if(S){if(""===S.message)return void j(!1);"error"!==S.type&&j(!0)}},[S]);let b="";return S&&(b=S.detailedErrorMsg,(""===b||b&&b.length<5)&&(b=S.message)),(0,o.jsxs)(s.ngX,{onClose:t,open:a,title:d,titleIcon:h,widthLimit:p,sx:x,iconColor:g,children:[(0,o.jsx)(c.A,{isModal:!0}),(0,o.jsx)(s.qb_,{onClose:()=>{j(!1),m((0,r.h0)(""))},open:f,message:b,mode:"inline",variant:"error"===S.type?"error":"default",autoHideDuration:"error"===S.type?10:5,condensed:!0}),u]})}},66147:(e,t,a)=>{a.d(t,{A:()=>d});var n=a(9950),l=a(87946),s=a.n(l),i=a(95491),r=a.n(i),c=a(89132),o=a(44414);const d=e=>{let{elements:t,name:a,label:l,tooltip:i="",keyPlaceholder:d="",valuePlaceholder:u="",onChange:p,withBorder:h=!1}=e;const[g,x]=(0,n.useState)([""]),[m,f]=(0,n.useState)([""]),j=(0,n.createRef)();(0,n.useEffect)(()=>{if(1===g.length&&""===g[0]&&1===m.length&&""===m[0]&&t&&""!==t){const e=t.split("&");let a=[],n=[];e.forEach(e=>{const t=e.split("=");2===t.length&&(a.push(t[0]),n.push(t[1]))}),a.push(""),n.push(""),x(a),f(n)}},[g,m,t]),(0,n.useEffect)(()=>{const e=j.current;e&&g.length>1&&e.scrollIntoView(!1)},[g]);const S=(0,n.useRef)(!0);(0,n.useLayoutEffect)(()=>{S.current?S.current=!1:y()},[g,m]);const b=e=>{e.persist();let t=[...g];const a=s()(e.target,"dataset.index","0");t[parseInt(a)]=e.target.value,x(t)},v=e=>{e.persist();let t=[...m];const a=s()(e.target,"dataset.index","0");t[parseInt(a)]=e.target.value,f(t)},y=r()(()=>{let e="";g.forEach((t,a)=>{if(g[a]&&m[a]){let n="".concat(t,"=").concat(m[a]);0!==a&&(n="&".concat(n)),e="".concat(e).concat(n)}}),p(e)},500),k=m.map((e,t)=>(0,o.jsxs)(c.xA9,{item:!0,xs:12,className:"lineInputBoxes inputItem",children:[(0,o.jsx)(c.cl_,{id:"".concat(a,"-key-").concat(t.toString()),label:"",name:"".concat(a,"-").concat(t.toString()),value:g[t],onChange:b,index:t,placeholder:d}),(0,o.jsx)("span",{className:"queryDiv",children:":"}),(0,o.jsx)(c.cl_,{id:"".concat(a,"-value-").concat(t.toString()),label:"",name:"".concat(a,"-").concat(t.toString()),value:m[t],onChange:v,index:t,placeholder:u,overlayIcon:t===m.length-1?(0,o.jsx)(c.REV,{}):null,overlayAction:()=>{(()=>{if(""!==g[g.length-1].trim()&&""!==m[m.length-1].trim()){const e=[...g],t=[...m];e.push(""),t.push(""),x(e),f(t)}})()}})]},"query-pair-".concat(a,"-").concat(t.toString())));return(0,o.jsx)(n.Fragment,{children:(0,o.jsxs)(c.xA9,{item:!0,xs:12,sx:{"& .lineInputBoxes":{display:"flex"},"& .queryDiv":{alignSelf:"center",margin:"-15px 4px 0",fontWeight:600}},className:"inputItem",children:[(0,o.jsxs)(c.l1Y,{children:[l,""!==i&&(0,o.jsx)(c.azJ,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,o.jsx)(c.m_M,{tooltip:i,placement:"top",children:(0,o.jsx)(c.NTw,{style:{width:13,height:13}})})})]}),(0,o.jsxs)(c.azJ,{withBorders:h,sx:{padding:15,height:150,overflowY:"auto",position:"relative",marginTop:15},children:[k,(0,o.jsx)("div",{ref:j})]})]})})}}}]); ================================================ FILE: web-app/build/static/js/5692.b701d50d.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5692],{95692:(e,t,s)=>{s.r(t),s.d(t,{default:()=>S});var c=s(9950),n=s(98341),i=s(28429),a=s(89132),o=s(70444),r=s(48965),l=s(93598),d=s(26843),m=s(49078),u=s(47304),_=s(99491),h=s(44414);const S=()=>{const e=(0,_.jL)(),t=(0,i.Zp)(),s=(0,i.g)(),S=(0,n.d4)(u.Nx),[I,b]=(0,c.useState)("simple-tab-0"),[p,O]=(0,c.useState)(!0),[U,k]=(0,c.useState)([]),[A,E]=(0,c.useState)(!0),[C,L]=(0,c.useState)([]),N=s.bucketName||"",P=(0,d._)(N,[l.OV.ADMIN_LIST_USER_POLICIES]),f=(0,d._)(N,[l.OV.ADMIN_GET_POLICY,l.OV.ADMIN_LIST_USERS,l.OV.ADMIN_LIST_GROUPS],!0),g=(0,d._)(l.Ms,[l.OV.ADMIN_GET_USER]),M=(0,d._)(l.Ms,[l.OV.ADMIN_GET_POLICY,l.OV.ADMIN_LIST_USERS,l.OV.ADMIN_LIST_GROUPS]);(0,c.useEffect)(()=>{S&&(E(!0),O(!0))},[S,E,O]);const T=[{type:"view",disableButtonFunction:()=>!M,onClick:e=>{t("".concat(l.zZ.POLICIES,"/").concat(encodeURIComponent(e.name)))}}],j=[{type:"view",disableButtonFunction:()=>!g,onClick:e=>{t("".concat(l.zZ.USERS,"/").concat(encodeURIComponent(e)))}}];return(0,c.useEffect)(()=>{A&&(f?o.F.bucketUsers.listUsersWithAccessToBucket(N).then(e=>{L(e.data),E(!1)}).catch(t=>{e((0,m.C9)((0,r.S)(t))),E(!1)}):E(!1))},[A,e,N,f]),(0,c.useEffect)(()=>{e((0,m.ph)("bucket_detail_access"))},[]),(0,c.useEffect)(()=>{p&&(P?o.F.bucketPolicy.listPoliciesWithBucket(N).then(e=>{k(e.data.policies),O(!1)}).catch(t=>{e((0,m.C9)((0,r.S)(t))),O(!1)}):O(!1))},[p,e,N,P]),(0,h.jsxs)(c.Fragment,{children:[(0,h.jsx)(a._xt,{separator:!0,children:(0,h.jsx)(a.V7x,{content:(0,h.jsxs)(c.Fragment,{children:["Understand which"," ",(0,h.jsx)("a",{target:"blank",href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/policy-based-access-control.html",children:"Policies"})," ","and"," ",(0,h.jsx)("a",{target:"blank",href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/minio-user-management.html",children:"Users"})," ","are authorized to access this Bucket."]}),placement:"right",children:"Access Audit"})}),(0,h.jsx)(a.tUM,{currentTabOrPath:I,onTabClick:e=>{b(e)},horizontal:!0,options:[{tabConfig:{label:"Policies",id:"simple-tab-0"},content:(0,h.jsx)(d.R,{scopes:[l.OV.ADMIN_LIST_USER_POLICIES],resource:N,errorProps:{disabled:!0},children:U&&(0,h.jsx)(a.bQt,{noBackground:!0,itemActions:T,columns:[{label:"Name",elementKey:"name"}],isLoading:p,records:U,entityName:"Policies",idField:"name"})})},{tabConfig:{label:"Users",id:"simple-tab-1"},content:(0,h.jsx)(d.R,{scopes:[l.OV.ADMIN_GET_POLICY,l.OV.ADMIN_LIST_USERS,l.OV.ADMIN_LIST_GROUPS],resource:N,matchAll:!0,errorProps:{disabled:!0},children:(0,h.jsx)(a.bQt,{noBackground:!0,itemActions:j,columns:[{label:"User",elementKey:"accessKey"}],isLoading:A,records:C,entityName:"Users",idField:"accessKey"})})}]})]})}}}]); ================================================ FILE: web-app/build/static/js/583.e6916889.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[583],{23934:(e,t,n)=>{n.d(t,{A:()=>p});var s=n(9950),i=n(89132),a=n(49078),o=n(99491),r=n(49534),l=n(70444),c=n(48965),d=n(44414);const p=e=>{let{closeDeleteModalAndRefresh:t,deleteOpen:n,idp:p,idpType:u}=e;const f=(0,o.jL)(),[x,A]=(0,s.useState)(!1);if(!p)return null;const j="_"===p?"Default":p;return(0,d.jsx)(r.A,{title:"Delete ".concat(j),confirmText:"Delete",isOpen:n,titleIcon:(0,d.jsx)(i.xWY,{}),isLoading:x,onConfirm:()=>{A(!0),l.F.idp.deleteConfiguration(p,u).then(e=>{(e=>{t(!0),f((0,a.YR)(!0===e.restart))})(e.data)}).catch(e=>f((0,a.C9)((0,c.S)(e.error)))).finally(()=>A(!1))},onClose:()=>t(!1),confirmButtonProps:{disabled:x},confirmationContent:(0,d.jsxs)(s.Fragment,{children:["Are you sure you want to delete IDP ",(0,d.jsx)("b",{children:j})," ","configuration? ",(0,d.jsx)("br",{})]})})}},50583:(e,t,n)=>{n.r(t),n.d(t,{default:()=>m});var s=n(9950),i=n(89379),a=n(89132),o=n(28429),r=n(70444),l=n(48965),c=n(99491),d=n(93598),p=n(26843),u=n(49078),f=n(45246),x=n(30272),A=n(23934),j=n(82817),C=n(70503),b=n(44414);const h=e=>{let{idpType:t}=e;const n=(0,c.jL)(),h=(0,o.Zp)(),[m,y]=(0,s.useState)(!1),[D,_]=(0,s.useState)(""),[O,g]=(0,s.useState)(!1),[I,M]=(0,s.useState)([]),N=(0,p._)(d.Ms,[d.OV.ADMIN_CONFIG_UPDATE]),F=(0,p._)(d.Ms,[d.OV.ADMIN_CONFIG_UPDATE]),T=(0,p._)(d.Ms,[d.OV.ADMIN_CONFIG_UPDATE]);(0,s.useEffect)(()=>{E()},[]),(0,s.useEffect)(()=>{O&&(T?r.F.idp.listConfigurations(t).then(e=>{g(!1),e.data.results&&M(e.data.results.map(e=>(e.name="_"===e.name?"Default":e.name,e.enabled=!0===e.enabled?"Enabled":"Disabled",e)))}).catch(e=>{g(!1),n((0,u.C9)((0,l.S)(e.error)))}):g(!1))},[O,g,M,n,T,t]);const E=()=>{g(!0)},P=[{type:"view",onClick:e=>{let n="Default"===e.name?"_":e.name;h("/identity/idp/".concat(t,"/configurations/").concat(n))},disableButtonFunction:()=>!F},{type:"delete",onClick:e=>{y(!0),_(e="Default"===e?"_":e)},sendOnlyId:!0,disableButtonFunction:e=>!N||"Default"===e}];return(0,s.useEffect)(()=>{n((0,u.ph)("idp_configs"))},[]),(0,b.jsxs)(s.Fragment,{children:[m&&(0,b.jsx)(A.A,{deleteOpen:m,idp:D,idpType:t,closeDeleteModalAndRefresh:async e=>{y(!1),e&&E()}}),(0,b.jsx)(j.A,{label:"".concat(t.toUpperCase()," Configurations"),actions:(0,b.jsx)(C.A,{})}),(0,b.jsx)(a.Mxu,{children:(0,b.jsxs)(a.xA9,{container:!0,children:[(0,b.jsxs)(a.xA9,{item:!0,xs:12,sx:(0,i.A)((0,i.A)({},f._0.actionsTray),{},{justifyContent:"flex-end",gap:8}),children:[(0,b.jsx)(p.R,{scopes:[d.OV.ADMIN_CONFIG_UPDATE],resource:d.Ms,errorProps:{disabled:!0},children:(0,b.jsx)(x.A,{tooltip:"Refresh",children:(0,b.jsx)(a.$nd,{id:"refresh-keys",variant:"regular",icon:(0,b.jsx)(a.fNY,{}),onClick:()=>g(!0)})})}),(0,b.jsx)(p.R,{scopes:[d.OV.ADMIN_CONFIG_UPDATE],resource:d.Ms,errorProps:{disabled:!0},children:(0,b.jsx)(x.A,{tooltip:"Create ".concat(t," configuration"),children:(0,b.jsx)(a.$nd,{id:"create-idp",label:"Create Configuration",variant:"callAction",icon:(0,b.jsx)(a.REV,{}),onClick:()=>h("/identity/idp/".concat(t,"/configurations/add-idp"))})})})]}),(0,b.jsx)(a.xA9,{item:!0,xs:12,children:(0,b.jsx)(p.R,{scopes:[d.OV.ADMIN_CONFIG_UPDATE],resource:d.Ms,errorProps:{disabled:!0},children:(0,b.jsx)(a.bQt,{itemActions:P,columns:[{label:"Name",elementKey:"name"},{label:"Type",elementKey:"type"},{label:"Enabled",elementKey:"enabled"}],isLoading:O,records:I,entityName:"Keys",idField:"name"})})})]})})]})},m=()=>(0,b.jsx)(h,{idpType:"openid"})}}]); ================================================ FILE: web-app/build/static/js/593.fb5ea6de.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[593],{30593:(e,t,a)=>{a.r(t),a.d(t,{default:()=>x});var n=a(9950),r=a(87946),s=a.n(r),c=a(89132),l=a(70444),o=a(48965),i=a(45246),d=a(49078),u=a(99491),m=a(32680),h=a(44414);const x=e=>{let{open:t,closeModalAndRefresh:a,tierData:r}=e;const x=(0,u.jL)(),[p,g]=(0,n.useState)(!1),[j,y]=(0,n.useState)(""),[f,v]=(0,n.useState)(""),[C,b]=(0,n.useState)(""),[S,A]=(0,n.useState)(""),[K,E]=(0,n.useState)(!0),_=s()(r,"type",""),w=s()(r,"".concat(_,".name"),"");(0,n.useEffect)(()=>{let e=!0;"s3"===_||"azure"===_||"minio"===_?""!==C&&""!==S||(e=!1):"gcs"===_&&""===f&&(e=!1),E(e)},[S,C,f,_]);return(0,h.jsx)(m.A,{modalOpen:t,titleIcon:(0,h.jsx)(c.XAi,{}),onClose:()=>{a(!1)},title:"Update Credentials - ".concat(_," / ").concat(w),children:(0,h.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),g(!0),(()=>{let e={};"s3"===_||"azure"===_||"minio"===_?e={access_key:C,secret_key:S}:"gcs"===_&&(e={creds:f}),""!==w?l.F.admin.editTierCredentials(_,w,e).then(()=>{g(!1),a(!0)}).catch(e=>{g(!1),x((0,d.Dy)((0,o.S)(e.error)))}):(0,d.Dy)({errorMessage:"There was an error retrieving tier information",detailedError:""})})()},children:[(0,h.jsxs)(c.Hbc,{withBorders:!1,containerPadding:!1,children:[("s3"===_||"minio"===_)&&(0,h.jsxs)(n.Fragment,{children:[(0,h.jsx)(c.cl_,{id:"accessKey",name:"accessKey",label:"Access Key",placeholder:"Enter Access Key",value:C,onChange:e=>{b(e.target.value)}}),(0,h.jsx)(c.cl_,{id:"secretKey",name:"secretKey",label:"Secret Key",placeholder:"Enter Secret Key",value:S,onChange:e=>{A(e.target.value)}})]}),"gcs"===_&&(0,h.jsx)(n.Fragment,{children:(0,h.jsx)(c.SxS,{accept:".json",id:"creds",label:"Credentials",name:"creds",returnEncodedData:!0,onChange:(e,t,a)=>{a&&(v(a),y(t))},value:j})}),"azure"===_&&(0,h.jsxs)(n.Fragment,{children:[(0,h.jsx)(c.cl_,{id:"accountName",name:"accountName",label:"Account Name",placeholder:"Enter Account Name",value:C,onChange:e=>{b(e.target.value)}}),(0,h.jsx)(c.cl_,{id:"accountKey",name:"accountKey",label:"Account Key",placeholder:"Enter Account Key",value:S,onChange:e=>{A(e.target.value)}})]})]}),p&&(0,h.jsx)(c.xA9,{item:!0,xs:12,children:(0,h.jsx)(c.z21,{})}),(0,h.jsx)(c.xA9,{item:!0,xs:12,sx:i.Uz.modalButtonBar,children:(0,h.jsx)(c.$nd,{id:"save-credentials",type:"submit",variant:"callAction",disabled:p||!K,label:"Save"})})]})})}},32680:(e,t,a)=>{a.d(t,{A:()=>d});var n=a(9950),r=a(98341),s=a(89132),c=a(99491),l=a(49078),o=a(96382),i=a(44414);const d=e=>{let{onClose:t,modalOpen:a,title:d,children:u,wideLimit:m=!0,titleIcon:h=null,iconColor:x="default",sx:p}=e;const g=(0,c.jL)(),[j,y]=(0,n.useState)(!1),f=(0,r.d4)(e=>e.system.modalSnackBar);(0,n.useEffect)(()=>{g((0,l.h0)(""))},[g]),(0,n.useEffect)(()=>{if(f){if(""===f.message)return void y(!1);"error"!==f.type&&y(!0)}},[f]);let v="";return f&&(v=f.detailedErrorMsg,(""===v||v&&v.length<5)&&(v=f.message)),(0,i.jsxs)(s.ngX,{onClose:t,open:a,title:d,titleIcon:h,widthLimit:m,sx:p,iconColor:x,children:[(0,i.jsx)(o.A,{isModal:!0}),(0,i.jsx)(s.qb_,{onClose:()=>{y(!1),g((0,l.h0)(""))},open:j,message:v,mode:"inline",variant:"error"===f.type?"error":"default",autoHideDuration:"error"===f.type?10:5,condensed:!0}),u]})}}}]); ================================================ FILE: web-app/build/static/js/5938.d0dc8bf3.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5938],{32680:(e,t,l)=>{l.d(t,{A:()=>d});var n=l(9950),s=l(98341),a=l(89132),o=l(99491),r=l(49078),i=l(96382),c=l(44414);const d=e=>{let{onClose:t,modalOpen:l,title:d,children:u,wideLimit:p=!0,titleIcon:h=null,iconColor:b="default",sx:m}=e;const x=(0,o.jL)(),[C,f]=(0,n.useState)(!1),j=(0,s.d4)(e=>e.system.modalSnackBar);(0,n.useEffect)(()=>{x((0,r.h0)(""))},[x]),(0,n.useEffect)(()=>{if(j){if(""===j.message)return void f(!1);"error"!==j.type&&f(!0)}},[j]);let v="";return j&&(v=j.detailedErrorMsg,(""===v||v&&v.length<5)&&(v=j.message)),(0,c.jsxs)(a.ngX,{onClose:t,open:l,title:d,titleIcon:h,widthLimit:p,sx:m,iconColor:b,children:[(0,c.jsx)(i.A,{isModal:!0}),(0,c.jsx)(a.qb_,{onClose:()=>{f(!1),x((0,r.h0)(""))},open:C,message:v,mode:"inline",variant:"error"===j.type?"error":"default",autoHideDuration:"error"===j.type?10:5,condensed:!0}),u]})}},55938:(e,t,l)=>{l.r(t),l.d(t,{default:()=>p});var n=l(9950),s=l(89132),a=l(70444),o=l(48965),r=l(45246),i=l(49078),c=l(99491),d=l(32680),u=l(44414);const p=e=>{let{modalOpen:t,onClose:l,bucket:p,toEdit:h,initial:b}=e;const m=(0,c.jL)(),[x,C]=(0,n.useState)(b);return(0,u.jsx)(n.Fragment,{children:(0,u.jsxs)(d.A,{modalOpen:t,title:"Edit Anonymous Access Rule for ".concat("".concat(p,"/").concat(h||"")),onClose:l,titleIcon:(0,u.jsx)(s.No_,{}),children:[(0,u.jsx)(s.Hbc,{containerPadding:!1,withBorders:!1,children:(0,u.jsx)(s.l6P,{id:"access",name:"Access",onChange:e=>{C(e)},label:"Access",value:x,options:[{label:"readonly",value:"readonly"},{label:"writeonly",value:"writeonly"},{label:"readwrite",value:"readwrite"}],disabled:!1})}),(0,u.jsxs)(s.xA9,{item:!0,xs:12,sx:r.Uz.modalButtonBar,children:[(0,u.jsx)(s.$nd,{id:"clear",type:"button",variant:"regular",onClick:()=>{C(b)},label:"Clear"}),(0,u.jsx)(s.$nd,{id:"save",type:"submit",variant:"callAction",onClick:()=>{a.F.bucket.setAccessRuleWithBucket(p,{prefix:h,access:x}).then(()=>{l()}).catch(e=>{m((0,i.C9)((0,o.S)(e.error))),l()})},label:"Save"})]})]})})}}}]); ================================================ FILE: web-app/build/static/js/6215.3dec8894.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6215],{60252:(e,t,o)=>{o.d(t,{_T:()=>c,pW:()=>s,qA:()=>a,vH:()=>r,y:()=>l});var n=o(89132),i=o(44414);const r="minio",a="gcs",s="s3",l="azure",c=[{serviceName:r,targetTitle:"MinIO",logo:(0,i.jsx)(n.Wh8,{}),logoXs:(0,i.jsx)(n.$2v,{})},{serviceName:a,targetTitle:"Google Cloud Storage",logo:(0,i.jsx)(n.F7U,{}),logoXs:(0,i.jsx)(n.gwF,{})},{serviceName:s,targetTitle:"AWS S3",logo:(0,i.jsx)(n._tF,{}),logoXs:(0,i.jsx)(n.ZZX,{})},{serviceName:l,targetTitle:"Azure",logo:(0,i.jsx)(n.Nmx,{}),logoXs:(0,i.jsx)(n.Ubg,{})}]},86215:(e,t,o)=>{o.r(t),o.d(t,{default:()=>u});var n=o(9950),i=o(28429),r=o(60252),a=o(93598),s=o(19335),l=o(87946),c=o.n(l),m=o(44414);const g=s.Ay.button(e=>{let{theme:t}=e;return{background:c()(t,"boxBackground","#FFF"),border:"".concat(c()(t,"borderColor","#E2E2E2")," 1px solid"),borderRadius:5,height:80,display:"flex",alignItems:"center",justifyContent:"start",marginBottom:16,marginRight:8,cursor:"pointer",overflow:"hidden","&:hover":{backgroundColor:c()(t,"buttons.regular.hover.background","#ebebeb")},"& .imageContainer":{width:80,"& .min-icon":{maxWidth:46,maxHeight:46}},"& .tierNotifTitle":{color:c()(t,"buttons.callAction.enabled.background","#07193E"),fontSize:16,fontFamily:"Inter,sans-serif",paddingLeft:18,fontWeight:"bold"}}}),d=e=>{let{onClick:t,icon:o,name:n}=e;return(0,m.jsxs)(g,{onClick:()=>{t(n)},children:[(0,m.jsx)("span",{className:"imageContainer",children:o}),(0,m.jsx)("span",{className:"tierNotifTitle",children:n})]})};var h=o(89132),j=o(82817),p=o(70503),x=o(49078),b=o(99491);const u=()=>{const e=(0,i.Zp)(),t=(0,b.jL)();return(0,n.useEffect)(()=>{t((0,x.ph)("tier-type-selector"))},[t]),(0,m.jsxs)(n.Fragment,{children:[(0,m.jsx)(j.A,{label:(0,m.jsx)(n.Fragment,{children:(0,m.jsx)(h.EGL,{label:"Tier Types",onClick:()=>e(a.zZ.TIERS)})}),actions:(0,m.jsx)(p.A,{})}),(0,m.jsx)(h.Mxu,{children:(0,m.jsx)(h.Hbc,{title:"Select Tier Type",icon:(0,m.jsx)(h.fAn,{}),helpBox:(0,m.jsx)(h.lVp,{iconComponent:(0,m.jsx)(h.fAn,{}),title:"Tier Types",help:(0,m.jsxs)(n.Fragment,{children:["MinIO supports creating object transition lifecycle management rules, where MinIO can automatically move an object to a remote storage \u201ctier\u201d.",(0,m.jsx)("br",{}),(0,m.jsx)("br",{}),"MinIO supports the following Tier types:",(0,m.jsx)("br",{}),(0,m.jsxs)("ul",{children:[(0,m.jsx)("li",{children:(0,m.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/transition-objects-to-s3.html",target:"_blank",rel:"noopener",children:"MinIO or other S3-compatible storage"})}),(0,m.jsx)("li",{children:(0,m.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/transition-objects-to-s3.html",target:"_blank",rel:"noopener",children:"Amazon S3"})}),(0,m.jsx)("li",{children:(0,m.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/transition-objects-to-gcs.html",target:"_blank",rel:"noopener",children:"Google Cloud Storage"})}),(0,m.jsx)("li",{children:(0,m.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/object-management/transition-objects-to-azure.html",target:"_blank",rel:"noopener",children:"Microsoft Azure Blob Storage"})})]})]})}),children:(0,m.jsx)(h.azJ,{sx:{margin:"15px",display:"grid",gridGap:"20px",gridTemplateColumns:"repeat(2, 1fr)",["@media (max-width: ".concat(h.nmC.md,"px)")]:{gridTemplateColumns:"repeat(1, 1fr)"}},children:r._T.map((t,o)=>(0,m.jsx)(d,{name:t.targetTitle,onClick:()=>{var o;o=t.serviceName,e("".concat(a.zZ.TIERS_ADD,"/").concat(o))},icon:t.logo},"tierOpt-".concat(o.toString,"-").concat(t.targetTitle)))})})})]})}}}]); ================================================ FILE: web-app/build/static/js/6242.25b871ee.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6242],{36242:(e,s,t)=>{t.r(s),t.d(s,{default:()=>I});var i=t(9950),n=t(89132),o=t(28429),c=t(45246),a=t(93598),r=t(26843),l=t(49078),d=t(99491),u=t(70444),h=t(27428),m=t(55604),p=t(30272),x=t(82817),A=t(70503),j=t(44414);const b=(0,m.A)(i.lazy(()=>t.e(4043).then(t.bind(t,54043)))),I=()=>{const e=(0,d.jL)(),s=(0,o.Zp)(),[t,m]=(0,i.useState)([]),[I,f]=(0,i.useState)(!1),[y,C]=(0,i.useState)(!1),[M,P]=(0,i.useState)(""),[_,v]=(0,i.useState)(""),O=(0,r._)(a.Ms,[a.OV.ADMIN_GET_POLICY]),S=(0,r._)(a.Ms,a.uA),E=(0,r._)(a.Ms,a.Bc),L=(0,r._)(a.Ms,a.nr),g=(0,r._)(a.Ms,a.yv);(0,i.useEffect)(()=>{k()},[]),(0,i.useEffect)(()=>{I&&(E?u.F.policies.listPolicies().then(e=>{var s;const t=null!==(s=e.data.policies)&&void 0!==s?s:[];t.sort((e,s)=>e.name>s.name?1:e.name{f(!1),e((0,l.C9)(s))}):f(!1))},[I,f,m,e,E]);const k=()=>{f(!0)},w=[{type:"view",onClick:e=>{s("".concat(a.zZ.POLICIES,"/").concat(encodeURIComponent(e.name)))},disableButtonFunction:()=>!O},{type:"delete",onClick:e=>{C(!0),P(e)},sendOnlyId:!0,disableButtonFunction:()=>!S}],R=t.filter(e=>{var s;return null===(s=e.name)||void 0===s?void 0:s.includes(_)});return(0,i.useEffect)(()=>{e((0,l.ph)("list_policies"))},[]),(0,j.jsxs)(i.Fragment,{children:[y&&(0,j.jsx)(b,{deleteOpen:y,selectedPolicy:M,closeDeleteModalAndRefresh:e=>{C(!1),e&&k()}}),(0,j.jsx)(x.A,{label:"IAM Policies",actions:(0,j.jsx)(A.A,{})}),(0,j.jsx)(n.Mxu,{children:(0,j.jsxs)(n.xA9,{container:!0,children:[(0,j.jsxs)(n.xA9,{item:!0,xs:12,sx:c._0.actionsTray,children:[(0,j.jsx)(h.A,{onChange:v,placeholder:"Search Policies",value:_,sx:{maxWidth:380}}),(0,j.jsx)(r.R,{scopes:[a.OV.ADMIN_CREATE_POLICY],resource:a.Ms,errorProps:{disabled:!0},children:(0,j.jsx)(p.A,{tooltip:L?"":(0,a.vj)(a.nr,"create a Policy"),children:(0,j.jsx)(n.$nd,{id:"create-policy",label:"Create Policy",variant:"callAction",icon:(0,j.jsx)(n.REV,{}),onClick:()=>{s("".concat(a.zZ.POLICY_ADD))},disabled:!L})})})]}),(0,j.jsx)(n.xA9,{item:!0,xs:12,children:(0,j.jsx)(r.R,{scopes:[a.OV.ADMIN_LIST_USER_POLICIES],resource:a.Ms,errorProps:{disabled:!0},children:(0,j.jsx)(p.A,{tooltip:g?"":(0,a.vj)(a.yv,"view Policy details"),children:(0,j.jsx)(n.bQt,{itemActions:w,columns:[{label:"Name",elementKey:"name"}],isLoading:I,records:R,entityName:"Policies",idField:"name"})})})}),(0,j.jsx)(n.xA9,{item:!0,xs:12,sx:{marginTop:15},children:(0,j.jsx)(n.lVp,{title:"Learn more about IAM POLICIES",iconComponent:(0,j.jsx)(n.n$X,{}),help:(0,j.jsxs)(i.Fragment,{children:["MinIO uses Policy-Based Access Control (PBAC) to define the authorized actions and resources to which an authenticated user has access. Each policy describes one or more actions and conditions that outline the permissions of a user or group of users.",(0,j.jsx)("br",{}),(0,j.jsx)("br",{}),"MinIO PBAC is built for compatibility with AWS IAM policy syntax, structure, and behavior. The MinIO documentation makes a best-effort to cover IAM-specific behavior and functionality. Consider deferring to the IAM documentation for more complete documentation on AWS IAM-specific topics.",(0,j.jsx)("br",{}),(0,j.jsx)("br",{}),"You can learn more at the"," ",(0,j.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/policy-based-access-control.html",target:"_blank",rel:"noopener",children:"documentation"}),"."]})})})]})})]})}}}]); ================================================ FILE: web-app/build/static/js/6243.51dc4462.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6243],{26243:(e,r,n)=>{n.r(r),n.d(r,{default:()=>a});var o=n(9950),t=n(89132),s=n(82817);var i=n(44414);const a=()=>(0,i.jsxs)(o.Fragment,{children:[(0,i.jsx)(s.A,{label:"License"}),(0,i.jsx)(t.Mxu,{children:(0,i.jsxs)(t.xA9,{item:!0,xs:12,children:[(0,i.jsx)(t.lVp,{title:"License",iconComponent:(0,i.jsx)(t.t6I,{}),help:(0,i.jsxs)(o.Fragment,{children:[(0,i.jsxs)("p",{children:["This is just a fork of the"," ",(0,i.jsx)("a",{href:"https://github.com/minio/object-browser",target:"_blank",rel:"noopener noreferrer",children:"MinIO Console"})," ","for my own personal educational purposes, and therefore it incorporates MinIO\xae source code. You may also want to look for other maintained"," ",(0,i.jsx)("a",{href:"https://github.com/minio/object-browser/forks",target:"_blank",rel:"noopener noreferrer",children:"forks"}),"."]}),(0,i.jsxs)("p",{children:["It is important to note that ",(0,i.jsx)("strong",{children:"MINIO"})," is a registered trademark of the MinIO Corporation. Consequently, this project is not affiliated with or endorsed by the MinIO Corporation."]})]})}),(0,i.jsxs)(t.azJ,{sx:{display:"flex",flexFlow:"column","& .link-text":{color:"#2781B0",fontWeight:600},alignItems:"center",justifyContent:"center"},children:[(0,i.jsx)(t.azJ,{sx:{marginTop:"30px",marginBottom:"30px",width:"350px"},children:(0,i.jsx)(t.GTC,{applicationName:"console",subVariant:"AGPL"})}),(0,i.jsxs)(t.azJ,{sx:{marginBottom:"30px",fontSize:"30px"},children:["Version: v","1.9.1"]}),(0,i.jsxs)(t.azJ,{sx:{marginBottom:"10px"},children:["Source code:"," ",(0,i.jsx)("a",{href:"https://github.com/georgmangold/console",target:"_blank",rel:"noopener noreferrer",children:"https://github.com/georgmangold/console"})]}),(0,i.jsx)(t.azJ,{sx:{marginBottom:"20px"},children:"Console is licensed under the GNU Affero General Public License (AGPL) Version 3.0."}),(0,i.jsx)(t.azJ,{sx:{display:"flex",alignItems:"center",marginBottom:"20px",justifyContent:"center","& .min-icon":{fill:"blue",width:"188px",height:"62px"}},children:(0,i.jsx)(t.P1T,{})}),(0,i.jsxs)(t.azJ,{sx:{paddingBottom:"30px"},children:["For more information, please refer to the license at"," ",(0,i.jsx)("a",{href:"https://www.gnu.org/licenses/agpl-3.0.en.html",target:"_blank",rel:"noopener noreferrer",children:"https://www.gnu.org/licenses/agpl-3.0.en.html"}),"."]}),(0,i.jsxs)(t.azJ,{sx:{marginBottom:"27px"},children:["This software incorporates MinIO\xae source code which is also licensed under the GNU AGPL v3, for which, the full text can be found here:"," ",(0,i.jsx)("a",{href:"https://www.gnu.org/licenses/agpl-3.0.html",target:"_blank",rel:"noopener noreferrer",className:"link-text",children:"https://www.gnu.org/licenses/agpl-3.0.html."})]}),(0,i.jsxs)(t.azJ,{sx:{paddingBottom:"23px"},children:[(0,i.jsx)("strong",{children:"MINIO"})," is a registered trademark of the MinIO Corporation."]})]})]})})]})}}]); ================================================ FILE: web-app/build/static/js/6481.1beeaf32.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6481],{32680:(e,t,n)=>{n.d(t,{A:()=>d});var i=n(9950),s=n(98341),l=n(89132),o=n(99491),r=n(49078),a=n(96382),c=n(44414);const d=e=>{let{onClose:t,modalOpen:n,title:d,children:p,wideLimit:x=!0,titleIcon:m=null,iconColor:h="default",sx:u}=e;const j=(0,o.jL)(),[g,f]=(0,i.useState)(!1),y=(0,s.d4)(e=>e.system.modalSnackBar);(0,i.useEffect)(()=>{j((0,r.h0)(""))},[j]),(0,i.useEffect)(()=>{if(y){if(""===y.message)return void f(!1);"error"!==y.type&&f(!0)}},[y]);let b="";return y&&(b=y.detailedErrorMsg,(""===b||b&&b.length<5)&&(b=y.message)),(0,c.jsxs)(l.ngX,{onClose:t,open:n,title:d,titleIcon:m,widthLimit:x,sx:u,iconColor:h,children:[(0,c.jsx)(a.A,{isModal:!0}),(0,c.jsx)(l.qb_,{onClose:()=>{f(!1),j((0,r.h0)(""))},open:g,message:b,mode:"inline",variant:"error"===y.type?"error":"default",autoHideDuration:"error"===y.type?10:5,condensed:!0}),p]})}},86481:(e,t,n)=>{n.r(t),n.d(t,{default:()=>I});var i=n(89379),s=n(9950),l=n(28429),o=n(89132),r=n(93598),a=n(49078),c=n(99491),d=n(49534),p=n(1531),x=n(19335),m=n(87946),h=n.n(m),u=n(32680),j=n(45246),g=n(44414);const f=x.Ay.div(e=>{let{theme:t}=e;return{"& .alertText":{color:h()(t,"signalColors.danger","#C51B3F")}}}),y=e=>{let{editSite:t={},onClose:n,onComplete:i}=e;const l=(0,c.jL)(),[r,d]=(0,s.useState)(""),[x,m]=(0,p.A)(e=>{e.success?l((0,a.Hk)(e.status)):l((0,a.C9)({errorMessage:"Error",detailedError:e.status})),i()},e=>{l((0,a.C9)(e)),i()});let h=!1;try{new URL(r),h=!0}catch(y){h=!1}return(0,g.jsxs)(u.A,{title:"Edit Replication Endpoint ",modalOpen:!0,titleIcon:(0,g.jsx)(o.qUP,{}),onClose:n,children:[(0,g.jsxs)(f,{children:[(0,g.jsxs)(o.azJ,{sx:{display:"flex",flexFlow:"column",marginBottom:"15px"},children:[(0,g.jsxs)(o.azJ,{sx:{marginBottom:"10px"},children:[(0,g.jsx)("strong",{children:"Site:"})," "," ",t.name]}),(0,g.jsxs)(o.azJ,{sx:{marginBottom:"10px"},children:[(0,g.jsx)("strong",{children:"Current Endpoint:"})," "," ",t.endpoint]})]}),(0,g.jsxs)(o.xA9,{item:!0,xs:12,children:[(0,g.jsx)(o.l1Y,{sx:{marginBottom:5},children:"New Endpoint:"}),(0,g.jsx)(o.cl_,{id:"edit-rep-peer-endpoint",name:"edit-rep-peer-endpoint",placeholder:"https://dr.minio-storage:9000",onChange:e=>{d(e.target.value)},label:"",value:r})]}),(0,g.jsxs)(o.xA9,{item:!0,xs:12,sx:{marginBottom:15,fontStyle:"italic",display:"flex",alignItems:"center",fontSize:"12px",marginTop:2},children:[(0,g.jsx)("strong",{children:"Note:"}),"\xa0",(0,g.jsx)("span",{className:"alertText",children:"Access Key and Secret Key should be same on the new site/endpoint."})]})]}),(0,g.jsxs)(o.xA9,{item:!0,xs:12,sx:j.Uz.modalButtonBar,children:[(0,g.jsx)(o.$nd,{id:"close",type:"button",variant:"regular",onClick:n,label:"Cancel"}),(0,g.jsx)(o.$nd,{id:"update",type:"button",variant:"callAction",disabled:x||!h,onClick:()=>{m("PUT","api/v1/admin/site-replication",{endpoint:r,name:t.name,deploymentId:t.deploymentID})},label:"Update"})]})]})},b=x.Ay.div(e=>{let{theme:t}=e;return{display:"flex",gap:10,"& .currentIndicator":{"& .min-icon":{width:12,height:12,fill:h()(t,"signalColors.good","#4CCB92")}},"& .endpointName":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}),C=e=>{let{sites:t,onDeleteSite:n,onRefresh:i}=e;const[l,r]=(0,s.useState)(""),[a,c]=(0,s.useState)(null),p=[{label:"Site Name",elementKey:"name"},{label:"Endpoint",elementKey:"endpoint",renderFullObject:!0,renderFunction:e=>(0,g.jsxs)(b,{children:[e.isCurrent?(0,g.jsx)(o.m_M,{tooltip:"This site/cluster",placement:"top",children:(0,g.jsx)(o.azJ,{className:"currentIndicator",children:(0,g.jsx)(o.GQ2,{})})}):null,(0,g.jsx)(o.m_M,{tooltip:e.endpoint,children:(0,g.jsx)(o.azJ,{className:"endpointName",children:e.endpoint})})]})}],x=[{type:"edit",onClick:e=>c(e),tooltip:"Edit Endpoint"},{type:"delete",onClick:e=>r(e.name),tooltip:"Delete Site"}];return(0,g.jsxs)(s.Fragment,{children:[(0,g.jsx)(o.bQt,{columns:p,records:t,itemActions:x,idField:"name",customPaperHeight:"calc(100vh - 660px)",sx:{marginBottom:20}}),""!==l&&(0,g.jsx)(d.A,{title:"Delete Replication Site",confirmText:"Delete",isOpen:""!==l,titleIcon:(0,g.jsx)(o.xWY,{}),isLoading:!1,onConfirm:()=>{n(!1,[l])},onClose:()=>{r("")},confirmationContent:(0,g.jsxs)(s.Fragment,{children:["Are you sure you want to remove the replication site:"," ",(0,g.jsx)("strong",{children:l}),"?"]})}),null!==a&&(0,g.jsx)(y,{onComplete:()=>{c(null),i()},editSite:a,onClose:()=>{c(null)}})]})};var S=n(30272),A=n(82817),v=n(70503);const I=()=>{const e=(0,c.jL)(),t=(0,l.Zp)(),[n,x]=(0,s.useState)([]),[m,h]=(0,s.useState)(!1),[u,j]=(0,p.A)(e=>{const{sites:t,name:n}=e,s=t.findIndex(e=>e.name===n);if(-1!==s){let e=t[s];e=(0,i.A)((0,i.A)({},e),{},{isCurrent:!0}),t.splice(s,1,e)}t.sort((e,t)=>e.name===n?-1:t.name===n?1:0),x(t)},e=>{x([])}),f=()=>{j("GET","api/v1/admin/site-replication")},[y,b]=(0,p.A)(t=>{h(!1),e((0,a.Hk)("Successfully deleted.")),f()},t=>{e((0,a.C9)(t))}),I=function(){b("DELETE","api/v1/admin/site-replication",{all:arguments.length>0&&void 0!==arguments[0]&&arguments[0],sites:arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]})};(0,s.useEffect)(()=>{f()},[]);const E=null===n||void 0===n?void 0:n.length;return(0,s.useEffect)(()=>{e((0,a.ph)("site-replication"))},[]),(0,g.jsxs)(s.Fragment,{children:[(0,g.jsx)(A.A,{label:"Site Replication",actions:(0,g.jsx)(v.A,{})}),(0,g.jsxs)(o.Mxu,{children:[(0,g.jsx)(o._xt,{separator:!!E,sx:{marginBottom:15},actions:(0,g.jsxs)(o.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8},children:[E?(0,g.jsxs)(s.Fragment,{children:[(0,g.jsx)(S.A,{tooltip:"Delete All",children:(0,g.jsx)(o.$nd,{id:"delete-all",label:"Delete All",variant:"secondary",disabled:y,icon:(0,g.jsx)(o.ucK,{}),onClick:()=>{h(!0)}})}),(0,g.jsx)(S.A,{tooltip:"Replication Status",children:(0,g.jsx)(o.$nd,{id:"replication-status",label:"Replication Status",variant:"regular",icon:(0,g.jsx)(o.YkU,{}),onClick:e=>{e.preventDefault(),t(r.zZ.SITE_REPLICATION_STATUS)}})})]}):null,(0,g.jsx)(S.A,{tooltip:"Add Replication Sites",children:(0,g.jsx)(o.$nd,{id:"add-replication-site",label:"Add Sites",variant:"callAction",disabled:y,icon:(0,g.jsx)(o.REV,{}),onClick:()=>{t(r.zZ.SITE_REPLICATION_ADD)}})})]}),children:E?"List of Replicated Sites":""}),E?(0,g.jsx)(C,{sites:n,onDeleteSite:I,onRefresh:f}):null,u?(0,g.jsx)(o.azJ,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"calc( 100vh - 450px )"},children:(0,g.jsx)(o.aHM,{style:{width:16,height:16}})}):null,E||u?null:(0,g.jsx)(o.xA9,{container:!0,children:(0,g.jsx)(o.xA9,{item:!0,xs:8,children:(0,g.jsx)(o.lVp,{title:"Site Replication",iconComponent:(0,g.jsx)(o.pHQ,{}),help:(0,g.jsxs)(s.Fragment,{children:["This feature allows multiple independent MinIO sites (or clusters) that are using the same external IDentity Provider (IDP) to be configured as replicas.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),"To get started,"," ",(0,g.jsx)(o.t53,{isLoading:!1,label:"",onClick:()=>{t(r.zZ.SITE_REPLICATION_ADD)},children:"Add a Replication Site"}),".",(0,g.jsx)("br",{}),"You can learn more at the"," ",(0,g.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/operations/replication/multi-site-replication.html",target:"_blank",rel:"noopener",children:"documentation"}),"."]})})})}),E&&!u?(0,g.jsx)(o.lVp,{title:"Site Replication",iconComponent:(0,g.jsx)(o.pHQ,{}),help:(0,g.jsxs)(s.Fragment,{children:["This feature allows multiple independent MinIO sites (or clusters) that are using the same external IDentity Provider (IDP) to be configured as replicas. In this situation the set of replica sites are referred to as peer sites or just sites.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),"Initially, only one of the sites added for replication may have data. After site-replication is successfully configured, this data is replicated to the other (initially empty) sites. Subsequently, objects may be written to any of the sites, and they will be replicated to all other sites.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),"All sites must have the same deployment credentials (i.e. MINIO_ROOT_USER, MINIO_ROOT_PASSWORD).",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),"All sites must be using the same external IDP(s) if any.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),"For SSE-S3 or SSE-KMS encryption via KMS, all sites must have access to a central KMS deployment server.",(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),"You can learn more at the"," ",(0,g.jsx)("a",{href:"https://github.com/minio/minio/tree/master/docs/site-replication",target:"_blank",rel:"noopener",children:"documentation"}),"."]})}):null,m?(0,g.jsx)(d.A,{title:"Delete All",confirmText:"Delete",isOpen:!0,titleIcon:(0,g.jsx)(o.xWY,{}),isLoading:!1,onConfirm:()=>{const e=n.map(e=>e.name);I(!0,e)},onClose:()=>{h(!1)},confirmationContent:(0,g.jsx)(s.Fragment,{children:"Are you sure you want to remove all the replication sites?."})}):null]})]})}}}]); ================================================ FILE: web-app/build/static/js/6582.fb2dceaa.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6582],{66582:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var o=n(9950),l=n(89132),s=n(49078),r=n(99491),c=n(49534),a=n(70444),i=n(48965),u=n(44414);const p=e=>{let{selectedGroups:t,deleteOpen:n,closeDeleteModalAndRefresh:p}=e;const h=(0,r.jL)(),[d,f]=(0,o.useState)(!1);if(!t)return null;const g=t.map(e=>(0,u.jsx)("div",{children:(0,u.jsx)("b",{children:e})},e));return(0,u.jsx)(c.A,{title:"Delete Group".concat(t.length>1?"s":""),confirmText:"Delete",isOpen:n,titleIcon:(0,u.jsx)(l.xWY,{}),isLoading:d,onConfirm:()=>{for(let e of t)f(!0),a.F.group.removeGroup(e).then(e=>{p(!0)}).catch(async e=>{const t=await e.json();h((0,s.C9)((0,i.S)(t))),p(!1)}).finally(()=>f(!1))},onClose:()=>p(!1),confirmationContent:(0,u.jsxs)(o.Fragment,{children:["Are you sure you want to delete the following"," ",1===t.length?"":t.length," group",t.length>1?"s?":"?",g]})})}}}]); ================================================ FILE: web-app/build/static/js/66.6c94b445.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[66],{50066:(e,s,t)=>{t.r(s),t.d(s,{default:()=>v});var n=t(9950),o=t(1531),r=t(49534),i=t(89132),l=t(49078),c=t(99491),a=t(26843),d=t(93598),u=t(98341),b=t(70444),h=t(44414);const v=e=>{let{closeDeleteModalAndRefresh:s,deleteOpen:t,selectedBucket:v,selectedObjects:p,versioning:j}=e;const g=(0,c.jL)(),x=()=>s(!0),[f,m]=(0,o.A)(x,e=>g((0,l.C9)(e))),[C,y]=(0,n.useState)(!1),[O,_]=(0,n.useState)(!1),k=(0,u.d4)(e=>e.objectBrowser.retentionConfig),w=(0,a._)([v],[d.OV.S3_BYPASS_GOVERNANCE_RETENTION])&&"governance"===(null===k||void 0===k?void 0:k.mode);if(!p)return null;const T="Enabled"===(null===j||void 0===j?void 0:j.status)||"Suspended"===(null===j||void 0===j?void 0:j.status);return(0,h.jsx)(r.A,{title:"Delete Objects",confirmText:"Delete",isOpen:t,titleIcon:(0,h.jsx)(i.xWY,{}),isLoading:f,onConfirm:()=>{let e=[];for(let s=0;s{g((0,l.C9)({errorMessage:"Could not delete object. ".concat(e.statusText,". ").concat(k?"Please check retention mode and if object is WORM protected.":""),detailedError:""}))})}else m("POST","/api/v1/buckets/".concat(v,"/delete-objects?all_versions=").concat(C).concat(O?"&bypass=true":""),e)},onClose:()=>s(!1),confirmationContent:(0,h.jsxs)(n.Fragment,{children:["Are you sure you want to delete the selected ",p.length," ","objects?"," ",T&&(0,h.jsxs)(n.Fragment,{children:[(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),(0,h.jsx)(i.dOG,{label:"Delete All Versions",indicatorLabels:["Yes","No"],checked:C,value:"delete_versions",id:"delete-versions",name:"delete-versions",onChange:e=>{y(!C)},description:""}),w&&C&&(0,h.jsx)(n.Fragment,{children:(0,h.jsx)("div",{style:{marginTop:10},children:(0,h.jsx)(i.dOG,{label:"Bypass Governance Mode",indicatorLabels:["Yes","No"],checked:O,value:"bypass_governance",id:"bypass_governance",name:"bypass_governance",onChange:e=>{_(!O)},description:""})})}),C&&(0,h.jsxs)(n.Fragment,{children:[(0,h.jsxs)("div",{style:{marginTop:10,border:"#c83b51 1px solid",borderRadius:3,padding:5,backgroundColor:"#c83b5120",color:"#c83b51"},children:["This will remove the objects as well as all of their versions, ",(0,h.jsx)("br",{}),"This action is irreversible."]}),(0,h.jsx)("br",{}),"Are you sure you want to continue?"]})]})]})})}}}]); ================================================ FILE: web-app/build/static/js/6644.3349262e.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6644],{76644:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var a=n(9950),l=n(98341),s=n(89132),c=n(99491),o=n(59908),i=n(31690),r=n(11488),d=n(49078),u=n(2586),x=n(82817),h=n(70503),m=n(44414);const p=()=>{const e=(0,c.jL)(),t=(0,l.d4)(e=>e.watch.messages),[n,p]=(0,a.useState)(!1),[b,f]=(0,a.useState)("Select Bucket"),[g,j]=(0,a.useState)(""),[w,k]=(0,a.useState)(""),[S,v]=(0,a.useState)([]);(0,a.useEffect)(()=>{u.A.invoke("GET","/api/v1/buckets").then(e=>{let t=[];null!==e.buckets&&(t=e.buckets),v(t)}).catch(e=>{console.error(e)})},[]),(0,a.useEffect)(()=>{if(e((0,r.n4)()),n&&S.some(e=>e.name===b)){const t=new URL(window.location.toString()),n=!1?"9090":t.port,a=new URL(document.baseURI).pathname,l=(0,i.nw)(t.protocol),s=new WebSocket("".concat(l,"://").concat(t.hostname,":").concat(n).concat(a,"ws/watch/").concat(b,"?prefix=").concat(g,"&suffix=").concat(w));let c=null;if(null!==s)return s.onopen=()=>{console.log("WebSocket Client Connected"),s.send("ok"),c=setInterval(()=>{s.send("ok")},1e4)},s.onmessage=t=>{let n=JSON.parse(t.data.toString());n.Time=new Date(n.Time.toString()),n.key=Math.random(),e((0,r.ID)(n))},s.onclose=()=>{clearInterval(c),console.log("connection closed by server"),p(!1)},()=>{s.close(1e3),clearInterval(c),console.log("closing websockets")}}else p(!1)},[e,n,S,b,g,w]);const y=S.map(e=>({label:e.name,value:e.name}));(0,a.useEffect)(()=>{e((0,d.ph)("watch"))},[]);const C=y.map(e=>({label:e.label,value:e.value}));return(0,m.jsxs)(a.Fragment,{children:[(0,m.jsx)(x.A,{label:"Watch",actions:(0,m.jsx)(h.A,{})}),(0,m.jsx)(s.Mxu,{children:(0,m.jsxs)(s.xA9,{container:!0,children:[(0,m.jsxs)(s.xA9,{item:!0,xs:12,sx:{display:"flex",gap:10,marginBottom:15,alignItems:"center"},children:[(0,m.jsxs)(s.azJ,{sx:{flexGrow:1},children:[(0,m.jsx)(s.l1Y,{children:"Bucket"}),(0,m.jsx)(s.l6P,{id:"bucket-name",name:"bucket-name",value:b,onChange:e=>{f(e)},disabled:n,options:C,placeholder:"Select Bucket"})]}),(0,m.jsxs)(s.azJ,{sx:{flexGrow:1},children:[(0,m.jsx)(s.l1Y,{children:"Prefix"}),(0,m.jsx)(s.cl_,{id:"prefix-resource",disabled:n,onChange:e=>{j(e.target.value)}})]}),(0,m.jsxs)(s.azJ,{sx:{flexGrow:1},children:[(0,m.jsx)(s.l1Y,{children:"Suffix"}),(0,m.jsx)(s.cl_,{id:"suffix-resource",disabled:n,onChange:e=>{k(e.target.value)}})]}),(0,m.jsx)(s.azJ,{sx:{alignSelf:"flex-end",paddingBottom:4},children:n?(0,m.jsx)(s.$nd,{id:"stop-watch",type:"submit",variant:"callAction",onClick:()=>p(!1),label:"Stop"}):(0,m.jsx)(s.$nd,{id:"start-watch",type:"submit",variant:"callAction",onClick:()=>p(!0),label:"Start"})})]}),(0,m.jsx)(s.xA9,{item:!0,xs:12,children:(0,m.jsx)(s.bQt,{columns:[{label:"Time",elementKey:"Time",renderFunction:o.cj},{label:"Size",elementKey:"Size",renderFunction:o.nO},{label:"Type",elementKey:"Type"},{label:"Path",elementKey:"Path"}],records:t,entityName:"Watch",customEmptyMessage:"No Changes at this time",idField:"watch_table",isLoading:!1,customPaperHeight:"calc(100vh - 270px)"})})]})})]})}}}]); ================================================ FILE: web-app/build/static/js/6681.f34cfbfa.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6681],{6805:(e,i,t)=>{t.d(i,{A:()=>a});var r=t(9950),n=t(89132),s=t(44414);const l=e=>{let{icon:i,description:t}=e;return(0,s.jsxs)(n.azJ,{sx:{display:"flex","& .min-icon":{marginRight:"10px",height:"23px",width:"23px",marginBottom:"10px"}},children:[i," ",(0,s.jsx)("div",{style:{fontSize:"14px",fontStyle:"italic",color:"#5E5E5E"},children:t})]})},a=e=>{let{helpText:i,docLink:t,docText:a,contents:o}=e;return(0,s.jsxs)(n.azJ,{sx:{flex:1,border:"1px solid #eaeaea",borderRadius:"2px",display:"flex",flexFlow:"column",padding:"20px"},children:[(0,s.jsxs)(n.azJ,{sx:{fontSize:"16px",fontWeight:600,display:"flex",alignItems:"center",marginBottom:"16px",paddingBottom:"20px","& .min-icon":{height:"21px",width:"21px",marginRight:"15px"}},children:[(0,s.jsx)(n.nag,{}),(0,s.jsx)("div",{children:i})]}),(0,s.jsxs)(n.azJ,{sx:{fontSize:"14px",marginBottom:"15px"},children:[o.map((e,i)=>(0,s.jsxs)(r.Fragment,{children:[e.icon&&(0,s.jsx)(n.azJ,{sx:{paddingBottom:"20px"},children:(0,s.jsx)(l,{icon:e.icon,description:e.iconDescription})}),(0,s.jsx)(n.azJ,{sx:{paddingBottom:"20px"},children:e.text})]},"feature-item-".concat(i))),(0,s.jsx)(n.azJ,{sx:{paddingBottom:"20px"},children:(0,s.jsx)("a",{href:t,target:"_blank",rel:"noopener",children:a})})]})]})}},18120:(e,i,t)=>{t.d(i,{A:()=>p});var r=t(9950),n=t(70444),s=t(48965),l=t(49534),a=t(89132),o=t(49078),c=t(99491),d=t(44414);const p=e=>{let{configurationName:i,closeResetModalAndRefresh:t,resetOpen:p}=e;const x=(0,c.jL)(),[u,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{u&&n.F.configs.resetConfig(i).then(()=>{h(!1),t(!0)}).catch(e=>{h(!1),x((0,o.C9)((0,s.S)(e.error)))})},[t,i,u,x]);return(0,d.jsx)(l.A,{title:"Restore Defaults",confirmText:"Yes, Reset Configuration",isOpen:p,titleIcon:(0,d.jsx)(a.xWY,{}),isLoading:u,onConfirm:()=>{h(!0)},onClose:()=>{t(!1)},confirmationContent:(0,d.jsxs)(r.Fragment,{children:[u&&(0,d.jsx)(a.z21,{}),(0,d.jsxs)(r.Fragment,{children:["Are you sure you want to restore these configurations to default values?",(0,d.jsx)("br",{}),(0,d.jsx)("b",{style:{maxWidth:"200px",whiteSpace:"normal",wordWrap:"break-word"},children:"Please note that this may cause your system to not be accessible"})]})]})})}},20416:(e,i,t)=>{t.d(i,{Hw:()=>n,LA:()=>r,SO:()=>s,rY:()=>l});const r=(e,i)=>{if(e.accessKey&&i.accessKey){if(e.accessKey>i.accessKey)return 1;if(e.accessKeye.name>i.name?1:e.namee>i?1:ee.policy>i.policy?1:e.policy{t.r(i),t.d(i,{default:()=>D});var r=t(89379),n=t(9950),s=t(89132),l=t(70444),a=t(48965),o=t(99491),c=t(49078),d=t(91234),p=t(82817),x=t(6805),u=t(98341),h=t(43217),m=t(44414);const g=e=>{let{name:i}=e;return(0,m.jsxs)("h4",{children:[(0,m.jsx)(s.FUY,{style:{transform:"rotateZ(90deg)"}}),i]})},f=e=>{let{blockName:i,results:t}=e;return(0,m.jsxs)(n.Fragment,{children:[(0,m.jsxs)("strong",{children:[i,":"]}),(0,m.jsx)("ul",{children:t.map((e,t)=>(0,m.jsx)("li",{children:e},"policy-".concat(i,"-").concat(t)))})]})},y=e=>{var i,t,r,l,a,o;let{entityName:c,results:d}=e,p=0;switch(c){case"Group":p=(null===(i=d.groups)||void 0===i?void 0:i.length)||0;break;case"Policy":p=(null===(t=d.policies)||void 0===t?void 0:t.length)||0;break;case"User":p=(null===(r=d.users)||void 0===r?void 0:r.length)||0}return(0,m.jsxs)(s.azJ,{className:"resultElement",sx:{marginTop:50,"&:first-of-type":{marginTop:0}},children:[(0,m.jsxs)(s._xt,{separator:!0,sx:{fontSize:12},icon:(0,m.jsx)(s.Xk0,{style:{width:17,height:17}}),actions:(0,m.jsxs)(s.azJ,{sx:{fontSize:14},children:[(0,m.jsx)("strong",{children:p})," Entit",1===p?"y":"ies"," Found"]}),children:[c," Mappings"]}),(0,m.jsxs)(s.azJ,{className:"resultsList",sx:{h4:{borderBottom:"#e2e2e2 1px solid",padding:"12px 0",margin:0,marginBottom:15,display:"flex",alignItems:"center","& svg":{marginRight:10,fill:"#3C77A7"}}},children:["Group"===c&&(null===(l=d.groups)||void 0===l?void 0:l.map((e,i)=>(0,m.jsxs)(n.Fragment,{children:[(0,m.jsx)(g,{name:e.group||""}),e.policies&&(0,m.jsx)(f,{blockName:"Policies",results:e.policies})]},"policy-res-".concat(i)))),"User"===c&&(null===(a=d.users)||void 0===a?void 0:a.map((e,i)=>(0,m.jsxs)(n.Fragment,{children:[(0,m.jsx)(g,{name:e.user||""}),e.policies&&(0,m.jsx)(f,{blockName:"Policies",results:e.policies})]},"users-res-".concat(i)))),"Policy"===c&&(null===(o=d.policies)||void 0===o?void 0:o.map((e,i)=>(0,m.jsxs)(n.Fragment,{children:[(0,m.jsx)(g,{name:e.policy||""}),e.groups&&(0,m.jsx)(f,{blockName:"Groups",results:e.groups}),e.users&&(0,m.jsx)(f,{blockName:"Users",results:e.users})]},"policy-map-".concat(i))))]})]})};var j=t(40038);const b=()=>{const e=(0,o.jL)(),[i,t]=(0,n.useState)(!1),[r,d]=(0,n.useState)([""]),[p,x]=(0,n.useState)([""]),[g,f]=(0,n.useState)(null),b=(0,u.d4)(e=>e.createUser.selectedPolicies);return(0,m.jsxs)(s.azJ,{sx:{marginTop:15,paddingTop:0},children:[(0,m.jsxs)(s.xA9,{container:!0,sx:{marginTop:5},children:[(0,m.jsxs)(s.xA9,{item:!0,sm:12,md:6,lg:5,sx:{padding:10,paddingTop:0},children:[(0,m.jsx)(s._xt,{children:"Query Filters"}),(0,m.jsxs)(s.azJ,{sx:{padding:"0 10px",display:"flex",flexDirection:"column",gap:40},children:[(0,m.jsxs)(s.azJ,{sx:{padding:"10px 26px"},withBorders:!0,children:[(0,m.jsx)(s.azJ,{sx:{display:"flex"},children:(0,m.jsx)("h4",{style:{margin:0,marginBottom:10,fontSize:14},children:"Users"})}),(0,m.jsx)(s.azJ,{sx:{overflowY:"auto",minHeight:50,maxHeight:250,"& > div > div":{width:"100%"}},children:r.map((e,i)=>(0,m.jsx)(s.cl_,{id:"search-user-".concat(i),value:e,onChange:e=>{const t=[...r];t[i]=e.target.value,d(t)},overlayIcon:r.length===i+1?(0,m.jsx)(s.REV,{}):(0,m.jsx)(s.YPx,{}),overlayAction:()=>{((e,i)=>{if(e){const e=[...r,""];return void d(e)}const t=r.filter((e,t)=>t!==i);d(t)})(r.length===i+1,i)}},"search-user-".concat(i)))})]}),(0,m.jsxs)(s.azJ,{sx:{padding:"10px 26px"},withBorders:!0,children:[(0,m.jsx)("h4",{style:{margin:0,marginBottom:10,fontSize:14},children:"Groups"}),(0,m.jsx)(s.azJ,{sx:{overflowY:"auto",minHeight:50,maxHeight:"calc(100vh - 340px)","& > div > div":{width:"100%"}},children:p.map((e,i)=>(0,m.jsx)(s.cl_,{id:"search-group-".concat(i),value:e,onChange:e=>{const t=[...p];t[i]=e.target.value,x(t)},overlayIcon:p.length===i+1?(0,m.jsx)(s.REV,{}):(0,m.jsx)(s.YPx,{}),overlayAction:()=>{((e,i)=>{if(e){const e=[...p,""];return void x(e)}const t=p.filter((e,t)=>t!==i);x(t)})(p.length===i+1,i)}},"search-group-".concat(i)))})]}),(0,m.jsxs)(s.azJ,{sx:{padding:"10px 26px"},withBorders:!0,children:[(0,m.jsx)("h4",{style:{margin:0,marginBottom:10,fontSize:14},children:"Policies"}),(0,m.jsx)(s.azJ,{sx:{minHeight:265,maxHeight:"calc(100vh - 740px)"},children:(0,m.jsx)(j.A,{selectedPolicy:b,noTitle:!0})})]})]})]}),(0,m.jsx)(s.xA9,{item:!0,sm:12,md:6,lg:7,sx:{padding:10,paddingTop:0,display:"flex",flexDirection:"column"},children:i?(0,m.jsx)(s.azJ,{sx:{textAlign:"center"},children:(0,m.jsx)(s.aHM,{})}):(0,m.jsxs)(n.Fragment,{children:[(0,m.jsx)(s._xt,{actions:(0,m.jsx)(s.azJ,{sx:{display:"flex",flexDirection:"row",alignItems:"center",fontSize:14},children:null!==g&&void 0!==g&&g.timestamp?(0,m.jsxs)(n.Fragment,{children:[(0,m.jsx)(s.b1c,{style:{width:14,height:14,marginRight:5,fill:"#BEBFBF"}}),h.c9.fromISO(g.timestamp).toFormat("D HH:mm:ss")]}):""}),children:"Query Results"}),g?(0,m.jsxs)(s.azJ,{sx:{backgroundColor:"#FBFAFA",padding:"8px 22px",flexGrow:1,overflowY:"auto"},children:[!g.groups&&!g.users&&!g.policies&&(0,m.jsx)(s.azJ,{sx:{textAlign:"center"},children:(0,m.jsx)("h4",{children:"No Results Available"})}),!!g.groups&&(0,m.jsx)(y,{results:g,entityName:"Group"}),!!g.users&&(0,m.jsx)(y,{results:g,entityName:"User"}),!!g.policies&&(0,m.jsx)(y,{results:g,entityName:"Policy"})]}):(0,m.jsx)(s.azJ,{sx:{textAlign:"center"},children:"No query results yet"})]})})]}),(0,m.jsx)(s.xA9,{container:!0,children:(0,m.jsx)(s.xA9,{item:!0,xs:12,sx:{display:"flex",justifyContent:"flex-start",marginTop:45,padding:"0 20px"},children:(0,m.jsx)(s.$nd,{id:"search-entity",type:"button",variant:"callAction",onClick:()=>{t(!0);let i={},n=b.filter(e=>""!==e),s=r.filter(e=>""!==e),o=p.filter(e=>""!==e);n.length>0&&(i.policies=n),s.length>0&&(i.users=s),o.length>0&&(i.groups=o),l.F.ldapEntities.getLdapEntities(i).then(e=>{f(e.data),t(!1)}).catch(i=>{e((0,c.C9)((0,a.S)(i.error))),t(!1)})},icon:(0,m.jsx)(s.WIv,{}),children:"Search"})})})]})};var v=t(18120),C=t(70503);const A=["server_addr","lookup_bind_dn","user_dn_search_base_dn","user_dn_search_filter"],D=()=>{const e=(0,o.jL)(),i=d.Lq,[t,u]=(0,n.useState)(!0),[h,g]=(0,n.useState)(!1),[f,y]=(0,n.useState)(!1),[j,D]=(0,n.useState)({}),[_,k]=(0,n.useState)({}),[S,w]=(0,n.useState)(void 0),[P,E]=(0,n.useState)(!1),[I,O]=(0,n.useState)(!1),[z,L]=(0,n.useState)("configuration"),[F,N]=(0,n.useState)(!1),q=()=>{P&&S&&B(S),E(!P)},B=e=>{let i={},t={};if(e&&e.length>0){const r=e.find(e=>"enable"===e.key);let n=0,s=0;e.forEach(e=>{e.env_override?(i[e.key]=e.env_override.value,t[e.key]=e.env_override.name):i[e.key]=e.value,A.includes(e.key)&&(e.value&&""!==e.value&&"off"!==e.value||e.env_override&&""!==e.env_override.value&&"off"!==e.env_override.value)&&n++,A.includes(e.key)&&e.env_override&&s++});const l=0!==n;l&&(r&&"off"!==r.value||!r)?g(!0):g(!1),0!==s&&N(!0),y(l)}k(t),D(i)};(0,n.useEffect)(()=>{t&&l.F.configs.configInfo("identity_ldap").then(e=>{e.data.length>0&&(w(e.data[0].key_values),B(e.data[0].key_values||[])),u(!1)}).catch(i=>{u(!1),e((0,c.C9)((0,a.S)(i.error)))})},[e,t]);return(0,n.useEffect)(()=>{e((0,c.ph)("LDAP"))},[]),(0,m.jsxs)(s.xA9,{item:!0,xs:12,children:[I&&(0,m.jsx)(v.A,{configurationName:"identity_ldap",closeResetModalAndRefresh:async i=>{O(!1),i&&(e((0,c.YR)(i)),w(void 0),D({}),g(!1),y(!1),E(!1))},resetOpen:I}),(0,m.jsx)(p.A,{label:"LDAP",actions:(0,m.jsx)(C.A,{})}),(0,m.jsx)(s.Mxu,{variant:"constrained",children:(0,m.jsx)(s.tUM,{horizontal:!0,options:[{tabConfig:{id:"configuration",label:"Configuration"},content:(0,m.jsxs)(n.Fragment,{children:[(0,m.jsx)(s.lcx,{icon:null,title:P?"Edit Configuration":"",actions:P?null:(0,m.jsxs)(n.Fragment,{children:[(0,m.jsx)(s.m_M,{tooltip:F?"Configuration cannot be edited in this module as LDAP environment variables are set for this MinIO instance.":"",children:(0,m.jsx)(s.$nd,{id:"edit",type:"button",variant:"callAction",icon:(0,m.jsx)(s.qUP,{}),onClick:q,label:"Edit Configuration",disabled:t||F})}),f&&(0,m.jsx)(s.m_M,{tooltip:F?"Configuration cannot be disabled / enabled in this module as LDAP environment variables are set for this MinIO instance.":"",children:(0,m.jsx)(s.$nd,{id:"is-configuration-enabled",onClick:()=>(i=>{const t={key_values:[{key:"enable",value:i?"on":"off"}]};l.F.configs.setConfig("identity_ldap",t).then(i=>{g(!h),e((0,c.YR)(i.data.restart||!1)),i.data.restart||e((0,c.Hk)("Configuration saved successfully"))}).catch(i=>{e((0,c.C9)((0,a.S)(i.error)))})})(!h),label:h?"Disable LDAP":"Enable LDAP",variant:h?"secondary":"regular",disabled:F})}),(0,m.jsx)(s.$nd,{id:"refresh-idp-config",onClick:()=>u(!0),label:"Refresh",icon:(0,m.jsx)(s.fNY,{})})]})}),(0,m.jsx)("br",{}),t?(0,m.jsx)(s.azJ,{sx:{display:"flex",justifyContent:"center",marginTop:10},children:(0,m.jsx)(s.aHM,{})}):(0,m.jsx)(n.Fragment,{children:P?(0,m.jsx)(n.Fragment,{children:(0,m.jsxs)(s.Hbc,{helpBox:(0,m.jsx)(x.A,{helpText:"Learn more about LDAP Configurations",contents:d.iT,docLink:"https://docs.min.io/community/minio-object-store/operations/external-iam.html#active-directory-ldap",docText:"Learn more about LDAP Configurations"}),children:[P&&f?(0,m.jsx)(s.azJ,{sx:{marginBottom:15},children:(0,m.jsx)(s.lVp,{title:(0,m.jsx)(s.azJ,{style:{display:"flex",justifyContent:"space-between",alignItems:"center",flexGrow:1},children:"Lookup Bind Password must be re-entered to change LDAP configurations"}),iconComponent:(0,m.jsx)(s.cJw,{}),help:null})}):null,Object.entries(i).map(e=>{let[i,t]=e;return((e,i)=>"toggle"===i.type?(0,m.jsx)(s.dOG,{indicatorLabels:["Enabled","Disabled"],checked:"on"===j[e],value:"is-field-enabled",id:"is-field-enabled",name:"is-field-enabled",label:i.label,tooltip:i.tooltip,onChange:i=>D((0,r.A)((0,r.A)({},j),{},{[e]:i.target.checked?"on":"off"})),description:"",disabled:!P},e):(0,m.jsx)(s.cl_,{id:e,required:i.required,name:e,label:i.label,tooltip:i.tooltip,error:i.hasError(j[e],P),value:j[e]?j[e]:"",onChange:i=>D((0,r.A)((0,r.A)({},j),{},{[e]:i.target.value})),placeholder:i.placeholder,disabled:!P,type:i.type},e))(i,t)}),(0,m.jsxs)(s.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:"20px",gap:"15px"},children:[P&&f&&(0,m.jsx)(s.$nd,{id:"clear",type:"button",variant:"secondary",onClick:()=>O(!0),label:"Reset Configuration"}),(0,m.jsx)(s.$nd,{id:"cancel",type:"button",variant:"regular",onClick:q,label:"Cancel"}),(0,m.jsx)(s.$nd,{id:"save-key",type:"submit",variant:"callAction",color:"primary",disabled:t||!(()=>{for(const[e,t]of Object.entries(i))if(t.required&&(void 0===j[e]||null===j[e]||""===j[e]))return!1;return!0})(),label:"Save",onClick:()=>{const t=Object.keys(i).map(e=>({key:e,value:j[e]}));l.F.configs.setConfig("identity_ldap",{key_values:t}).then(i=>{E(!1),w(t),B(t),e((0,c.YR)(i.data.restart||!1)),D((0,r.A)((0,r.A)({},j),{},{lookup_bind_password:""})),i.data.restart||e((0,c.Hk)("Configuration saved successfully"))}).catch(i=>{e((0,c.C9)((0,a.S)(i.error)))})}})]})]})}):(0,m.jsx)(n.Fragment,{children:(0,m.jsxs)(s.azJ,{sx:{display:"grid",gridTemplateColumns:"1fr",gridAutoFlow:"dense",gap:3,padding:"15px",border:"1px solid #eaeaea","@media (min-width: 576px)":{gridTemplateColumns:"2fr 1fr",gridAutoFlow:"row"}},children:[(0,m.jsx)(s.mZW,{label:"LDAP Enabled",value:h?"Yes":"No"}),f&&(0,m.jsx)(n.Fragment,{children:Object.entries(i).map(e=>{let[i,t]=e;if(!t.editOnly){let e=t.label,r=j[i]?j[i]:"";return _[i]&&(e=(0,m.jsxs)(s.azJ,{sx:{display:"flex",alignItems:"center",gap:5,"& .min-icon":{height:20,width:20},"& span":{height:20,display:"flex",alignItems:"center"}},children:[(0,m.jsx)("span",{children:t.label}),(0,m.jsx)(s.m_M,{tooltip:"This value is set from the ".concat(_[i]," environment variable"),placement:"right",children:(0,m.jsx)("span",{className:"muted",children:(0,m.jsx)(s.D0K,{})})})]}),r=(0,m.jsx)("i",{children:(0,m.jsx)("span",{className:"muted",children:r})})),(0,m.jsx)(s.mZW,{label:e,value:r},i)}return null})})]})})})]})},{tabConfig:{id:"entities",label:"Entities",disabled:!f||!h},content:(0,m.jsx)(n.Fragment,{children:f&&(0,m.jsx)(s.azJ,{children:(0,m.jsx)(b,{})})})}],currentTabOrPath:z,onTabClick:e=>{L(e),E(!1)}})})]})}},40038:(e,i,t)=>{t.d(i,{A:()=>u});var r=t(9950),n=t(89132),s=t(20416),l=t(27428),a=t(49078),o=t(99491),c=t(5887),d=t(98341),p=t(70444),x=t(44414);const u=e=>{let{noTitle:i=!1}=e;const t=(0,o.jL)(),[u,h]=(0,r.useState)([]),[m,g]=(0,r.useState)(!1),[f,y]=(0,r.useState)(""),j=(0,d.d4)(e=>e.createUser.selectedPolicies),b=(0,r.useCallback)(()=>{g(!0),p.F.policies.listPolicies().then(e=>{var i;const t=null!==(i=e.data.policies)&&void 0!==i?i:[];g(!1),h(t.sort(s.Hw))}).catch(e=>{g(!1),t((0,a.Dy)(e))})},[t]);(0,r.useEffect)(()=>{g(!0)},[]),(0,r.useEffect)(()=>{m&&b()},[m,b]);const v=u.filter(e=>e.name.includes(f));return(0,x.jsxs)(n.xA9,{item:!0,xs:12,className:"inputItem",children:[m&&(0,x.jsx)(n.z21,{}),u.length>0?(0,x.jsxs)(r.Fragment,{children:[(0,x.jsx)(n.xA9,{item:!0,xs:12,className:"inputItem",children:(0,x.jsx)(l.A,{placeholder:"Start typing to search for a Policy",onChange:e=>{y(e)},value:f,label:i?"":"Assign Policies"})}),(0,x.jsx)(n.bQt,{columns:[{label:"Policy",elementKey:"name"}],onSelect:e=>{const i=e.target,r=i.value,n=i.checked;let s=[...j];n?s.push(r):s=s.filter(e=>e!==r),s=s.filter(e=>""!==e),t((0,c.Gy)(s))},selectedItems:j,isLoading:m,records:v,entityName:"Policies",idField:"name",customPaperHeight:"200px"})]}):(0,x.jsx)(n.azJ,{sx:{textAlign:"center",padding:"10px 0"},children:"No Policies Available"})]})}},91234:(e,i,t)=>{t.d(i,{G5:()=>l,Lq:()=>o,Vb:()=>a,iT:()=>s});var r=t(89132),n=t(44414);const s=[{text:"MinIO supports using an Active Directory or LDAP (AD/LDAP) service for external management of user identities. Configuring an external IDentity Provider (IDP) enables Single-Sign On (SSO) workflows, where applications authenticate against the external IDP before accessing MinIO.",icon:(0,n.jsx)(r.Tir,{}),iconDescription:"Create Configurations"},{text:"MinIO queries the configured Active Directory / LDAP server to verify the credentials specified by the application and optionally return a list of groups in which the user has membership. MinIO supports two modes (Lookup-Bind Mode and Username-Bind Mode) for performing these queries",icon:null,iconDescription:""},{text:"MinIO recommends using Lookup-Bind mode as the preferred method for verifying AD/LDAP credentials. Username-Bind mode is a legacy method retained for backwards compatibility only.",icon:null,iconDescription:""}],l=[{text:"MinIO supports using an OpenID Connect (OIDC) compatible IDentity Provider (IDP) such as Okta, KeyCloak, Dex, Google, or Facebook for external management of user identities.",icon:(0,n.jsx)(r.XAi,{}),iconDescription:"Create Configurations"},{text:"Configuring an external IDP enables Single-Sign On workflows, where applications authenticate against the external IDP before accessing MinIO.",icon:null,iconDescription:""}],a={config_url:{required:!0,hasError:(e,i)=>!e&&i?"Config URL is required":"",label:"Config URL",tooltip:"Config URL for identity provider configuration",placeholder:"https://identity-provider-url/.well-known/openid-configuration",type:"text",editOnly:!1},client_id:{required:!0,hasError:(e,i)=>!e&&i?"Client ID is required":"",label:"Client ID",tooltip:"Identity provider Client ID",placeholder:"Enter Client ID",type:"text",editOnly:!1},client_secret:{required:!0,hasError:(e,i)=>!e&&i?"Client Secret is required":"",label:"Client Secret",tooltip:"Identity provider Client Secret",placeholder:"Enter Client Secret",type:"password",editOnly:!0},claim_name:{required:!1,label:"Claim Name",tooltip:"Claim from which MinIO will read the policy or role to use",placeholder:"Enter Claim Name",type:"text",hasError:(e,i)=>"",editOnly:!1},display_name:{required:!1,label:"Display Name",tooltip:"",placeholder:"Enter Display Name",type:"text",hasError:(e,i)=>"",editOnly:!1},claim_prefix:{required:!1,label:"Claim Prefix",tooltip:"",placeholder:"Enter Claim Prefix",type:"text",hasError:(e,i)=>"",editOnly:!1},scopes:{required:!1,label:"Scopes",tooltip:"",placeholder:"openid,profile,email",type:"text",hasError:(e,i)=>"",editOnly:!1},redirect_uri:{required:!1,label:"Redirect URI",tooltip:"",placeholder:"https://console-endpoint-url/oauth_callback",type:"text",hasError:(e,i)=>"",editOnly:!1},role_policy:{required:!1,label:"Role Policy",tooltip:"",placeholder:"readonly",type:"text",hasError:(e,i)=>"",editOnly:!1},claim_userinfo:{required:!1,label:"Claim User Info",tooltip:"",placeholder:"Claim User Info",type:"toggle",hasError:(e,i)=>"",editOnly:!1},redirect_uri_dynamic:{required:!1,label:"Redirect URI Dynamic",tooltip:"",placeholder:"Redirect URI Dynamic",type:"toggle",hasError:(e,i)=>"",editOnly:!1}},o={server_insecure:{required:!0,hasError:(e,i)=>!e&&i?"Server Address is required":"",label:"Server Insecure",tooltip:"Disable SSL certificate verification ",placeholder:"myldapserver.com:636",type:"toggle",editOnly:!1},server_addr:{required:!0,hasError:(e,i)=>!e&&i?"Server Address is required":"",label:"Server Address",tooltip:'AD/LDAP server address e.g. "myldapserver.com:636"',placeholder:"myldapserver.com:636",type:"text",editOnly:!1},lookup_bind_dn:{required:!0,hasError:(e,i)=>!e&&i?"Lookup Bind DN is required":"",label:"Lookup Bind DN",tooltip:"DN (Distinguished Name) for LDAP read-only service account used to perform DN and group lookups",placeholder:"cn=admin,dc=min,dc=io",type:"text",editOnly:!1},lookup_bind_password:{required:!0,hasError:(e,i)=>!e&&i?"Lookup Bind Password is required":"",label:"Lookup Bind Password",tooltip:"Password for LDAP read-only service account used to perform DN and group lookups",placeholder:"admin",type:"password",editOnly:!0},user_dn_search_base_dn:{required:!0,hasError:(e,i)=>!e&&i?"User DN Search Base DN is required":"",label:"User DN Search Base",tooltip:"",placeholder:"DC=example,DC=net",type:"text",editOnly:!1},user_dn_search_filter:{required:!0,hasError:(e,i)=>!e&&i?"User DN Search Filter is required":"",label:"User DN Search Filter",tooltip:"",placeholder:"(sAMAccountName=%s)",type:"text",editOnly:!1},group_search_base_dn:{required:!1,hasError:(e,i)=>"",label:"Group Search Base DN",tooltip:"",placeholder:"ou=swengg,dc=min,dc=io",type:"text",editOnly:!1},group_search_filter:{required:!1,hasError:(e,i)=>"",label:"Group Search Filter",tooltip:"",placeholder:"(&(objectclass=groupofnames)(member=%d))",type:"text",editOnly:!1}}}}]); ================================================ FILE: web-app/build/static/js/669.866766bf.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[669],{40669:(e,s,t)=>{t.r(s),t.d(s,{default:()=>R});var a=t(89379),n=t(9950),r=t(89132),o=t(98341),c=t(28429),i=t(45246),l=t(32680),d=t(49078),u=t(99491),h=t(70444),x=t(48965),p=t(44414);const m=e=>{let{open:s,closeModal:t}=e;const o=(0,u.jL)(),[c,m]=(0,n.useState)(""),[g,j]=(0,n.useState)(""),[w,y]=(0,n.useState)(""),[A,b]=(0,n.useState)(!1),C=localStorage.getItem("userLoggedIn")||"";return s?(0,p.jsxs)(l.A,{title:"Change Password for ".concat(C),modalOpen:s,onClose:()=>{j(""),y(""),m(""),t()},titleIcon:(0,p.jsx)(r.Fwq,{}),children:[(0,p.jsx)("div",{children:"This will change your Console password. Please note your new password down, as it will be required to log into Console after this session."}),(0,p.jsx)(r.Wei,{variant:"warning",title:"Warning",message:(0,p.jsxs)(n.Fragment,{children:["If you are looking to change MINIO_ROOT_USER credentials, ",(0,p.jsx)("br",{}),"Please refer to"," ",(0,p.jsx)("a",{target:"_blank",rel:"noopener",href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/minio-user-management.html#minio-root-user",children:"rotating"})," ","credentials."]}),sx:{margin:"15px 0"}}),(0,p.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{(e=>{if(e.preventDefault(),g!==w)return void o((0,d.Dy)({errorMessage:"New passwords don't match",detailedError:""}));if(g.length<8)return void o((0,d.Dy)({errorMessage:"Passwords must be at least 8 characters long",detailedError:""}));if(A)return;b(!0);let s={current_secret_key:c,new_secret_key:g};h.F.account.accountChangePassword(s).then(()=>{b(!1),j(""),y(""),m(""),o((0,d.Hk)("Successfully updated the password.")),t()}).catch(async e=>{b(!1),j(""),y(""),m("");const s=await e.json();o((0,d.C9)((0,x.S)(s)))})})(e)},children:(0,p.jsxs)(r.xA9,{container:!0,children:[(0,p.jsx)(r.xA9,{item:!0,xs:12,sx:(0,a.A)({},i.Uz.modalFormScrollable),children:(0,p.jsxs)(r.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,p.jsx)(r.cl_,{id:"current-password",name:"current-password",onChange:e=>{m(e.target.value)},label:"Current Password",type:"password",value:c}),(0,p.jsx)(r.cl_,{id:"new-password",name:"new-password",onChange:e=>{j(e.target.value)},label:"New Password",type:"password",value:g}),(0,p.jsx)(r.cl_,{id:"re-new-password",name:"re-new-password",onChange:e=>{y(e.target.value)},label:"Type New Password Again",type:"password",value:w})]})}),(0,p.jsx)(r.xA9,{item:!0,xs:12,sx:(0,a.A)({},i.Uz.modalButtonBar),children:(0,p.jsx)(r.$nd,{id:"save-password-modal",type:"submit",variant:"callAction",color:"primary",disabled:A||!(c.length>0&&g.length>0&&w.length>0),label:"Save"})}),A&&(0,p.jsx)(r.xA9,{item:!0,xs:12,children:(0,p.jsx)(r.z21,{})})]})})]}):null};var g=t(27428),j=t(55604),w=t(7174),y=t(43878),A=t(85743),b=t(86070),C=t(30272),v=t(82817),f=t(70503),S=t(42677),k=t(20416),_=t(26843),E=t(93598);const M=(0,j.A)(n.lazy(()=>t.e(7958).then(t.bind(t,77958)))),R=()=>{const e=(0,u.jL)(),s=(0,c.Zp)(),t=(0,o.d4)(b.s$),[l,j]=(0,n.useState)([]),[R,I]=(0,n.useState)(!1),[K,O]=(0,n.useState)(""),[P,D]=(0,n.useState)(!1),[N,T]=(0,n.useState)(null),[F,L]=(0,n.useState)(!1),[U,z]=(0,n.useState)([]),[V,$]=(0,n.useState)(!1),[W,B]=(0,n.useState)(!1),H=t&&t.includes("external-idp")||!1;(0,n.useEffect)(()=>{J()},[]),(0,n.useEffect)(()=>{e((0,d.ph)("accessKeys"))},[]),(0,n.useEffect)(()=>{R&&h.F.serviceAccounts.listUserServiceAccounts().then(e=>{I(!1);const s=e.data.sort(k.LA);j(s)}).catch(s=>{e((0,d.C9)((0,x.S)((null===s||void 0===s?void 0:s.error)||"Error retrieving access keys"))),I(!1)})},[R,I,j,e]);const J=()=>{I(!0)},q=e=>{T(e),B(!0)},Q=[{type:"view",onClick:e=>{e&&q(e.accessKey)}},{type:"delete",onClick:e=>{e&&(e=>{T(e),D(!0)})(e.accessKey)}},{type:"edit",onClick:e=>{e&&q(e.accessKey)}}],Y=l.filter(e=>{var s;return null===e||void 0===e||null===(s=e.accessKey)||void 0===s?void 0:s.toLowerCase().includes(K.toLowerCase())});return(0,p.jsxs)(n.Fragment,{children:[P&&(0,p.jsx)(M,{deleteOpen:P,selectedServiceAccount:N,closeDeleteModalAndRefresh:e=>{(e=>{D(!1),e&&(z([]),J())})(e)}}),V&&(0,p.jsx)(y.A,{deleteOpen:V,selectedSAs:U,closeDeleteModalAndRefresh:s=>{$(!1),s&&(e((0,d.Hk)("Access keys deleted successfully.")),z([]),I(!0))}}),W&&(0,p.jsx)(A.A,{open:W,selectedAccessKey:N,closeModalAndRefresh:()=>{B(!1),I(!0)}}),(0,p.jsx)(m,{open:F,closeModal:()=>L(!1)}),(0,p.jsx)(v.A,{label:"Access Keys",actions:(0,p.jsx)(f.A,{})}),(0,p.jsx)(r.Mxu,{children:(0,p.jsxs)(r.xA9,{container:!0,children:[(0,p.jsxs)(r.xA9,{item:!0,xs:12,sx:(0,a.A)({},i._0.actionsTray),children:[(0,p.jsx)(g.A,{placeholder:"Search Access Keys",onChange:O,sx:{marginRight:"auto",maxWidth:380},value:K}),(0,p.jsxs)(r.azJ,{sx:{display:"flex",flexWrap:"nowrap",gap:5},children:[(0,p.jsx)(C.A,{tooltip:"Delete Selected",children:(0,p.jsx)(r.$nd,{id:"delete-selected-accounts",onClick:()=>{$(!0)},label:"Delete Selected",icon:(0,p.jsx)(r.d7y,{}),disabled:0===U.length,variant:"secondary"})}),(0,p.jsx)(_.R,{scopes:[E.OV.ADMIN_CREATE_USER],resource:E.Ms,matchAll:!0,errorProps:{disabled:!0},children:(0,p.jsx)(r.$nd,{id:"change-password",onClick:()=>L(!0),label:"Change Password",icon:(0,p.jsx)(r.aJN,{}),variant:"regular",disabled:H})}),(0,p.jsx)(_.R,{scopes:[E.OV.ADMIN_CREATE_SERVICEACCOUNT],resource:E.Ms,matchAll:!0,errorProps:{disabled:!0},children:(0,p.jsx)(r.$nd,{id:"create-service-account",onClick:()=>{s("".concat(E.zZ.ACCOUNT_ADD))},label:"Create access key",icon:(0,p.jsx)(r.REV,{}),variant:"callAction"})})]})]}),(0,p.jsx)(r.xA9,{item:!0,xs:12,children:(0,p.jsx)(r.bQt,{itemActions:Q,entityName:"Access Keys",columns:S.X,onSelect:e=>(0,w.Qm)(e,z,U),selectedItems:U,isLoading:R,records:Y,idField:"accessKey"})}),(0,p.jsx)(r.xA9,{item:!0,xs:12,sx:{marginTop:15},children:(0,p.jsx)(r.lVp,{title:"Learn more about ACCESS KEYS",iconComponent:(0,p.jsx)(r.JMb,{}),help:(0,p.jsxs)(n.Fragment,{children:["MinIO access keys are child identities of an authenticated MinIO user, including externally managed identities. Each access key inherits its privileges based on the policies attached to it\u2019s parent user or those groups in which the parent user has membership. Access Keys also support an optional inline policy which further restricts access to a subset of actions and resources available to the parent user.",(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),"You can learn more at the"," ",(0,p.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/administration/identity-access-management/minio-user-management.html#access-keys",target:"_blank",rel:"noopener",children:"documentation"}),"."]})})})]})})]})}}}]); ================================================ FILE: web-app/build/static/js/6777.1a21cf18.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6777],{46777:(e,t,o)=>{o.r(t),o.d(t,{default:()=>E});var n=o(9950),a=o(87946),r=o.n(a),l=o(89132),i=o(28429),s=o(70444),c=o(48965),p=o(76356),d=o(93598),u=o(49078),g=o(99491),m=o(19156),f=o(55604),h=o(82817),y=o(19335),b=o(44414);const S=y.Ay.div(e=>{let{theme:t}=e;return{background:r()(t,"boxBackground","#fff"),border:"".concat(r()(t,"borderColor","#E5E5E5")," 1px solid"),borderRadius:5,height:80,display:"flex",alignItems:"center",justifyContent:"start",marginBottom:16,cursor:"pointer",padding:0,overflow:"hidden","& .logoButton":{height:"80px"},"& .imageContainer":{backgroundColor:r()(t,"bgColor","#fff"),display:"flex",alignItems:"center",justifyContent:"center",width:80,height:80,"& img":{maxWidth:46,maxHeight:46,filter:"drop-shadow(1px 1px 8px #fff)"}},"& .titleBox":{color:r()(t,"fontColor","#000"),fontSize:16,fontFamily:"Inter,sans-serif",paddingLeft:18}}}),T=e=>{let{logoSrc:t,title:o}=e;return(0,b.jsxs)(S,{children:[(0,b.jsx)(l.azJ,{className:"imageContainer",children:(0,b.jsx)("img",{src:t,className:"logoButton",alt:o})}),(0,b.jsx)(l.azJ,{className:"titleBox",children:(0,b.jsxs)("b",{children:[o," Event Destination"]})})]})};var v=o(70503);const _=(0,f.A)(n.lazy(()=>o.e(7852).then(o.bind(o,47852)))),A=(0,f.A)(n.lazy(()=>o.e(9459).then(o.bind(o,49459)))),k=(0,f.A)(n.lazy(()=>o.e(3541).then(o.bind(o,13541)))),E=e=>{let{saveAndRefresh:t}=e;const o=(0,g.jL)(),a=(0,i.Zp)(),f=(0,i.g)(),[y,S]=(0,n.useState)([]),[E,x]=(0,n.useState)(""),[q,L]=(0,n.useState)(!1),C=f.service||"";(0,n.useEffect)(()=>{if(q){const e={key_values:(0,p.Xm)(y)};s.F.configs.setConfig("".concat(C,":").concat(E),e).then(()=>{L(!1),o((0,u.YR)(!0)),o((0,m.$)(!0)),a(d.zZ.EVENT_DESTINATIONS)}).catch(e=>{L(!1),o((0,u.C9)((0,c.S)(e.error)))})}},[q,C,y,t,o,a,E]);const w=(0,n.useCallback)(e=>{S(e)},[S]);let j;switch(C){case p.P4:j=(0,b.jsx)(k,{onChange:w});break;case p.AU:j=(0,b.jsx)(_,{onChange:w});break;default:{const e=r()(p.fx,C,[]);j=(0,b.jsx)(A,{fields:e,onChange:w})}}const N=p.bo.find(e=>e.actionTrigger===C);return(0,n.useEffect)(()=>{o((0,u.ph)("add_notification_endpoint"))},[]),(0,b.jsxs)(n.Fragment,{children:[(0,b.jsx)(h.A,{label:(0,b.jsx)(n.Fragment,{children:(0,b.jsx)(l.EGL,{label:"Event Destinations",onClick:()=>a(d.zZ.EVENT_DESTINATIONS_ADD)})}),actions:(0,b.jsx)(v.A,{})}),(0,b.jsx)(l.Mxu,{children:(0,b.jsx)("form",{noValidate:!0,onSubmit:e=>{e.preventDefault(),L(!0)},children:""!==C&&(0,b.jsxs)(n.Fragment,{children:[(0,b.jsx)(l.xA9,{item:!0,xs:12,children:N&&(0,b.jsx)(T,{logoSrc:N.logo,title:N?N.targetTitle:""})}),(0,b.jsxs)(l.Hbc,{children:[(0,b.jsx)(l.cl_,{id:"identifier-field",name:"identifier-field",label:"Identifier",value:E,onChange:e=>x(e.target.value),tooltip:"Unique descriptive string for this destination",placeholder:"Enter Destination Identifier",required:!0}),(0,b.jsx)(l.xA9,{item:!0,xs:12,children:j}),(0,b.jsx)(l.xA9,{item:!0,xs:12,sx:{display:"flex",justifyContent:"flex-end",marginTop:15},children:(0,b.jsx)(l.$nd,{id:"save-notification-target",type:"submit",variant:"callAction",disabled:q||""===E.trim(),label:"Save Event Destination"})})]})]})})})]})}},55604:(e,t,o)=>{o.d(t,{A:()=>l});var n=o(89379),a=o(9950),r=o(44414);const l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(o){return(0,r.jsx)(a.Suspense,{fallback:t,children:(0,r.jsx)(e,(0,n.A)({},o))})}}},76356:(e,t,o)=>{o.d(t,{AU:()=>a,D3:()=>m,Es:()=>g,P4:()=>n,Xm:()=>b,bo:()=>h,fx:()=>S,h4:()=>v});const n="notify_postgres",a="notify_mysql",r="notify_kafka",l="notify_amqp",i="notify_mqtt",s="notify_redis",c="notify_nats",p="notify_elasticsearch",d="notify_webhook",u="notify_nsq",g=e=>e.map(e=>({service_name:"".concat(e.service,":").concat(e.account_id),name:e.service,account_id:e.account_id,status:e.status}));class m{}m.DB="database",m.Queue="queue",m.Func="functions";const f=()=>"".concat(document.baseURI),h=[{actionTrigger:n,targetTitle:"PostgreSQL",logo:"".concat(f(),"postgres-logo.svg"),category:m.DB},{actionTrigger:r,targetTitle:"Kafka",logo:"".concat(f(),"kafka-logo.svg"),category:m.Queue},{actionTrigger:l,targetTitle:"AMQP",logo:"".concat(f(),"amqp-logo.svg"),category:m.Queue},{actionTrigger:i,targetTitle:"MQTT",logo:"".concat(f(),"mqtt-logo.svg"),category:m.Queue},{actionTrigger:s,targetTitle:"Redis",logo:"".concat(f(),"redis-logo.svg"),category:m.Queue},{actionTrigger:c,targetTitle:"NATS",logo:"".concat(f(),"nats-logo.svg"),category:m.Queue},{actionTrigger:a,targetTitle:"Mysql",logo:"".concat(f(),"mysql-logo.svg"),category:m.DB},{actionTrigger:p,targetTitle:"Elastic Search",logo:"".concat(f(),"elasticsearch-logo.svg"),category:m.DB},{actionTrigger:d,targetTitle:"Webhook",logo:"".concat(f(),"webhooks-logo.svg"),category:m.Func},{actionTrigger:u,targetTitle:"NSQ",logo:"".concat(f(),"nsq-logo.svg"),category:m.Queue}],y=[{name:"queue_dir",label:"Queue Directory",required:!1,tooltip:"Staging directory for undelivered messages e.g. '/home/events'",type:"string",placeholder:"Enter Queue Directory"},{name:"queue_limit",label:"Queue Limit",required:!1,tooltip:"Maximum limit for undelivered messages, defaults to '10000'",type:"number",placeholder:"Enter Queue Limit"},{name:"comment",label:"Comment",required:!1,type:"comment",placeholder:"Enter custom notes if any"}],b=e=>e.filter(e=>""!==e.value),S={[r]:[{name:"brokers",label:"Brokers",required:!0,tooltip:"Comma separated list of Kafka broker addresses",type:"string",placeholder:"Enter Brokers"},{name:"topic",label:"Topic",tooltip:"Kafka topic used for bucket notifications",type:"string",placeholder:"Enter Topic"},{name:"sasl_username",label:"SASL Username",tooltip:"Username for SASL/PLAIN or SASL/SCRAM authentication",type:"string",placeholder:"Enter SASL Username"},{name:"sasl_password",label:"SASL Password",tooltip:"Password for SASL/PLAIN or SASL/SCRAM authentication",type:"string",placeholder:"Enter SASL Password"},{name:"sasl_mechanism",label:"SASL Mechanism",tooltip:"SASL authentication mechanism, default 'PLAIN'",type:"string"},{name:"tls_client_auth",label:"TLS Client Auth",tooltip:"Client Auth determines the Kafka server's policy for TLS client authorization",type:"string",placeholder:"Enter TLS Client Auth"},{name:"sasl",label:"SASL",tooltip:"Set to 'on' to enable SASL authentication",type:"on|off"},{name:"tls",label:"TLS",tooltip:"Set to 'on' to enable TLS",type:"on|off"},{name:"tls_skip_verify",label:"TLS skip verify",tooltip:'Trust server TLS without verification, defaults to "on" (verify)',type:"on|off"},{name:"client_tls_cert",label:"client TLS cert",tooltip:"Path to client certificate for mTLS authorization",type:"path",placeholder:"Enter TLS Client Cert"},{name:"client_tls_key",label:"client TLS key",tooltip:"Path to client key for mTLS authorization",type:"path",placeholder:"Enter TLS Client Key"},{name:"version",label:"Version",tooltip:"Specify the version of the Kafka cluster e.g '2.2.0'",type:"string",placeholder:"Enter Kafka Version"},...y],[l]:[{name:"url",required:!0,label:"URL",tooltip:"AMQP server endpoint e.g. `amqp://myuser:mypassword@localhost:5672`",type:"url"},{name:"exchange",label:"Exchange",tooltip:"Name of the AMQP exchange",type:"string",placeholder:"Enter Exchange"},{name:"exchange_type",label:"Exchange Type",tooltip:"AMQP exchange type",type:"string",placeholder:"Enter Exchange Type"},{name:"routing_key",label:"Routing Key",tooltip:"Routing key for publishing",type:"string",placeholder:"Enter Routing Key"},{name:"mandatory",label:"Mandatory",tooltip:"Quietly ignore undelivered messages when set to 'off', default is 'on'",type:"on|off"},{name:"durable",label:"Durable",tooltip:"Persist queue across broker restarts when set to 'on', default is 'off'",type:"on|off"},{name:"no_wait",label:"No Wait",tooltip:"Non-blocking message delivery when set to 'on', default is 'off'",type:"on|off"},{name:"internal",label:"Internal",tooltip:"Set to 'on' for exchange to be not used directly by publishers, but only when bound to other exchanges",type:"on|off"},{name:"auto_deleted",label:"Auto Deleted",tooltip:"Auto delete queue when set to 'on', when there are no consumers",type:"on|off"},{name:"delivery_mode",label:"Delivery Mode",tooltip:"Set to '1' for non-persistent or '2' for persistent queue",type:"number",placeholder:"Enter Delivery Mode"},...y],[s]:[{name:"address",required:!0,label:"Address",tooltip:"Redis server's address e.g. `localhost:6379`",type:"address",placeholder:"Enter Address"},{name:"key",required:!0,label:"Key",tooltip:"Redis key to store/update events, key is auto-created",type:"string",placeholder:"Enter Key"},{name:"password",label:"Password",tooltip:"Redis server password",type:"string",placeholder:"Enter Password"},...y],[i]:[{name:"broker",required:!0,label:"Broker",tooltip:"MQTT server endpoint e.g. `tcp://localhost:1883`",type:"uri",placeholder:"Enter Brokers"},{name:"topic",required:!0,label:"Topic",tooltip:"Name of the MQTT topic to publish",type:"string",placeholder:"Enter Topic"},{name:"username",label:"Username",tooltip:"MQTT username",type:"string",placeholder:"Enter Username"},{name:"password",label:"Password",tooltip:"MQTT password",type:"string",placeholder:"Enter Password"},{name:"qos",label:"QOS",tooltip:"Set the quality of service priority, defaults to '0'",type:"number",placeholder:"Enter QOS"},{name:"keep_alive_interval",label:"Keep Alive Interval",tooltip:"Keep-alive interval for MQTT connections in s,m,h,d",type:"duration",placeholder:"Enter Keep Alive Interval"},{name:"reconnect_interval",label:"Reconnect Interval",tooltip:"Reconnect interval for MQTT connections in s,m,h,d",type:"duration",placeholder:"Enter Reconnect Interval"},...y],[c]:[{name:"address",required:!0,label:"Address",tooltip:"NATS server address e.g. '0.0.0.0:4222'",type:"address",placeholder:"Enter Address"},{name:"subject",required:!0,label:"Subject",tooltip:"NATS subscription subject",type:"string",placeholder:"Enter NATS Subject"},{name:"username",label:"Username",tooltip:"NATS username",type:"string",placeholder:"Enter NATS Username"},{name:"password",label:"Password",tooltip:"NATS password",type:"string",placeholder:"Enter NATS password"},{name:"token",label:"Token",tooltip:"NATS token",type:"string",placeholder:"Enter NATS token"},{name:"tls",label:"TLS",tooltip:"Set to 'on' to enable TLS",type:"on|off"},{name:"tls_skip_verify",label:"TLS Skip Verify",tooltip:'Trust server TLS without verification, defaults to "on" (verify)',type:"on|off"},{name:"ping_interval",label:"Ping Interval",tooltip:"Client ping commands interval in s,m,h,d. Disabled by default",type:"duration",placeholder:"Enter Ping Interval"},{name:"streaming",label:"Streaming",tooltip:"Set to 'on' to use streaming NATS server",type:"on|off"},{name:"streaming_async",label:"Streaming async",tooltip:"Set to 'on' to enable asynchronous publish",type:"on|off"},{name:"streaming_max_pub_acks_in_flight",label:"Streaming max publish ACKS in flight",tooltip:"Number of messages to publish without waiting for ACKs",type:"number",placeholder:"Enter Streaming in flight value"},{name:"streaming_cluster_id",label:"Streaming Cluster ID",tooltip:"Unique ID for NATS streaming cluster",type:"string",placeholder:"Enter Streaming Cluster ID"},{name:"cert_authority",label:"Cert Authority",tooltip:"Path to certificate chain of the target NATS server",type:"string",placeholder:"Enter Cert Authority"},{name:"client_cert",label:"Client Cert",tooltip:"Client cert for NATS mTLS auth",type:"string",placeholder:"Enter Client Cert"},{name:"client_key",label:"Client Key",tooltip:"Client cert key for NATS mTLS authorization",type:"string",placeholder:"Enter Client Key"},...y],[p]:[{name:"url",required:!0,label:"URL",tooltip:"Elasticsearch server's address, with optional authentication info",type:"url",placeholder:"Enter URL"},{name:"index",required:!0,label:"Index",tooltip:"Elasticsearch index to store/update events, index is auto-created",type:"string",placeholder:"Enter Index"},{name:"format",required:!0,label:"Format",tooltip:"'namespace' reflects current bucket/object list and 'access' reflects a journal of object operations, defaults to 'namespace'",type:"enum",placeholder:"Enter Format"},...y],[d]:[{name:"endpoint",required:!0,label:"Endpoint",tooltip:"Webhook server endpoint e.g. http://localhost:8080/minio/events",type:"url",placeholder:"Enter Endpoint"},{name:"auth_token",label:"Auth Token",tooltip:"Opaque string or JWT authorization token",type:"string",placeholder:"Enter auth_token"},...y],[u]:[{name:"nsqd_address",required:!0,label:"NSQD Address",tooltip:"NSQ server address e.g. '127.0.0.1:4150'",type:"address",placeholder:"Enter nsqd_address"},{name:"topic",required:!0,label:"Topic",tooltip:"NSQ topic",type:"string",placeholder:"Enter Topic"},{name:"tls",label:"TLS",tooltip:"Set to 'on' to enable TLS",type:"on|off"},{name:"tls_skip_verify",label:"TLS Skip Verify",tooltip:'Trust server TLS without verification, defaults to "on" (verify)',type:"on|off"},...y]},T={webhook:"notify_webhook",amqp:"notify_amqp",kafka:"notify_kafka",mqtt:"notify_mqtt",nats:"notify_nats",nsq:"notify_nsq",mysql:"notify_mysql",postgresql:"notify_postgres",elasticsearch:"notify_elasticsearch",redis:"notify_redis"},v=e=>T[e]}}]); ================================================ FILE: web-app/build/static/js/68.5a8e7ba6.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[68],{55604:(e,n,s)=>{s.d(n,{A:()=>h});var t=s(89379),l=s(9950),a=s(44414);const h=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(s){return(0,a.jsx)(l.Suspense,{fallback:n,children:(0,a.jsx)(e,(0,t.A)({},s))})}}},70068:(e,n,s)=>{s.r(n),s.d(n,{default:()=>u});var t=s(9950),l=s(28429),a=s(55604),h=s(20171),p=s(44414);const c=(0,a.A)(t.lazy(()=>s.e(3477).then(s.bind(s,33477)))),r=(0,a.A)(t.lazy(()=>s.e(1366).then(s.bind(s,31366)))),u=()=>(0,p.jsxs)(l.BV,{children:[(0,p.jsx)(l.qh,{path:"profile",element:(0,p.jsx)(r,{})}),(0,p.jsx)(l.qh,{path:"inspect",element:(0,p.jsx)(c,{})}),(0,p.jsx)(l.qh,{path:"*",element:(0,p.jsx)(h.A,{})})]})}}]); ================================================ FILE: web-app/build/static/js/7102.48ea23c8.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[7102],{57102:(e,t,s)=>{s.r(t),s.d(t,{default:()=>b});var c=s(9950),n=s(89132),i=s(98341),o=s(28429),a=s(70444),l=s(48965),r=s(93598),u=s(26843),d=s(49078),_=s(47304),p=s(99491),h=s(55604),m=s(30272),C=s(44414);const S=(0,h.A)(c.lazy(()=>s.e(4945).then(s.bind(s,54945)))),x=(0,h.A)(c.lazy(()=>s.e(4803).then(s.bind(s,74803)))),O=(0,h.A)(c.lazy(()=>s.e(5938).then(s.bind(s,55938)))),b=()=>{const e=(0,p.jL)(),t=(0,o.g)(),s=(0,i.d4)(_.Nx),[h,b]=(0,c.useState)(!0),[A,T]=(0,c.useState)([]),[f,E]=(0,c.useState)(!1),[k,j]=(0,c.useState)(!1),[y,P]=(0,c.useState)(""),[V,B]=(0,c.useState)(!1),[I,U]=(0,c.useState)(""),[L,g]=(0,c.useState)(""),w=t.bucketName||"",K=(0,u._)(w,[r.OV.S3_GET_BUCKET_POLICY,r.OV.S3_GET_ACTIONS]),N=(0,u._)(w,[r.OV.S3_DELETE_BUCKET_POLICY]),R=(0,u._)(w,[r.OV.S3_PUT_BUCKET_POLICY,r.OV.S3_PUT_ACTIONS]);(0,c.useEffect)(()=>{s&&b(!0)},[s,b]);const F=[{type:"delete",disableButtonFunction:()=>!N,onClick:e=>{j(!0),P(e.prefix)}},{type:"view",disableButtonFunction:()=>!R,onClick:e=>{U(e.prefix),g(e.access),B(!0)}}];(0,c.useEffect)(()=>{e((0,d.ph)("bucket_detail_prefix"))},[]),(0,c.useEffect)(()=>{h&&(K?a.F.bucket.listAccessRulesWithBucket(w).then(e=>{T(e.data.accessRules),b(!1)}).catch(t=>{e((0,d.C9)((0,l.S)(t))),b(!1)}):b(!1))},[h,e,K,w]);return(0,C.jsxs)(c.Fragment,{children:[f&&(0,C.jsx)(S,{modalOpen:f,onClose:()=>{E(!1),b(!0)},bucket:w}),k&&(0,C.jsx)(x,{modalOpen:k,onClose:()=>{j(!1),b(!0)},bucket:w,toDelete:y}),V&&(0,C.jsx)(O,{modalOpen:V,onClose:()=>{B(!1),b(!0)},bucket:w,toEdit:I,initial:L}),(0,C.jsx)(n._xt,{separator:!0,sx:{marginBottom:15},actions:(0,C.jsx)(u.R,{scopes:[r.OV.S3_GET_BUCKET_POLICY,r.OV.S3_PUT_BUCKET_POLICY,r.OV.S3_GET_ACTIONS,r.OV.S3_PUT_ACTIONS],resource:w,matchAll:!0,errorProps:{disabled:!0},children:(0,C.jsx)(m.A,{tooltip:"Add Access Rule",children:(0,C.jsx)(n.$nd,{id:"add-bucket-access-rule",onClick:()=>{E(!0)},label:"Add Access Rule",icon:(0,C.jsx)(n.REV,{}),variant:"callAction"})})}),children:(0,C.jsx)(n.V7x,{content:(0,C.jsxs)(c.Fragment,{children:["Setting an"," ",(0,C.jsx)("a",{href:"https://docs.min.io/community/minio-object-store/reference/minio-mc/mc-anonymous-set.html",target:"blank",children:"Anonymous"})," ","policy allows clients to access the Bucket or prefix contents and perform actions consistent with the specified policy without authentication."]}),placement:"right",children:"Anonymous Access"})}),(0,C.jsx)(u.R,{scopes:[r.OV.S3_GET_BUCKET_POLICY,r.OV.S3_GET_ACTIONS],resource:w,errorProps:{disabled:!0},children:(0,C.jsx)(n.bQt,{itemActions:F,columns:[{label:"Prefix",elementKey:"prefix",renderFunction:e=>e||"/"},{label:"Access",elementKey:"access"}],isLoading:h,records:A||[],entityName:"Access Rules",idField:"prefix"})})]})}}}]); ================================================ FILE: web-app/build/static/js/7356.1ab60708.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[7356],{59462:(t,e,n)=>{n.d(e,{A:()=>i});n(9950);var r=n(89132),a=n(44414);const i=t=>{let{icon:e=null,label:n=null}=t;return(0,a.jsxs)(r.azJ,{sx:{display:"flex",alignItems:"center",gap:5,marginTop:3},children:[(0,a.jsx)(r.azJ,{sx:{height:16,width:16,display:"flex",alignItems:"center"},children:e}),(0,a.jsx)(r.azJ,{children:n})]})}},80294:(t,e,n)=>{n.d(e,{E:()=>l});var r=n(3864),a=n(85706),i=n(60158),o=n(44813),s=n(71052),l=(0,r.gu)({chartName:"BarChart",GraphicalChild:a.y,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:i.W},{axisType:"yAxis",AxisComp:o.h}],formatAxisMap:s.pr})},97356:(t,e,n)=>{n.r(e),n.d(e,{default:()=>ot});var r=n(89379),a=n(9950),i=n(89132),o=n(80294),s=n(93245),l=n(60158),c=n(44813),u=n(16335),p=n(25102),d=n(85706),h=n(3864),f=n(77437),y=n(93008),m=n.n(y),x=n(40821),v=n.n(x),b=n(59418),g=n.n(b),j=n(72004),A=n(76653),S=n(42143),w=n(62775),k=n(67628),O=n(99064),P=n(21570),E=n(675),C=n(91792),D=n(95912),T=["type","layout","connectNulls","ref"],F=["key"];function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function K(t,e){if(null==t)return{};var n,r,a=function(t,e){if(null==t)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function M(){return M=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);ns){c=[].concat(W(a.slice(0,u)),[s-p]);break}var d=c.length%2===0?[0,l]:[l];return[].concat(W(e.repeat(a,o)),W(c),d).map(function(t){return"".concat(t,"px")}).join(", ")}),q(t,"id",(0,P.NF)("recharts-line-")),q(t,"pathRef",function(e){t.mainCurve=e}),q(t,"handleAnimationEnd",function(){t.setState({isAnimationFinished:!0}),t.props.onAnimationEnd&&t.props.onAnimationEnd()}),q(t,"handleAnimationStart",function(){t.setState({isAnimationFinished:!1}),t.props.onAnimationStart&&t.props.onAnimationStart()}),t}return function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&R(t,e)}(e,t),n=e,i=[{key:"getDerivedStateFromProps",value:function(t,e){return t.animationId!==e.prevAnimationId?{prevAnimationId:t.animationId,curPoints:t.points,prevPoints:e.curPoints}:t.points!==e.curPoints?{curPoints:t.points}:null}},{key:"repeat",value:function(t,e){for(var n=t.length%2!==0?[].concat(W(t),[0]):t,r=[],a=0;a0||!g()(o,r))?this.renderCurveWithAnimation(t,e):this.renderCurveStatically(r,t,e)}},{key:"render",value:function(){var t,e=this.props,n=e.hide,r=e.dot,i=e.points,o=e.className,s=e.xAxis,l=e.yAxis,c=e.top,u=e.left,p=e.width,d=e.height,h=e.isAnimationActive,f=e.id;if(n||!i||!i.length)return null;var y=this.state.isAnimationFinished,m=1===i.length,x=(0,j.A)("recharts-line",o),b=s&&s.allowDataOverflow,g=l&&l.allowDataOverflow,A=b||g,S=v()(f)?this.id:f,O=null!==(t=(0,E.J9)(r,!1))&&void 0!==t?t:{r:3,strokeWidth:2},P=O.r,C=void 0===P?3:P,D=O.strokeWidth,T=void 0===D?2:D,F=((0,E.sT)(r)?r:{}).clipDot,I=void 0===F||F,K=2*C+T;return a.createElement(w.W,{className:x},b||g?a.createElement("defs",null,a.createElement("clipPath",{id:"clipPath-".concat(S)},a.createElement("rect",{x:b?u:u-p/2,y:g?c:c-d/2,width:b?p:2*p,height:g?d:2*d})),!I&&a.createElement("clipPath",{id:"clipPath-dots-".concat(S)},a.createElement("rect",{x:u-K/2,y:c-K/2,width:p+K,height:d+K}))):null,!m&&this.renderCurve(A,S),this.renderErrorBar(A,S),(m||r)&&this.renderDots(A,I,S),(!h||y)&&k.Z.renderCallByParent(this.props,i))}}])&&z(n.prototype,r),i&&z(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(a.PureComponent);q(U,"displayName","Line"),q(U,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!C.m.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1}),q(U,"getComposedData",function(t){var e=t.props,n=t.xAxis,r=t.yAxis,a=t.xAxisTicks,i=t.yAxisTicks,o=t.dataKey,s=t.bandSize,l=t.displayedData,c=t.offset,u=e.layout;return N({points:l.map(function(t,e){var l=(0,D.kr)(t,o);return"horizontal"===u?{x:(0,D.nb)({axis:n,ticks:a,bandSize:s,entry:t,index:e}),y:v()(l)?null:r.scale(l),value:l,payload:t}:{x:v()(l)?null:n.scale(l),y:(0,D.nb)({axis:r,ticks:i,bandSize:s,entry:t,index:e}),value:l,payload:t}}),layout:u},c)});var H=n(71052),G=(0,h.gu)({chartName:"LineChart",GraphicalChild:U,axisComponents:[{axisType:"xAxis",AxisComp:l.W},{axisType:"yAxis",AxisComp:c.h}],formatAxisMap:H.pr}),$=n(26843),Q=n(93598),X=n(49078),Y=n(99491),tt=n(59462),et=n(82817),nt=n(70503),rt=n(70444),at=n(48965),it=n(44414);const ot=()=>{const t=(0,Y.jL)(),[e,n]=(0,a.useState)("simple-tab-0"),[h,f]=(0,a.useState)(!0),[y,m]=(0,a.useState)(null),[x,v]=(0,a.useState)(!0),[b,g]=(0,a.useState)(null),[j,A]=(0,a.useState)(!0),[S,w]=(0,a.useState)(null),[k,O]=(0,a.useState)(!0),[P,E]=(0,a.useState)(null),[C,D]=(0,a.useState)(!0),T=(0,$._)(Q.Ms,[Q.OV.KMS_STATUS]),F=(0,$._)(Q.Ms,[Q.OV.KMS_METRICS])&&!h,I=(0,$._)(Q.Ms,[Q.OV.KMS_APIS])&&!h,K=(0,$._)(Q.Ms,[Q.OV.KMS_Version])&&!h;(0,a.useEffect)(()=>{T&&x&&rt.F.kms.kmsStatus().then(t=>{t.data&&(m(t.data),f("SecretKey"===t.data.name))}).catch(e=>{t((0,X.C9)((0,at.S)(e.error)))}).finally(()=>v(!1)),F&&j&&rt.F.kms.kmsMetrics().then(t=>{t.data&&g(t.data)}).catch(e=>{t((0,X.C9)((0,at.S)(e.error)))}).finally(()=>A(!1)),I&&k&&rt.F.kms.kmsapIs().then(t=>{t.data&&w(t.data)}).catch(e=>{t((0,X.C9)((0,at.S)(e.error)))}).finally(()=>O(!1)),K&&C&&rt.F.kms.kmsVersion().then(t=>{t.data&&E(t.data)}).catch(e=>{t((0,X.C9)((0,at.S)(e.error)))}).finally(()=>D(!1))},[t,T,x,F,j,I,k,K,C]);const M=(0,it.jsxs)(a.Fragment,{children:[(0,it.jsx)(i._xt,{children:"Status"}),(0,it.jsx)("br",{}),y&&(0,it.jsx)(i.xA9,{container:!0,children:(0,it.jsx)(i.xA9,{item:!0,xs:12,children:(0,it.jsx)(i.azJ,{sx:{display:"grid",gap:2,gridTemplateColumns:"2fr 1fr",gridAutoFlow:"row",["@media (max-width: ".concat(i.nmC.sm,"px)")]:{gridTemplateColumns:"1fr",gridAutoFlow:"dense"}},children:(0,it.jsxs)(i.azJ,{sx:{display:"grid",gap:2,gridTemplateColumns:"2fr 1fr",gridAutoFlow:"row",["@media (max-width: ".concat(i.nmC.sm,"px)")]:{gridTemplateColumns:"1fr",gridAutoFlow:"dense"}},children:[(0,it.jsx)(i.mZW,{label:"Name:",value:y.name}),P&&(0,it.jsx)(i.mZW,{label:"Version:",value:P.version}),(0,it.jsx)(i.mZW,{label:"Default Key ID:",value:y.defaultKeyID}),(0,it.jsx)(i.mZW,{label:"Key Management Service Endpoints:",value:(0,it.jsx)(a.Fragment,{children:y.endpoints&&y.endpoints.map((t,e)=>(0,it.jsx)(tt.A,{icon:"online"===t.status?(0,it.jsx)(i.xhy,{}):(0,it.jsx)(i.aaC,{}),label:t.url},e))})})]})})})})]}),_=(0,it.jsxs)(a.Fragment,{children:[(0,it.jsx)(i._xt,{children:"Supported API endpoints"}),(0,it.jsx)("br",{}),S&&(0,it.jsx)(i.xA9,{container:!0,children:(0,it.jsx)(i.xA9,{item:!0,xs:12,children:(0,it.jsx)(i.mZW,{label:"",value:(0,it.jsx)(i.azJ,{sx:{display:"grid",gap:2,gridTemplateColumns:"2fr 1fr",gridAutoFlow:"row",["@media (max-width: ".concat(i.nmC.sm,"px)")]:{gridTemplateColumns:"1fr",gridAutoFlow:"dense"}},children:S.results.map((t,e)=>(0,it.jsx)(tt.A,{icon:(0,it.jsx)(i.xhy,{}),label:"".concat(t.path," - ").concat(t.method)},e))})})})})]}),N=(0,it.jsx)(a.Fragment,{children:b&&(0,it.jsxs)(a.Fragment,{children:[(0,it.jsx)("h3",{children:"API Requests"}),(0,it.jsxs)(o.E,{width:730,height:250,data:[{label:"Success",success:b.requestOK},{label:"Failures",failures:b.requestFail},{label:"Errors",errors:b.requestErr},{label:"Active",active:b.requestActive}],children:[(0,it.jsx)(s.d,{strokeDasharray:"3 3"}),(0,it.jsx)(l.W,{dataKey:"label"}),(0,it.jsx)(c.h,{}),(0,it.jsx)(u.m,{}),(0,it.jsx)(p.s,{}),(0,it.jsx)(d.y,{dataKey:"success",fill:"green"}),(0,it.jsx)(d.y,{dataKey:"failures",fill:"red"}),(0,it.jsx)(d.y,{dataKey:"errors",fill:"black"}),(0,it.jsx)(d.y,{dataKey:"active",fill:"#8884d8"})]}),(0,it.jsx)("h3",{children:"Events"}),(0,it.jsxs)(o.E,{width:730,height:250,data:[{label:"Audit",audit:b.auditEvents},{label:"Errors",errors:b.errorEvents}],children:[(0,it.jsx)(s.d,{strokeDasharray:"3 3"}),(0,it.jsx)(l.W,{dataKey:"label"}),(0,it.jsx)(c.h,{}),(0,it.jsx)(u.m,{}),(0,it.jsx)(p.s,{}),(0,it.jsx)(d.y,{dataKey:"audit",fill:"green"}),(0,it.jsx)(d.y,{dataKey:"errors",fill:"black"})]}),(0,it.jsx)("h3",{children:"Latency Histogram"}),b.latencyHistogram&&(0,it.jsxs)(G,{width:730,height:250,data:b.latencyHistogram.map(t=>(0,r.A)((0,r.A)({},t),{},{duration:"".concat(t.duration/1e6,"ms")})),margin:{top:5,right:30,left:20,bottom:5},children:[(0,it.jsx)(s.d,{strokeDasharray:"3 3"}),(0,it.jsx)(l.W,{dataKey:"duration"}),(0,it.jsx)(c.h,{}),(0,it.jsx)(u.m,{}),(0,it.jsx)(p.s,{}),(0,it.jsx)(U,{type:"monotone",dataKey:"total",stroke:"#8884d8",name:"Requests that took T ms or less"})]})]})});return(0,a.useEffect)(()=>{t((0,X.ph)("kms_status"))},[]),(0,it.jsxs)(a.Fragment,{children:[(0,it.jsx)(et.A,{label:"Key Management Service",actions:(0,it.jsx)(nt.A,{})}),(0,it.jsx)(i.Mxu,{children:(0,it.jsx)(i.tUM,{currentTabOrPath:e,onTabClick:t=>n(t),options:[{tabConfig:{label:"Status",id:"simple-tab-0"},content:(0,it.jsx)(i.azJ,{withBorders:!0,sx:{display:"flex",flexFlow:"column",padding:"43px"},children:M})},{tabConfig:{label:"APIs",id:"simple-tab-1",disabled:!I},content:(0,it.jsx)(i.azJ,{withBorders:!0,sx:{display:"flex",flexFlow:"column",padding:"43px"},children:_})},{tabConfig:{label:"Metrics",id:"simple-tab-2",disabled:!F},content:(0,it.jsx)(i.azJ,{withBorders:!0,sx:{display:"flex",flexFlow:"column",padding:"43px"},children:N})}]})})]})}}}]); ================================================ FILE: web-app/build/static/js/7401.cd4f5830.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[7401],{77401:(s,x,e)=>{e.r(x),e.d(x,{default:()=>i});var m=e(9950),j=e(89132),r=e(44414);const i=()=>{const[s,x]=(0,m.useState)("default");return(0,r.jsxs)(j.azJ,{sx:{position:"relative",padding:"20px 35px 0","& h6":{color:"#777777",fontSize:30},"& p":{"& span:not(*[class*='smallUnit'])":{fontSize:16}}},children:[(0,r.jsx)(j.xA9,{container:!0,children:(0,r.jsx)(j.z6M,{selectorOptions:[{value:"def",label:"Default"},{value:"red",label:"Color"}],currentValue:s,id:"color-selector",name:"color-selector",onChange:s=>{x(s.target.value)}})}),(0,r.jsx)("h1",{children:"Logos"}),(0,r.jsx)(j.xA9,{container:!0,sx:{fontSize:12,wordWrap:"break-word","& .min-loader":{width:45,height:45},"& .min-icon":{color:"red"===s?"red":"black"}},children:(0,r.jsxs)(j.xA9,{item:!0,xs:3,children:[(0,r.jsx)(j.xul,{}),(0,r.jsx)("br",{}),"ThemedLogo"]})}),(0,r.jsx)("h1",{children:"Loaders"}),(0,r.jsx)(j.xA9,{container:!0,sx:{fontSize:12,wordWrap:"break-word","& .min-loader":{width:45,height:45},"& .min-icon":{color:"red"===s?"red":"black"}},children:(0,r.jsxs)(j.xA9,{item:!0,xs:3,children:[(0,r.jsx)(j.aHM,{}),(0,r.jsx)("br",{}),"Loader"]})}),(0,r.jsx)("h1",{children:"Icons"}),(0,r.jsxs)(j.xA9,{container:!0,sx:{fontSize:12,wordWrap:"break-word","& .min-loader":{width:45,height:45},"& .min-icon":{color:"red"===s?"red":"black"}},children:[(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.JMb,{}),(0,r.jsx)("br",{}),"AccountIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.No_,{}),(0,r.jsx)("br",{}),"AddAccessRuleIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.hQD,{}),(0,r.jsx)("br",{}),"AddFolderIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.REV,{}),(0,r.jsx)("br",{}),"AddIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.WC,{}),(0,r.jsx)("br",{}),"AddMembersToGroupIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.b_$,{}),(0,r.jsx)("br",{}),"AddNewTagIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j._0O,{}),(0,r.jsx)("br",{}),"AlertIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.wKj,{}),(0,r.jsx)("br",{}),"AllBucketsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.HKb,{}),(0,r.jsx)("br",{}),"ArrowIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.flY,{}),(0,r.jsx)("br",{}),"ArrowRightIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Nmx,{}),(0,r.jsx)("br",{}),"AzureTierIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Ubg,{}),(0,r.jsx)("br",{}),"AzureTierIconXs"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.y$O,{}),(0,r.jsx)("br",{}),"BackSettingsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.j6H,{}),(0,r.jsx)("br",{}),"BucketEncryptionIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Uh,{}),(0,r.jsx)("br",{}),"BucketQuotaIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.WBh,{}),(0,r.jsx)("br",{}),"BucketReplicationIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.brV,{}),(0,r.jsx)("br",{}),"BucketsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.CTc,{}),(0,r.jsx)("br",{}),"CalendarIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.fJb,{}),(0,r.jsx)("br",{}),"CallHomeFeatureIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.rXL,{}),(0,r.jsx)("br",{}),"CancelledIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.uYH,{}),(0,r.jsx)("br",{}),"ChangeAccessPolicyIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Fwq,{}),(0,r.jsx)("br",{}),"ChangePasswordIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.GQ2,{}),(0,r.jsx)("br",{}),"CircleIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j._FR,{}),(0,r.jsx)("br",{}),"ClosePanelIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.pHQ,{}),(0,r.jsx)("br",{}),"ClustersIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.dLE,{}),(0,r.jsx)("br",{}),"CollapseIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.RJ2,{}),(0,r.jsx)("br",{}),"ComputerLineIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.xTG,{}),(0,r.jsx)("br",{}),"ConfigurationsListIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.xWY,{}),(0,r.jsx)("br",{}),"ConfirmDeleteIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.$rg,{}),(0,r.jsx)("br",{}),"ConfirmModalIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.D0K,{}),(0,r.jsx)("br",{}),"ConsoleIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.TdU,{}),(0,r.jsx)("br",{}),"CopyIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.lwR,{}),(0,r.jsx)("br",{}),"CreateGroupIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.WSU,{}),(0,r.jsx)("br",{}),"CreateIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.DGR,{}),(0,r.jsx)("br",{}),"CreateNewPathIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.R$W,{}),(0,r.jsx)("br",{}),"CreateUserIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.aL$,{}),(0,r.jsx)("br",{}),"DashboardIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.d7y,{}),(0,r.jsx)("br",{}),"DeleteIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.rgY,{}),(0,r.jsx)("br",{}),"DeleteNonCurrentIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.uFi,{}),(0,r.jsx)("br",{}),"DiagnosticsFeatureIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.KLX,{}),(0,r.jsx)("br",{}),"DiagnosticsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.aaC,{}),(0,r.jsx)("br",{}),"DisabledIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.wD7,{}),(0,r.jsx)("br",{}),"DocumentationIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.s3U,{}),(0,r.jsx)("br",{}),"DownloadIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.CB9,{}),(0,r.jsx)("br",{}),"DownloadStatIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.KPq,{}),(0,r.jsx)("br",{}),"DriveFormatErrorsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.JUN,{}),(0,r.jsx)("br",{}),"DrivesIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.qUP,{}),(0,r.jsx)("br",{}),"EditIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.cGQ,{}),(0,r.jsx)("br",{}),"EditTagIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.qI7,{}),(0,r.jsx)("br",{}),"EditTenantIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.jcB,{}),(0,r.jsx)("br",{}),"EditYamlIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.K8y,{}),(0,r.jsx)("br",{}),"EditorThemeSwitchIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.F7$,{}),(0,r.jsx)("br",{}),"EgressIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.xhy,{}),(0,r.jsx)("br",{}),"EnabledIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.VDx,{}),(0,r.jsx)("br",{}),"EventSubscriptionIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.JHI,{}),(0,r.jsx)("br",{}),"ExtraFeaturesIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.DUd,{}),(0,r.jsx)("br",{}),"FileBookIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.$5j,{}),(0,r.jsx)("br",{}),"FileCloudIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.bM2,{}),(0,r.jsx)("br",{}),"FileCodeIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.qM2,{}),(0,r.jsx)("br",{}),"FileConfigIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.ITz,{}),(0,r.jsx)("br",{}),"FileDbIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.PcO,{}),(0,r.jsx)("br",{}),"FileFontIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.nLN,{}),(0,r.jsx)("br",{}),"FileImageIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Uom,{}),(0,r.jsx)("br",{}),"FileLinkIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.VSs,{}),(0,r.jsx)("br",{}),"FileLockIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.YJK,{}),(0,r.jsx)("br",{}),"FileMissingIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.jCy,{}),(0,r.jsx)("br",{}),"FileMusicIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.yTC,{}),(0,r.jsx)("br",{}),"FilePdfIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.QvW,{}),(0,r.jsx)("br",{}),"FilePptIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.yEV,{}),(0,r.jsx)("br",{}),"FileTxtIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.FRZ,{}),(0,r.jsx)("br",{}),"FileVideoIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.wPu,{}),(0,r.jsx)("br",{}),"FileWorldIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.z9t,{}),(0,r.jsx)("br",{}),"FileXlsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.j_m,{}),(0,r.jsx)("br",{}),"FileZipIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.sjq,{}),(0,r.jsx)("br",{}),"FolderIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.eXQ,{}),(0,r.jsx)("br",{}),"FormatDrivesIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.F7U,{}),(0,r.jsx)("br",{}),"GoogleTierIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.gwF,{}),(0,r.jsx)("br",{}),"GoogleTierIconXs"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.YXz,{}),(0,r.jsx)("br",{}),"GroupsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.rod,{}),(0,r.jsx)("br",{}),"HardBucketQuotaIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Sdx,{}),(0,r.jsx)("br",{}),"HealIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.NTw,{}),(0,r.jsx)("br",{}),"HelpIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.nag,{}),(0,r.jsx)("br",{}),"HelpIconFilled"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.osr,{}),(0,r.jsx)("br",{}),"HistoryIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.n$X,{}),(0,r.jsx)("br",{}),"IAMPoliciesIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.mo0,{}),(0,r.jsx)("br",{}),"InfoIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.iv,{}),(0,r.jsx)("br",{}),"JSONIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.QrX,{}),(0,r.jsx)("br",{}),"LambdaBalloonIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.PI5,{}),(0,r.jsx)("br",{}),"LambdaIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.jm5,{}),(0,r.jsx)("br",{}),"LambdaNotificationsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.ODz,{}),(0,r.jsx)("br",{}),"LegalHoldIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.t6I,{}),(0,r.jsx)("br",{}),"LicenseIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.oVU,{}),(0,r.jsx)("br",{}),"LifecycleConfigIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.qYV,{}),(0,r.jsx)("br",{}),"LinkIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.XAi,{}),(0,r.jsx)("br",{}),"LockIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.o4l,{}),(0,r.jsx)("br",{}),"LogoutIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Dk$,{}),(0,r.jsx)("br",{}),"LogsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.$vN,{}),(0,r.jsx)("br",{}),"MetadataIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Wh8,{}),(0,r.jsx)("br",{}),"MinIOTierIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.$2v,{}),(0,r.jsx)("br",{}),"MinIOTierIconXs"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.XWb,{}),(0,r.jsx)("br",{}),"MirroringIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.hwo,{}),(0,r.jsx)("br",{}),"MultipleBucketsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.VgG,{}),(0,r.jsx)("br",{}),"NewAccountIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.pj3,{}),(0,r.jsx)("br",{}),"NewPathIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.WJF,{}),(0,r.jsx)("br",{}),"NewPoolIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Kiw,{}),(0,r.jsx)("br",{}),"NextArrowIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.g7G,{}),(0,r.jsx)("br",{}),"ObjectBrowser1Icon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.t1M,{}),(0,r.jsx)("br",{}),"ObjectBrowserFolderIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.nwl,{}),(0,r.jsx)("br",{}),"ObjectBrowserIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Hch,{}),(0,r.jsx)("br",{}),"ObjectInfoIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.W2Y,{}),(0,r.jsx)("br",{}),"ObjectManagerIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.jG,{}),(0,r.jsx)("br",{}),"ObjectPreviewIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.lD6,{}),(0,r.jsx)("br",{}),"OfflineRegistrationBackIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Kmb,{}),(0,r.jsx)("br",{}),"OfflineRegistrationIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.J2s,{}),(0,r.jsx)("br",{}),"OnlineRegistrationBackIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.ESy,{}),(0,r.jsx)("br",{}),"OnlineRegistrationIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.UtR,{}),(0,r.jsx)("br",{}),"OpenListIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.aJN,{}),(0,r.jsx)("br",{}),"PasswordKeyIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.s5I,{}),(0,r.jsx)("br",{}),"PerformanceFeatureIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.BlH,{}),(0,r.jsx)("br",{}),"PermissionIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.cyn,{}),(0,r.jsx)("br",{}),"PreviewIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.uMc,{}),(0,r.jsx)("br",{}),"PrometheusErrorIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.wb9,{}),(0,r.jsx)("br",{}),"PrometheusIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.YkU,{}),(0,r.jsx)("br",{}),"RecoverIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.UfX,{}),(0,r.jsx)("br",{}),"RedoIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.fNY,{}),(0,r.jsx)("br",{}),"RefreshIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.TFC,{}),(0,r.jsx)("br",{}),"RemoveAllIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.YPx,{}),(0,r.jsx)("br",{}),"RemoveIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.fRK,{}),(0,r.jsx)("br",{}),"ReportedUsageFullIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.wNL,{}),(0,r.jsx)("br",{}),"ReportedUsageIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.gn6,{}),(0,r.jsx)("br",{}),"RetentionIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j._tF,{}),(0,r.jsx)("br",{}),"S3TierIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.ZZX,{}),(0,r.jsx)("br",{}),"S3TierIconXs"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.WIv,{}),(0,r.jsx)("br",{}),"SearchIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.nhX,{}),(0,r.jsx)("br",{}),"SelectAllIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.IN,{}),(0,r.jsx)("br",{}),"SelectMultipleIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.WXN,{}),(0,r.jsx)("br",{}),"ServersIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.kQt,{}),(0,r.jsx)("br",{}),"ServiceAccountCredentialsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.ehx,{}),(0,r.jsx)("br",{}),"ServiceAccountIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.tec,{}),(0,r.jsx)("br",{}),"ServiceAccountsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Zes,{}),(0,r.jsx)("br",{}),"SettingsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.liv,{}),(0,r.jsx)("br",{}),"ShareIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.vhL,{}),(0,r.jsx)("br",{}),"SpeedtestIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Gg5,{}),(0,r.jsx)("br",{}),"StarIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.NBP,{}),(0,r.jsx)("br",{}),"StorageIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Fjq,{}),(0,r.jsx)("br",{}),"SyncIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.P3Z,{}),(0,r.jsx)("br",{}),"TagsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.fmr,{}),(0,r.jsx)("br",{}),"TenantsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.$R7,{}),(0,r.jsx)("br",{}),"TenantsOutlineIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.fAn,{}),(0,r.jsx)("br",{}),"TiersIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.zEc,{}),(0,r.jsx)("br",{}),"TiersNotAvailableIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.dwU,{}),(0,r.jsx)("br",{}),"ToolsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Sxe,{}),(0,r.jsx)("br",{}),"TotalObjectsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.bqg,{}),(0,r.jsx)("br",{}),"TraceIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.ucK,{}),(0,r.jsx)("br",{}),"TrashIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.EO4,{}),(0,r.jsx)("br",{}),"UploadFile"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.nDF,{}),(0,r.jsx)("br",{}),"UploadFolderIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.JMY,{}),(0,r.jsx)("br",{}),"UploadIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.VJE,{}),(0,r.jsx)("br",{}),"UploadStatIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Owo,{}),(0,r.jsx)("br",{}),"UptimeIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.c2u,{}),(0,r.jsx)("br",{}),"UsersIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.M3H,{}),(0,r.jsx)("br",{}),"VerifiedIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.mzI,{}),(0,r.jsx)("br",{}),"VersionIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.j1U,{}),(0,r.jsx)("br",{}),"VersionsIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.cJw,{}),(0,r.jsx)("br",{}),"WarnIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.WN0,{}),(0,r.jsx)("br",{}),"WarpIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.jJ3,{}),(0,r.jsx)("br",{}),"WatchIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.evq,{}),(0,r.jsx)("br",{}),"AlertCloseIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.DtA,{}),(0,r.jsx)("br",{}),"OpenSourceIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.xLb,{}),(0,r.jsx)("br",{}),"LicenseDocIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Z3O,{}),(0,r.jsx)("br",{}),"BackIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.YGH,{}),(0,r.jsx)("br",{}),"FilterIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.BK0,{}),(0,r.jsx)("br",{}),"SuccessIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.OFF,{}),(0,r.jsx)("br",{}),"NetworkGetIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.z8D,{}),(0,r.jsx)("br",{}),"NetworkPutIcon"]})]}),(0,r.jsx)("h1",{children:"Menu Icons"}),(0,r.jsxs)(j.xA9,{container:!0,sx:{fontSize:12,wordWrap:"break-word","& .min-loader":{width:45,height:45},"& .min-icon":{color:"red"===s?"red":"black"}},children:[(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.nhF,{}),(0,r.jsx)("br",{}),"AccessMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.l7M,{}),(0,r.jsx)("br",{}),"AccountsMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Vep,{}),(0,r.jsx)("br",{}),"AuditLogsMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.wql,{}),(0,r.jsx)("br",{}),"BucketsMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.kfP,{}),(0,r.jsx)("br",{}),"CallHomeMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Zui,{}),(0,r.jsx)("br",{}),"DiagnosticsMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.YMI,{}),(0,r.jsx)("br",{}),"DrivesMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.Xk0,{}),(0,r.jsx)("br",{}),"GroupsMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.bdq,{}),(0,r.jsx)("br",{}),"HealthMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.XjC,{}),(0,r.jsx)("br",{}),"IdentityMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.nTF,{}),(0,r.jsx)("br",{}),"InspectMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.cpY,{}),(0,r.jsx)("br",{}),"LogsMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.YI8,{}),(0,r.jsx)("br",{}),"MenuCollapsedIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.w_U,{}),(0,r.jsx)("br",{}),"MenuExpandedIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.KKE,{}),(0,r.jsx)("br",{}),"MetricsMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.v5p,{}),(0,r.jsx)("br",{}),"MonitoringMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.$iK,{}),(0,r.jsx)("br",{}),"PerformanceMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.oPe,{}),(0,r.jsx)("br",{}),"ProfileMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.ke_,{}),(0,r.jsx)("br",{}),"RegisterMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.EsX,{}),(0,r.jsx)("br",{}),"SupportMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.sJx,{}),(0,r.jsx)("br",{}),"TraceMenuIcon"]}),(0,r.jsxs)(j.xA9,{item:!0,xs:3,sm:2,md:1,children:[(0,r.jsx)(j.PPm,{}),(0,r.jsx)("br",{}),"UsersMenuIcon"]})]})]})}}}]); ================================================ FILE: web-app/build/static/js/7445.06fee929.chunk.js ================================================ "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[7445],{27445:(e,t,o)=>{o.r(t),o.d(t,{default:()=>A});var a=o(89379),n=o(9950),r=o(28429),i=o(89132),l=o(76356),s=o(45246),c=o(93598),p=o(44414);const d=()=>(0,p.jsx)(i.lVp,{iconComponent:(0,p.jsx)(i.jm5,{}),title:"What are Event Destinations?",help:(0,p.jsx)(i.azJ,{sx:{paddingTop:"20px"},children:"MinIO bucket notifications allow administrators to send notifications to supported external services on certain object or bucket events. MinIO supports bucket and object-level S3 events similar to the Amazon S3 Event Notifications."})});var g=o(82817),u=o(87946),m=o.n(u);const h=o(19335).Ay.button(e=>{let{theme:t}=e;return{background:m()(t,"boxBackground","#FFF"),border:"".concat(m()(t,"borderColor","#E2E2E2")," 1px solid"),borderRadius:5,width:250,height:80,display:"flex",alignItems:"center",justifyContent:"start",marginBottom:16,marginRight:8,cursor:"pointer",overflow:"hidden","&:hover":{backgroundColor:m()(t,"buttons.regular.hover.background","#ebebeb")},"& .imageContainer":{width:80,"& .logoButton":{maxWidth:46,maxHeight:46,filter:"drop-shadow(1px 1px 8px #fff)"}},"& .lambdaNotifTitle":{color:m()(t,"buttons.callAction.enabled.background","#07193E"),fontSize:16,fontFamily:"Inter,sans-serif",paddingLeft:18,fontWeight:"bold"}}}),y=e=>{let{destinationType:t,srcImage:o,title:a}=e;const n=(0,r.Zp)();return(0,p.jsxs)(h,{onClick:()=>{n("".concat(c.zZ.EVENT_DESTINATIONS_ADD,"/").concat(t))},children:[(0,p.jsx)("span",{className:"imageContainer",children:(0,p.jsx)("img",{src:o,className:"logoButton",alt:a})}),(0,p.jsx)("span",{className:"lambdaNotifTitle",children:a})]})};var f=o(70503),b=o(99491),T=o(49078);const S=l.bo.filter(e=>""!==e.logo),v=S.filter(e=>e.category===l.D3.DB),_=S.filter(e=>e.category===l.D3.Queue),k=S.filter(e=>e.category===l.D3.Func),A=()=>{const e=(0,r.Zp)(),t=(0,b.jL)();return(0,n.useEffect)(()=>{t((0,T.ph)("notification_type_selector"))},[]),(0,p.jsxs)(n.Fragment,{children:[(0,p.jsx)(g.A,{label:(0,p.jsx)(n.Fragment,{children:(0,p.jsx)(i.EGL,{label:"Event Destinations",onClick:()=>e(c.zZ.EVENT_DESTINATIONS)})}),actions:(0,p.jsx)(f.A,{})}),(0,p.jsx)(i.Mxu,{children:(0,p.jsx)(i.Hbc,{helpBox:(0,p.jsx)(d,{}),children:(0,p.jsxs)(i.azJ,{children:[(0,p.jsx)(i.azJ,{sx:{fontSize:16,fontWeight:600,paddingBottom:15},children:"Queue"}),(0,p.jsx)(i.azJ,{sx:(0,a.A)({},s.AF.iconContainer),children:_.map(e=>(0,p.jsx)(y,{destinationType:e.actionTrigger,srcImage:e.logo,title:e.targetTitle},"icon-".concat(e.targetTitle)))}),(0,p.jsx)(i.azJ,{sx:{fontSize:16,fontWeight:600,paddingBottom:15},children:"Database"}),(0,p.jsx)(i.azJ,{sx:(0,a.A)({},s.AF.iconContainer),children:v.map(e=>(0,p.jsx)(y,{destinationType:e.actionTrigger,srcImage:e.logo,title:e.targetTitle},"icon-".concat(e.targetTitle)))}),(0,p.jsx)(i.azJ,{sx:{fontSize:16,fontWeight:600,paddingBottom:15},children:"Functions"}),(0,p.jsx)(i.azJ,{sx:(0,a.A)({},s.AF.iconContainer),children:k.map(e=>(0,p.jsx)(y,{destinationType:e.actionTrigger,srcImage:e.logo,title:e.targetTitle},"icon-".concat(e.targetTitle)))})]})})})]})}},76356:(e,t,o)=>{o.d(t,{AU:()=>n,D3:()=>m,Es:()=>u,P4:()=>a,Xm:()=>b,bo:()=>y,fx:()=>T,h4:()=>v});const a="notify_postgres",n="notify_mysql",r="notify_kafka",i="notify_amqp",l="notify_mqtt",s="notify_redis",c="notify_nats",p="notify_elasticsearch",d="notify_webhook",g="notify_nsq",u=e=>e.map(e=>({service_name:"".concat(e.service,":").concat(e.account_id),name:e.service,account_id:e.account_id,status:e.status}));class m{}m.DB="database",m.Queue="queue",m.Func="functions";const h=()=>"".concat(document.baseURI),y=[{actionTrigger:a,targetTitle:"PostgreSQL",logo:"".concat(h(),"postgres-logo.svg"),category:m.DB},{actionTrigger:r,targetTitle:"Kafka",logo:"".concat(h(),"kafka-logo.svg"),category:m.Queue},{actionTrigger:i,targetTitle:"AMQP",logo:"".concat(h(),"amqp-logo.svg"),category:m.Queue},{actionTrigger:l,targetTitle:"MQTT",logo:"".concat(h(),"mqtt-logo.svg"),category:m.Queue},{actionTrigger:s,targetTitle:"Redis",logo:"".concat(h(),"redis-logo.svg"),category:m.Queue},{actionTrigger:c,targetTitle:"NATS",logo:"".concat(h(),"nats-logo.svg"),category:m.Queue},{actionTrigger:n,targetTitle:"Mysql",logo:"".concat(h(),"mysql-logo.svg"),category:m.DB},{actionTrigger:p,targetTitle:"Elastic Search",logo:"".concat(h(),"elasticsearch-logo.svg"),category:m.DB},{actionTrigger:d,targetTitle:"Webhook",logo:"".concat(h(),"webhooks-logo.svg"),category:m.Func},{actionTrigger:g,targetTitle:"NSQ",logo:"".concat(h(),"nsq-logo.svg"),category:m.Queue}],f=[{name:"queue_dir",label:"Queue Directory",required:!1,tooltip:"Staging directory for undelivered messages e.g. '/home/events'",type:"string",placeholder:"Enter Queue Directory"},{name:"queue_limit",label:"Queue Limit",required:!1,tooltip:"Maximum limit for undelivered messages, defaults to '10000'",type:"number",placeholder:"Enter Queue Limit"},{name:"comment",label:"Comment",required:!1,type:"comment",placeholder:"Enter custom notes if any"}],b=e=>e.filter(e=>""!==e.value),T={[r]:[{name:"brokers",label:"Brokers",required:!0,tooltip:"Comma separated list of Kafka broker addresses",type:"string",placeholder:"Enter Brokers"},{name:"topic",label:"Topic",tooltip:"Kafka topic used for bucket notifications",type:"string",placeholder:"Enter Topic"},{name:"sasl_username",label:"SASL Username",tooltip:"Username for SASL/PLAIN or SASL/SCRAM authentication",type:"string",placeholder:"Enter SASL Username"},{name:"sasl_password",label:"SASL Password",tooltip:"Password for SASL/PLAIN or SASL/SCRAM authentication",type:"string",placeholder:"Enter SASL Password"},{name:"sasl_mechanism",label:"SASL Mechanism",tooltip:"SASL authentication mechanism, default 'PLAIN'",type:"string"},{name:"tls_client_auth",label:"TLS Client Auth",tooltip:"Client Auth determines the Kafka server's policy for TLS client authorization",type:"string",placeholder:"Enter TLS Client Auth"},{name:"sasl",label:"SASL",tooltip:"Set to 'on' to enable SASL authentication",type:"on|off"},{name:"tls",label:"TLS",tooltip:"Set to 'on' to enable TLS",type:"on|off"},{name:"tls_skip_verify",label:"TLS skip verify",tooltip:'Trust server TLS without verification, defaults to "on" (verify)',type:"on|off"},{name:"client_tls_cert",label:"client TLS cert",tooltip:"Path to client certificate for mTLS authorization",type:"path",placeholder:"Enter TLS Client Cert"},{name:"client_tls_key",label:"client TLS key",tooltip:"Path to client key for mTLS authorization",type:"path",placeholder:"Enter TLS Client Key"},{name:"version",label:"Version",tooltip:"Specify the version of the Kafka cluster e.g '2.2.0'",type:"string",placeholder:"Enter Kafka Version"},...f],[i]:[{name:"url",required:!0,label:"URL",tooltip:"AMQP server endpoint e.g. `amqp://myuser:mypassword@localhost:5672`",type:"url"},{name:"exchange",label:"Exchange",tooltip:"Name of the AMQP exchange",type:"string",placeholder:"Enter Exchange"},{name:"exchange_type",label:"Exchange Type",tooltip:"AMQP exchange type",type:"string",placeholder:"Enter Exchange Type"},{name:"routing_key",label:"Routing Key",tooltip:"Routing key for publishing",type:"string",placeholder:"Enter Routing Key"},{name:"mandatory",label:"Mandatory",tooltip:"Quietly ignore undelivered messages when set to 'off', default is 'on'",type:"on|off"},{name:"durable",label:"Durable",tooltip:"Persist queue across broker restarts when set to 'on', default is 'off'",type:"on|off"},{name:"no_wait",label:"No Wait",tooltip:"Non-blocking message delivery when set to 'on', default is 'off'",type:"on|off"},{name:"internal",label:"Internal",tooltip:"Set to 'on' for exchange to be not used directly by publishers, but only when bound to other exchanges",type:"on|off"},{name:"auto_deleted",label:"Auto Deleted",tooltip:"Auto delete queue when set to 'on', when there are no consumers",type:"on|off"},{name:"delivery_mode",label:"Delivery Mode",tooltip:"Set to '1' for non-persistent or '2' for persistent queue",type:"number",placeholder:"Enter Delivery Mode"},...f],[s]:[{name:"address",required:!0,label:"Address",tooltip:"Redis server's address e.g. `localhost:6379`",type:"address",placeholder:"Enter Address"},{name:"key",required:!0,label:"Key",tooltip:"Redis key to store/update events, key is auto-created",type:"string",placeholder:"Enter Key"},{name:"password",label:"Password",tooltip:"Redis server password",type:"string",placeholder:"Enter Password"},...f],[l]:[{name:"broker",required:!0,label:"Broker",tooltip:"MQTT server endpoint e.g. `tcp://localhost:1883`",type:"uri",placeholder:"Enter Brokers"},{name:"topic",required:!0,label:"Topic",tooltip:"Name of the MQTT topic to publish",type:"string",placeholder:"Enter Topic"},{name:"username",label:"Username",tooltip:"MQTT username",type:"string",placeholder:"Enter Username"},{name:"password",label:"Password",tooltip:"MQTT password",type:"string",placeholder:"Enter Password"},{name:"qos",label:"QOS",tooltip:"Set the quality of service priority, defaults to '0'",type:"number",placeholder:"Enter QOS"},{name:"keep_alive_interval",label:"Keep Alive Interval",tooltip:"Keep-alive interval for MQTT connections in s,m,h,d",type:"duration",placeholder:"Enter Keep Alive Interval"},{name:"reconnect_interval",label:"Reconnect Interval",tooltip:"Reconnect interval for MQTT connections in s,m,h,d",type:"duration",placeholder:"Enter Reconnect Interval"},...f],[c]:[{name:"address",required:!0,label:"Address",tooltip:"NATS server address e.g. '0.0.0.0:4222'",type:"address",placeholder:"Enter Address"},{name:"subject",required:!0,label:"Subject",tooltip:"NATS subscription subject",type:"string",placeholder:"Enter NATS Subject"},{name:"username",label:"Username",tooltip:"NATS username",type:"string",placeholder:"Enter NATS Username"},{name:"password",label:"Password",tooltip:"NATS password",type:"string",placeholder:"Enter NATS password"},{name:"token",label:"Token",tooltip:"NATS token",type:"string",placeholder:"Enter NATS token"},{name:"tls",label:"TLS",tooltip:"Set to 'on' to enable TLS",type:"on|off"},{name:"tls_skip_verify",label:"TLS Skip Verify",tooltip:'Trust server TLS without verification, defaults to "on" (verify)',type:"on|off"},{name:"ping_interval",label:"Ping Interval",tooltip:"Client ping commands interval in s,m,h,d. Disabled by default",type:"duration",placeholder:"Enter Ping Interval"},{name:"streaming",label:"Streaming",tooltip:"Set to 'on' to use streaming NATS server",type:"on|off"},{name:"streaming_async",label:"Streaming async",tooltip:"Set to 'on' to enable asynchronous publish",type:"on|off"},{name:"streaming_max_pub_acks_in_flight",label:"Streaming max publish ACKS in flight",tooltip:"Number of messages to publish without waiting for ACKs",type:"number",placeholder:"Enter Streaming in flight value"},{name:"streaming_cluster_id",label:"Streaming Cluster ID",tooltip:"Unique ID for NATS streaming cluster",type:"string",placeholder:"Enter Streaming Cluster ID"},{name:"cert_authority",label:"Cert Authority",tooltip:"Path to certificate chain of the target NATS server",type:"string",placeholder:"Enter Cert Authority"},{name:"client_cert",label:"Client Cert",tooltip:"Client cert for NATS mTLS auth",type:"string",placeholder:"Enter Client Cert"},{name:"client_key",label:"Client Key",tooltip:"Client cert key for NATS mTLS authorization",type:"string",placeholder:"Enter Client Key"},...f],[p]:[{name:"url",required:!0,label:"URL",tooltip:"Elasticsearch server's address, with optional authentication info",type:"url",placeholder:"Enter URL"},{name:"index",required:!0,label:"Index",tooltip:"Elasticsearch index to store/update events, index is auto-created",type:"string",placeholder:"Enter Index"},{name:"format",required:!0,label:"Format",tooltip:"'namespace' reflects current bucket/object list and 'access' reflects a journal of object operations, defaults to 'namespace'",type:"enum",placeholder:"Enter Format"},...f],[d]:[{name:"endpoint",required:!0,label:"Endpoint",tooltip:"Webhook server endpoint e.g. http://localhost:8080/minio/events",type:"url",placeholder:"Enter Endpoint"},{name:"auth_token",label:"Auth Token",tooltip:"Opaque string or JWT authorization token",type:"string",placeholder:"Enter auth_token"},...f],[g]:[{name:"nsqd_address",required:!0,label:"NSQD Address",tooltip:"NSQ server address e.g. '127.0.0.1:4150'",type:"address",placeholder:"Enter nsqd_address"},{name:"topic",required:!0,label:"Topic",tooltip:"NSQ topic",type:"string",placeholder:"Enter Topic"},{name:"tls",label:"TLS",tooltip:"Set to 'on' to enable TLS",type:"on|off"},{name:"tls_skip_verify",label:"TLS Skip Verify",tooltip:'Trust server TLS without verification, defaults to "on" (verify)',type:"on|off"},...f]},S={webhook:"notify_webhook",amqp:"notify_amqp",kafka:"notify_kafka",mqtt:"notify_mqtt",nats:"notify_nats",nsq:"notify_nsq",mysql:"notify_mysql",postgresql:"notify_postgres",elasticsearch:"notify_elasticsearch",redis:"notify_redis"},v=e=>S[e]}}]); ================================================ FILE: web-app/build/static/js/7470.4b28f453.chunk.js ================================================ /*! For license information please see 7470.4b28f453.chunk.js.LICENSE.txt */ (self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[7470],{33684:(t,A,e)=>{var r=e(10366),n=e(86942),i=Object.prototype.hasOwnProperty,o=n(function(t,A,e){i.call(t,e)?t[e].push(A):r(t,e,[A])});t.exports=o},41971:(t,A,e)=>{var r=e(20927);t.exports=function(t,A,e,n){return r(t,function(t,r,i){A(n,t,e(t),i)}),n}},60299:t=>{t.exports=function(t,A,e,r){for(var n=-1,i=null==t?0:t.length;++n{var r=e(12897).default;t.exports=function(t){var A={};function e(r){if(A[r])return A[r].exports;var n=A[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=t,e.c=A,e.d=function(t,A,r){e.o(t,A)||Object.defineProperty(t,A,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,A){if(1&A&&(t=e(t)),8&A)return t;if(4&A&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&A&&"string"!=typeof t)for(var n in t)e.d(r,n,function(A){return t[A]}.bind(null,n));return r},e.n=function(t){var A=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(A,"a",A),A},e.o=function(t,A){return Object.prototype.hasOwnProperty.call(t,A)},e.p="",e(e.s=3)}([function(t,A,e){t.exports=function(){"use strict";var t=function(A,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,A){t.__proto__=A}||function(t,A){for(var e in A)A.hasOwnProperty(e)&&(t[e]=A[e])})(A,e)};function A(A,e){function r(){this.constructor=A}t(A,e),A.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var e=function(){return(e=Object.assign||function(t){for(var A,e=1,r=arguments.length;e0&&n[n.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]=55296&&n<=56319&&e>10),o%1024+56320)),(n+1===e||r.length>16384)&&(i+=String.fromCharCode.apply(String,r),r.length=0)}return i},c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="undefined"==typeof Uint8Array?[]:new Uint8Array(256),l=0;l<64;l++)u[c.charCodeAt(l)]=l;var h,f=function(t,A,e){return t.slice?t.slice(A,e):new Uint16Array(Array.prototype.slice.call(t,A,e))},d=function(){function t(t,A,e,r,n,i){this.initialValue=t,this.errorValue=A,this.highStart=e,this.highValueIndex=r,this.index=n,this.data=i}return t.prototype.get=function(t){var A;if(t>=0){if(t<55296||t>56319&&t<=65535)return A=((A=this.index[t>>5])<<2)+(31&t),this.data[A];if(t<=65535)return A=((A=this.index[2048+(t-55296>>5)])<<2)+(31&t),this.data[A];if(t>11),A=this.index[A],A+=t>>5&63,A=((A=this.index[A])<<2)+(31&t),this.data[A];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),p=10,B=13,g=15,w=17,m=18,Q=19,C=20,y=21,v=22,F=24,U=25,N=26,E=27,b=28,L=30,H=32,x=33,S=34,I=35,_=37,T=38,R=39,O=40,K=42,M=function(){var t,A,e,r=function(t){var A,e,r,n,i,o=.75*t.length,s=t.length,a=0;"="===t[t.length-1]&&(o--,"="===t[t.length-2]&&o--);var c="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(o):new Array(o),l=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A>4,l[a++]=(15&r)<<4|n>>2,l[a++]=(3&n)<<6|63&i;return c}("KwAAAAAAAAAACA4AIDoAAPAfAAACAAAAAAAIABAAGABAAEgAUABYAF4AZgBeAGYAYABoAHAAeABeAGYAfACEAIAAiACQAJgAoACoAK0AtQC9AMUAXgBmAF4AZgBeAGYAzQDVAF4AZgDRANkA3gDmAOwA9AD8AAQBDAEUARoBIgGAAIgAJwEvATcBPwFFAU0BTAFUAVwBZAFsAXMBewGDATAAiwGTAZsBogGkAawBtAG8AcIBygHSAdoB4AHoAfAB+AH+AQYCDgIWAv4BHgImAi4CNgI+AkUCTQJTAlsCYwJrAnECeQKBAk0CiQKRApkCoQKoArACuALAAsQCzAIwANQC3ALkAjAA7AL0AvwCAQMJAxADGAMwACADJgMuAzYDPgOAAEYDSgNSA1IDUgNaA1oDYANiA2IDgACAAGoDgAByA3YDfgOAAIQDgACKA5IDmgOAAIAAogOqA4AAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAK8DtwOAAIAAvwPHA88D1wPfAyAD5wPsA/QD/AOAAIAABAQMBBIEgAAWBB4EJgQuBDMEIAM7BEEEXgBJBCADUQRZBGEEaQQwADAAcQQ+AXkEgQSJBJEEgACYBIAAoASoBK8EtwQwAL8ExQSAAIAAgACAAIAAgACgAM0EXgBeAF4AXgBeAF4AXgBeANUEXgDZBOEEXgDpBPEE+QQBBQkFEQUZBSEFKQUxBTUFPQVFBUwFVAVcBV4AYwVeAGsFcwV7BYMFiwWSBV4AmgWgBacFXgBeAF4AXgBeAKsFXgCyBbEFugW7BcIFwgXIBcIFwgXQBdQF3AXkBesF8wX7BQMGCwYTBhsGIwYrBjMGOwZeAD8GRwZNBl4AVAZbBl4AXgBeAF4AXgBeAF4AXgBeAF4AXgBeAGMGXgBqBnEGXgBeAF4AXgBeAF4AXgBeAF4AXgB5BoAG4wSGBo4GkwaAAIADHgR5AF4AXgBeAJsGgABGA4AAowarBrMGswagALsGwwbLBjAA0wbaBtoG3QbaBtoG2gbaBtoG2gblBusG8wb7BgMHCwcTBxsHCwcjBysHMAc1BzUHOgdCB9oGSgdSB1oHYAfaBloHaAfaBlIH2gbaBtoG2gbaBtoG2gbaBjUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHbQdeAF4ANQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQd1B30HNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B4MH2gaKB68EgACAAIAAgACAAIAAgACAAI8HlwdeAJ8HpweAAIAArwe3B14AXgC/B8UHygcwANAH2AfgB4AA6AfwBz4B+AcACFwBCAgPCBcIogEYAR8IJwiAAC8INwg/CCADRwhPCFcIXwhnCEoDGgSAAIAAgABvCHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIhAiLCI4IMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAANQc1BzUHNQc1BzUHNQc1BzUHNQc1B54INQc1B6II2gaqCLIIugiAAIAAvgjGCIAAgACAAIAAgACAAIAAgACAAIAAywiHAYAA0wiAANkI3QjlCO0I9Aj8CIAAgACAAAIJCgkSCRoJIgknCTYHLwk3CZYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiAAIAAAAFAAXgBeAGAAcABeAHwAQACQAKAArQC9AJ4AXgBeAE0A3gBRAN4A7AD8AMwBGgEAAKcBNwEFAUwBXAF4QkhCmEKnArcCgAHHAsABz4LAAcABwAHAAd+C6ABoAG+C/4LAAcABwAHAAc+DF4MAAcAB54M3gweDV4Nng3eDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEeDqABVg6WDqABoQ6gAaABoAHXDvcONw/3DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DncPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB7cPPwlGCU4JMACAAIAAgABWCV4JYQmAAGkJcAl4CXwJgAkwADAAMAAwAIgJgACLCZMJgACZCZ8JowmrCYAAswkwAF4AXgB8AIAAuwkABMMJyQmAAM4JgADVCTAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAqwYWBNkIMAAwADAAMADdCeAJ6AnuCR4E9gkwAP4JBQoNCjAAMACAABUK0wiAAB0KJAosCjQKgAAwADwKQwqAAEsKvQmdCVMKWwowADAAgACAALcEMACAAGMKgABrCjAAMAAwADAAMAAwADAAMAAwADAAMAAeBDAAMAAwADAAMAAwADAAMAAwADAAMAAwAIkEPQFzCnoKiQSCCooKkAqJBJgKoAqkCokEGAGsCrQKvArBCjAAMADJCtEKFQHZCuEK/gHpCvEKMAAwADAAMACAAIwE+QowAIAAPwEBCzAAMAAwADAAMACAAAkLEQswAIAAPwEZCyELgAAOCCkLMAAxCzkLMAAwADAAMAAwADAAXgBeAEELMAAwADAAMAAwADAAMAAwAEkLTQtVC4AAXAtkC4AAiQkwADAAMAAwADAAMAAwADAAbAtxC3kLgAuFC4sLMAAwAJMLlwufCzAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAApwswADAAMACAAIAAgACvC4AAgACAAIAAgACAALcLMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAvwuAAMcLgACAAIAAgACAAIAAyguAAIAAgACAAIAA0QswADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAANkLgACAAIAA4AswADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACJCR4E6AswADAAhwHwC4AA+AsADAgMEAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMACAAIAAGAwdDCUMMAAwAC0MNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQw1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHPQwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADUHNQc1BzUHNQc1BzUHNQc2BzAAMAA5DDUHNQc1BzUHNQc1BzUHNQc1BzUHNQdFDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAATQxSDFoMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAF4AXgBeAF4AXgBeAF4AYgxeAGoMXgBxDHkMfwxeAIUMXgBeAI0MMAAwADAAMAAwAF4AXgCVDJ0MMAAwADAAMABeAF4ApQxeAKsMswy7DF4Awgy9DMoMXgBeAF4AXgBeAF4AXgBeAF4AXgDRDNkMeQBqCeAM3Ax8AOYM7Az0DPgMXgBeAF4AXgBeAF4AXgBeAF4AXgBeAF4AXgBeAF4AXgCgAAANoAAHDQ4NFg0wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAeDSYNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAC4NMABeAF4ANg0wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAD4NRg1ODVYNXg1mDTAAbQ0wADAAMAAwADAAMAAwADAA2gbaBtoG2gbaBtoG2gbaBnUNeg3CBYANwgWFDdoGjA3aBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gaUDZwNpA2oDdoG2gawDbcNvw3HDdoG2gbPDdYN3A3fDeYN2gbsDfMN2gbaBvoN/g3aBgYODg7aBl4AXgBeABYOXgBeACUG2gYeDl4AJA5eACwO2w3aBtoGMQ45DtoG2gbaBtoGQQ7aBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDjUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B1EO2gY1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQdZDjUHNQc1BzUHNQc1B2EONQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHaA41BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B3AO2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gY1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B2EO2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBkkOeA6gAKAAoAAwADAAMAAwAKAAoACgAKAAoACgAKAAgA4wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAD//wQABAAEAAQABAAEAAQABAAEAA0AAwABAAEAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAKABMAFwAeABsAGgAeABcAFgASAB4AGwAYAA8AGAAcAEsASwBLAEsASwBLAEsASwBLAEsAGAAYAB4AHgAeABMAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAFgAbABIAHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYADQARAB4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkAFgAaABsAGwAbAB4AHQAdAB4ATwAXAB4ADQAeAB4AGgAbAE8ATwAOAFAAHQAdAB0ATwBPABcATwBPAE8AFgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwArAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAAQABAANAA0ASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAUAArACsAKwArACsAKwArACsABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAGgAaAFAAUABQAFAAUABMAB4AGwBQAB4AKwArACsABAAEAAQAKwBQAFAAUABQAFAAUAArACsAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUAArAFAAUAArACsABAArAAQABAAEAAQABAArACsAKwArAAQABAArACsABAAEAAQAKwArACsABAArACsAKwArACsAKwArAFAAUABQAFAAKwBQACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwAEAAQAUABQAFAABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQAKwArAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeABsAKwArACsAKwArACsAKwBQAAQABAAEAAQABAAEACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAKwArACsAKwArACsAKwArAAQABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwAEAFAAKwBQAFAAUABQAFAAUAArACsAKwBQAFAAUAArAFAAUABQAFAAKwArACsAUABQACsAUAArAFAAUAArACsAKwBQAFAAKwArACsAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQAKwArACsABAAEAAQAKwAEAAQABAAEACsAKwBQACsAKwArACsAKwArAAQAKwArACsAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAB4AHgAeAB4AHgAeABsAHgArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArAFAAUABQACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAB4AUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArACsAKwArACsAKwArAFAAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwArAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAKwBcAFwAKwBcACsAKwBcACsAKwArACsAKwArAFwAXABcAFwAKwBcAFwAXABcAFwAXABcACsAXABcAFwAKwBcACsAXAArACsAXABcACsAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgArACoAKgBcACsAKwBcAFwAXABcAFwAKwBcACsAKgAqACoAKgAqACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAFwAXABcAFwAUAAOAA4ADgAOAB4ADgAOAAkADgAOAA0ACQATABMAEwATABMACQAeABMAHgAeAB4ABAAEAB4AHgAeAB4AHgAeAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUAANAAQAHgAEAB4ABAAWABEAFgARAAQABABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAAQABAAEAAQABAANAAQABABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsADQANAB4AHgAeAB4AHgAeAAQAHgAeAB4AHgAeAB4AKwAeAB4ADgAOAA0ADgAeAB4AHgAeAB4ACQAJACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgAeAB4AHgBcAFwAXABcAFwAXAAqACoAKgAqAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAKgAqACoAKgAqACoAKgBcAFwAXAAqACoAKgAqAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAXAAqAEsASwBLAEsASwBLAEsASwBLAEsAKgAqACoAKgAqACoAUABQAFAAUABQAFAAKwBQACsAKwArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQACsAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwAEAAQABAAeAA0AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAEQArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAADQANAA0AUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAA0ADQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoADQANABUAXAANAB4ADQAbAFwAKgArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAB4AHgATABMADQANAA4AHgATABMAHgAEAAQABAAJACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAUABQAFAAUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwAeACsAKwArABMAEwBLAEsASwBLAEsASwBLAEsASwBLAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwBcAFwAXABcAFwAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcACsAKwArACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwAeAB4AXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsABABLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKgAqACoAKgAqACoAKgBcACoAKgAqACoAKgAqACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAUABQAFAAUABQAFAAUAArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4ADQANAA0ADQAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAHgAeAB4AHgBQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwANAA0ADQANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwBQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsABAAEAAQAHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAABABQAFAAUABQAAQABAAEAFAAUAAEAAQABAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAKwBQACsAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAKwArAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAKwAeAB4AHgAeAB4AHgAeAA4AHgArAA0ADQANAA0ADQANAA0ACQANAA0ADQAIAAQACwAEAAQADQAJAA0ADQAMAB0AHQAeABcAFwAWABcAFwAXABYAFwAdAB0AHgAeABQAFAAUAA0AAQABAAQABAAEAAQABAAJABoAGgAaABoAGgAaABoAGgAeABcAFwAdABUAFQAeAB4AHgAeAB4AHgAYABYAEQAVABUAFQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgANAB4ADQANAA0ADQAeAA0ADQANAAcAHgAeAB4AHgArAAQABAAEAAQABAAEAAQABAAEAAQAUABQACsAKwBPAFAAUABQAFAAUAAeAB4AHgAWABEATwBQAE8ATwBPAE8AUABQAFAAUABQAB4AHgAeABYAEQArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAGwAbABsAGwAbABsAGwAaABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAaABsAGwAbABsAGgAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgBQABoAHgAdAB4AUAAeABoAHgAeAB4AHgAeAB4AHgAeAB4ATwAeAFAAGwAeAB4AUABQAFAAUABQAB4AHgAeAB0AHQAeAFAAHgBQAB4AUAAeAFAATwBQAFAAHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AUABQAFAAUABPAE8AUABQAFAAUABQAE8AUABQAE8AUABPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAE8ATwBPAE8ATwBPAE8ATwBPAE8AUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAATwAeAB4AKwArACsAKwAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB0AHQAeAB4AHgAdAB0AHgAeAB0AHgAeAB4AHQAeAB0AGwAbAB4AHQAeAB4AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB0AHgAdAB4AHQAdAB0AHQAdAB0AHgAdAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAdAB0AHQAdAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAlACUAHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBQAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB0AHQAeAB4AHgAeAB0AHQAdAB4AHgAdAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB0AHQAeAB4AHQAeAB4AHgAeAB0AHQAeAB4AHgAeACUAJQAdAB0AJQAeACUAJQAlACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAHgAeAB4AHgAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHQAdAB0AHgAdACUAHQAdAB4AHQAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHQAdAB0AHQAlAB4AJQAlACUAHQAlACUAHQAdAB0AJQAlAB0AHQAlAB0AHQAlACUAJQAeAB0AHgAeAB4AHgAdAB0AJQAdAB0AHQAdAB0AHQAlACUAJQAlACUAHQAlACUAIAAlAB0AHQAlACUAJQAlACUAJQAlACUAHgAeAB4AJQAlACAAIAAgACAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeABcAFwAXABcAFwAXAB4AEwATACUAHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACUAJQBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwArACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAE8ATwBPAE8ATwBPAE8ATwAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeACsAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUAArACsAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQBQAFAAUABQACsAKwArACsAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAABAAEAAQAKwAEAAQAKwArACsAKwArAAQABAAEAAQAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsABAAEAAQAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsADQANAA0ADQANAA0ADQANAB4AKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAUABQAFAAUABQAA0ADQANAA0ADQANABQAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwANAA0ADQANAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAeAAQABAAEAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLACsADQArAB4AKwArAAQABAAEAAQAUABQAB4AUAArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwAEAAQABAAEAAQABAAEAAQABAAOAA0ADQATABMAHgAeAB4ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0AUABQAFAAUAAEAAQAKwArAAQADQANAB4AUAArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXABcAA0ADQANACoASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUAArACsAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANACsADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEcARwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwAeAAQABAANAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAEAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUAArACsAUAArACsAUABQACsAKwBQAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAeAB4ADQANAA0ADQAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAArAAQABAArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAEAAQABAAEAAQABAAEACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAFgAWAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAKwBQACsAKwArACsAKwArAFAAKwArACsAKwBQACsAUAArAFAAKwBQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQACsAUAArAFAAKwBQACsAUABQACsAUAArACsAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAUABQAFAAUAArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUAArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAlACUAJQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeACUAJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeACUAJQAlACUAJQAeACUAJQAlACUAJQAgACAAIAAlACUAIAAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIQAhACEAIQAhACUAJQAgACAAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAIAAlACUAJQAlACAAJQAgACAAIAAgACAAIAAgACAAIAAlACUAJQAgACUAJQAlACUAIAAgACAAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeACUAHgAlAB4AJQAlACUAJQAlACAAJQAlACUAJQAeACUAHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAIAAgACAAJQAlACUAIAAgACAAIAAgAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFwAXABcAFQAVABUAHgAeAB4AHgAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAlACAAIAAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsA"),n=Array.isArray(r)?function(t){for(var A=t.length,e=[],r=0;r0;){var o=r[--i];if(Array.isArray(t)?-1!==t.indexOf(o):t===o)for(var s=e;s<=r.length;){var a;if((a=r[++s])===A)return!0;if(a!==p)break}if(o!==p)break}return!1},G=function(t,A){for(var e=t;e>=0;){var r=A[e];if(r!==p)return r;e--}return 0},J=function(t,A,e,r,n){if(0===e[r])return"\xd7";var i=r-1;if(Array.isArray(n)&&!0===n[i])return"\xd7";var o=i-1,s=i+1,a=A[i],c=o>=0?A[o]:0,u=A[s];if(2===a&&3===u)return"\xd7";if(-1!==D.indexOf(a))return"!";if(-1!==D.indexOf(u))return"\xd7";if(-1!==k.indexOf(u))return"\xd7";if(8===G(i,A))return"\xf7";if(11===M.get(t[i])&&(u===_||u===H||u===x))return"\xd7";if(7===a||7===u)return"\xd7";if(9===a)return"\xd7";if(-1===[p,B,g].indexOf(a)&&9===u)return"\xd7";if(-1!==[w,m,Q,F,b].indexOf(u))return"\xd7";if(G(i,A)===v)return"\xd7";if(X(23,v,i,A))return"\xd7";if(X([w,m],y,i,A))return"\xd7";if(X(12,12,i,A))return"\xd7";if(a===p)return"\xf7";if(23===a||23===u)return"\xd7";if(16===u||16===a)return"\xf7";if(-1!==[B,g,y].indexOf(u)||14===a)return"\xd7";if(36===c&&-1!==V.indexOf(a))return"\xd7";if(a===b&&36===u)return"\xd7";if(u===C&&-1!==P.concat(C,Q,U,_,H,x).indexOf(a))return"\xd7";if(-1!==P.indexOf(u)&&a===U||-1!==P.indexOf(a)&&u===U)return"\xd7";if(a===E&&-1!==[_,H,x].indexOf(u)||-1!==[_,H,x].indexOf(a)&&u===N)return"\xd7";if(-1!==P.indexOf(a)&&-1!==z.indexOf(u)||-1!==z.indexOf(a)&&-1!==P.indexOf(u))return"\xd7";if(-1!==[E,N].indexOf(a)&&(u===U||-1!==[v,g].indexOf(u)&&A[s+1]===U)||-1!==[v,g].indexOf(a)&&u===U||a===U&&-1!==[U,b,F].indexOf(u))return"\xd7";if(-1!==[U,b,F,w,m].indexOf(u))for(var l=i;l>=0;){if((h=A[l])===U)return"\xd7";if(-1===[b,F].indexOf(h))break;l--}if(-1!==[E,N].indexOf(u))for(l=-1!==[w,m].indexOf(a)?o:i;l>=0;){var h;if((h=A[l])===U)return"\xd7";if(-1===[b,F].indexOf(h))break;l--}if(T===a&&-1!==[T,R,S,I].indexOf(u)||-1!==[R,S].indexOf(a)&&-1!==[R,O].indexOf(u)||-1!==[O,I].indexOf(a)&&u===O)return"\xd7";if(-1!==q.indexOf(a)&&-1!==[C,N].indexOf(u)||-1!==q.indexOf(u)&&a===E)return"\xd7";if(-1!==P.indexOf(a)&&-1!==P.indexOf(u))return"\xd7";if(a===F&&-1!==P.indexOf(u))return"\xd7";if(-1!==P.concat(U).indexOf(a)&&u===v||-1!==P.concat(U).indexOf(u)&&a===m)return"\xd7";if(41===a&&41===u){for(var f=e[i],d=1;f>0&&41===A[--f];)d++;if(d%2!=0)return"\xd7"}return a===H&&u===x?"\xd7":"\xf7"},W=function(){function t(t,A,e,r){this.codePoints=t,this.required="!"===A,this.start=e,this.end=r}return t.prototype.slice=function(){return a.apply(void 0,this.codePoints.slice(this.start,this.end))},t}();!function(t){t[t.STRING_TOKEN=0]="STRING_TOKEN",t[t.BAD_STRING_TOKEN=1]="BAD_STRING_TOKEN",t[t.LEFT_PARENTHESIS_TOKEN=2]="LEFT_PARENTHESIS_TOKEN",t[t.RIGHT_PARENTHESIS_TOKEN=3]="RIGHT_PARENTHESIS_TOKEN",t[t.COMMA_TOKEN=4]="COMMA_TOKEN",t[t.HASH_TOKEN=5]="HASH_TOKEN",t[t.DELIM_TOKEN=6]="DELIM_TOKEN",t[t.AT_KEYWORD_TOKEN=7]="AT_KEYWORD_TOKEN",t[t.PREFIX_MATCH_TOKEN=8]="PREFIX_MATCH_TOKEN",t[t.DASH_MATCH_TOKEN=9]="DASH_MATCH_TOKEN",t[t.INCLUDE_MATCH_TOKEN=10]="INCLUDE_MATCH_TOKEN",t[t.LEFT_CURLY_BRACKET_TOKEN=11]="LEFT_CURLY_BRACKET_TOKEN",t[t.RIGHT_CURLY_BRACKET_TOKEN=12]="RIGHT_CURLY_BRACKET_TOKEN",t[t.SUFFIX_MATCH_TOKEN=13]="SUFFIX_MATCH_TOKEN",t[t.SUBSTRING_MATCH_TOKEN=14]="SUBSTRING_MATCH_TOKEN",t[t.DIMENSION_TOKEN=15]="DIMENSION_TOKEN",t[t.PERCENTAGE_TOKEN=16]="PERCENTAGE_TOKEN",t[t.NUMBER_TOKEN=17]="NUMBER_TOKEN",t[t.FUNCTION=18]="FUNCTION",t[t.FUNCTION_TOKEN=19]="FUNCTION_TOKEN",t[t.IDENT_TOKEN=20]="IDENT_TOKEN",t[t.COLUMN_TOKEN=21]="COLUMN_TOKEN",t[t.URL_TOKEN=22]="URL_TOKEN",t[t.BAD_URL_TOKEN=23]="BAD_URL_TOKEN",t[t.CDC_TOKEN=24]="CDC_TOKEN",t[t.CDO_TOKEN=25]="CDO_TOKEN",t[t.COLON_TOKEN=26]="COLON_TOKEN",t[t.SEMICOLON_TOKEN=27]="SEMICOLON_TOKEN",t[t.LEFT_SQUARE_BRACKET_TOKEN=28]="LEFT_SQUARE_BRACKET_TOKEN",t[t.RIGHT_SQUARE_BRACKET_TOKEN=29]="RIGHT_SQUARE_BRACKET_TOKEN",t[t.UNICODE_RANGE_TOKEN=30]="UNICODE_RANGE_TOKEN",t[t.WHITESPACE_TOKEN=31]="WHITESPACE_TOKEN",t[t.EOF_TOKEN=32]="EOF_TOKEN"}(h||(h={}));var Y=function(t){return t>=48&&t<=57},Z=function(t){return Y(t)||t>=65&&t<=70||t>=97&&t<=102},$=function(t){return 10===t||9===t||32===t},tt=function(t){return function(t){return function(t){return t>=97&&t<=122}(t)||function(t){return t>=65&&t<=90}(t)}(t)||function(t){return t>=128}(t)||95===t},At=function(t){return tt(t)||Y(t)||45===t},et=function(t){return t>=0&&t<=8||11===t||t>=14&&t<=31||127===t},rt=function(t,A){return 92===t&&10!==A},nt=function(t,A,e){return 45===t?tt(A)||rt(A,e):!!tt(t)||!(92!==t||!rt(t,A))},it=function(t,A,e){return 43===t||45===t?!!Y(A)||46===A&&Y(e):Y(46===t?A:t)},ot=function(t){var A=0,e=1;43!==t[A]&&45!==t[A]||(45===t[A]&&(e=-1),A++);for(var r=[];Y(t[A]);)r.push(t[A++]);var n=r.length?parseInt(a.apply(void 0,r),10):0;46===t[A]&&A++;for(var i=[];Y(t[A]);)i.push(t[A++]);var o=i.length,s=o?parseInt(a.apply(void 0,i),10):0;69!==t[A]&&101!==t[A]||A++;var c=1;43!==t[A]&&45!==t[A]||(45===t[A]&&(c=-1),A++);for(var u=[];Y(t[A]);)u.push(t[A++]);var l=u.length?parseInt(a.apply(void 0,u),10):0;return e*(n+s*Math.pow(10,-o))*Math.pow(10,c*l)},st={type:h.LEFT_PARENTHESIS_TOKEN},at={type:h.RIGHT_PARENTHESIS_TOKEN},ct={type:h.COMMA_TOKEN},ut={type:h.SUFFIX_MATCH_TOKEN},lt={type:h.PREFIX_MATCH_TOKEN},ht={type:h.COLUMN_TOKEN},ft={type:h.DASH_MATCH_TOKEN},dt={type:h.INCLUDE_MATCH_TOKEN},pt={type:h.LEFT_CURLY_BRACKET_TOKEN},Bt={type:h.RIGHT_CURLY_BRACKET_TOKEN},gt={type:h.SUBSTRING_MATCH_TOKEN},wt={type:h.BAD_URL_TOKEN},mt={type:h.BAD_STRING_TOKEN},Qt={type:h.CDO_TOKEN},Ct={type:h.CDC_TOKEN},yt={type:h.COLON_TOKEN},vt={type:h.SEMICOLON_TOKEN},Ft={type:h.LEFT_SQUARE_BRACKET_TOKEN},Ut={type:h.RIGHT_SQUARE_BRACKET_TOKEN},Nt={type:h.WHITESPACE_TOKEN},Et={type:h.EOF_TOKEN},bt=function(){function t(){this._value=[]}return t.prototype.write=function(t){this._value=this._value.concat(s(t))},t.prototype.read=function(){for(var t=[],A=this.consumeToken();A!==Et;)t.push(A),A=this.consumeToken();return t},t.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case 34:return this.consumeStringToken(34);case 35:var A=this.peekCodePoint(0),e=this.peekCodePoint(1),r=this.peekCodePoint(2);if(At(A)||rt(e,r)){var n=nt(A,e,r)?2:1,i=this.consumeName();return{type:h.HASH_TOKEN,value:i,flags:n}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),ut;break;case 39:return this.consumeStringToken(39);case 40:return st;case 41:return at;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),gt;break;case 43:if(it(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case 44:return ct;case 45:var o=t,s=this.peekCodePoint(0),c=this.peekCodePoint(1);if(it(o,s,c))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(nt(o,s,c))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(45===s&&62===c)return this.consumeCodePoint(),this.consumeCodePoint(),Ct;break;case 46:if(it(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(42===u&&47===(u=this.consumeCodePoint()))return this.consumeToken();if(-1===u)return this.consumeToken()}break;case 58:return yt;case 59:return vt;case 60:if(33===this.peekCodePoint(0)&&45===this.peekCodePoint(1)&&45===this.peekCodePoint(2))return this.consumeCodePoint(),this.consumeCodePoint(),Qt;break;case 64:var l=this.peekCodePoint(0),f=this.peekCodePoint(1),d=this.peekCodePoint(2);if(nt(l,f,d))return i=this.consumeName(),{type:h.AT_KEYWORD_TOKEN,value:i};break;case 91:return Ft;case 92:if(rt(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case 93:return Ut;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),lt;break;case 123:return pt;case 125:return Bt;case 117:case 85:var p=this.peekCodePoint(0),B=this.peekCodePoint(1);return 43!==p||!Z(B)&&63!==B||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),ft;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),ht;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),dt;break;case-1:return Et}return $(t)?(this.consumeWhiteSpace(),Nt):Y(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):tt(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:h.DELIM_TOKEN,value:a(t)}},t.prototype.consumeCodePoint=function(){var t=this._value.shift();return void 0===t?-1:t},t.prototype.reconsumeCodePoint=function(t){this._value.unshift(t)},t.prototype.peekCodePoint=function(t){return t>=this._value.length?-1:this._value[t]},t.prototype.consumeUnicodeRangeToken=function(){for(var t=[],A=this.consumeCodePoint();Z(A)&&t.length<6;)t.push(A),A=this.consumeCodePoint();for(var e=!1;63===A&&t.length<6;)t.push(A),A=this.consumeCodePoint(),e=!0;if(e){var r=parseInt(a.apply(void 0,t.map(function(t){return 63===t?48:t})),16),n=parseInt(a.apply(void 0,t.map(function(t){return 63===t?70:t})),16);return{type:h.UNICODE_RANGE_TOKEN,start:r,end:n}}var i=parseInt(a.apply(void 0,t),16);if(45===this.peekCodePoint(0)&&Z(this.peekCodePoint(1))){this.consumeCodePoint(),A=this.consumeCodePoint();for(var o=[];Z(A)&&o.length<6;)o.push(A),A=this.consumeCodePoint();return n=parseInt(a.apply(void 0,o),16),{type:h.UNICODE_RANGE_TOKEN,start:i,end:n}}return{type:h.UNICODE_RANGE_TOKEN,start:i,end:i}},t.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return"url"===t.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:h.FUNCTION_TOKEN,value:t}):{type:h.IDENT_TOKEN,value:t}},t.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),-1===this.peekCodePoint(0))return{type:h.URL_TOKEN,value:""};var A=this.peekCodePoint(0);if(39===A||34===A){var e=this.consumeStringToken(this.consumeCodePoint());return e.type===h.STRING_TOKEN&&(this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:h.URL_TOKEN,value:e.value}):(this.consumeBadUrlRemnants(),wt)}for(;;){var r=this.consumeCodePoint();if(-1===r||41===r)return{type:h.URL_TOKEN,value:a.apply(void 0,t)};if($(r))return this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:h.URL_TOKEN,value:a.apply(void 0,t)}):(this.consumeBadUrlRemnants(),wt);if(34===r||39===r||40===r||et(r))return this.consumeBadUrlRemnants(),wt;if(92===r){if(!rt(r,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),wt;t.push(this.consumeEscapedCodePoint())}else t.push(r)}},t.prototype.consumeWhiteSpace=function(){for(;$(this.peekCodePoint(0));)this.consumeCodePoint()},t.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(41===t||-1===t)return;rt(t,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},t.prototype.consumeStringSlice=function(t){for(var A="";t>0;){var e=Math.min(6e4,t);A+=a.apply(void 0,this._value.splice(0,e)),t-=e}return this._value.shift(),A},t.prototype.consumeStringToken=function(t){for(var A="",e=0;;){var r=this._value[e];if(-1===r||void 0===r||r===t)return A+=this.consumeStringSlice(e),{type:h.STRING_TOKEN,value:A};if(10===r)return this._value.splice(0,e),mt;if(92===r){var n=this._value[e+1];-1!==n&&void 0!==n&&(10===n?(A+=this.consumeStringSlice(e),e=-1,this._value.shift()):rt(r,n)&&(A+=this.consumeStringSlice(e),A+=a(this.consumeEscapedCodePoint()),e=-1))}e++}},t.prototype.consumeNumber=function(){var t=[],A=4,e=this.peekCodePoint(0);for(43!==e&&45!==e||t.push(this.consumeCodePoint());Y(this.peekCodePoint(0));)t.push(this.consumeCodePoint());e=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(46===e&&Y(r))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),A=8;Y(this.peekCodePoint(0));)t.push(this.consumeCodePoint());e=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((69===e||101===e)&&((43===r||45===r)&&Y(n)||Y(r)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),A=8;Y(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[ot(t),A]},t.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),A=t[0],e=t[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),i=this.peekCodePoint(2);if(nt(r,n,i)){var o=this.consumeName();return{type:h.DIMENSION_TOKEN,number:A,flags:e,unit:o}}return 37===r?(this.consumeCodePoint(),{type:h.PERCENTAGE_TOKEN,number:A,flags:e}):{type:h.NUMBER_TOKEN,number:A,flags:e}},t.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(Z(t)){for(var A=a(t);Z(this.peekCodePoint(0))&&A.length<6;)A+=a(this.consumeCodePoint());$(this.peekCodePoint(0))&&this.consumeCodePoint();var e=parseInt(A,16);return 0===e||function(t){return t>=55296&&t<=57343}(e)||e>1114111?65533:e}return-1===t?65533:t},t.prototype.consumeName=function(){for(var t="";;){var A=this.consumeCodePoint();if(At(A))t+=a(A);else{if(!rt(A,this.peekCodePoint(0)))return this.reconsumeCodePoint(A),t;t+=a(this.consumeEscapedCodePoint())}}},t}(),Lt=function(){function t(t){this._tokens=t}return t.create=function(A){var e=new bt;return e.write(A),new t(e.read())},t.parseValue=function(A){return t.create(A).parseComponentValue()},t.parseValues=function(A){return t.create(A).parseComponentValues()},t.prototype.parseComponentValue=function(){for(var t=this.consumeToken();t.type===h.WHITESPACE_TOKEN;)t=this.consumeToken();if(t.type===h.EOF_TOKEN)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(t);var A=this.consumeComponentValue();do{t=this.consumeToken()}while(t.type===h.WHITESPACE_TOKEN);if(t.type===h.EOF_TOKEN)return A;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},t.prototype.parseComponentValues=function(){for(var t=[];;){var A=this.consumeComponentValue();if(A.type===h.EOF_TOKEN)return t;t.push(A),t.push()}},t.prototype.consumeComponentValue=function(){var t=this.consumeToken();switch(t.type){case h.LEFT_CURLY_BRACKET_TOKEN:case h.LEFT_SQUARE_BRACKET_TOKEN:case h.LEFT_PARENTHESIS_TOKEN:return this.consumeSimpleBlock(t.type);case h.FUNCTION_TOKEN:return this.consumeFunction(t)}return t},t.prototype.consumeSimpleBlock=function(t){for(var A={type:t,values:[]},e=this.consumeToken();;){if(e.type===h.EOF_TOKEN||Kt(e,t))return A;this.reconsumeToken(e),A.values.push(this.consumeComponentValue()),e=this.consumeToken()}},t.prototype.consumeFunction=function(t){for(var A={name:t.value,values:[],type:h.FUNCTION};;){var e=this.consumeToken();if(e.type===h.EOF_TOKEN||e.type===h.RIGHT_PARENTHESIS_TOKEN)return A;this.reconsumeToken(e),A.values.push(this.consumeComponentValue())}},t.prototype.consumeToken=function(){var t=this._tokens.shift();return void 0===t?Et:t},t.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},t}(),Ht=function(t){return t.type===h.DIMENSION_TOKEN},xt=function(t){return t.type===h.NUMBER_TOKEN},St=function(t){return t.type===h.IDENT_TOKEN},It=function(t){return t.type===h.STRING_TOKEN},_t=function(t,A){return St(t)&&t.value===A},Tt=function(t){return t.type!==h.WHITESPACE_TOKEN},Rt=function(t){return t.type!==h.WHITESPACE_TOKEN&&t.type!==h.COMMA_TOKEN},Ot=function(t){var A=[],e=[];return t.forEach(function(t){if(t.type===h.COMMA_TOKEN){if(0===e.length)throw new Error("Error parsing function args, zero tokens for arg");return A.push(e),void(e=[])}t.type!==h.WHITESPACE_TOKEN&&e.push(t)}),e.length&&A.push(e),A},Kt=function(t,A){return A===h.LEFT_CURLY_BRACKET_TOKEN&&t.type===h.RIGHT_CURLY_BRACKET_TOKEN||A===h.LEFT_SQUARE_BRACKET_TOKEN&&t.type===h.RIGHT_SQUARE_BRACKET_TOKEN||A===h.LEFT_PARENTHESIS_TOKEN&&t.type===h.RIGHT_PARENTHESIS_TOKEN},Mt=function(t){return t.type===h.NUMBER_TOKEN||t.type===h.DIMENSION_TOKEN},Pt=function(t){return t.type===h.PERCENTAGE_TOKEN||Mt(t)},Dt=function(t){return t.length>1?[t[0],t[1]]:[t[0]]},kt={type:h.NUMBER_TOKEN,number:0,flags:4},zt={type:h.PERCENTAGE_TOKEN,number:50,flags:4},jt={type:h.PERCENTAGE_TOKEN,number:100,flags:4},qt=function(t,A,e){var r=t[0],n=t[1];return[Vt(r,A),Vt(void 0!==n?n:r,e)]},Vt=function(t,A){if(t.type===h.PERCENTAGE_TOKEN)return t.number/100*A;if(Ht(t))switch(t.unit){case"rem":case"em":return 16*t.number;default:return t.number}return t.number},Xt=function(t){if(t.type===h.DIMENSION_TOKEN)switch(t.unit){case"deg":return Math.PI*t.number/180;case"grad":return Math.PI/200*t.number;case"rad":return t.number;case"turn":return 2*Math.PI*t.number}throw new Error("Unsupported angle type")},Gt=function(t){return t.type===h.DIMENSION_TOKEN&&("deg"===t.unit||"grad"===t.unit||"rad"===t.unit||"turn"===t.unit)},Jt=function(t){switch(t.filter(St).map(function(t){return t.value}).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[kt,kt];case"to top":case"bottom":return Wt(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[kt,jt];case"to right":case"left":return Wt(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[jt,jt];case"to bottom":case"top":return Wt(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[jt,kt];case"to left":case"right":return Wt(270)}return 0},Wt=function(t){return Math.PI*t/180},Yt=function(t){if(t.type===h.FUNCTION){var A=sA[t.name];if(void 0===A)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return A(t.values)}if(t.type===h.HASH_TOKEN){if(3===t.value.length){var e=t.value.substring(0,1),r=t.value.substring(1,2),n=t.value.substring(2,3);return tA(parseInt(e+e,16),parseInt(r+r,16),parseInt(n+n,16),1)}if(4===t.value.length){e=t.value.substring(0,1),r=t.value.substring(1,2),n=t.value.substring(2,3);var i=t.value.substring(3,4);return tA(parseInt(e+e,16),parseInt(r+r,16),parseInt(n+n,16),parseInt(i+i,16)/255)}if(6===t.value.length)return e=t.value.substring(0,2),r=t.value.substring(2,4),n=t.value.substring(4,6),tA(parseInt(e,16),parseInt(r,16),parseInt(n,16),1);if(8===t.value.length)return e=t.value.substring(0,2),r=t.value.substring(2,4),n=t.value.substring(4,6),i=t.value.substring(6,8),tA(parseInt(e,16),parseInt(r,16),parseInt(n,16),parseInt(i,16)/255)}if(t.type===h.IDENT_TOKEN){var o=aA[t.value.toUpperCase()];if(void 0!==o)return o}return aA.TRANSPARENT},Zt=function(t){return 0==(255&t)},$t=function(t){var A=255&t,e=255&t>>8,r=255&t>>16,n=255&t>>24;return A<255?"rgba("+n+","+r+","+e+","+A/255+")":"rgb("+n+","+r+","+e+")"},tA=function(t,A,e,r){return(t<<24|A<<16|e<<8|Math.round(255*r))>>>0},AA=function(t,A){if(t.type===h.NUMBER_TOKEN)return t.number;if(t.type===h.PERCENTAGE_TOKEN){var e=3===A?1:255;return 3===A?t.number/100*e:Math.round(t.number/100*e)}return 0},eA=function(t){var A=t.filter(Rt);if(3===A.length){var e=A.map(AA),r=e[0],n=e[1],i=e[2];return tA(r,n,i,1)}if(4===A.length){var o=A.map(AA),s=(r=o[0],n=o[1],i=o[2],o[3]);return tA(r,n,i,s)}return 0};function rA(t,A,e){return e<0&&(e+=1),e>=1&&(e-=1),e<1/6?(A-t)*e*6+t:e<.5?A:e<2/3?6*(A-t)*(2/3-e)+t:t}var nA,iA,oA=function(t){var A=t.filter(Rt),e=A[0],r=A[1],n=A[2],i=A[3],o=(e.type===h.NUMBER_TOKEN?Wt(e.number):Xt(e))/(2*Math.PI),s=Pt(r)?r.number/100:0,a=Pt(n)?n.number/100:0,c=void 0!==i&&Pt(i)?Vt(i,1):1;if(0===s)return tA(255*a,255*a,255*a,1);var u=a<=.5?a*(s+1):a+s-a*s,l=2*a-u,f=rA(l,u,o+1/3),d=rA(l,u,o),p=rA(l,u,o-1/3);return tA(255*f,255*d,255*p,c)},sA={hsl:oA,hsla:oA,rgb:eA,rgba:eA},aA={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199};(function(t){t[t.VALUE=0]="VALUE",t[t.LIST=1]="LIST",t[t.IDENT_VALUE=2]="IDENT_VALUE",t[t.TYPE_VALUE=3]="TYPE_VALUE",t[t.TOKEN_VALUE=4]="TOKEN_VALUE"})(nA||(nA={})),function(t){t[t.BORDER_BOX=0]="BORDER_BOX",t[t.PADDING_BOX=1]="PADDING_BOX",t[t.CONTENT_BOX=2]="CONTENT_BOX"}(iA||(iA={}));var cA,uA,lA,hA={name:"background-clip",initialValue:"border-box",prefix:!1,type:nA.LIST,parse:function(t){return t.map(function(t){if(St(t))switch(t.value){case"padding-box":return iA.PADDING_BOX;case"content-box":return iA.CONTENT_BOX}return iA.BORDER_BOX})}},fA={name:"background-color",initialValue:"transparent",prefix:!1,type:nA.TYPE_VALUE,format:"color"},dA=function(t){var A=Yt(t[0]),e=t[1];return e&&Pt(e)?{color:A,stop:e}:{color:A,stop:null}},pA=function(t,A){var e=t[0],r=t[t.length-1];null===e.stop&&(e.stop=kt),null===r.stop&&(r.stop=jt);for(var n=[],i=0,o=0;oi?n.push(a):n.push(i),i=a}else n.push(null)}var c=null;for(o=0;ot.optimumDistance)?{optimumCorner:A,optimumDistance:s}:t},{optimumDistance:n?1/0:-1/0,optimumCorner:null}).optimumCorner},wA=function(t){var A=Wt(180),e=[];return Ot(t).forEach(function(t,r){if(0===r){var n=t[0];if(n.type===h.IDENT_TOKEN&&-1!==["top","left","right","bottom"].indexOf(n.value))return void(A=Jt(t));if(Gt(n))return void(A=(Xt(n)+Wt(270))%Wt(360))}var i=dA(t);e.push(i)}),{angle:A,stops:e,type:cA.LINEAR_GRADIENT}},mA=function(t){return 0===t[0]&&255===t[1]&&0===t[2]&&255===t[3]},QA=function(t,A,e,r,n){var i="http://www.w3.org/2000/svg",o=document.createElementNS(i,"svg"),s=document.createElementNS(i,"foreignObject");return o.setAttributeNS(null,"width",t.toString()),o.setAttributeNS(null,"height",A.toString()),s.setAttributeNS(null,"width","100%"),s.setAttributeNS(null,"height","100%"),s.setAttributeNS(null,"x",e.toString()),s.setAttributeNS(null,"y",r.toString()),s.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(s),s.appendChild(n),o},CA=function(t){return new Promise(function(A,e){var r=new Image;r.onload=function(){return A(r)},r.onerror=e,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(t))})},yA={get SUPPORT_RANGE_BOUNDS(){var t=function(t){if(t.createRange){var A=t.createRange();if(A.getBoundingClientRect){var e=t.createElement("boundtest");e.style.height="123px",e.style.display="block",t.body.appendChild(e),A.selectNode(e);var r=A.getBoundingClientRect(),n=Math.round(r.height);if(t.body.removeChild(e),123===n)return!0}}return!1}(document);return Object.defineProperty(yA,"SUPPORT_RANGE_BOUNDS",{value:t}),t},get SUPPORT_SVG_DRAWING(){var t=function(t){var A=new Image,e=t.createElement("canvas"),r=e.getContext("2d");if(!r)return!1;A.src="data:image/svg+xml,";try{r.drawImage(A,0,0),e.toDataURL()}catch(t){return!1}return!0}(document);return Object.defineProperty(yA,"SUPPORT_SVG_DRAWING",{value:t}),t},get SUPPORT_FOREIGNOBJECT_DRAWING(){var t="function"==typeof Array.from&&"function"==typeof window.fetch?function(t){var A=t.createElement("canvas");A.width=100,A.height=100;var e=A.getContext("2d");if(!e)return Promise.reject(!1);e.fillStyle="rgb(0, 255, 0)",e.fillRect(0,0,100,100);var r=new Image,n=A.toDataURL();r.src=n;var i=QA(100,100,0,0,r);return e.fillStyle="red",e.fillRect(0,0,100,100),CA(i).then(function(A){e.drawImage(A,0,0);var r=e.getImageData(0,0,100,100).data;e.fillStyle="red",e.fillRect(0,0,100,100);var i=t.createElement("div");return i.style.backgroundImage="url("+n+")",i.style.height="100px",mA(r)?CA(QA(100,100,0,0,i)):Promise.reject(!1)}).then(function(t){return e.drawImage(t,0,0),mA(e.getImageData(0,0,100,100).data)}).catch(function(){return!1})}(document):Promise.resolve(!1);return Object.defineProperty(yA,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:t}),t},get SUPPORT_CORS_IMAGES(){var t=void 0!==(new Image).crossOrigin;return Object.defineProperty(yA,"SUPPORT_CORS_IMAGES",{value:t}),t},get SUPPORT_RESPONSE_TYPE(){var t="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(yA,"SUPPORT_RESPONSE_TYPE",{value:t}),t},get SUPPORT_CORS_XHR(){var t="withCredentials"in new XMLHttpRequest;return Object.defineProperty(yA,"SUPPORT_CORS_XHR",{value:t}),t}},vA=function(){function t(t){var A=t.id,e=t.enabled;this.id=A,this.enabled=e,this.start=Date.now()}return t.prototype.debug=function(){for(var t=[],A=0;A0&&setTimeout(function(){return A("Timed out ("+o._options.imageTimeout+"ms) loading image")},o._options.imageTimeout)})];case 3:return[2,n.sent()]}})})},t.prototype.has=function(t){return void 0!==this._cache[t]},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(t){var A=this,e=this._options.proxy;if(!e)throw new Error("No proxy defined");var r=t.substring(0,256);return new Promise(function(n,i){var o=yA.SUPPORT_RESPONSE_TYPE?"blob":"text",s=new XMLHttpRequest;if(s.onload=function(){if(200===s.status)if("text"===o)n(s.response);else{var t=new FileReader;t.addEventListener("load",function(){return n(t.result)},!1),t.addEventListener("error",function(t){return i(t)},!1),t.readAsDataURL(s.response)}else i("Failed to proxy resource "+r+" with status code "+s.status)},s.onerror=i,s.open("GET",e+"?url="+encodeURIComponent(t)+"&responseType="+o),"text"!==o&&s instanceof XMLHttpRequest&&(s.responseType=o),A._options.imageTimeout){var a=A._options.imageTimeout;s.timeout=a,s.ontimeout=function(){return i("Timed out ("+a+"ms) proxying "+r)}}s.send()})},t}(),NA=/^data:image\/svg\+xml/i,EA=/^data:image\/.*;base64,/i,bA=/^data:image\/.*/i,LA=function(t){return yA.SUPPORT_SVG_DRAWING||!IA(t)},HA=function(t){return bA.test(t)},xA=function(t){return EA.test(t)},SA=function(t){return"blob"===t.substr(0,4)},IA=function(t){return"svg"===t.substr(-3).toLowerCase()||NA.test(t)},_A=function(t){var A=uA.CIRCLE,e=lA.FARTHEST_CORNER,r=[],n=[];return Ot(t).forEach(function(t,i){var o=!0;if(0===i?o=t.reduce(function(t,A){if(St(A))switch(A.value){case"center":return n.push(zt),!1;case"top":case"left":return n.push(kt),!1;case"right":case"bottom":return n.push(jt),!1}else if(Pt(A)||Mt(A))return n.push(A),!1;return t},o):1===i&&(o=t.reduce(function(t,r){if(St(r))switch(r.value){case"circle":return A=uA.CIRCLE,!1;case"ellipse":return A=uA.ELLIPSE,!1;case"contain":case"closest-side":return e=lA.CLOSEST_SIDE,!1;case"farthest-side":return e=lA.FARTHEST_SIDE,!1;case"closest-corner":return e=lA.CLOSEST_CORNER,!1;case"cover":case"farthest-corner":return e=lA.FARTHEST_CORNER,!1}else if(Mt(r)||Pt(r))return Array.isArray(e)||(e=[]),e.push(r),!1;return t},o)),o){var s=dA(t);r.push(s)}}),{size:e,shape:A,stops:r,position:n,type:cA.RADIAL_GRADIENT}};!function(t){t[t.URL=0]="URL",t[t.LINEAR_GRADIENT=1]="LINEAR_GRADIENT",t[t.RADIAL_GRADIENT=2]="RADIAL_GRADIENT"}(cA||(cA={})),function(t){t[t.CIRCLE=0]="CIRCLE",t[t.ELLIPSE=1]="ELLIPSE"}(uA||(uA={})),function(t){t[t.CLOSEST_SIDE=0]="CLOSEST_SIDE",t[t.FARTHEST_SIDE=1]="FARTHEST_SIDE",t[t.CLOSEST_CORNER=2]="CLOSEST_CORNER",t[t.FARTHEST_CORNER=3]="FARTHEST_CORNER"}(lA||(lA={}));var TA,RA=function(t){if(t.type===h.URL_TOKEN){var A={url:t.value,type:cA.URL};return FA.getInstance().addImage(t.value),A}if(t.type===h.FUNCTION){var e=OA[t.name];if(void 0===e)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return e(t.values)}throw new Error("Unsupported image type")},OA={"linear-gradient":function(t){var A=Wt(180),e=[];return Ot(t).forEach(function(t,r){if(0===r){var n=t[0];if(n.type===h.IDENT_TOKEN&&"to"===n.value)return void(A=Jt(t));if(Gt(n))return void(A=Xt(n))}var i=dA(t);e.push(i)}),{angle:A,stops:e,type:cA.LINEAR_GRADIENT}},"-moz-linear-gradient":wA,"-ms-linear-gradient":wA,"-o-linear-gradient":wA,"-webkit-linear-gradient":wA,"radial-gradient":function(t){var A=uA.CIRCLE,e=lA.FARTHEST_CORNER,r=[],n=[];return Ot(t).forEach(function(t,i){var o=!0;if(0===i){var s=!1;o=t.reduce(function(t,r){if(s)if(St(r))switch(r.value){case"center":return n.push(zt),t;case"top":case"left":return n.push(kt),t;case"right":case"bottom":return n.push(jt),t}else(Pt(r)||Mt(r))&&n.push(r);else if(St(r))switch(r.value){case"circle":return A=uA.CIRCLE,!1;case"ellipse":return A=uA.ELLIPSE,!1;case"at":return s=!0,!1;case"closest-side":return e=lA.CLOSEST_SIDE,!1;case"cover":case"farthest-side":return e=lA.FARTHEST_SIDE,!1;case"contain":case"closest-corner":return e=lA.CLOSEST_CORNER,!1;case"farthest-corner":return e=lA.FARTHEST_CORNER,!1}else if(Mt(r)||Pt(r))return Array.isArray(e)||(e=[]),e.push(r),!1;return t},o)}if(o){var a=dA(t);r.push(a)}}),{size:e,shape:A,stops:r,position:n,type:cA.RADIAL_GRADIENT}},"-moz-radial-gradient":_A,"-ms-radial-gradient":_A,"-o-radial-gradient":_A,"-webkit-radial-gradient":_A,"-webkit-gradient":function(t){var A=Wt(180),e=[],r=cA.LINEAR_GRADIENT,n=uA.CIRCLE,i=lA.FARTHEST_CORNER;return Ot(t).forEach(function(t,A){var n=t[0];if(0===A){if(St(n)&&"linear"===n.value)return void(r=cA.LINEAR_GRADIENT);if(St(n)&&"radial"===n.value)return void(r=cA.RADIAL_GRADIENT)}if(n.type===h.FUNCTION)if("from"===n.name){var i=Yt(n.values[0]);e.push({stop:kt,color:i})}else if("to"===n.name)i=Yt(n.values[0]),e.push({stop:jt,color:i});else if("color-stop"===n.name){var o=n.values.filter(Rt);if(2===o.length){i=Yt(o[1]);var s=o[0];xt(s)&&e.push({stop:{type:h.PERCENTAGE_TOKEN,number:100*s.number,flags:s.flags},color:i})}}}),r===cA.LINEAR_GRADIENT?{angle:(A+Wt(180))%Wt(360),stops:e,type:r}:{size:i,shape:n,stops:e,position:[],type:r}}},KA={name:"background-image",initialValue:"none",type:nA.LIST,prefix:!1,parse:function(t){if(0===t.length)return[];var A=t[0];return A.type===h.IDENT_TOKEN&&"none"===A.value?[]:t.filter(function(t){return Rt(t)&&function(t){return t.type!==h.FUNCTION||OA[t.name]}(t)}).map(RA)}},MA={name:"background-origin",initialValue:"border-box",prefix:!1,type:nA.LIST,parse:function(t){return t.map(function(t){if(St(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},PA={name:"background-position",initialValue:"0% 0%",type:nA.LIST,prefix:!1,parse:function(t){return Ot(t).map(function(t){return t.filter(Pt)}).map(Dt)}};!function(t){t[t.REPEAT=0]="REPEAT",t[t.NO_REPEAT=1]="NO_REPEAT",t[t.REPEAT_X=2]="REPEAT_X",t[t.REPEAT_Y=3]="REPEAT_Y"}(TA||(TA={}));var DA,kA={name:"background-repeat",initialValue:"repeat",prefix:!1,type:nA.LIST,parse:function(t){return Ot(t).map(function(t){return t.filter(St).map(function(t){return t.value}).join(" ")}).map(zA)}},zA=function(t){switch(t){case"no-repeat":return TA.NO_REPEAT;case"repeat-x":case"repeat no-repeat":return TA.REPEAT_X;case"repeat-y":case"no-repeat repeat":return TA.REPEAT_Y;default:return TA.REPEAT}};!function(t){t.AUTO="auto",t.CONTAIN="contain",t.COVER="cover"}(DA||(DA={}));var jA,qA={name:"background-size",initialValue:"0",prefix:!1,type:nA.LIST,parse:function(t){return Ot(t).map(function(t){return t.filter(VA)})}},VA=function(t){return St(t)||Pt(t)},XA=function(t){return{name:"border-"+t+"-color",initialValue:"transparent",prefix:!1,type:nA.TYPE_VALUE,format:"color"}},GA=XA("top"),JA=XA("right"),WA=XA("bottom"),YA=XA("left"),ZA=function(t){return{name:"border-radius-"+t,initialValue:"0 0",prefix:!1,type:nA.LIST,parse:function(t){return Dt(t.filter(Pt))}}},$A=ZA("top-left"),te=ZA("top-right"),Ae=ZA("bottom-right"),ee=ZA("bottom-left");!function(t){t[t.NONE=0]="NONE",t[t.SOLID=1]="SOLID"}(jA||(jA={}));var re,ne=function(t){return{name:"border-"+t+"-style",initialValue:"solid",prefix:!1,type:nA.IDENT_VALUE,parse:function(t){return"none"===t?jA.NONE:jA.SOLID}}},ie=ne("top"),oe=ne("right"),se=ne("bottom"),ae=ne("left"),ce=function(t){return{name:"border-"+t+"-width",initialValue:"0",type:nA.VALUE,prefix:!1,parse:function(t){return Ht(t)?t.number:0}}},ue=ce("top"),le=ce("right"),he=ce("bottom"),fe=ce("left"),de={name:"color",initialValue:"transparent",prefix:!1,type:nA.TYPE_VALUE,format:"color"},pe={name:"display",initialValue:"inline-block",prefix:!1,type:nA.LIST,parse:function(t){return t.filter(St).reduce(function(t,A){return t|Be(A.value)},0)}},Be=function(t){switch(t){case"block":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0};!function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.INLINE_START=3]="INLINE_START",t[t.INLINE_END=4]="INLINE_END"}(re||(re={}));var ge,we={name:"float",initialValue:"none",prefix:!1,type:nA.IDENT_VALUE,parse:function(t){switch(t){case"left":return re.LEFT;case"right":return re.RIGHT;case"inline-start":return re.INLINE_START;case"inline-end":return re.INLINE_END}return re.NONE}},me={name:"letter-spacing",initialValue:"0",prefix:!1,type:nA.VALUE,parse:function(t){return t.type===h.IDENT_TOKEN&&"normal"===t.value?0:t.type===h.NUMBER_TOKEN||t.type===h.DIMENSION_TOKEN?t.number:0}};!function(t){t.NORMAL="normal",t.STRICT="strict"}(ge||(ge={}));var Qe,Ce={name:"line-break",initialValue:"normal",prefix:!1,type:nA.IDENT_VALUE,parse:function(t){return"strict"===t?ge.STRICT:ge.NORMAL}},ye={name:"line-height",initialValue:"normal",prefix:!1,type:nA.TOKEN_VALUE},ve={name:"list-style-image",initialValue:"none",type:nA.VALUE,prefix:!1,parse:function(t){return t.type===h.IDENT_TOKEN&&"none"===t.value?null:RA(t)}};!function(t){t[t.INSIDE=0]="INSIDE",t[t.OUTSIDE=1]="OUTSIDE"}(Qe||(Qe={}));var Fe,Ue={name:"list-style-position",initialValue:"outside",prefix:!1,type:nA.IDENT_VALUE,parse:function(t){return"inside"===t?Qe.INSIDE:Qe.OUTSIDE}};!function(t){t[t.NONE=-1]="NONE",t[t.DISC=0]="DISC",t[t.CIRCLE=1]="CIRCLE",t[t.SQUARE=2]="SQUARE",t[t.DECIMAL=3]="DECIMAL",t[t.CJK_DECIMAL=4]="CJK_DECIMAL",t[t.DECIMAL_LEADING_ZERO=5]="DECIMAL_LEADING_ZERO",t[t.LOWER_ROMAN=6]="LOWER_ROMAN",t[t.UPPER_ROMAN=7]="UPPER_ROMAN",t[t.LOWER_GREEK=8]="LOWER_GREEK",t[t.LOWER_ALPHA=9]="LOWER_ALPHA",t[t.UPPER_ALPHA=10]="UPPER_ALPHA",t[t.ARABIC_INDIC=11]="ARABIC_INDIC",t[t.ARMENIAN=12]="ARMENIAN",t[t.BENGALI=13]="BENGALI",t[t.CAMBODIAN=14]="CAMBODIAN",t[t.CJK_EARTHLY_BRANCH=15]="CJK_EARTHLY_BRANCH",t[t.CJK_HEAVENLY_STEM=16]="CJK_HEAVENLY_STEM",t[t.CJK_IDEOGRAPHIC=17]="CJK_IDEOGRAPHIC",t[t.DEVANAGARI=18]="DEVANAGARI",t[t.ETHIOPIC_NUMERIC=19]="ETHIOPIC_NUMERIC",t[t.GEORGIAN=20]="GEORGIAN",t[t.GUJARATI=21]="GUJARATI",t[t.GURMUKHI=22]="GURMUKHI",t[t.HEBREW=22]="HEBREW",t[t.HIRAGANA=23]="HIRAGANA",t[t.HIRAGANA_IROHA=24]="HIRAGANA_IROHA",t[t.JAPANESE_FORMAL=25]="JAPANESE_FORMAL",t[t.JAPANESE_INFORMAL=26]="JAPANESE_INFORMAL",t[t.KANNADA=27]="KANNADA",t[t.KATAKANA=28]="KATAKANA",t[t.KATAKANA_IROHA=29]="KATAKANA_IROHA",t[t.KHMER=30]="KHMER",t[t.KOREAN_HANGUL_FORMAL=31]="KOREAN_HANGUL_FORMAL",t[t.KOREAN_HANJA_FORMAL=32]="KOREAN_HANJA_FORMAL",t[t.KOREAN_HANJA_INFORMAL=33]="KOREAN_HANJA_INFORMAL",t[t.LAO=34]="LAO",t[t.LOWER_ARMENIAN=35]="LOWER_ARMENIAN",t[t.MALAYALAM=36]="MALAYALAM",t[t.MONGOLIAN=37]="MONGOLIAN",t[t.MYANMAR=38]="MYANMAR",t[t.ORIYA=39]="ORIYA",t[t.PERSIAN=40]="PERSIAN",t[t.SIMP_CHINESE_FORMAL=41]="SIMP_CHINESE_FORMAL",t[t.SIMP_CHINESE_INFORMAL=42]="SIMP_CHINESE_INFORMAL",t[t.TAMIL=43]="TAMIL",t[t.TELUGU=44]="TELUGU",t[t.THAI=45]="THAI",t[t.TIBETAN=46]="TIBETAN",t[t.TRAD_CHINESE_FORMAL=47]="TRAD_CHINESE_FORMAL",t[t.TRAD_CHINESE_INFORMAL=48]="TRAD_CHINESE_INFORMAL",t[t.UPPER_ARMENIAN=49]="UPPER_ARMENIAN",t[t.DISCLOSURE_OPEN=50]="DISCLOSURE_OPEN",t[t.DISCLOSURE_CLOSED=51]="DISCLOSURE_CLOSED"}(Fe||(Fe={}));var Ne,Ee={name:"list-style-type",initialValue:"none",prefix:!1,type:nA.IDENT_VALUE,parse:function(t){switch(t){case"disc":return Fe.DISC;case"circle":return Fe.CIRCLE;case"square":return Fe.SQUARE;case"decimal":return Fe.DECIMAL;case"cjk-decimal":return Fe.CJK_DECIMAL;case"decimal-leading-zero":return Fe.DECIMAL_LEADING_ZERO;case"lower-roman":return Fe.LOWER_ROMAN;case"upper-roman":return Fe.UPPER_ROMAN;case"lower-greek":return Fe.LOWER_GREEK;case"lower-alpha":return Fe.LOWER_ALPHA;case"upper-alpha":return Fe.UPPER_ALPHA;case"arabic-indic":return Fe.ARABIC_INDIC;case"armenian":return Fe.ARMENIAN;case"bengali":return Fe.BENGALI;case"cambodian":return Fe.CAMBODIAN;case"cjk-earthly-branch":return Fe.CJK_EARTHLY_BRANCH;case"cjk-heavenly-stem":return Fe.CJK_HEAVENLY_STEM;case"cjk-ideographic":return Fe.CJK_IDEOGRAPHIC;case"devanagari":return Fe.DEVANAGARI;case"ethiopic-numeric":return Fe.ETHIOPIC_NUMERIC;case"georgian":return Fe.GEORGIAN;case"gujarati":return Fe.GUJARATI;case"gurmukhi":return Fe.GURMUKHI;case"hebrew":return Fe.HEBREW;case"hiragana":return Fe.HIRAGANA;case"hiragana-iroha":return Fe.HIRAGANA_IROHA;case"japanese-formal":return Fe.JAPANESE_FORMAL;case"japanese-informal":return Fe.JAPANESE_INFORMAL;case"kannada":return Fe.KANNADA;case"katakana":return Fe.KATAKANA;case"katakana-iroha":return Fe.KATAKANA_IROHA;case"khmer":return Fe.KHMER;case"korean-hangul-formal":return Fe.KOREAN_HANGUL_FORMAL;case"korean-hanja-formal":return Fe.KOREAN_HANJA_FORMAL;case"korean-hanja-informal":return Fe.KOREAN_HANJA_INFORMAL;case"lao":return Fe.LAO;case"lower-armenian":return Fe.LOWER_ARMENIAN;case"malayalam":return Fe.MALAYALAM;case"mongolian":return Fe.MONGOLIAN;case"myanmar":return Fe.MYANMAR;case"oriya":return Fe.ORIYA;case"persian":return Fe.PERSIAN;case"simp-chinese-formal":return Fe.SIMP_CHINESE_FORMAL;case"simp-chinese-informal":return Fe.SIMP_CHINESE_INFORMAL;case"tamil":return Fe.TAMIL;case"telugu":return Fe.TELUGU;case"thai":return Fe.THAI;case"tibetan":return Fe.TIBETAN;case"trad-chinese-formal":return Fe.TRAD_CHINESE_FORMAL;case"trad-chinese-informal":return Fe.TRAD_CHINESE_INFORMAL;case"upper-armenian":return Fe.UPPER_ARMENIAN;case"disclosure-open":return Fe.DISCLOSURE_OPEN;case"disclosure-closed":return Fe.DISCLOSURE_CLOSED;default:return Fe.NONE}}},be=function(t){return{name:"margin-"+t,initialValue:"0",prefix:!1,type:nA.TOKEN_VALUE}},Le=be("top"),He=be("right"),xe=be("bottom"),Se=be("left");!function(t){t[t.VISIBLE=0]="VISIBLE",t[t.HIDDEN=1]="HIDDEN",t[t.SCROLL=2]="SCROLL",t[t.AUTO=3]="AUTO"}(Ne||(Ne={}));var Ie,_e={name:"overflow",initialValue:"visible",prefix:!1,type:nA.LIST,parse:function(t){return t.filter(St).map(function(t){switch(t.value){case"hidden":return Ne.HIDDEN;case"scroll":return Ne.SCROLL;case"auto":return Ne.AUTO;default:return Ne.VISIBLE}})}};!function(t){t.NORMAL="normal",t.BREAK_WORD="break-word"}(Ie||(Ie={}));var Te,Re={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:nA.IDENT_VALUE,parse:function(t){return"break-word"===t?Ie.BREAK_WORD:Ie.NORMAL}},Oe=function(t){return{name:"padding-"+t,initialValue:"0",prefix:!1,type:nA.TYPE_VALUE,format:"length-percentage"}},Ke=Oe("top"),Me=Oe("right"),Pe=Oe("bottom"),De=Oe("left");!function(t){t[t.LEFT=0]="LEFT",t[t.CENTER=1]="CENTER",t[t.RIGHT=2]="RIGHT"}(Te||(Te={}));var ke,ze={name:"text-align",initialValue:"left",prefix:!1,type:nA.IDENT_VALUE,parse:function(t){switch(t){case"right":return Te.RIGHT;case"center":case"justify":return Te.CENTER;default:return Te.LEFT}}};!function(t){t[t.STATIC=0]="STATIC",t[t.RELATIVE=1]="RELATIVE",t[t.ABSOLUTE=2]="ABSOLUTE",t[t.FIXED=3]="FIXED",t[t.STICKY=4]="STICKY"}(ke||(ke={}));var je,qe={name:"position",initialValue:"static",prefix:!1,type:nA.IDENT_VALUE,parse:function(t){switch(t){case"relative":return ke.RELATIVE;case"absolute":return ke.ABSOLUTE;case"fixed":return ke.FIXED;case"sticky":return ke.STICKY}return ke.STATIC}},Ve={name:"text-shadow",initialValue:"none",type:nA.LIST,prefix:!1,parse:function(t){return 1===t.length&&_t(t[0],"none")?[]:Ot(t).map(function(t){for(var A={color:aA.TRANSPARENT,offsetX:kt,offsetY:kt,blur:kt},e=0,r=0;r1?1:0],this.overflowWrap=Fr(Re,t.overflowWrap),this.paddingTop=Fr(Ke,t.paddingTop),this.paddingRight=Fr(Me,t.paddingRight),this.paddingBottom=Fr(Pe,t.paddingBottom),this.paddingLeft=Fr(De,t.paddingLeft),this.position=Fr(qe,t.position),this.textAlign=Fr(ze,t.textAlign),this.textDecorationColor=Fr(or,t.textDecorationColor||t.color),this.textDecorationLine=Fr(sr,t.textDecorationLine),this.textShadow=Fr(Ve,t.textShadow),this.textTransform=Fr(Ge,t.textTransform),this.transform=Fr(Je,t.transform),this.transformOrigin=Fr($e,t.transformOrigin),this.visibility=Fr(Ar,t.visibility),this.wordBreak=Fr(rr,t.wordBreak),this.zIndex=Fr(nr,t.zIndex)}return t.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===Xe.VISIBLE},t.prototype.isTransparent=function(){return Zt(this.backgroundColor)},t.prototype.isTransformed=function(){return null!==this.transform},t.prototype.isPositioned=function(){return this.position!==ke.STATIC},t.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},t.prototype.isFloating=function(){return this.float!==re.NONE},t.prototype.isInlineLevel=function(){return dr(this.display,4)||dr(this.display,33554432)||dr(this.display,268435456)||dr(this.display,536870912)||dr(this.display,67108864)||dr(this.display,134217728)},t}(),yr=function(t){this.content=Fr(pr,t.content),this.quotes=Fr(wr,t.quotes)},vr=function(t){this.counterIncrement=Fr(Br,t.counterIncrement),this.counterReset=Fr(gr,t.counterReset)},Fr=function(t,A){var e=new bt,r=null!=A?A.toString():t.initialValue;e.write(r);var n=new Lt(e.read());switch(t.type){case nA.IDENT_VALUE:var i=n.parseComponentValue();return t.parse(St(i)?i.value:t.initialValue);case nA.VALUE:return t.parse(n.parseComponentValue());case nA.LIST:return t.parse(n.parseComponentValues());case nA.TOKEN_VALUE:return n.parseComponentValue();case nA.TYPE_VALUE:switch(t.format){case"angle":return Xt(n.parseComponentValue());case"color":return Yt(n.parseComponentValue());case"image":return RA(n.parseComponentValue());case"length":var o=n.parseComponentValue();return Mt(o)?o:kt;case"length-percentage":var s=n.parseComponentValue();return Pt(s)?s:kt}}throw new Error("Attempting to parse unsupported css format type "+t.format)},Ur=function(t){this.styles=new Cr(window.getComputedStyle(t,null)),this.textNodes=[],this.elements=[],null!==this.styles.transform&&tn(t)&&(t.style.transform="none"),this.bounds=o(t),this.flags=0},Nr=function(t,A){this.text=t,this.bounds=A},Er=function(t){var A=t.ownerDocument;if(A){var e=A.createElement("html2canvaswrapper");e.appendChild(t.cloneNode(!0));var r=t.parentNode;if(r){r.replaceChild(e,t);var n=o(e);return e.firstChild&&r.replaceChild(e.firstChild,e),n}}return new i(0,0,0,0)},br=function(t,A,e){var r=t.ownerDocument;if(!r)throw new Error("Node has no owner document");var n=r.createRange();return n.setStart(t,A),n.setEnd(t,A+e),i.fromClientRect(n.getBoundingClientRect())},Lr=function(t,A){for(var e,r=function(t,A){var e=s(t),r=function(t,A){A||(A={lineBreak:"normal",wordBreak:"normal"});var e=function(t,A){void 0===A&&(A="strict");var e=[],r=[],n=[];return t.forEach(function(t,i){var o=M.get(t);if(o>50?(n.push(!0),o-=50):n.push(!1),-1!==["normal","auto","loose"].indexOf(A)&&-1!==[8208,8211,12316,12448].indexOf(t))return r.push(i),e.push(16);if(4===o||11===o){if(0===i)return r.push(i),e.push(L);var s=e[i-1];return-1===j.indexOf(s)?(r.push(r[i-1]),e.push(s)):(r.push(i),e.push(L))}return r.push(i),31===o?e.push("strict"===A?y:_):o===K||29===o?e.push(L):43===o?t>=131072&&t<=196605||t>=196608&&t<=262141?e.push(_):e.push(L):void e.push(o)}),[r,e,n]}(t,A.lineBreak),r=e[0],n=e[1],i=e[2];return"break-all"!==A.wordBreak&&"break-word"!==A.wordBreak||(n=n.map(function(t){return-1!==[U,L,K].indexOf(t)?_:t})),[r,n,"keep-all"===A.wordBreak?i.map(function(A,e){return A&&t[e]>=19968&&t[e]<=40959}):void 0]}(e,A),n=r[0],i=r[1],o=r[2],a=e.length,c=0,u=0;return{next:function(){if(u>=a)return{done:!0,value:null};for(var t="\xd7";u0)if(yA.SUPPORT_RANGE_BOUNDS)n.push(new Nr(t,br(e,i,t.length)));else{var r=e.splitText(t.length);n.push(new Nr(t,Er(e))),e=r}else yA.SUPPORT_RANGE_BOUNDS||(e=e.splitText(t.length));i+=t.length}),n}(this.text,A,t)},xr=function(t,A){switch(A){case je.LOWERCASE:return t.toLowerCase();case je.CAPITALIZE:return t.replace(Sr,Ir);case je.UPPERCASE:return t.toUpperCase();default:return t}},Sr=/(^|\s|:|-|\(|\))([a-z])/g,Ir=function(t,A,e){return t.length>0?A+e.toUpperCase():t},_r=function(t){function e(A){var e=t.call(this,A)||this;return e.src=A.currentSrc||A.src,e.intrinsicWidth=A.naturalWidth,e.intrinsicHeight=A.naturalHeight,FA.getInstance().addImage(e.src),e}return A(e,t),e}(Ur),Tr=function(t){function e(A){var e=t.call(this,A)||this;return e.canvas=A,e.intrinsicWidth=A.width,e.intrinsicHeight=A.height,e}return A(e,t),e}(Ur),Rr=function(t){function e(A){var e=t.call(this,A)||this,r=new XMLSerializer;return e.svg="data:image/svg+xml,"+encodeURIComponent(r.serializeToString(A)),e.intrinsicWidth=A.width.baseVal.value,e.intrinsicHeight=A.height.baseVal.value,FA.getInstance().addImage(e.svg),e}return A(e,t),e}(Ur),Or=function(t){function e(A){var e=t.call(this,A)||this;return e.value=A.value,e}return A(e,t),e}(Ur),Kr=function(t){function e(A){var e=t.call(this,A)||this;return e.start=A.start,e.reversed="boolean"==typeof A.reversed&&!0===A.reversed,e}return A(e,t),e}(Ur),Mr=[{type:h.DIMENSION_TOKEN,flags:0,unit:"px",number:3}],Pr=[{type:h.PERCENTAGE_TOKEN,flags:0,number:50}],Dr=function(t){function e(A){var e,r,n,o=t.call(this,A)||this;switch(o.type=A.type.toLowerCase(),o.checked=A.checked,o.value=0===(r="password"===(e=A).type?new Array(e.value.length+1).join("\u2022"):e.value).length?e.placeholder||"":r,"checkbox"!==o.type&&"radio"!==o.type||(o.styles.backgroundColor=3739148031,o.styles.borderTopColor=o.styles.borderRightColor=o.styles.borderBottomColor=o.styles.borderLeftColor=2779096575,o.styles.borderTopWidth=o.styles.borderRightWidth=o.styles.borderBottomWidth=o.styles.borderLeftWidth=1,o.styles.borderTopStyle=o.styles.borderRightStyle=o.styles.borderBottomStyle=o.styles.borderLeftStyle=jA.SOLID,o.styles.backgroundClip=[iA.BORDER_BOX],o.styles.backgroundOrigin=[0],o.bounds=(n=o.bounds).width>n.height?new i(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)A.textNodes.push(new Hr(r,A.styles));else if($r(r)){var i=Gr(r);i.styles.isVisible()&&(Wr(r,i,e)?i.flags|=4:Yr(i.styles)&&(i.flags|=2),-1!==Vr.indexOf(r.tagName)&&(i.flags|=8),A.elements.push(i),fn(r)||on(r)||dn(r)||Xr(r,i,e))}},Gr=function(t){return cn(t)?new _r(t):an(t)?new Tr(t):on(t)?new Rr(t):en(t)?new Or(t):rn(t)?new Kr(t):nn(t)?new Dr(t):dn(t)?new kr(t):fn(t)?new zr(t):un(t)?new qr(t):new Ur(t)},Jr=function(t){var A=Gr(t);return A.flags|=4,Xr(t,A,A),A},Wr=function(t,A,e){return A.styles.isPositionedWithZIndex()||A.styles.opacity<1||A.styles.isTransformed()||sn(t)&&e.styles.isTransparent()},Yr=function(t){return t.isPositioned()||t.isFloating()},Zr=function(t){return t.nodeType===Node.TEXT_NODE},$r=function(t){return t.nodeType===Node.ELEMENT_NODE},tn=function(t){return $r(t)&&void 0!==t.style&&!An(t)},An=function(t){return"object"==typeof t.className},en=function(t){return"LI"===t.tagName},rn=function(t){return"OL"===t.tagName},nn=function(t){return"INPUT"===t.tagName},on=function(t){return"svg"===t.tagName},sn=function(t){return"BODY"===t.tagName},an=function(t){return"CANVAS"===t.tagName},cn=function(t){return"IMG"===t.tagName},un=function(t){return"IFRAME"===t.tagName},ln=function(t){return"STYLE"===t.tagName},hn=function(t){return"SCRIPT"===t.tagName},fn=function(t){return"TEXTAREA"===t.tagName},dn=function(t){return"SELECT"===t.tagName},pn=function(){function t(){this.counters={}}return t.prototype.getCounterValue=function(t){var A=this.counters[t];return A&&A.length?A[A.length-1]:1},t.prototype.getCounterValues=function(t){return this.counters[t]||[]},t.prototype.pop=function(t){var A=this;t.forEach(function(t){return A.counters[t].pop()})},t.prototype.parse=function(t){var A=this,e=t.counterIncrement,r=t.counterReset,n=!0;null!==e&&e.forEach(function(t){var e=A.counters[t.counter];e&&0!==t.increment&&(n=!1,e[Math.max(0,e.length-1)]+=t.increment)});var i=[];return n&&r.forEach(function(t){var e=A.counters[t.counter];i.push(t.counter),e||(e=A.counters[t.counter]=[]),e.push(t.reset)}),i},t}(),Bn={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},gn={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054f","\u054e","\u054d","\u054c","\u054b","\u054a","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053f","\u053e","\u053d","\u053c","\u053b","\u053a","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},wn={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05d9\u05f3","\u05d8\u05f3","\u05d7\u05f3","\u05d6\u05f3","\u05d5\u05f3","\u05d4\u05f3","\u05d3\u05f3","\u05d2\u05f3","\u05d1\u05f3","\u05d0\u05f3","\u05ea","\u05e9","\u05e8","\u05e7","\u05e6","\u05e4","\u05e2","\u05e1","\u05e0","\u05de","\u05dc","\u05db","\u05d9\u05d8","\u05d9\u05d7","\u05d9\u05d6","\u05d8\u05d6","\u05d8\u05d5","\u05d9","\u05d8","\u05d7","\u05d6","\u05d5","\u05d4","\u05d3","\u05d2","\u05d1","\u05d0"]},mn={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10f5","\u10f0","\u10ef","\u10f4","\u10ee","\u10ed","\u10ec","\u10eb","\u10ea","\u10e9","\u10e8","\u10e7","\u10e6","\u10e5","\u10e4","\u10f3","\u10e2","\u10e1","\u10e0","\u10df","\u10de","\u10dd","\u10f2","\u10dc","\u10db","\u10da","\u10d9","\u10d8","\u10d7","\u10f1","\u10d6","\u10d5","\u10d4","\u10d3","\u10d2","\u10d1","\u10d0"]},Qn=function(t,A,e,r,n,i){return te?Un(t,n,i.length>0):r.integers.reduce(function(A,e,n){for(;t>=e;)t-=e,A+=r.values[n];return A},"")+i},Cn=function(t,A,e,r){var n="";do{e||t--,n=r(t)+n,t/=A}while(t*A>=A);return n},yn=function(t,A,e,r,n){var i=e-A+1;return(t<0?"-":"")+(Cn(Math.abs(t),i,r,function(t){return a(Math.floor(t%i)+A)})+n)},vn=function(t,A,e){void 0===e&&(e=". ");var r=A.length;return Cn(Math.abs(t),r,!1,function(t){return A[Math.floor(t%r)]})+e},Fn=function(t,A,e,r,n,i){if(t<-9999||t>9999)return Un(t,Fe.CJK_DECIMAL,n.length>0);var o=Math.abs(t),s=n;if(0===o)return A[0]+s;for(var a=0;o>0&&a<=4;a++){var c=o%10;0===c&&dr(i,1)&&""!==s?s=A[c]+s:c>1||1===c&&0===a||1===c&&1===a&&dr(i,2)||1===c&&1===a&&dr(i,4)&&t>100||1===c&&a>1&&dr(i,8)?s=A[c]+(a>0?e[a-1]:"")+s:1===c&&a>0&&(s=e[a-1]+s),o=Math.floor(o/10)}return(t<0?r:"")+s},Un=function(t,A,e){var r=e?". ":"",n=e?"\u3001":"",i=e?", ":"",o=e?" ":"";switch(A){case Fe.DISC:return"\u2022"+o;case Fe.CIRCLE:return"\u25e6"+o;case Fe.SQUARE:return"\u25fe"+o;case Fe.DECIMAL_LEADING_ZERO:var s=yn(t,48,57,!0,r);return s.length<4?"0"+s:s;case Fe.CJK_DECIMAL:return vn(t,"\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d",n);case Fe.LOWER_ROMAN:return Qn(t,1,3999,Bn,Fe.DECIMAL,r).toLowerCase();case Fe.UPPER_ROMAN:return Qn(t,1,3999,Bn,Fe.DECIMAL,r);case Fe.LOWER_GREEK:return yn(t,945,969,!1,r);case Fe.LOWER_ALPHA:return yn(t,97,122,!1,r);case Fe.UPPER_ALPHA:return yn(t,65,90,!1,r);case Fe.ARABIC_INDIC:return yn(t,1632,1641,!0,r);case Fe.ARMENIAN:case Fe.UPPER_ARMENIAN:return Qn(t,1,9999,gn,Fe.DECIMAL,r);case Fe.LOWER_ARMENIAN:return Qn(t,1,9999,gn,Fe.DECIMAL,r).toLowerCase();case Fe.BENGALI:return yn(t,2534,2543,!0,r);case Fe.CAMBODIAN:case Fe.KHMER:return yn(t,6112,6121,!0,r);case Fe.CJK_EARTHLY_BRANCH:return vn(t,"\u5b50\u4e11\u5bc5\u536f\u8fb0\u5df3\u5348\u672a\u7533\u9149\u620c\u4ea5",n);case Fe.CJK_HEAVENLY_STEM:return vn(t,"\u7532\u4e59\u4e19\u4e01\u620a\u5df1\u5e9a\u8f9b\u58ec\u7678",n);case Fe.CJK_IDEOGRAPHIC:case Fe.TRAD_CHINESE_INFORMAL:return Fn(t,"\u96f6\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u5341\u767e\u5343\u842c","\u8ca0",n,14);case Fe.TRAD_CHINESE_FORMAL:return Fn(t,"\u96f6\u58f9\u8cb3\u53c3\u8086\u4f0d\u9678\u67d2\u634c\u7396","\u62fe\u4f70\u4edf\u842c","\u8ca0",n,15);case Fe.SIMP_CHINESE_INFORMAL:return Fn(t,"\u96f6\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u5341\u767e\u5343\u842c","\u8d1f",n,14);case Fe.SIMP_CHINESE_FORMAL:return Fn(t,"\u96f6\u58f9\u8d30\u53c1\u8086\u4f0d\u9646\u67d2\u634c\u7396","\u62fe\u4f70\u4edf\u842c","\u8d1f",n,15);case Fe.JAPANESE_INFORMAL:return Fn(t,"\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u5341\u767e\u5343\u4e07","\u30de\u30a4\u30ca\u30b9",n,0);case Fe.JAPANESE_FORMAL:return Fn(t,"\u96f6\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d","\u62fe\u767e\u5343\u4e07","\u30de\u30a4\u30ca\u30b9",n,7);case Fe.KOREAN_HANGUL_FORMAL:return Fn(t,"\uc601\uc77c\uc774\uc0bc\uc0ac\uc624\uc721\uce60\ud314\uad6c","\uc2ed\ubc31\ucc9c\ub9cc","\ub9c8\uc774\ub108\uc2a4",i,7);case Fe.KOREAN_HANJA_INFORMAL:return Fn(t,"\u96f6\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u5341\u767e\u5343\u842c","\ub9c8\uc774\ub108\uc2a4",i,0);case Fe.KOREAN_HANJA_FORMAL:return Fn(t,"\u96f6\u58f9\u8cb3\u53c3\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u62fe\u767e\u5343","\ub9c8\uc774\ub108\uc2a4",i,7);case Fe.DEVANAGARI:return yn(t,2406,2415,!0,r);case Fe.GEORGIAN:return Qn(t,1,19999,mn,Fe.DECIMAL,r);case Fe.GUJARATI:return yn(t,2790,2799,!0,r);case Fe.GURMUKHI:return yn(t,2662,2671,!0,r);case Fe.HEBREW:return Qn(t,1,10999,wn,Fe.DECIMAL,r);case Fe.HIRAGANA:return vn(t,"\u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051\u3053\u3055\u3057\u3059\u305b\u305d\u305f\u3061\u3064\u3066\u3068\u306a\u306b\u306c\u306d\u306e\u306f\u3072\u3075\u3078\u307b\u307e\u307f\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308a\u308b\u308c\u308d\u308f\u3090\u3091\u3092\u3093");case Fe.HIRAGANA_IROHA:return vn(t,"\u3044\u308d\u306f\u306b\u307b\u3078\u3068\u3061\u308a\u306c\u308b\u3092\u308f\u304b\u3088\u305f\u308c\u305d\u3064\u306d\u306a\u3089\u3080\u3046\u3090\u306e\u304a\u304f\u3084\u307e\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304d\u3086\u3081\u307f\u3057\u3091\u3072\u3082\u305b\u3059");case Fe.KANNADA:return yn(t,3302,3311,!0,r);case Fe.KATAKANA:return vn(t,"\u30a2\u30a4\u30a6\u30a8\u30aa\u30ab\u30ad\u30af\u30b1\u30b3\u30b5\u30b7\u30b9\u30bb\u30bd\u30bf\u30c1\u30c4\u30c6\u30c8\u30ca\u30cb\u30cc\u30cd\u30ce\u30cf\u30d2\u30d5\u30d8\u30db\u30de\u30df\u30e0\u30e1\u30e2\u30e4\u30e6\u30e8\u30e9\u30ea\u30eb\u30ec\u30ed\u30ef\u30f0\u30f1\u30f2\u30f3",n);case Fe.KATAKANA_IROHA:return vn(t,"\u30a4\u30ed\u30cf\u30cb\u30db\u30d8\u30c8\u30c1\u30ea\u30cc\u30eb\u30f2\u30ef\u30ab\u30e8\u30bf\u30ec\u30bd\u30c4\u30cd\u30ca\u30e9\u30e0\u30a6\u30f0\u30ce\u30aa\u30af\u30e4\u30de\u30b1\u30d5\u30b3\u30a8\u30c6\u30a2\u30b5\u30ad\u30e6\u30e1\u30df\u30b7\u30f1\u30d2\u30e2\u30bb\u30b9",n);case Fe.LAO:return yn(t,3792,3801,!0,r);case Fe.MONGOLIAN:return yn(t,6160,6169,!0,r);case Fe.MYANMAR:return yn(t,4160,4169,!0,r);case Fe.ORIYA:return yn(t,2918,2927,!0,r);case Fe.PERSIAN:return yn(t,1776,1785,!0,r);case Fe.TAMIL:return yn(t,3046,3055,!0,r);case Fe.TELUGU:return yn(t,3174,3183,!0,r);case Fe.THAI:return yn(t,3664,3673,!0,r);case Fe.TIBETAN:return yn(t,3872,3881,!0,r);case Fe.DECIMAL:default:return yn(t,48,57,!0,r)}},Nn=function(){function t(t,A){if(this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new pn,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement)}return t.prototype.toIFrame=function(t,A){var e=this,i=bn(t,A);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var o=t.defaultView.pageXOffset,s=t.defaultView.pageYOffset,a=i.contentWindow,c=a.document,u=Ln(i).then(function(){return r(e,void 0,void 0,function(){var t;return n(this,function(e){switch(e.label){case 0:return this.scrolledElements.forEach(In),a&&(a.scrollTo(A.left,A.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||a.scrollY===A.top&&a.scrollX===A.left||(c.documentElement.style.top=-A.top+"px",c.documentElement.style.left=-A.left+"px",c.documentElement.style.position="absolute")),t=this.options.onclone,void 0===this.clonedReferenceElement?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:c.fonts&&c.fonts.ready?[4,c.fonts.ready]:[3,2];case 1:e.sent(),e.label=2;case 2:return"function"==typeof t?[2,Promise.resolve().then(function(){return t(c)}).then(function(){return i})]:[2,i]}})})});return c.open(),c.write(xn(document.doctype)+""),Sn(this.referenceElement.ownerDocument,o,s),c.replaceChild(c.adoptNode(this.documentElement),c.documentElement),c.close(),u},t.prototype.createElementClone=function(t){if(an(t))return this.createCanvasClone(t);if(ln(t))return this.createStyleClone(t);var A=t.cloneNode(!1);return cn(A)&&"lazy"===A.loading&&(A.loading="eager"),A},t.prototype.createStyleClone=function(t){try{var A=t.sheet;if(A&&A.cssRules){var e=[].slice.call(A.cssRules,0).reduce(function(t,A){return A&&"string"==typeof A.cssText?t+A.cssText:t},""),r=t.cloneNode(!1);return r.textContent=e,r}}catch(t){if(vA.getInstance(this.options.id).error("Unable to access cssRules property",t),"SecurityError"!==t.name)throw t}return t.cloneNode(!1)},t.prototype.createCanvasClone=function(t){if(this.options.inlineImages&&t.ownerDocument){var A=t.ownerDocument.createElement("img");try{return A.src=t.toDataURL(),A}catch(t){vA.getInstance(this.options.id).info("Unable to clone canvas contents, canvas is tainted")}}var e=t.cloneNode(!1);try{e.width=t.width,e.height=t.height;var r=t.getContext("2d"),n=e.getContext("2d");return n&&(r?n.putImageData(r.getImageData(0,0,t.width,t.height),0,0):n.drawImage(t,0,0)),e}catch(t){}return e},t.prototype.cloneNode=function(t){if(Zr(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var A=t.ownerDocument.defaultView;if(A&&$r(t)&&(tn(t)||An(t))){var e=this.createElementClone(t),r=A.getComputedStyle(t),n=A.getComputedStyle(t,":before"),i=A.getComputedStyle(t,":after");this.referenceElement===t&&tn(e)&&(this.clonedReferenceElement=e),sn(e)&&Rn(e);for(var o=this.counters.parse(new vr(r)),s=this.resolvePseudoContent(t,e,n,hr.BEFORE),a=t.firstChild;a;a=a.nextSibling)$r(a)&&(hn(a)||a.hasAttribute("data-html2canvas-ignore")||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(a))||this.options.copyStyles&&$r(a)&&ln(a)||e.appendChild(this.cloneNode(a));s&&e.insertBefore(s,e.firstChild);var c=this.resolvePseudoContent(t,e,i,hr.AFTER);return c&&e.appendChild(c),this.counters.pop(o),r&&(this.options.copyStyles||An(t))&&!un(t)&&Hn(r,e),0===t.scrollTop&&0===t.scrollLeft||this.scrolledElements.push([e,t.scrollLeft,t.scrollTop]),(fn(t)||dn(t))&&(fn(e)||dn(e))&&(e.value=t.value),e}return t.cloneNode(!1)},t.prototype.resolvePseudoContent=function(t,A,e,r){var n=this;if(e){var i=e.content,o=A.ownerDocument;if(o&&i&&"none"!==i&&"-moz-alt-content"!==i&&"none"!==e.display){this.counters.parse(new vr(e));var s=new yr(e),a=o.createElement("html2canvaspseudoelement");Hn(e,a),s.content.forEach(function(A){if(A.type===h.STRING_TOKEN)a.appendChild(o.createTextNode(A.value));else if(A.type===h.URL_TOKEN){var e=o.createElement("img");e.src=A.value,e.style.opacity="1",a.appendChild(e)}else if(A.type===h.FUNCTION){if("attr"===A.name){var r=A.values.filter(St);r.length&&a.appendChild(o.createTextNode(t.getAttribute(r[0].value)||""))}else if("counter"===A.name){var i=A.values.filter(Rt),c=i[0],u=i[1];if(c&&St(c)){var l=n.counters.getCounterValue(c.value),f=u&&St(u)?Ee.parse(u.value):Fe.DECIMAL;a.appendChild(o.createTextNode(Un(l,f,!1)))}}else if("counters"===A.name){var d=A.values.filter(Rt),p=(c=d[0],d[1]);if(u=d[2],c&&St(c)){var B=n.counters.getCounterValues(c.value),g=u&&St(u)?Ee.parse(u.value):Fe.DECIMAL,w=p&&p.type===h.STRING_TOKEN?p.value:"",m=B.map(function(t){return Un(t,g,!1)}).join(w);a.appendChild(o.createTextNode(m))}}}else if(A.type===h.IDENT_TOKEN)switch(A.value){case"open-quote":a.appendChild(o.createTextNode(mr(s.quotes,n.quoteDepth++,!0)));break;case"close-quote":a.appendChild(o.createTextNode(mr(s.quotes,--n.quoteDepth,!1)));break;default:a.appendChild(o.createTextNode(A.value))}}),a.className=_n+" "+Tn;var c=r===hr.BEFORE?" "+_n:" "+Tn;return An(A)?A.className.baseValue+=c:A.className+=c,a}}},t.destroy=function(t){return!!t.parentNode&&(t.parentNode.removeChild(t),!0)},t}();!function(t){t[t.BEFORE=0]="BEFORE",t[t.AFTER=1]="AFTER"}(hr||(hr={}));var En,bn=function(t,A){var e=t.createElement("iframe");return e.className="html2canvas-container",e.style.visibility="hidden",e.style.position="fixed",e.style.left="-10000px",e.style.top="0px",e.style.border="0",e.width=A.width.toString(),e.height=A.height.toString(),e.scrolling="no",e.setAttribute("data-html2canvas-ignore","true"),t.body.appendChild(e),e},Ln=function(t){return new Promise(function(A,e){var r=t.contentWindow;if(!r)return e("No window assigned for iframe");var n=r.document;r.onload=t.onload=n.onreadystatechange=function(){r.onload=t.onload=n.onreadystatechange=null;var e=setInterval(function(){n.body.childNodes.length>0&&"complete"===n.readyState&&(clearInterval(e),A(t))},50)}})},Hn=function(t,A){for(var e=t.length-1;e>=0;e--){var r=t.item(e);"content"!==r&&A.style.setProperty(r,t.getPropertyValue(r))}return A},xn=function(t){var A="";return t&&(A+=""),A},Sn=function(t,A,e){t&&t.defaultView&&(A!==t.defaultView.pageXOffset||e!==t.defaultView.pageYOffset)&&t.defaultView.scrollTo(A,e)},In=function(t){var A=t[0],e=t[1],r=t[2];A.scrollLeft=e,A.scrollTop=r},_n="___html2canvas___pseudoelement_before",Tn="___html2canvas___pseudoelement_after",Rn=function(t){On(t,"."+_n+':before{\n content: "" !important;\n display: none !important;\n}\n .'+Tn+':after{\n content: "" !important;\n display: none !important;\n}')},On=function(t,A){var e=t.ownerDocument;if(e){var r=e.createElement("style");r.textContent=A,t.appendChild(r)}};!function(t){t[t.VECTOR=0]="VECTOR",t[t.BEZIER_CURVE=1]="BEZIER_CURVE"}(En||(En={}));var Kn,Mn=function(t,A){return t.length===A.length&&t.some(function(t,e){return t===A[e]})},Pn=function(){function t(t,A){this.type=En.VECTOR,this.x=t,this.y=A}return t.prototype.add=function(A,e){return new t(this.x+A,this.y+e)},t}(),Dn=function(t,A,e){return new Pn(t.x+(A.x-t.x)*e,t.y+(A.y-t.y)*e)},kn=function(){function t(t,A,e,r){this.type=En.BEZIER_CURVE,this.start=t,this.startControl=A,this.endControl=e,this.end=r}return t.prototype.subdivide=function(A,e){var r=Dn(this.start,this.startControl,A),n=Dn(this.startControl,this.endControl,A),i=Dn(this.endControl,this.end,A),o=Dn(r,n,A),s=Dn(n,i,A),a=Dn(o,s,A);return e?new t(this.start,r,o,a):new t(a,s,i,this.end)},t.prototype.add=function(A,e){return new t(this.start.add(A,e),this.startControl.add(A,e),this.endControl.add(A,e),this.end.add(A,e))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),zn=function(t){return t.type===En.BEZIER_CURVE},jn=function(t){var A=t.styles,e=t.bounds,r=qt(A.borderTopLeftRadius,e.width,e.height),n=r[0],i=r[1],o=qt(A.borderTopRightRadius,e.width,e.height),s=o[0],a=o[1],c=qt(A.borderBottomRightRadius,e.width,e.height),u=c[0],l=c[1],h=qt(A.borderBottomLeftRadius,e.width,e.height),f=h[0],d=h[1],p=[];p.push((n+s)/e.width),p.push((f+u)/e.width),p.push((i+d)/e.height),p.push((a+l)/e.height);var B=Math.max.apply(Math,p);B>1&&(n/=B,i/=B,s/=B,a/=B,u/=B,l/=B,f/=B,d/=B);var g=e.width-s,w=e.height-l,m=e.width-u,Q=e.height-d,C=A.borderTopWidth,y=A.borderRightWidth,v=A.borderBottomWidth,F=A.borderLeftWidth,U=Vt(A.paddingTop,t.bounds.width),N=Vt(A.paddingRight,t.bounds.width),E=Vt(A.paddingBottom,t.bounds.width),b=Vt(A.paddingLeft,t.bounds.width);this.topLeftBorderBox=n>0||i>0?qn(e.left,e.top,n,i,Kn.TOP_LEFT):new Pn(e.left,e.top),this.topRightBorderBox=s>0||a>0?qn(e.left+g,e.top,s,a,Kn.TOP_RIGHT):new Pn(e.left+e.width,e.top),this.bottomRightBorderBox=u>0||l>0?qn(e.left+m,e.top+w,u,l,Kn.BOTTOM_RIGHT):new Pn(e.left+e.width,e.top+e.height),this.bottomLeftBorderBox=f>0||d>0?qn(e.left,e.top+Q,f,d,Kn.BOTTOM_LEFT):new Pn(e.left,e.top+e.height),this.topLeftPaddingBox=n>0||i>0?qn(e.left+F,e.top+C,Math.max(0,n-F),Math.max(0,i-C),Kn.TOP_LEFT):new Pn(e.left+F,e.top+C),this.topRightPaddingBox=s>0||a>0?qn(e.left+Math.min(g,e.width+F),e.top+C,g>e.width+F?0:s-F,a-C,Kn.TOP_RIGHT):new Pn(e.left+e.width-y,e.top+C),this.bottomRightPaddingBox=u>0||l>0?qn(e.left+Math.min(m,e.width-F),e.top+Math.min(w,e.height+C),Math.max(0,u-y),l-v,Kn.BOTTOM_RIGHT):new Pn(e.left+e.width-y,e.top+e.height-v),this.bottomLeftPaddingBox=f>0||d>0?qn(e.left+F,e.top+Q,Math.max(0,f-F),d-v,Kn.BOTTOM_LEFT):new Pn(e.left+F,e.top+e.height-v),this.topLeftContentBox=n>0||i>0?qn(e.left+F+b,e.top+C+U,Math.max(0,n-(F+b)),Math.max(0,i-(C+U)),Kn.TOP_LEFT):new Pn(e.left+F+b,e.top+C+U),this.topRightContentBox=s>0||a>0?qn(e.left+Math.min(g,e.width+F+b),e.top+C+U,g>e.width+F+b?0:s-F+b,a-(C+U),Kn.TOP_RIGHT):new Pn(e.left+e.width-(y+N),e.top+C+U),this.bottomRightContentBox=u>0||l>0?qn(e.left+Math.min(m,e.width-(F+b)),e.top+Math.min(w,e.height+C+U),Math.max(0,u-(y+N)),l-(v+E),Kn.BOTTOM_RIGHT):new Pn(e.left+e.width-(y+N),e.top+e.height-(v+E)),this.bottomLeftContentBox=f>0||d>0?qn(e.left+F+b,e.top+Q,Math.max(0,f-(F+b)),d-(v+E),Kn.BOTTOM_LEFT):new Pn(e.left+F+b,e.top+e.height-(v+E))};!function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(Kn||(Kn={}));var qn=function(t,A,e,r,n){var i=(Math.sqrt(2)-1)/3*4,o=e*i,s=r*i,a=t+e,c=A+r;switch(n){case Kn.TOP_LEFT:return new kn(new Pn(t,c),new Pn(t,c-s),new Pn(a-o,A),new Pn(a,A));case Kn.TOP_RIGHT:return new kn(new Pn(t,A),new Pn(t+o,A),new Pn(a,c-s),new Pn(a,c));case Kn.BOTTOM_RIGHT:return new kn(new Pn(a,A),new Pn(a,A+s),new Pn(t+o,c),new Pn(t,c));case Kn.BOTTOM_LEFT:default:return new kn(new Pn(a,c),new Pn(a-o,c),new Pn(t,A+s),new Pn(t,A))}},Vn=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},Xn=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},Gn=function(t,A,e){this.type=0,this.offsetX=t,this.offsetY=A,this.matrix=e,this.target=6},Jn=function(t,A){this.type=1,this.target=A,this.path=t},Wn=function(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},Yn=function(){function t(t,A){if(this.container=t,this.effects=A.slice(0),this.curves=new jn(t),null!==t.styles.transform){var e=t.bounds.left+t.styles.transformOrigin[0].number,r=t.bounds.top+t.styles.transformOrigin[1].number,n=t.styles.transform;this.effects.push(new Gn(e,r,n))}if(t.styles.overflowX!==Ne.VISIBLE){var i=Vn(this.curves),o=Xn(this.curves);Mn(i,o)?this.effects.push(new Jn(i,6)):(this.effects.push(new Jn(i,2)),this.effects.push(new Jn(o,4)))}}return t.prototype.getParentEffects=function(){var t=this.effects.slice(0);if(this.container.styles.overflowX!==Ne.VISIBLE){var A=Vn(this.curves),e=Xn(this.curves);Mn(A,e)||t.push(new Jn(e,6))}return t},t}(),Zn=function(t,A,e,r){t.container.elements.forEach(function(n){var i=dr(n.flags,4),o=dr(n.flags,2),s=new Yn(n,t.getParentEffects());dr(n.styles.display,2048)&&r.push(s);var a=dr(n.flags,8)?[]:r;if(i||o){var c=i||n.styles.isPositioned()?e:A,u=new Wn(s);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var l=n.styles.zIndex.order;if(l<0){var h=0;c.negativeZIndex.some(function(t,A){return l>t.element.container.styles.zIndex.order?(h=A,!1):h>0}),c.negativeZIndex.splice(h,0,u)}else if(l>0){var f=0;c.positiveZIndex.some(function(t,A){return l>=t.element.container.styles.zIndex.order?(f=A+1,!1):f>0}),c.positiveZIndex.splice(f,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else n.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);Zn(s,u,i?u:e,a)}else n.styles.isInlineLevel()?A.inlineLevel.push(s):A.nonInlineLevel.push(s),Zn(s,A,e,a);dr(n.flags,8)&&$n(n,a)})},$n=function(t,A){for(var e=t instanceof Kr?t.start:1,r=t instanceof Kr&&t.reversed,n=0;n0&&t.intrinsicHeight>0){var r=ei(t),n=Xn(A);this.path(n),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(e,0,0,t.intrinsicWidth,t.intrinsicHeight,r.left,r.top,r.width,r.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(A){return r(this,void 0,void 0,function(){var e,r,o,s,a,c,u,l,f,d,p,B,g,w;return n(this,function(n){switch(n.label){case 0:this.applyEffects(A.effects,4),e=A.container,r=A.curves,o=e.styles,s=0,a=e.textNodes,n.label=1;case 1:return s0&&F>0&&(w=r.ctx.createPattern(p,"repeat"),r.renderRepeat(Q,w,N,E))):function(t){return t.type===cA.RADIAL_GRADIENT}(e)&&(m=ri(t,A,[null,null,null]),Q=m[0],C=m[1],y=m[2],v=m[3],F=m[4],U=0===e.position.length?[zt]:e.position,N=Vt(U[0],v),E=Vt(U[U.length-1],F),b=function(t,A,e,r,n){var i=0,o=0;switch(t.size){case lA.CLOSEST_SIDE:t.shape===uA.CIRCLE?i=o=Math.min(Math.abs(A),Math.abs(A-r),Math.abs(e),Math.abs(e-n)):t.shape===uA.ELLIPSE&&(i=Math.min(Math.abs(A),Math.abs(A-r)),o=Math.min(Math.abs(e),Math.abs(e-n)));break;case lA.CLOSEST_CORNER:if(t.shape===uA.CIRCLE)i=o=Math.min(BA(A,e),BA(A,e-n),BA(A-r,e),BA(A-r,e-n));else if(t.shape===uA.ELLIPSE){var s=Math.min(Math.abs(e),Math.abs(e-n))/Math.min(Math.abs(A),Math.abs(A-r)),a=gA(r,n,A,e,!0),c=a[0],u=a[1];o=s*(i=BA(c-A,(u-e)/s))}break;case lA.FARTHEST_SIDE:t.shape===uA.CIRCLE?i=o=Math.max(Math.abs(A),Math.abs(A-r),Math.abs(e),Math.abs(e-n)):t.shape===uA.ELLIPSE&&(i=Math.max(Math.abs(A),Math.abs(A-r)),o=Math.max(Math.abs(e),Math.abs(e-n)));break;case lA.FARTHEST_CORNER:if(t.shape===uA.CIRCLE)i=o=Math.max(BA(A,e),BA(A,e-n),BA(A-r,e),BA(A-r,e-n));else if(t.shape===uA.ELLIPSE){s=Math.max(Math.abs(e),Math.abs(e-n))/Math.max(Math.abs(A),Math.abs(A-r));var l=gA(r,n,A,e,!1);c=l[0],u=l[1],o=s*(i=BA(c-A,(u-e)/s))}}return Array.isArray(t.size)&&(i=Vt(t.size[0],r),o=2===t.size.length?Vt(t.size[1],n):i),[i,o]}(e,N,E,v,F),L=b[0],H=b[1],L>0&&L>0&&(x=r.ctx.createRadialGradient(C+N,y+E,0,C+N,y+E,L),pA(e.stops,2*L).forEach(function(t){return x.addColorStop(t.stop,$t(t.color))}),r.path(Q),r.ctx.fillStyle=x,L!==H?(S=t.bounds.left+.5*t.bounds.width,I=t.bounds.top+.5*t.bounds.height,T=1/(_=H/L),r.ctx.save(),r.ctx.translate(S,I),r.ctx.transform(1,0,0,_,0,0),r.ctx.translate(-S,-I),r.ctx.fillRect(C,T*(y-I)+I,v,F*T),r.ctx.restore()):r.ctx.fill())),n.label=6;case 6:return A--,[2]}})},r=this,i=0,o=t.styles.backgroundImage.slice(0).reverse(),a.label=1;case 1:return i>18&63,e=i>>12&63,r=i>>6&63,n=63&i,c[s++]=h.charAt(A)+h.charAt(e)+h.charAt(r)+h.charAt(n),o>16&255,e=o>>8&255,r=255&o,c[a++]=64==n?String.fromCharCode(A):64==i?String.fromCharCode(A,e):String.fromCharCode(A,e,r),s>>0,r=new Array(e),n=1>>0,n=0;n>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var r=arguments[1],n=0;n>16&255,r=c>>8&255,i=255&c}if(void 0===r||void 0===o&&e===r&&r===i)if("string"==typeof e)A=e+" "+s[0];else if(2===t.precision)A=m(e/255)+" "+s[0];else A=Q(e/255)+" "+s[0];else if(void 0===o||"object"===n(o)){if(o&&!isNaN(o.a)&&0===o.a)return["1.000","1.000","1.000",s[1]].join(" ");if("string"==typeof e)A=[e,r,i,s[1]].join(" ");else if(2===t.precision)A=[m(e/255),m(r/255),m(i/255),s[1]].join(" ");else A=[Q(e/255),Q(r/255),Q(i/255),s[1]].join(" ")}else if("string"==typeof e)A=[e,r,i,o,s[2]].join(" ");else if(2===t.precision)A=[m(e/255),m(r/255),m(i/255),m(o/255),s[2]].join(" ");else A=[Q(e/255),Q(r/255),Q(i/255),Q(o/255),s[2]].join(" ");return A},pt=f.__private__.getFilters=function(){return c},Bt=f.__private__.putStream=function(t){var A,e=(t=t||{}).data||"",r=t.filters||pt(),n=t.alreadyAppliedFilters||[],i=t.addLength1||!1,o=e.length;!0===r&&(r=["FlateEncode"]);var a=t.additionalKeyValues||[],c=(A=void 0!==s.API.processDataByFilters?s.API.processDataByFilters(e,r):{data:e,reverseChain:[]}).reverseChain+(Array.isArray(n)?n.join(" "):n.toString());0!==A.data.length&&(a.push({key:"Length",value:A.data.length}),!0===i&&a.push({key:"Length1",value:o})),0!=c.length&&(c.split("/").length-1==1?a.push({key:"Filter",value:c}):a.push({key:"Filter",value:"["+c+"]"})),D("<<");for(var u=0;u>"),0!==A.data.length&&(D("stream"),D(A.data),D("endstream"))},gt=f.__private__.putPage=function(t){t.mediaBox;var A=t.number,e=t.data,r=t.objId,n=t.contentsObjId;ct(r,!0),rt[b].mediaBox.topRightX,rt[b].mediaBox.bottomLeftX,rt[b].mediaBox.topRightY,rt[b].mediaBox.bottomLeftY,D("<>"),D("endobj");var i=e.join("\n");return ct(n,!0),Bt({data:i,filters:pt()}),D("endobj"),r},wt=f.__private__.putPages=function(){var t,A,e=[];for(t=1;t<=et;t++)rt[t].objId=at(),rt[t].contentsObjId=at();for(t=1;t<=et;t++)e.push(gt({number:t,data:K[t],objId:rt[t].objId,contentsObjId:rt[t].contentsObjId,mediaBox:rt[t].mediaBox,cropBox:rt[t].cropBox,bleedBox:rt[t].bleedBox,trimBox:rt[t].trimBox,artBox:rt[t].artBox,userUnit:rt[t].userUnit,rootDictionaryObjId:lt,resourceDictionaryObjId:ht}));ct(lt,!0),D("<>"),D("endobj"),it.publish("postPutPages")},mt=function(t,A,e){At.hasOwnProperty(A)||(At[A]={}),At[A][e]=t},Qt=function(t,A,e,r,n){n=n||!1;var i="F"+(Object.keys(tt).length+1).toString(10),o={id:i,postScriptName:t,fontName:A,fontStyle:e,encoding:r,isStandardFont:n,metadata:{}};return it.publish("addFont",{font:o,instance:this}),void 0!==i&&(tt[i]=o,mt(i,A,e)),i},Ct=f.__private__.pdfEscape=f.pdfEscape=function(t,A){return function(t,A){var e,r,n,i,o,s,a,c,u;if(n=(A=A||{}).sourceEncoding||"Unicode",o=A.outputEncoding,(A.autoencode||o)&&tt[I].metadata&&tt[I].metadata[n]&&tt[I].metadata[n].encoding&&(i=tt[I].metadata[n].encoding,!o&&tt[I].encoding&&(o=tt[I].encoding),!o&&i.codePages&&(o=i.codePages[0]),"string"==typeof o&&(o=i[o]),o)){for(a=!1,s=[],e=0,r=t.length;e>8&&(a=!0);t=s.join("")}for(e=t.length;void 0===a&&0!==e;)t.charCodeAt(e-1)>>8&&(a=!0),e--;if(!a)return t;for(s=A.noBOM?[]:[254,255],e=0,r=t.length;e>8)>>8)throw new Error("Character at position "+e+" of string '"+t+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");s.push(u),s.push(c-(u<<8))}return String.fromCharCode.apply(void 0,s)}(t,A).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},yt=f.__private__.beginPage=function(t,A){var r,n="string"==typeof A&&A.toLowerCase();if("string"==typeof t&&(r=g(t.toLowerCase()))&&(t=r[0],A=r[1]),Array.isArray(t)&&(A=t[1],t=t[0]),(isNaN(t)||isNaN(A))&&(t=e[0],A=e[1]),n){switch(n.substr(0,1)){case"l":t>"),D("endobj")},bt=f.__private__.putCatalog=function(t){var A=(t=t||{}).rootDictionaryObjId||lt;switch(st(),D("<<"),D("/Type /Catalog"),D("/Pages "+A+" 0 R"),H||(H="fullwidth"),H){case"fullwidth":D("/OpenAction [3 0 R /FitH null]");break;case"fullheight":D("/OpenAction [3 0 R /FitV null]");break;case"fullpage":D("/OpenAction [3 0 R /Fit]");break;case"original":D("/OpenAction [3 0 R /XYZ null null 1]");break;default:var e=""+H;"%"===e.substr(e.length-1)&&(H=parseInt(H)/100),"number"==typeof H&&D("/OpenAction [3 0 R /XYZ null null "+m(H)+"]")}switch(S||(S="continuous"),S){case"continuous":D("/PageLayout /OneColumn");break;case"single":D("/PageLayout /SinglePage");break;case"two":case"twoleft":D("/PageLayout /TwoColumnLeft");break;case"tworight":D("/PageLayout /TwoColumnRight")}x&&D("/PageMode /"+x),it.publish("putCatalog"),D(">>"),D("endobj")},Lt=f.__private__.putTrailer=function(){D("trailer"),D("<<"),D("/Size "+(Z+1)),D("/Root "+Z+" 0 R"),D("/Info "+(Z-1)+" 0 R"),D("/ID [ <"+C+"> <"+C+"> ]"),D(">>")},xt=f.__private__.putHeader=function(){D("%PDF-"+d),D("%\xba\xdf\xac\xe0")},St=f.__private__.putXRef=function(){var t=1,A="0000000000";for(D("xref"),D("0 "+(Z+1)),D("0000000000 65535 f "),t=1;t<=Z;t++)"function"==typeof $[t]?D((A+$[t]()).slice(-10)+" 00000 n "):void 0!==$[t]?D((A+$[t]).slice(-10)+" 00000 n "):D("0000000000 00000 n ")},It=f.__private__.buildDocument=function(){O=!1,P=Z=0,M=[],$=[],nt=[],lt=at(),ht=at(),it.publish("buildDocument"),xt(),wt(),function(){it.publish("putAdditionalObjects");for(var t=0;t>"),D("endobj")));var A}(),it.publish("putResources"),ct(ht,!0),D("<<"),function(){for(var t in D("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),D("/Font <<"),tt)tt.hasOwnProperty(t)&&(!1===l||!0===l&&h.hasOwnProperty(t))&&D("/"+t+" "+tt[t].objectNumber+" 0 R");D(">>"),D("/XObject <<"),it.publish("putXobjectDict"),D(">>")}(),D(">>"),D("endobj"),it.publish("postPutResources"),Et(),bt();var t=P;return St(),Lt(),D("startxref"),D(""+t),D("%%EOF"),O=!0,M.join("\n")},_t=f.__private__.getBlob=function(t){return new Blob([z(t)],{type:"application/pdf"})},Tt=f.output=f.__private__.output=((T=function(t,A){A=A||{};var e=It();switch("string"==typeof A?A={filename:A}:A.filename=A.filename||"generated.pdf",t){case void 0:return e;case"save":f.save(A.filename);break;case"arraybuffer":return z(e);case"blob":return _t(e);case"bloburi":case"bloburl":if(void 0!==r.URL&&"function"==typeof r.URL.createObjectURL)return r.URL&&r.URL.createObjectURL(_t(e))||void 0;console.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":return"data:application/pdf;filename="+A.filename+";base64,"+btoa(e);case"dataurlnewwindow":var n='',i=r.open();if(null!==i&&i.document.write(n),i||"undefined"==typeof safari)return i;case"datauri":case"dataurl":return r.document.location.href="data:application/pdf;filename="+A.filename+";base64,"+btoa(e);default:return null}}).foo=function(){try{return T.apply(this,arguments)}catch(e){var t=e.stack||"";~t.indexOf(" at ")&&(t=t.split(" at ")[1]);var A="Error in function "+t.split("\n")[0].split("<")[0]+": "+e.message;if(!r.console)throw new Error(A);r.console.error(A,e),r.alert&&alert(A)}},(T.foo.bar=T).foo),Rt=function(t){return!0===Array.isArray(ot)&&-1":")"),At=1):(Y=Gt(A),Z=Jt(e),$=(c?"<":"(")+y[W]+(c?">":")")),void 0!==z&&void 0!==z[W]&&(et=z[W]+" Tw\n"),0!==L.length&&0===W?t.push(et+L.join(" ")+" "+Y.toFixed(2)+" "+Z.toFixed(2)+" Tm\n"+$):1===At||0===At&&0===W?t.push(et+Y.toFixed(2)+" "+Z.toFixed(2)+" Td\n"+$):t.push(et+$);t=0===At?t.join(" Tj\nT* "):t.join(" Tj\n"),t+=" Tj\n";var rt="BT\n/"+I+" "+q+" Tf\n"+(q*l).toFixed(2)+" TL\n"+tA+"\n";return rt+=u,rt+=t,D(rt+="ET"),h[I]=!0,f},f.__private__.lstext=f.lstext=function(t,A,e,r){return console.warn("jsPDF.lstext is deprecated"),this.text(t,A,e,{charSpace:r})},f.__private__.clip=f.clip=function(t){D("evenodd"===t?"W*":"W"),D("n")},f.__private__.clip_fixed=f.clip_fixed=function(t){console.log("clip_fixed is deprecated"),f.clip(t)};var Pt=f.__private__.isValidStyle=function(t){var A=!1;return-1!==[void 0,null,"S","F","DF","FD","f","f*","B","B*"].indexOf(t)&&(A=!0),A},Dt=f.__private__.getStyle=function(t){var A="S";return"F"===t?A="f":"FD"===t||"DF"===t?A="B":"f"!==t&&"f*"!==t&&"B"!==t&&"B*"!==t||(A=t),A};f.__private__.line=f.line=function(t,A,e,r){if(isNaN(t)||isNaN(A)||isNaN(e)||isNaN(r))throw new Error("Invalid arguments passed to jsPDF.line");return this.lines([[e-t,r-A]],t,A)},f.__private__.lines=f.lines=function(t,A,e,r,n,i){var o,s,a,c,u,l,h,f,d,p,B,g;if("number"==typeof t&&(g=e,e=A,A=t,t=g),r=r||[1,1],i=i||!1,isNaN(A)||isNaN(e)||!Array.isArray(t)||!Array.isArray(r)||!Pt(n)||"boolean"!=typeof i)throw new Error("Invalid arguments passed to jsPDF.lines");for(D(Q(Gt(A))+" "+Q(Jt(e))+" m "),o=r[0],s=r[1],c=t.length,p=A,B=e,a=0;a=o.length-1;if(F&&!U){m+=" ";continue}if(F||U){if(U)g=v;else if(t.multiline&&c<(h+2)*(Q+2)+2)continue t}else{if(!t.multiline)continue t;if(c<(h+2)*(Q+2)+2)continue t;g=v}for(var N="",E=B;E<=g;E++)N+=o[E]+" ";switch(N=" "==N.substr(N.length-1)?N.substr(0,N.length-1):N,w=y(N,t,a).width,t.textAlign){case"right":d=u-w-2;break;case"center":d=(u-w)/2;break;default:d=2}A+=s(d)+" "+s(p)+" Td\n",A+="("+i(N)+") Tj\n",A+=-s(d)+" 0 Td\n",p=-(a+2),w=0,B=g+1,Q++,m=""}break}return n.text=A,n.fontSize=a,n},y=function(t,A,r){var n=e.internal.getFont(A.fontName,A.fontStyle),i=e.getStringUnitWidth(t,{font:n,fontSize:parseFloat(r),charSpace:0})*parseFloat(r);return{height:e.getStringUnitWidth("3",{font:n,fontSize:parseFloat(r),charSpace:0})*parseFloat(r)*1.5,width:i}},v={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},F=function(){e.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var t=e.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var A in t)if(t.hasOwnProperty(A)){var r=t[A];r.objId=void 0,r.hasAnnotation&&U.call(e,r)}},U=function(t){var A={type:"reference",object:t};void 0===e.internal.getPageInfo(t.page).pageContext.annotations.find(function(t){return t.type===A.type&&t.object===A.object})&&e.internal.getPageInfo(t.page).pageContext.annotations.push(A)},N=function(){if(void 0===e.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("putCatalogCallback: Root missing.");e.internal.write("/AcroForm "+e.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")},E=function(){e.internal.events.unsubscribe(e.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete e.internal.acroformPlugin.acroFormDictionaryRoot._eventID,e.internal.acroformPlugin.printedOut=!0},b=function(t){var A=!t;for(var r in t||(e.internal.newObjectDeferredBegin(e.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),e.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),t=t||e.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(t.hasOwnProperty(r)){var i=t[r],o=[],s=i.Rect;if(i.Rect&&(i.Rect=m.call(this,i.Rect)),e.internal.newObjectDeferredBegin(i.objId,!0),i.DA=G.createDefaultAppearanceStream(i),"object"===n(i)&&"function"==typeof i.getKeyValueListForStream&&(o=i.getKeyValueListForStream()),i.Rect=s,i.hasAppearanceStream&&!i.appearanceStreamContent){var a=Q.call(this,i);o.push({key:"AP",value:"<>"}),e.internal.acroformPlugin.xForms.push(a)}if(i.appearanceStreamContent){var c="";for(var u in i.appearanceStreamContent)if(i.appearanceStreamContent.hasOwnProperty(u)){var l=i.appearanceStreamContent[u];if(c+="/"+u+" ",c+="<<",1<=Object.keys(l).length||Array.isArray(l))for(var r in l){var h;l.hasOwnProperty(r)&&("function"==typeof(h=l[r])&&(h=h.call(this,i)),c+="/"+r+" "+h+" ",0<=e.internal.acroformPlugin.xForms.indexOf(h)||e.internal.acroformPlugin.xForms.push(h))}else"function"==typeof(h=l)&&(h=h.call(this,i)),c+="/"+r+" "+h,0<=e.internal.acroformPlugin.xForms.indexOf(h)||e.internal.acroformPlugin.xForms.push(h);c+=">>"}o.push({key:"AP",value:"<<\n"+c+">>"})}e.internal.putStream({additionalKeyValues:o}),e.internal.out("endobj")}A&&L.call(this,e.internal.acroformPlugin.xForms)},L=function(t){for(var A in t)if(t.hasOwnProperty(A)){var r=A,i=t[A];e.internal.newObjectDeferredBegin(i&&i.objId,!0),"object"===n(i)&&"function"==typeof i.putStream&&i.putStream(),delete t[r]}},H=function(){if(void 0!==this.internal&&(void 0===this.internal.acroformPlugin||!1===this.internal.acroformPlugin.isInitialized)){if(e=this,R.FieldNum=0,this.internal.acroformPlugin=JSON.parse(JSON.stringify(v)),this.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");r=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new T,e.internal.acroformPlugin.acroFormDictionaryRoot._eventID=e.internal.events.subscribe("postPutResources",E),e.internal.events.subscribe("buildDocument",F),e.internal.events.subscribe("putCatalog",N),e.internal.events.subscribe("postPutPages",b),e.internal.acroformPlugin.isInitialized=!0}},x=t.__acroform__.arrayToPdfArray=function(t){if(Array.isArray(t)){for(var A="[",e=0;e>"),e.join("\n")}},set:function(t){"object"===n(t)&&(A=t)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return A.CA||""},set:function(t){"string"==typeof t&&(A.CA=t)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return t},set:function(A){t=A}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return t.substr(1,t.length-1)},set:function(A){t="/"+A}})};c(D,R);var k=function(){D.call(this),this.pushButton=!0};c(k,D);var z=function(){D.call(this),this.radio=!0,this.pushButton=!1;var t=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return t},set:function(A){t=void 0!==A?A:[]}})};c(z,D);var j=function(){var t,A;R.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return t},set:function(A){t=A}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return A},set:function(t){A=t}});var e,r={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var t,A=[];for(t in A.push("<<"),r)A.push("/"+t+" ("+r[t]+")");return A.push(">>"),A.join("\n")},set:function(t){"object"===n(t)&&(r=t)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return r.CA||""},set:function(t){"string"==typeof t&&(r.CA=t)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(t){e="/"+t}}),this.optionName=name,this.caption="l",this.appearanceState="Off",this._AppearanceType=G.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(name)};c(j,R),z.prototype.setAppearance=function(t){if(!("createAppearanceStream"in t)||!("getCA"in t))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var A in this.Kids)if(this.Kids.hasOwnProperty(A)){var e=this.Kids[A];e.appearanceStreamContent=t.createAppearanceStream(e.optionName),e.caption=t.getCA()}},z.prototype.createOption=function(t){this.Kids.length;var A=new j;return A.Parent=this,A.optionName=t,this.Kids.push(A),J.call(this,A),A};var q=function(){D.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=G.CheckBox.createAppearanceStream()};c(q,D);var V=function(){R.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return Boolean(B(this.Ff,13))},set:function(t){!0===Boolean(t)?this.Ff=g(this.Ff,13):this.Ff=w(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return Boolean(B(this.Ff,21))},set:function(t){!0===Boolean(t)?this.Ff=g(this.Ff,21):this.Ff=w(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return Boolean(B(this.Ff,23))},set:function(t){!0===Boolean(t)?this.Ff=g(this.Ff,23):this.Ff=w(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return Boolean(B(this.Ff,24))},set:function(t){!0===Boolean(t)?this.Ff=g(this.Ff,24):this.Ff=w(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return Boolean(B(this.Ff,25))},set:function(t){!0===Boolean(t)?this.Ff=g(this.Ff,25):this.Ff=w(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return Boolean(B(this.Ff,26))},set:function(t){!0===Boolean(t)?this.Ff=g(this.Ff,26):this.Ff=w(this.Ff,26)}});var t=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return t},set:function(A){t=A}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return t},set:function(A){Number.isInteger(A)&&(t=A)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};c(V,R);var X=function(){V.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return Boolean(B(this.Ff,14))},set:function(t){!0===Boolean(t)?this.Ff=g(this.Ff,14):this.Ff=w(this.Ff,14)}}),this.password=!0};c(X,V);var G={CheckBox:{createAppearanceStream:function(){return{N:{On:G.CheckBox.YesNormal},D:{On:G.CheckBox.YesPushDown,Off:G.CheckBox.OffPushDown}}},YesPushDown:function(t){var A=h(t),r=[],n=e.internal.getFont(t.fontName,t.fontStyle).id,i=e.__private__.encodeColorString(t.color),o=C(t,t.caption);return r.push("0.749023 g"),r.push("0 0 "+s(G.internal.getWidth(t))+" "+s(G.internal.getHeight(t))+" re"),r.push("f"),r.push("BMC"),r.push("q"),r.push("0 0 1 rg"),r.push("/"+n+" "+s(o.fontSize)+" Tf "+i),r.push("BT"),r.push(o.text),r.push("ET"),r.push("Q"),r.push("EMC"),A.stream=r.join("\n"),A},YesNormal:function(t){var A=h(t),r=e.internal.getFont(t.fontName,t.fontStyle).id,n=e.__private__.encodeColorString(t.color),i=[],o=G.internal.getHeight(t),a=G.internal.getWidth(t),c=C(t,t.caption);return i.push("1 g"),i.push("0 0 "+s(a)+" "+s(o)+" re"),i.push("f"),i.push("q"),i.push("0 0 1 rg"),i.push("0 0 "+s(a-1)+" "+s(o-1)+" re"),i.push("W"),i.push("n"),i.push("0 g"),i.push("BT"),i.push("/"+r+" "+s(c.fontSize)+" Tf "+n),i.push(c.text),i.push("ET"),i.push("Q"),A.stream=i.join("\n"),A},OffPushDown:function(t){var A=h(t),e=[];return e.push("0.749023 g"),e.push("0 0 "+s(G.internal.getWidth(t))+" "+s(G.internal.getHeight(t))+" re"),e.push("f"),A.stream=e.join("\n"),A}},RadioButton:{Circle:{createAppearanceStream:function(t){var A={D:{Off:G.RadioButton.Circle.OffPushDown},N:{}};return A.N[t]=G.RadioButton.Circle.YesNormal,A.D[t]=G.RadioButton.Circle.YesPushDown,A},getCA:function(){return"l"},YesNormal:function(t){var A=h(t),e=[],r=G.internal.getWidth(t)<=G.internal.getHeight(t)?G.internal.getWidth(t)/4:G.internal.getHeight(t)/4;r=Number((.9*r).toFixed(5));var n=G.internal.Bezier_C,i=Number((r*n).toFixed(5));return e.push("q"),e.push("1 0 0 1 "+a(G.internal.getWidth(t)/2)+" "+a(G.internal.getHeight(t)/2)+" cm"),e.push(r+" 0 m"),e.push(r+" "+i+" "+i+" "+r+" 0 "+r+" c"),e.push("-"+i+" "+r+" -"+r+" "+i+" -"+r+" 0 c"),e.push("-"+r+" -"+i+" -"+i+" -"+r+" 0 -"+r+" c"),e.push(i+" -"+r+" "+r+" -"+i+" "+r+" 0 c"),e.push("f"),e.push("Q"),A.stream=e.join("\n"),A},YesPushDown:function(t){var A=h(t),e=[],r=G.internal.getWidth(t)<=G.internal.getHeight(t)?G.internal.getWidth(t)/4:G.internal.getHeight(t)/4,n=(r=Number((.9*r).toFixed(5)),Number((2*r).toFixed(5))),i=Number((n*G.internal.Bezier_C).toFixed(5)),o=Number((r*G.internal.Bezier_C).toFixed(5));return e.push("0.749023 g"),e.push("q"),e.push("1 0 0 1 "+a(G.internal.getWidth(t)/2)+" "+a(G.internal.getHeight(t)/2)+" cm"),e.push(n+" 0 m"),e.push(n+" "+i+" "+i+" "+n+" 0 "+n+" c"),e.push("-"+i+" "+n+" -"+n+" "+i+" -"+n+" 0 c"),e.push("-"+n+" -"+i+" -"+i+" -"+n+" 0 -"+n+" c"),e.push(i+" -"+n+" "+n+" -"+i+" "+n+" 0 c"),e.push("f"),e.push("Q"),e.push("0 g"),e.push("q"),e.push("1 0 0 1 "+a(G.internal.getWidth(t)/2)+" "+a(G.internal.getHeight(t)/2)+" cm"),e.push(r+" 0 m"),e.push(r+" "+o+" "+o+" "+r+" 0 "+r+" c"),e.push("-"+o+" "+r+" -"+r+" "+o+" -"+r+" 0 c"),e.push("-"+r+" -"+o+" -"+o+" -"+r+" 0 -"+r+" c"),e.push(o+" -"+r+" "+r+" -"+o+" "+r+" 0 c"),e.push("f"),e.push("Q"),A.stream=e.join("\n"),A},OffPushDown:function(t){var A=h(t),e=[],r=G.internal.getWidth(t)<=G.internal.getHeight(t)?G.internal.getWidth(t)/4:G.internal.getHeight(t)/4,n=(r=Number((.9*r).toFixed(5)),Number((2*r).toFixed(5))),i=Number((n*G.internal.Bezier_C).toFixed(5));return e.push("0.749023 g"),e.push("q"),e.push("1 0 0 1 "+a(G.internal.getWidth(t)/2)+" "+a(G.internal.getHeight(t)/2)+" cm"),e.push(n+" 0 m"),e.push(n+" "+i+" "+i+" "+n+" 0 "+n+" c"),e.push("-"+i+" "+n+" -"+n+" "+i+" -"+n+" 0 c"),e.push("-"+n+" -"+i+" -"+i+" -"+n+" 0 -"+n+" c"),e.push(i+" -"+n+" "+n+" -"+i+" "+n+" 0 c"),e.push("f"),e.push("Q"),A.stream=e.join("\n"),A}},Cross:{createAppearanceStream:function(t){var A={D:{Off:G.RadioButton.Cross.OffPushDown},N:{}};return A.N[t]=G.RadioButton.Cross.YesNormal,A.D[t]=G.RadioButton.Cross.YesPushDown,A},getCA:function(){return"8"},YesNormal:function(t){var A=h(t),e=[],r=G.internal.calculateCross(t);return e.push("q"),e.push("1 1 "+s(G.internal.getWidth(t)-2)+" "+s(G.internal.getHeight(t)-2)+" re"),e.push("W"),e.push("n"),e.push(s(r.x1.x)+" "+s(r.x1.y)+" m"),e.push(s(r.x2.x)+" "+s(r.x2.y)+" l"),e.push(s(r.x4.x)+" "+s(r.x4.y)+" m"),e.push(s(r.x3.x)+" "+s(r.x3.y)+" l"),e.push("s"),e.push("Q"),A.stream=e.join("\n"),A},YesPushDown:function(t){var A=h(t),e=G.internal.calculateCross(t),r=[];return r.push("0.749023 g"),r.push("0 0 "+s(G.internal.getWidth(t))+" "+s(G.internal.getHeight(t))+" re"),r.push("f"),r.push("q"),r.push("1 1 "+s(G.internal.getWidth(t)-2)+" "+s(G.internal.getHeight(t)-2)+" re"),r.push("W"),r.push("n"),r.push(s(e.x1.x)+" "+s(e.x1.y)+" m"),r.push(s(e.x2.x)+" "+s(e.x2.y)+" l"),r.push(s(e.x4.x)+" "+s(e.x4.y)+" m"),r.push(s(e.x3.x)+" "+s(e.x3.y)+" l"),r.push("s"),r.push("Q"),A.stream=r.join("\n"),A},OffPushDown:function(t){var A=h(t),e=[];return e.push("0.749023 g"),e.push("0 0 "+s(G.internal.getWidth(t))+" "+s(G.internal.getHeight(t))+" re"),e.push("f"),A.stream=e.join("\n"),A}}},createDefaultAppearanceStream:function(t){var A=e.internal.getFont(t.fontName,t.fontStyle).id,r=e.__private__.encodeColorString(t.color);return"/"+A+" "+t.fontSize+" Tf "+r}};G.internal={Bezier_C:.551915024494,calculateCross:function(t){var A=G.internal.getWidth(t),e=G.internal.getHeight(t),r=Math.min(A,e);return{x1:{x:(A-r)/2,y:(e-r)/2+r},x2:{x:(A-r)/2+r,y:(e-r)/2},x3:{x:(A-r)/2,y:(e-r)/2},x4:{x:(A-r)/2+r,y:(e-r)/2+r}}}},G.internal.getWidth=function(t){var A=0;return"object"===n(t)&&(A=u(t.Rect[2])),A},G.internal.getHeight=function(t){var A=0;return"object"===n(t)&&(A=u(t.Rect[3])),A};var J=t.addField=function(t){if(H.call(this),!(t instanceof R))throw new Error("Invalid argument passed to jsPDF.addField.");return function(t){e.internal.acroformPlugin.printedOut&&(e.internal.acroformPlugin.printedOut=!1,e.internal.acroformPlugin.acroFormDictionaryRoot=null),e.internal.acroformPlugin.acroFormDictionaryRoot||H.call(e),e.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t)}.call(this,t),t.page=e.internal.getCurrentPageInfo().pageNumber,this};t.addButton=function(t){if(t instanceof D==0)throw new Error("Invalid argument passed to jsPDF.addButton.");return J.call(this,t)},t.addTextField=function(t){if(t instanceof V==0)throw new Error("Invalid argument passed to jsPDF.addTextField.");return J.call(this,t)},t.addChoiceField=function(t){if(t instanceof O==0)throw new Error("Invalid argument passed to jsPDF.addChoiceField.");return J.call(this,t)},"object"==n(A)&&void 0===A.ChoiceField&&void 0===A.ListBox&&void 0===A.ComboBox&&void 0===A.EditBox&&void 0===A.Button&&void 0===A.PushButton&&void 0===A.RadioButton&&void 0===A.CheckBox&&void 0===A.TextField&&void 0===A.PasswordField?(A.ChoiceField=O,A.ListBox=K,A.ComboBox=M,A.EditBox=P,A.Button=D,A.PushButton=k,A.RadioButton=z,A.CheckBox=q,A.TextField=V,A.PasswordField=X,A.AcroForm={Appearance:G}):console.warn("AcroForm-Classes are not populated into global-namespace, because the class-Names exist already."),t.AcroFormChoiceField=O,t.AcroFormListBox=K,t.AcroFormComboBox=M,t.AcroFormEditBox=P,t.AcroFormButton=D,t.AcroFormPushButton=k,t.AcroFormRadioButton=z,t.AcroFormCheckBox=q,t.AcroFormTextField=V,t.AcroFormPasswordField=X,t.AcroFormAppearance=G,t.AcroForm={ChoiceField:O,ListBox:K,ComboBox:M,EditBox:P,Button:D,PushButton:k,RadioButton:z,CheckBox:q,TextField:V,PasswordField:X,Appearance:G}})((window.tmp=dt).API,"undefined"!=typeof window&&window||void 0!==r&&r),function(t){var A="addImage_",e={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},r=t.getImageFileTypeByImageData=function(A,r){var n,i;r=r||"UNKNOWN";var o,s,a,c="UNKNOWN";for(a in t.isArrayBufferView(A)&&(A=t.arrayBufferToBinaryString(A)),e)for(o=e[a],n=0;n>"}),"trns"in A&&A.trns.constructor==Array){for(var s="",a=0,c=A.trns.length;a>18]+r[(258048&A)>>12]+r[(4032&A)>>6]+r[63&A];return 1==o?e+=r[(252&(A=n[s]))>>2]+r[(3&A)<<4]+"==":2==o&&(e+=r[(64512&(A=n[s]<<8|n[s+1]))>>10]+r[(1008&A)>>4]+r[(15&A)<<2]+"="),e},t.createImageInfo=function(t,A,e,r,n,i,o,s,a,c,u,l,h){var f={alias:s,w:A,h:e,cs:r,bpc:n,i:o,data:t};return i&&(f.f=i),a&&(f.dp=a),c&&(f.trns=c),u&&(f.pal=u),l&&(f.smask=l),h&&(f.p=h),f},t.addImage=function(e,r,i,h,f,d,p,B,g){var w="";if("string"!=typeof r){var m=d;d=f,f=h,h=i,i=r,r=m}if("object"===n(e)&&!c(e)&&"imageData"in e){var Q=e;e=Q.imageData,r=Q.format||r||"UNKNOWN",i=Q.x||i||0,h=Q.y||h||0,f=Q.w||f,d=Q.h||d,p=Q.alias||p,B=Q.compression||B,g=Q.rotation||Q.angle||g}var C=this.internal.getFilters();if(void 0===B&&-1!==C.indexOf("FlateEncode")&&(B="SLOW"),"string"==typeof e&&(e=unescape(e)),isNaN(i)||isNaN(h))throw console.error("jsPDF.addImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addImage");var y,v,F,U,N,E,b,L=function(){var t=this.internal.collections[A+"images"];return t||(this.internal.collections[A+"images"]=t={},this.internal.events.subscribe("putResources",o),this.internal.events.subscribe("putXobjectDict",s)),t}.call(this);if(!((y=l(e,L))||(c(e)&&(e=u(e,r)),(null==(b=p)||0===b.length)&&(p="string"==typeof(E=e)?t.sHashCode(E):t.isArrayBufferView(E)?t.sHashCode(t.arrayBufferToBinaryString(E)):null),y=l(p,L)))){if(this.isString(e)&&(""!==(w=this.convertStringToImageData(e))||void 0!==(w=t.loadFile(e)))&&(e=w),r=this.getImageFileTypeByImageData(e,r),!a(r))throw new Error("addImage does not support files of type '"+r+"', please ensure that a plugin for '"+r+"' support is added.");if(this.supportsArrayBuffer()&&(e instanceof Uint8Array||(v=e,e=this.binaryStringToUint8Array(e))),!(y=this["process"+r.toUpperCase()](e,(N=0,(U=L)&&(N=Object.keys?Object.keys(U).length:function(t){var A=0;for(var e in t)t.hasOwnProperty(e)&&A++;return A}(U)),N),p,((F=B)&&"string"==typeof F&&(F=F.toUpperCase()),F in t.image_compression?F:t.image_compression.NONE),v)))throw new Error("An unknown error occurred whilst processing the image")}return function(t,A,e,r,n,i,o,s){var a=function(t,A,e){return t||A||(A=t=-96),t<0&&(t=-1*e.w*72/t/this.internal.scaleFactor),A<0&&(A=-1*e.h*72/A/this.internal.scaleFactor),0===t&&(t=A*e.w/e.h),0===A&&(A=t*e.h/e.w),[t,A]}.call(this,e,r,n),c=this.internal.getCoordinateString,u=this.internal.getVerticalCoordinateString;if(e=a[0],r=a[1],o[i]=n,s){s*=Math.PI/180;var l=Math.cos(s),h=Math.sin(s),f=function(t){return t.toFixed(4)},d=[f(l),f(h),f(-1*h),f(l),0,0,"cm"]}this.internal.write("q"),s?(this.internal.write([1,"0","0",1,c(t),u(A+r),"cm"].join(" ")),this.internal.write(d.join(" ")),this.internal.write([c(e),"0","0",c(r),"0","0","cm"].join(" "))):this.internal.write([c(e),"0","0",c(r),c(t),u(A+r),"cm"].join(" ")),this.internal.write("/I"+n.i+" Do"),this.internal.write("Q")}.call(this,i,h,f,d,y,y.i,L,g),this},t.convertStringToImageData=function(A){var e,r="";if(this.isString(A)){var n;e=null!==(n=this.extractImageFromDataUrl(A))?n.data:A;try{r=atob(e)}catch(A){throw t.validateStringAsBase64(e)?new Error("atob-Error in jsPDF.convertStringToImageData "+A.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertStringToImageData ")}}return r};var h=function(t,A){return t.subarray(A,A+5)};t.processJPEG=function(t,A,e,n,i,o){var s,a=this.decode.DCT_DECODE;if(!this.isString(t)&&!this.isArrayBuffer(t)&&!this.isArrayBufferView(t))return null;if(this.isString(t)&&(s=function(t){var A;if("JPEG"!==r(t))throw new Error("getJpegSize requires a binary string jpeg file");for(var e=256*t.charCodeAt(4)+t.charCodeAt(5),n=4,i=t.length;n>",c.content=B;var h=c.objId+" 0 R";B="<>";else if(a.options.pageNumber)switch(B="<>",this.internal.write(B))}}this.internal.write("]")}}]),o.createAnnotation=function(t){var A=this.internal.getCurrentPageInfo();switch(t.type){case"link":this.link(t.bounds.x,t.bounds.y,t.bounds.w,t.bounds.h,t);break;case"text":case"freetext":A.pageContext.annotations.push(t)}},o.link=function(t,A,e,r,n){this.internal.getCurrentPageInfo().pageContext.annotations.push({x:t,y:A,w:e,h:r,options:n,type:"link"})},o.textWithLink=function(t,A,e,r){var n=this.getTextWidth(t),i=this.internal.getLineHeight()/this.internal.scaleFactor;return this.text(t,A,e),e+=.2*i,this.link(A,e-i,n,i,r),n},o.getTextWidth=function(t){var A=this.internal.getFontSize();return this.getStringUnitWidth(t)*A/this.internal.scaleFactor},function(t){var A={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},e={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},r={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},n=[1570,1571,1573,1575];t.__arabicParser__={};var i=t.__arabicParser__.isInArabicSubstitutionA=function(t){return void 0!==A[t.charCodeAt(0)]},o=t.__arabicParser__.isArabicLetter=function(t){return"string"==typeof t&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(t)},s=t.__arabicParser__.isArabicEndLetter=function(t){return o(t)&&i(t)&&A[t.charCodeAt(0)].length<=2},a=t.__arabicParser__.isArabicAlfLetter=function(t){return o(t)&&0<=n.indexOf(t.charCodeAt(0))},c=(t.__arabicParser__.arabicLetterHasIsolatedForm=function(t){return o(t)&&i(t)&&1<=A[t.charCodeAt(0)].length},t.__arabicParser__.arabicLetterHasFinalForm=function(t){return o(t)&&i(t)&&2<=A[t.charCodeAt(0)].length}),u=(t.__arabicParser__.arabicLetterHasInitialForm=function(t){return o(t)&&i(t)&&3<=A[t.charCodeAt(0)].length},t.__arabicParser__.arabicLetterHasMedialForm=function(t){return o(t)&&i(t)&&4==A[t.charCodeAt(0)].length}),l=t.__arabicParser__.resolveLigatures=function(t){var A=0,r=e,n=0,i="",o=0;for(A=0;A>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+A+" 0 R")});return this},s=dt.API,(a=function(){var t=void 0;Object.defineProperty(this,"pdf",{get:function(){return t},set:function(A){t=A}});var A=150;Object.defineProperty(this,"width",{get:function(){return A},set:function(t){A=isNaN(t)||!1===Number.isInteger(t)||t<0?150:t,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=A+1)}});var e=300;Object.defineProperty(this,"height",{get:function(){return e},set:function(t){e=isNaN(t)||!1===Number.isInteger(t)||t<0?300:t,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=e+1)}});var r=[];Object.defineProperty(this,"childNodes",{get:function(){return r},set:function(t){r=t}});var n={};Object.defineProperty(this,"style",{get:function(){return n},set:function(t){n=t}}),Object.defineProperty(this,"parentNode",{get:function(){return!1}})}).prototype.getContext=function(t,A){var e;if("2d"!==(t=t||"2d"))return null;for(e in A)this.pdf.context2d.hasOwnProperty(e)&&(this.pdf.context2d[e]=A[e]);return(this.pdf.context2d._canvas=this).pdf.context2d},a.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},s.events.push(["initialized",function(){this.canvas=new a,this.canvas.pdf=this}]),c=dt.API,l={x:void 0,y:void 0,w:void 0,h:void 0,ln:void 0},h=1,f=function(t,A,e,r,n){l={x:t,y:A,w:e,h:r,ln:n}},d=function(){return l},p={left:0,top:0,bottom:0},c.setHeaderFunction=function(t){u=t},c.getTextDimensions=function(t,A){var e=this.table_font_size||this.internal.getFontSize(),r=(this.internal.getFont().fontStyle,(A=A||{}).scaleFactor||this.internal.scaleFactor),n=0,i=0,o=0;if("string"==typeof t)0!=(n=this.getStringUnitWidth(t)*e)&&(i=1);else{if("[object Array]"!==Object.prototype.toString.call(t))throw new Error("getTextDimensions expects text-parameter to be of type String or an Array of Strings.");for(var s=0;s=this.internal.pageSize.getHeight()-c.bottom&&(this.cellAddPage(),a=!0,this.printHeaders&&this.tableHeaderRow&&this.printHeaderRow(i,!0)),A=d().y+d().h,a&&(A=23)}if(void 0!==n[0])if(this.printingHeaderRow?this.rect(t,A,e,r,"FD"):this.rect(t,A,e,r),"right"===o){n instanceof Array||(n=[n]);for(var u=0;u=2*Math.PI&&(r=0,n=2*Math.PI),this.path.push({type:"arc",x:t,y:A,radius:e,startAngle:r,endAngle:n,counterclockwise:i})},a.prototype.arcTo=function(t,A,e,r,n){throw new Error("arcTo not implemented.")},a.prototype.rect=function(t,A,e,r){if(isNaN(t)||isNaN(A)||isNaN(e)||isNaN(r))throw console.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(t,A),this.lineTo(t+e,A),this.lineTo(t+e,A+r),this.lineTo(t,A+r),this.lineTo(t,A),this.lineTo(t+e,A),this.lineTo(t,A)},a.prototype.fillRect=function(t,A,e,r){if(isNaN(t)||isNaN(A)||isNaN(e)||isNaN(r))throw console.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!u.call(this)){var n={};"butt"!==this.lineCap&&(n.lineCap=this.lineCap,this.lineCap="butt"),"miter"!==this.lineJoin&&(n.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(t,A,e,r),this.fill(),n.hasOwnProperty("lineCap")&&(this.lineCap=n.lineCap),n.hasOwnProperty("lineJoin")&&(this.lineJoin=n.lineJoin)}},a.prototype.strokeRect=function(t,A,e,r){if(isNaN(t)||isNaN(A)||isNaN(e)||isNaN(r))throw console.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");l.call(this)||(this.beginPath(),this.rect(t,A,e,r),this.stroke())},a.prototype.clearRect=function(t,A,e,r){if(isNaN(t)||isNaN(A)||isNaN(e)||isNaN(r))throw console.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(t,A,e,r))},a.prototype.save=function(t){t="boolean"!=typeof t||t;for(var A=this.pdf.internal.getCurrentPageInfo().pageNumber,e=0;e"},w=function(t){var A,e,r,n,i,o=String,s="length",a="charCodeAt",c="slice",u="replace";for(t[c](-2),t=t[c](0,-2)[u](/\s/g,"")[u]("z","!!!!!"),r=[],n=0,i=(t+=A="uuuuu"[c](t[s]%5||5))[s];n>24,255&e>>16,255&e>>8,255&e);return function(t){for(var e=A[s];0"},Q=function(t){var A=new RegExp(/^([0-9A-Fa-f]{2})+$/);if(-1!==(t=t.replace(/\s/g,"")).indexOf(">")&&(t=t.substr(0,t.indexOf(">"))),t.length%2&&(t+="0"),!1===A.test(t))return"";for(var e="",r=0;r>8&255,e>>16&255,e>>24&255]),t.length+2),String.fromCharCode.apply(null,n)},B.processDataByFilters=function(t,A){var e=0,r=t||"",n=[];for("string"==typeof(A=A||[])&&(A=[A]),e=0;e>"),this.internal.out("endobj"),L=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+H+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){void 0!==b&&void 0!==L&&this.internal.out("/Names <>")}),this},(x=dt.API).events.push(["postPutResources",function(){var t=this,A=/^(\d+) 0 obj$/;if(0> endobj")}var l=t.internal.newObject();for(t.internal.write("<< /Names [ "),r=0;r>","endobj"),t.internal.newObject(),t.internal.write("<< /Dests "+l+" 0 R"),t.internal.write(">>","endobj")}}]),x.events.push(["putCatalog",function(){0> \r\nendobj\r\n"},t.outline.count_r=function(t,A){for(var e=0;e>>24&255,h[l++]=s>>>16&255,h[l++]=s>>>8&255,h[l++]=255&s,S.arrayBufferToBinaryString(h)},T=function(t,A){var e=Math.LOG2E*Math.log(32768)-8<<4|8,r=e<<8;return r|=Math.min(3,(A-1&255)>>1)<<6,r|=0,[e,255&(r+=31-r%31)]},R=function(t,A){for(var e,r=1,n=0,i=t.length,o=0;0>>0},O=function(t,A,e,r){for(var n,i,o,s=t.length/A,a=new Uint8Array(t.length+s),c=j(),u=0;u>>1)&255;return i},k=function(t,A,e){var r,n,i,o,s=[],a=0,c=t.length;for(s[0]=4;a>>d&255,d+=i.bits;g[m]=C>>>d&255}if(16===i.bits){p=(N=new Uint32Array(i.decodePixels().buffer)).length,B=new Uint8Array(p*(32/i.pixelBitlength)*i.colors),g=new Uint8Array(p*(32/i.pixelBitlength));for(var C,y=1>>0&255,y&&(B[Q++]=C>>>16&255,C=N[m++],B[Q++]=C>>>0&255),g[v++]=C>>>16&255;f=8}r!==S.image_compression.NONE&&I()?(t=_(B,i.width*i.colors,i.colors,r),u=_(g,i.width,1,r)):(t=B,u=g,h=null)}if(3===i.colorType&&(l=this.color_spaces.INDEXED,c=i.palette,i.transparency.indexed)){var F=i.transparency.indexed,U=0;for(m=0,p=F.length;mr&&(n.push(t.slice(a,i)),s=0,a=i),s+=A[i],i++;return a!==i&&n.push(t.slice(a,i)),n},tt=function(t,A,e){e||(e={});var r,n,i,o,s,a,c=[],u=[c],l=e.textIndent||0,h=0,f=0,d=t.split(" "),p=W.apply(this,[" ",e])[0];if(a=-1===e.lineIndent?d[0].length+2:e.lineIndent||0){var B=Array(a).join(" "),g=[];d.map(function(t){1<(t=t.split(/\s*\n/)).length?g=g.concat(t.map(function(t,A){return(A&&t.length?"\n":"")+t})):g.push(t[0])}),d=g,a=Z.apply(this,[B,e])}for(i=0,o=d.length;i>")}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=e,this},at=dt.API,lt=ut=ct="",at.addMetadata=function(t,A){return ut=A||"http://jspdf.default.namespaceuri/",ct=t,this.internal.events.subscribe("postPutResources",function(){if(ct){var t='',A=unescape(encodeURIComponent('')),e=unescape(encodeURIComponent(t)),r=unescape(encodeURIComponent(ct)),n=unescape(encodeURIComponent("")),i=unescape(encodeURIComponent("")),o=e.length+r.length+n.length+A.length+i.length;lt=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+o+" >>"),this.internal.write("stream"),this.internal.write(A+e+r+n+i),this.internal.write("endstream"),this.internal.write("endobj")}else lt=""}),this.internal.events.subscribe("putCatalog",function(){lt&&this.internal.write("/Metadata "+lt+" 0 R")}),this},function(t){var A=t.API,e=A.pdfEscape16=function(t,A){for(var e,r=A.metadata.Unicode.widths,n=["","0","00","000","0000"],i=[""],o=0,s=t.length;o<"+n+">");return r.length&&(i+="\n"+r.length+" beginbfchar\n"+r.join("\n")+"\nendbfchar\n"),i+"endcmap\nCMapName currentdict /CMap defineresource pop\nend\nend"};A.events.push(["putFont",function(A){!function(A,e,n,i){if(A.metadata instanceof t.API.TTFFont&&"Identity-H"===A.encoding){for(var o=A.metadata.Unicode.widths,s=A.metadata.subset.encode(A.metadata.glyIdsUsed,1),a="",c=0;c>"),e("endobj");var f=n();e("<<"),e("/Type /Font"),e("/BaseFont /"+A.fontName),e("/FontDescriptor "+h+" 0 R"),e("/W "+t.API.PDFObject.convert(o)),e("/CIDToGIDMap /Identity"),e("/DW 1000"),e("/Subtype /CIDFontType2"),e("/CIDSystemInfo"),e("<<"),e("/Supplement 0"),e("/Registry (Adobe)"),e("/Ordering ("+A.encoding+")"),e(">>"),e(">>"),e("endobj"),A.objectNumber=n(),e("<<"),e("/Type /Font"),e("/Subtype /Type0"),e("/ToUnicode "+l+" 0 R"),e("/BaseFont /"+A.fontName),e("/Encoding /"+A.encoding),e("/DescendantFonts ["+f+" 0 R]"),e(">>"),e("endobj"),A.isAlreadyPutted=!0}}(A.font,A.out,A.newObject,A.putStream)}]),A.events.push(["putFont",function(A){!function(A,e,n,i){if(A.metadata instanceof t.API.TTFFont&&"WinAnsiEncoding"===A.encoding){A.metadata.Unicode.widths;for(var o=A.metadata.rawData,s="",a=0;a>"),e("endobj"),A.objectNumber=n(),a=0;a>"),e("endobj"),A.isAlreadyPutted=!0}}(A.font,A.out,A.newObject,A.putStream)}]);var n=function(t){var A,r,n=t.text||"",i=t.x,o=t.y,s=t.options||{},a=t.mutex||{},c=a.pdfEscape,u=a.activeFontKey,l=a.fonts,h=(a.activeFontSize,""),f=0,d="",p=l[r=u].encoding;if("Identity-H"!==l[r].encoding)return{text:n,x:i,y:o,options:s,mutex:a};for(d=n,r=u,"[object Array]"===Object.prototype.toString.call(n)&&(d=n[0]),f=0;fa-c.top-c.bottom&&r.pagesplit){var d=function(t,A,e,n,i){var o=document.createElement("canvas");o.height=i,o.width=n;var s=o.getContext("2d");return s.mozImageSmoothingEnabled=!1,s.webkitImageSmoothingEnabled=!1,s.msImageSmoothingEnabled=!1,s.imageSmoothingEnabled=!1,s.fillStyle=r.backgroundColor||"#ffffff",s.fillRect(0,0,n,i),s.drawImage(t,A,e,n,i,0,0,n,i),o},p=function(){for(var r,i,u=0,p=0,B={},g=!1;;){var w;if(p=0,B.top=0!==u?c.top:e,B.left=0!==u?c.left:A,g=(s-c.left-c.right)*o=t.width)break;this.addPage()}else m=[w=d(t,0,u,r,i),B.left,B.top,w.width/o,w.height/o,h,null,f],this.addImage.apply(this,m);if((u+=i)>=t.height)break;this.addPage()}n(l,u,null,m)}.bind(this);if("CANVAS"===t.nodeName){var B=new Image;B.onload=p,B.src=t.toDataURL("image/png"),t=B}else p()}else{var g=Math.random().toString(35),w=[t,A,e,l,u,h,g,f];this.addImage.apply(this,w),n(l,u,g,w)}}.bind(this),"undefined"!=typeof html2canvas&&!r.rstz)return html2canvas(t,r);if("undefined"==typeof rasterizeHTML)return null;var c="drawDocument";return"string"==typeof t&&(c=/^http/.test(t)?"drawURL":"drawHTML"),r.width=r.width||s*o,rasterizeHTML[c](t,void 0,r).then(function(t){r.onrendered(t.image)},function(t){n(null,t)})},function(t){var A,e,r,i,o,s,a,c,u,l,h,f,d,p,B,g,w,m,Q,C;A=function(){return function(A){return t.prototype=A,new t};function t(){}}(),l=function(t){var A,e,r,n,i,o,s;for(e=0,r=t.length,A=void 0,o=n=!1;!n&&e!==r;)(A=t[e]=t[e].trimLeft())&&(n=!0),e++;for(e=r-1;r&&!o&&-1!==e;)(A=t[e]=t[e].trimRight())&&(o=!0),e--;for(i=/\s+$/g,s=!0,e=0;e!==r;)"\u2028"!=t[e]&&(A=t[e].replace(/\s+/g," "),s&&(A=A.trimLeft()),A&&(s=i.test(A)),t[e]=A),e++;return t},f=function(t){var A,e,n;for(A=void 0,e=(n=t.split(",")).shift();!A&&e;)A=r[e.trim().toLowerCase()],e=n.shift();return A},d=function(t){var A;return-1<(t="auto"===t?"0px":t).indexOf("em")&&!isNaN(Number(t.replace("em","")))&&(t=18.719*Number(t.replace("em",""))+"px"),-1r.pdf.margins_doc.top&&(r.pdf.addPage(),r.y=r.pdf.margins_doc.top,r.executeWatchFunctions(o));var L=u(o),H=r.x,x=12/r.pdf.internal.scaleFactor,S=(L["margin-left"]+L["padding-left"])*x,I=(L["margin-right"]+L["padding-right"])*x,_=(L["margin-top"]+L["padding-top"])*x,T=(L["margin-bottom"]+L["padding-bottom"])*x;void 0!==L.float&&"right"===L.float?H+=r.settings.width-o.width-I:H+=S,r.pdf.addImage(E,H,r.y+_,o.width,o.height),E=void 0,"right"===L.float||"left"===L.float?(r.watchFunctions.push(function(t,A,e,n){return r.y>=A?(r.x+=t,r.settings.width+=e,!0):!!(n&&1===n.nodeType&&!y[n.nodeName]&&r.x+n.width>r.pdf.margins_doc.left+r.pdf.margins_doc.width)&&(r.x+=t,r.y=A,r.settings.width+=e,!0)}.bind(this,"left"===L.float?-o.width-S-I:0,r.y+o.height+_+T,o.width)),r.watchFunctions.push(function(t,A,e){return!(r.y]*?>/gi,""),u="jsPDFhtmlText"+Date.now().toString()+(1e3*Math.random()).toFixed(0),(c=document.createElement("div")).style.cssText="position: absolute !important;clip: rect(1px 1px 1px 1px); /* IE6, IE7 */clip: rect(1px, 1px, 1px, 1px);padding:0 !important;border:0 !important;height: 1px !important;width: 1px !important; top:auto;left:-100px;overflow: hidden;",c.innerHTML=' )} ) : null} ); }; export default PreviewFile; ================================================ FILE: web-app/src/screens/Console/Buckets/ListBuckets/Objects/Preview/PreviewFileModal.tsx ================================================ // 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 . import React, { Fragment } from "react"; import ModalWrapper from "../../../../Common/ModalWrapper/ModalWrapper"; import PreviewFileContent from "./PreviewFileContent"; import { ObjectPreviewIcon } from "mds"; import { BucketObject } from "../../../../../../api/consoleApi"; interface IPreviewFileProps { open: boolean; bucketName: string; actualInfo: BucketObject; onClosePreview: () => void; } const PreviewFileModal = ({ open, bucketName, actualInfo, onClosePreview, }: IPreviewFileProps) => { return ( } > ); }; export default PreviewFileModal; ================================================ FILE: web-app/src/screens/Console/Buckets/ListBuckets/Objects/Preview/PreviewPDF.tsx ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public 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, useState } from "react"; import { Document, Page, pdfjs } from "react-pdf"; import { Box, Button, InformativeMessage } from "mds"; pdfjs.GlobalWorkerOptions.workerSrc = "./scripts/pdf.worker.min.mjs"; interface IPreviewPDFProps { path: string; loading: boolean; onLoad: () => void; downloadFile: () => void; } const PreviewPDF = ({ path, loading, onLoad, downloadFile, }: IPreviewPDFProps) => { const [errorState, setErrorState] = useState(false); const [totalPages, setTotalPages] = useState(0); if (!path) { return null; } const renderPages = totalPages > 5 ? 5 : totalPages; const arrayCreate = Array.from(Array(renderPages).keys()); return ( {errorState && totalPages === 0 && ( File preview couldn't be displayed, Please try Download instead. } sx={{ marginBottom: 10 }} /> )} {!loading && !errorState && ( This is a File Preview for the first {arrayCreate.length} pages of the document, if you wish to work with the full document please download instead. } sx={{ marginBottom: 10 }} /> )} {!errorState && ( { setTotalPages(_pdfInfo.numPages || 0); setErrorState(false); onLoad(); }} onLoadError={(error) => { setErrorState(true); onLoad(); console.error(error); }} > {arrayCreate.map((item) => ( ))} )} ); }; export default PreviewPDF; ================================================ FILE: web-app/src/screens/Console/Buckets/ListBuckets/Objects/utils.ts ================================================ // 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 . import { BucketObjectItem } from "./ListObjects/types"; import { removeTrace } from "../../../ObjectBrowser/transferManager"; import { store } from "../../../../../store"; import { ContentType, PermissionResource } from "api/consoleApi"; import { api } from "../../../../../api"; import { setErrorSnackMessage } from "../../../../../systemSlice"; import { StatusCodes } from "http-status-codes"; const downloadWithLink = (href: string, downloadFileName: string) => { const link = document.createElement("a"); link.href = href; link.download = downloadFileName; document.body.appendChild(link); link.click(); document.body.removeChild(link); }; export const downloadSelectedAsZip = async ( bucketName: string, objectList: string[], resultFileName: string, ) => { const state = store.getState(); const anonymousMode = state.system.anonymousMode; try { const resp = await api.buckets.downloadMultipleObjects( bucketName, objectList, { type: ContentType.Json, headers: anonymousMode ? { "X-Anonymous": "1", } : undefined, }, ); const blob = await resp.blob(); const href = window.URL.createObjectURL(blob); downloadWithLink(href, resultFileName); } catch (err: any) { store.dispatch( setErrorSnackMessage({ errorMessage: `Download of multiple files failed. ${err.statusText}`, detailedError: "", }), ); } }; const isFolder = (objectPath: string) => { return objectPath.endsWith("/"); }; export const download = ( bucketName: string, objectPath: string, versionID: any, fileSize: number, overrideFileName: string | null = null, id: string, progressCallback: (progress: number) => void, completeCallback: () => void, errorCallback: (msg: string) => void, abortCallback: () => void, toastCallback: () => void, ) => { let basename = document.baseURI.replace(window.location.origin, ""); const state = store.getState(); const anonymousMode = state.system.anonymousMode; let path = `${ window.location.origin }${basename}api/v1/buckets/${encodeURIComponent(bucketName)}/objects/download?prefix=${encodeURIComponent(objectPath)}${ overrideFileName !== null && overrideFileName.trim() !== "" ? `&override_file_name=${encodeURIComponent(overrideFileName || "")}` : "" }`; if (versionID) { path = path.concat(`&version_id=${versionID}`); } // If file is greater than 5GiB then we force browser download, if not then we use HTTP Request for Object Manager if (fileSize > 5368709120) { return new BrowserDownload(path, id, completeCallback, toastCallback); } let req = new XMLHttpRequest(); req.open("GET", path, true); if (anonymousMode) { req.setRequestHeader("X-Anonymous", "1"); } req.addEventListener( "progress", function (evt) { let percentComplete = Math.round((evt.loaded / fileSize) * 100); if (progressCallback) { progressCallback(percentComplete); } }, false, ); req.responseType = "blob"; req.onreadystatechange = () => { if (req.readyState === XMLHttpRequest.DONE) { // Ensure object was downloaded fully, if it's a folder we don't get the fileSize let completeDownload = isFolder(objectPath) || req.response.size === fileSize; if (req.status === StatusCodes.OK && completeDownload) { const rspHeader = req.getResponseHeader("Content-Disposition"); let filename = "download"; if (rspHeader) { let rspHeaderDecoded = decodeURIComponent(rspHeader); filename = rspHeaderDecoded.split('"')[1]; } if (completeCallback) { completeCallback(); } removeTrace(id); downloadWithLink(window.URL.createObjectURL(req.response), filename); } else { if (req.getResponseHeader("Content-Type") === "application/json") { const rspBody: { detailedMessage?: string } = JSON.parse( req.response, ); if (rspBody.detailedMessage) { errorCallback(rspBody.detailedMessage); return; } } errorCallback(`Unexpected response, download incomplete.`); } } }; req.onerror = () => { if (errorCallback) { errorCallback("A network error occurred."); } }; req.onabort = () => { if (abortCallback) { abortCallback(); } }; return req; }; class BrowserDownload { path: string; id: string; completeCallback: () => void; toastCallback: () => void; constructor( path: string, id: string, completeCallback: () => void, toastCallback: () => void, ) { this.path = path; this.id = id; this.completeCallback = completeCallback; this.toastCallback = toastCallback; } send(): void { this.toastCallback(); const link = document.createElement("a"); link.href = this.path; document.body.appendChild(link); link.click(); document.body.removeChild(link); this.completeCallback(); removeTrace(this.id); } } export type AllowedPreviews = "image" | "pdf" | "audio" | "video" | "none"; const contentTypePreview = (contentType: string): AllowedPreviews => { if (contentType) { const mimeObjectType = (contentType || "").toLowerCase(); if (mimeObjectType.includes("image")) { return "image"; } if (mimeObjectType.includes("pdf")) { return "pdf"; } if (mimeObjectType.includes("audio")) { return "audio"; } if (mimeObjectType.includes("video")) { return "video"; } } return "none"; }; // Review file extension by name & returns the type of preview browser that can be used const extensionPreview = (fileName: string): AllowedPreviews => { const imageExtensions = [ "jif", "jfif", "apng", "avif", "svg", "webp", "bmp", "ico", "jpg", "jpe", "jpeg", "gif", "png", "heic", ]; const pdfExtensions = ["pdf"]; const audioExtensions = ["wav", "mp3", "alac", "aiff", "dsd", "pcm"]; const videoExtensions = [ "mp4", "avi", "mpg", "webm", "mov", "flv", "mkv", "wmv", "avchd", "mpeg-4", ]; let fileExtension = fileName.split(".").pop(); if (!fileExtension) { return "none"; } fileExtension = fileExtension.toLowerCase(); if (imageExtensions.includes(fileExtension)) { return "image"; } if (pdfExtensions.includes(fileExtension)) { return "pdf"; } if (audioExtensions.includes(fileExtension)) { return "audio"; } if (videoExtensions.includes(fileExtension)) { return "video"; } return "none"; }; export const previewObjectType = ( metaData: Record, objectName: string, ) => { const metaContentType = ( (metaData && metaData["Content-Type"]) || "" ).toString(); const extensionType = extensionPreview(objectName || ""); const contentType = contentTypePreview(metaContentType); let objectType: AllowedPreviews = extensionType; if (extensionType === contentType) { objectType = extensionType; } else if (extensionType === "none" && contentType !== "none") { objectType = contentType; } else if (contentType === "none" && extensionType !== "none") { objectType = extensionType; } return objectType; }; export const sortListObjects = (fieldSort: string) => { switch (fieldSort) { case "name": return (a: BucketObjectItem, b: BucketObjectItem) => a.name.localeCompare(b.name); case "last_modified": return (a: BucketObjectItem, b: BucketObjectItem) => new Date(a.last_modified).getTime() - new Date(b.last_modified).getTime(); case "size": return (a: BucketObjectItem, b: BucketObjectItem) => (a.size || -1) - (b.size || -1); } }; export const permissionItems = ( bucketName: string, currentPath: string, permissionsArray: PermissionResource[], ): BucketObjectItem[] | null => { if (permissionsArray.length === 0) { return null; } // We get permissions applied to the current bucket const filteredPermissionsForBucket = permissionsArray.filter( (permissionItem) => permissionItem.resource?.endsWith(`:${bucketName}`) || permissionItem.resource?.includes(`:${bucketName}/`), ); // No permissions for this bucket. we can throw the error message at this point if (filteredPermissionsForBucket.length === 0) { return null; } let returnElements: BucketObjectItem[] = []; // We split current path const splitCurrentPath = currentPath.split("/"); filteredPermissionsForBucket.forEach((permissionElement) => { // We review paths in resource address // We split ARN & get the last item to check the URL const splitARN = permissionElement.resource?.split(":"); const urlARN = splitARN?.pop() || ""; // We split the paths of the URL & compare against current location to see if there are more items to include. In case current level is a wildcard or is the last one, we omit this validation const splitURLARN = urlARN.split("/"); // splitURL has more items than bucket name, we can continue validating if (splitURLARN.length > 1) { splitURLARN.every((currentElementInPath, index) => { // It is a wildcard element. We can store the verification as value should be included (?) if (currentElementInPath === "*") { return false; } // Element is not included in the path. The user is trying to browse something else. if ( splitCurrentPath[index] && splitCurrentPath[index] !== currentElementInPath ) { return false; } // This element is not included by index in the current paths list. We add it so user can browse into it if (!splitCurrentPath[index]) { returnElements.push({ name: `${currentElementInPath}/`, size: 0, last_modified: "", version_id: "", }); } return true; }); } // We review prefixes in allow resources for StringEquals variant only. if ( permissionElement.conditionOperator === "StringEquals" || permissionElement.conditionOperator === "StringLike" ) { permissionElement.prefixes?.forEach((prefixItem) => { // Prefix Item is not empty? if (prefixItem !== "") { const splitItems = prefixItem.split("/"); let pathToRouteElements: string[] = []; // We verify if currentPath is contained in the path begin, if is not contained the user has no access to this subpath const cleanCurrPath = currentPath.replace(/\/$/, ""); if (!prefixItem.startsWith(cleanCurrPath) && currentPath !== "") { return; } // For every split element we iterate and check if we can construct a URL splitItems.every((splitElement, index) => { if (!splitElement.includes("*") && splitElement !== "") { if (splitElement !== splitCurrentPath[index]) { returnElements.push({ name: `${pathToRouteElements.join("/")}${ pathToRouteElements.length > 0 ? "/" : "" }${splitElement}/`, size: 0, last_modified: "", version_id: "", }); return false; } if (splitElement !== "") { pathToRouteElements.push(splitElement); } return true; } return false; }); } }); } }); // We clean duplicated name entries if (returnElements.length > 0) { let clElements: BucketObjectItem[] = []; let keys: string[] = []; returnElements.forEach((itm) => { if (!keys.includes(itm.name)) { clElements.push(itm); keys.push(itm.name); } }); returnElements = clElements; } return returnElements; }; ================================================ FILE: web-app/src/screens/Console/Buckets/ListBuckets/UploadFilesButton.tsx ================================================ // 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, useState } from "react"; import { CSSObject } from "styled-components"; import { Button, DropdownSelector, UploadFolderIcon, UploadIcon } from "mds"; import { IAM_SCOPES, permissionTooltipHelper, } from "../../../../common/SecureComponent/permissions"; import { hasPermission } from "../../../../common/SecureComponent"; import TooltipWrapper from "../../Common/TooltipWrapper/TooltipWrapper"; import { useSelector } from "react-redux"; import { AppState } from "../../../../store"; import { getSessionGrantsWildCard } from "./UploadPermissionUtils"; interface IUploadFilesButton { uploadPath: string; bucketName: string; forceDisable?: boolean; uploadFileFunction: (closeFunction: () => void) => void; uploadFolderFunction: (closeFunction: () => void) => void; overrideStyles?: CSSObject; } const UploadFilesButton = ({ uploadPath, bucketName, forceDisable = false, uploadFileFunction, uploadFolderFunction, overrideStyles = {}, }: IUploadFilesButton) => { const [anchorEl, setAnchorEl] = useState(null); const [uploadOptionsOpen, uploadOptionsSetOpen] = useState(false); const anonymousMode = useSelector( (state: AppState) => state.system.anonymousMode, ); const sessionGrants = useSelector((state: AppState) => state.console.session ? state.console.session.permissions || {} : {}, ); const putObjectPermScopes = [ IAM_SCOPES.S3_PUT_OBJECT, IAM_SCOPES.S3_PUT_ACTIONS, ]; const sessionGrantWildCards = getSessionGrantsWildCard( sessionGrants, uploadPath, putObjectPermScopes, ); const openUploadMenu = Boolean(anchorEl); const handleClick = (event: React.MouseEvent) => { uploadOptionsSetOpen(!uploadOptionsOpen); setAnchorEl(event.currentTarget); }; const handleCloseUpload = () => { setAnchorEl(null); }; const uploadObjectAllowed = hasPermission( [uploadPath, ...sessionGrantWildCards], putObjectPermScopes, ) || anonymousMode; const uploadFolderAllowed = hasPermission( [bucketName, ...sessionGrantWildCards], putObjectPermScopes, false, true, ); const uploadFolderAction = (action: string) => { if (action === "folder") { uploadFolderFunction(handleCloseUpload); return; } uploadFileFunction(handleCloseUpload); }; const uploadEnabled: boolean = uploadObjectAllowed || uploadFolderAllowed; return (

Currently Configured Endpoints

); }; export default WebhookSettings; ================================================ FILE: web-app/src/screens/Console/EventDestinations/destinationsSlice.ts ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public 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 { createSlice, PayloadAction } from "@reduxjs/toolkit"; interface DestinationState { loading: boolean; } const initialState: DestinationState = { loading: true, }; const destinationSlice = createSlice({ name: "destination", initialState, reducers: { setDestinationLoading: (state, action: PayloadAction) => { state.loading = action.payload; }, }, }); // Action creators are generated for each case reducer function export const { setDestinationLoading } = destinationSlice.actions; export default destinationSlice.reducer; ================================================ FILE: web-app/src/screens/Console/EventDestinations/types.ts ================================================ // 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 . export interface TransformedEndpointItem { service_name: string; status: string; name: string; account_id: string; } ================================================ FILE: web-app/src/screens/Console/EventDestinations/utils.ts ================================================ // 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 . import { NotificationEndpointItem } from "api/consoleApi"; import { IElementValue } from "../Configurations/types"; import { TransformedEndpointItem } from "./types"; export const notifyPostgres = "notify_postgres"; export const notifyMysql = "notify_mysql"; const notifyKafka = "notify_kafka"; const notifyAmqp = "notify_amqp"; const notifyMqtt = "notify_mqtt"; const notifyRedis = "notify_redis"; const notifyNats = "notify_nats"; const notifyElasticsearch = "notify_elasticsearch"; const notifyWebhooks = "notify_webhook"; const notifyNsq = "notify_nsq"; export const notificationTransform = ( notificationElements: NotificationEndpointItem[], ) => { return notificationElements.map((element) => { return { service_name: `${element.service}:${element.account_id}`, name: element.service, account_id: element.account_id, status: element.status, }; }) as TransformedEndpointItem[]; }; export class DestType { static DB: string = "database"; static Queue: string = "queue"; static Func: string = "functions"; } const getImgBaseURL = () => { return `${document.baseURI}`; }; export const destinationList = [ { actionTrigger: notifyPostgres, targetTitle: "PostgreSQL", logo: `${getImgBaseURL()}postgres-logo.svg`, category: DestType.DB, }, { actionTrigger: notifyKafka, targetTitle: "Kafka", logo: `${getImgBaseURL()}kafka-logo.svg`, category: DestType.Queue, }, { actionTrigger: notifyAmqp, targetTitle: "AMQP", logo: `${getImgBaseURL()}amqp-logo.svg`, category: DestType.Queue, }, { actionTrigger: notifyMqtt, targetTitle: "MQTT", logo: `${getImgBaseURL()}mqtt-logo.svg`, category: DestType.Queue, }, { actionTrigger: notifyRedis, targetTitle: "Redis", logo: `${getImgBaseURL()}redis-logo.svg`, category: DestType.Queue, }, { actionTrigger: notifyNats, targetTitle: "NATS", logo: `${getImgBaseURL()}nats-logo.svg`, category: DestType.Queue, }, { actionTrigger: notifyMysql, targetTitle: "Mysql", logo: `${getImgBaseURL()}mysql-logo.svg`, category: DestType.DB, }, { actionTrigger: notifyElasticsearch, targetTitle: "Elastic Search", logo: `${getImgBaseURL()}elasticsearch-logo.svg`, category: DestType.DB, }, { actionTrigger: notifyWebhooks, targetTitle: "Webhook", logo: `${getImgBaseURL()}webhooks-logo.svg`, category: DestType.Func, }, { actionTrigger: notifyNsq, targetTitle: "NSQ", logo: `${getImgBaseURL()}nsq-logo.svg`, category: DestType.Queue, }, ]; const commonFields = [ { name: "queue_dir", label: "Queue Directory", required: false, tooltip: "Staging directory for undelivered messages e.g. '/home/events'", type: "string", placeholder: "Enter Queue Directory", }, { name: "queue_limit", label: "Queue Limit", required: false, tooltip: "Maximum limit for undelivered messages, defaults to '10000'", type: "number", placeholder: "Enter Queue Limit", }, { name: "comment", label: "Comment", required: false, type: "comment", placeholder: "Enter custom notes if any", }, ]; export const removeEmptyFields = (formFields: IElementValue[]) => { const nonEmptyFields = formFields.filter((field) => field.value !== ""); return nonEmptyFields; }; export const notificationEndpointsFields: any = { [notifyKafka]: [ { name: "brokers", label: "Brokers", required: true, tooltip: "Comma separated list of Kafka broker addresses", type: "string", placeholder: "Enter Brokers", }, { name: "topic", label: "Topic", tooltip: "Kafka topic used for bucket notifications", type: "string", placeholder: "Enter Topic", }, { name: "sasl_username", label: "SASL Username", tooltip: "Username for SASL/PLAIN or SASL/SCRAM authentication", type: "string", placeholder: "Enter SASL Username", }, { name: "sasl_password", label: "SASL Password", tooltip: "Password for SASL/PLAIN or SASL/SCRAM authentication", type: "string", placeholder: "Enter SASL Password", }, { name: "sasl_mechanism", label: "SASL Mechanism", tooltip: "SASL authentication mechanism, default 'PLAIN'", type: "string", }, { name: "tls_client_auth", label: "TLS Client Auth", tooltip: "Client Auth determines the Kafka server's policy for TLS client authorization", type: "string", placeholder: "Enter TLS Client Auth", }, { name: "sasl", label: "SASL", tooltip: "Set to 'on' to enable SASL authentication", type: "on|off", }, { name: "tls", label: "TLS", tooltip: "Set to 'on' to enable TLS", type: "on|off", }, { name: "tls_skip_verify", label: "TLS skip verify", tooltip: 'Trust server TLS without verification, defaults to "on" (verify)', type: "on|off", }, { name: "client_tls_cert", label: "client TLS cert", tooltip: "Path to client certificate for mTLS authorization", type: "path", placeholder: "Enter TLS Client Cert", }, { name: "client_tls_key", label: "client TLS key", tooltip: "Path to client key for mTLS authorization", type: "path", placeholder: "Enter TLS Client Key", }, { name: "version", label: "Version", tooltip: "Specify the version of the Kafka cluster e.g '2.2.0'", type: "string", placeholder: "Enter Kafka Version", }, ...commonFields, ], [notifyAmqp]: [ { name: "url", required: true, label: "URL", tooltip: "AMQP server endpoint e.g. `amqp://myuser:mypassword@localhost:5672`", type: "url", }, { name: "exchange", label: "Exchange", tooltip: "Name of the AMQP exchange", type: "string", placeholder: "Enter Exchange", }, { name: "exchange_type", label: "Exchange Type", tooltip: "AMQP exchange type", type: "string", placeholder: "Enter Exchange Type", }, { name: "routing_key", label: "Routing Key", tooltip: "Routing key for publishing", type: "string", placeholder: "Enter Routing Key", }, { name: "mandatory", label: "Mandatory", tooltip: "Quietly ignore undelivered messages when set to 'off', default is 'on'", type: "on|off", }, { name: "durable", label: "Durable", tooltip: "Persist queue across broker restarts when set to 'on', default is 'off'", type: "on|off", }, { name: "no_wait", label: "No Wait", tooltip: "Non-blocking message delivery when set to 'on', default is 'off'", type: "on|off", }, { name: "internal", label: "Internal", tooltip: "Set to 'on' for exchange to be not used directly by publishers, but only when bound to other exchanges", type: "on|off", }, { name: "auto_deleted", label: "Auto Deleted", tooltip: "Auto delete queue when set to 'on', when there are no consumers", type: "on|off", }, { name: "delivery_mode", label: "Delivery Mode", tooltip: "Set to '1' for non-persistent or '2' for persistent queue", type: "number", placeholder: "Enter Delivery Mode", }, ...commonFields, ], [notifyRedis]: [ { name: "address", required: true, label: "Address", tooltip: "Redis server's address e.g. `localhost:6379`", type: "address", placeholder: "Enter Address", }, { name: "key", required: true, label: "Key", tooltip: "Redis key to store/update events, key is auto-created", type: "string", placeholder: "Enter Key", }, { name: "password", label: "Password", tooltip: "Redis server password", type: "string", placeholder: "Enter Password", }, ...commonFields, ], [notifyMqtt]: [ { name: "broker", required: true, label: "Broker", tooltip: "MQTT server endpoint e.g. `tcp://localhost:1883`", type: "uri", placeholder: "Enter Brokers", }, { name: "topic", required: true, label: "Topic", tooltip: "Name of the MQTT topic to publish", type: "string", placeholder: "Enter Topic", }, { name: "username", label: "Username", tooltip: "MQTT username", type: "string", placeholder: "Enter Username", }, { name: "password", label: "Password", tooltip: "MQTT password", type: "string", placeholder: "Enter Password", }, { name: "qos", label: "QOS", tooltip: "Set the quality of service priority, defaults to '0'", type: "number", placeholder: "Enter QOS", }, { name: "keep_alive_interval", label: "Keep Alive Interval", tooltip: "Keep-alive interval for MQTT connections in s,m,h,d", type: "duration", placeholder: "Enter Keep Alive Interval", }, { name: "reconnect_interval", label: "Reconnect Interval", tooltip: "Reconnect interval for MQTT connections in s,m,h,d", type: "duration", placeholder: "Enter Reconnect Interval", }, ...commonFields, ], [notifyNats]: [ { name: "address", required: true, label: "Address", tooltip: "NATS server address e.g. '0.0.0.0:4222'", type: "address", placeholder: "Enter Address", }, { name: "subject", required: true, label: "Subject", tooltip: "NATS subscription subject", type: "string", placeholder: "Enter NATS Subject", }, { name: "username", label: "Username", tooltip: "NATS username", type: "string", placeholder: "Enter NATS Username", }, { name: "password", label: "Password", tooltip: "NATS password", type: "string", placeholder: "Enter NATS password", }, { name: "token", label: "Token", tooltip: "NATS token", type: "string", placeholder: "Enter NATS token", }, { name: "tls", label: "TLS", tooltip: "Set to 'on' to enable TLS", type: "on|off", }, { name: "tls_skip_verify", label: "TLS Skip Verify", tooltip: 'Trust server TLS without verification, defaults to "on" (verify)', type: "on|off", }, { name: "ping_interval", label: "Ping Interval", tooltip: "Client ping commands interval in s,m,h,d. Disabled by default", type: "duration", placeholder: "Enter Ping Interval", }, { name: "streaming", label: "Streaming", tooltip: "Set to 'on' to use streaming NATS server", type: "on|off", }, { name: "streaming_async", label: "Streaming async", tooltip: "Set to 'on' to enable asynchronous publish", type: "on|off", }, { name: "streaming_max_pub_acks_in_flight", label: "Streaming max publish ACKS in flight", tooltip: "Number of messages to publish without waiting for ACKs", type: "number", placeholder: "Enter Streaming in flight value", }, { name: "streaming_cluster_id", label: "Streaming Cluster ID", tooltip: "Unique ID for NATS streaming cluster", type: "string", placeholder: "Enter Streaming Cluster ID", }, { name: "cert_authority", label: "Cert Authority", tooltip: "Path to certificate chain of the target NATS server", type: "string", placeholder: "Enter Cert Authority", }, { name: "client_cert", label: "Client Cert", tooltip: "Client cert for NATS mTLS auth", type: "string", placeholder: "Enter Client Cert", }, { name: "client_key", label: "Client Key", tooltip: "Client cert key for NATS mTLS authorization", type: "string", placeholder: "Enter Client Key", }, ...commonFields, ], [notifyElasticsearch]: [ { name: "url", required: true, label: "URL", tooltip: "Elasticsearch server's address, with optional authentication info", type: "url", placeholder: "Enter URL", }, { name: "index", required: true, label: "Index", tooltip: "Elasticsearch index to store/update events, index is auto-created", type: "string", placeholder: "Enter Index", }, { name: "format", required: true, label: "Format", tooltip: "'namespace' reflects current bucket/object list and 'access' reflects a journal of object operations, defaults to 'namespace'", type: "enum", placeholder: "Enter Format", }, ...commonFields, ], [notifyWebhooks]: [ { name: "endpoint", required: true, label: "Endpoint", tooltip: "Webhook server endpoint e.g. http://localhost:8080/minio/events", type: "url", placeholder: "Enter Endpoint", }, { name: "auth_token", label: "Auth Token", tooltip: "Opaque string or JWT authorization token", type: "string", placeholder: "Enter auth_token", }, ...commonFields, ], [notifyNsq]: [ { name: "nsqd_address", required: true, label: "NSQD Address", tooltip: "NSQ server address e.g. '127.0.0.1:4150'", type: "address", placeholder: "Enter nsqd_address", }, { name: "topic", required: true, label: "Topic", tooltip: "NSQ topic", type: "string", placeholder: "Enter Topic", }, { name: "tls", label: "TLS", tooltip: "Set to 'on' to enable TLS", type: "on|off", }, { name: "tls_skip_verify", label: "TLS Skip Verify", tooltip: 'Trust server TLS without verification, defaults to "on" (verify)', type: "on|off", }, ...commonFields, ], }; const serviceToConfigMap: Record = { webhook: "notify_webhook", amqp: "notify_amqp", kafka: "notify_kafka", mqtt: "notify_mqtt", nats: "notify_nats", nsq: "notify_nsq", mysql: "notify_mysql", postgresql: "notify_postgres", //looks different in server response(postgresql as opposed to postgres) from api/admin_notification_endpoints.go elasticsearch: "notify_elasticsearch", redis: "notify_redis", }; export const getNotificationConfigKey = (serviceName: string) => { return serviceToConfigMap[serviceName]; }; ================================================ FILE: web-app/src/screens/Console/Groups/AddGroupHelpBox.tsx ================================================ // 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 { Box, GroupsIcon, HelpIconFilled, IAMPoliciesIcon } from "mds"; const FeatureItem = ({ icon, description, }: { icon: any; description: string; }) => { return ( {icon}{" "}
{description}
); }; const AddGroupHelpBox = () => { return (
Learn more about Groups
Adding groups lets you assign IAM policies to multiple users at once. Users inherit access permissions to data and resources through the groups they belong to. A user can be a member of multiple groups. Groups provide a simplified method for managing shared permissions among users with common access patterns and workloads. Client’s cannot authenticate to a MinIO deployment using a group as an identity. } description={`Add Users to Group`} /> Select from the list of displayed users to assign users to the new group at creation. These users inherit the policies assigned to the group. } description={`Assign Custom IAM Policies for Group`} /> You can add policies to the group by selecting it from the Groups view after creation. The Policy view lets you manage the assigned policies for the group.
); }; export default AddGroupHelpBox; ================================================ FILE: web-app/src/screens/Console/Groups/AddGroupMember.tsx ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public 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, { useState } from "react"; import { AddMembersToGroupIcon, Button, FormLayout, Grid, ReadBox } from "mds"; import { modalStyleUtils } from "../Common/FormComponents/common/styleLibrary"; import { setModalErrorSnackMessage } from "../../../systemSlice"; import { useAppDispatch } from "../../../store"; import { api } from "api"; import { errorToHandler } from "api/errors"; import UsersSelectors from "./UsersSelectors"; import ModalWrapper from "../Common/ModalWrapper/ModalWrapper"; type UserPickerModalProps = { title?: string; preSelectedUsers?: string[]; selectedGroup?: string; open: boolean; onClose: () => void; onSaveClick: () => void; groupStatus?: string; }; const AddGroupMember = ({ title = "", groupStatus = "enabled", preSelectedUsers = [], selectedGroup = "", open, onClose, }: UserPickerModalProps) => { const dispatch = useAppDispatch(); const [selectedUsers, setSelectedUsers] = useState(preSelectedUsers); function addMembersToGroup() { return api.group .updateGroup(selectedGroup, { members: selectedUsers, status: groupStatus, }) .then(() => { onClose(); }) .catch((err) => { onClose(); dispatch(setModalErrorSnackMessage(errorToHandler(err.error))); }); } return ( } > {selectedGroup}
); }; export default HelpMenu; ================================================ FILE: web-app/src/screens/Console/HelpMenu.types.ts ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . export interface DocItem { img?: string; title: string; url: string; body: string; } ================================================ FILE: web-app/src/screens/Console/IDP/AddIDPConfiguration.tsx ================================================ // 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, { useEffect, useState } from "react"; import { BackLink, Button, FormLayout, Grid, InputBox, PageLayout, SectionTitle, Switch, } from "mds"; import { useNavigate } from "react-router-dom"; import { useAppDispatch } from "../../../store"; import { modalStyleUtils } from "../Common/FormComponents/common/styleLibrary"; import { setErrorSnackMessage, setHelpName, setServerNeedsRestart, } from "../../../systemSlice"; import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; import HelpMenu from "../HelpMenu"; import { api } from "api"; import { ApiError, HttpResponse, SetIDPResponse } from "api/consoleApi"; import { errorToHandler } from "api/errors"; type AddIDPConfigurationProps = { classes?: any; icon: React.ReactNode; helpBox: React.ReactNode; header: string; title: string; backLink: string; formFields: object; }; const AddIDPConfiguration = ({ icon, helpBox, header, backLink, title, formFields, }: AddIDPConfigurationProps) => { const extraFormFields = { name: { required: true, hasError: (s: string, editMode: boolean) => { return !s && editMode ? "Config Name is required" : ""; }, label: "Name", tooltip: "Name for identity provider configuration", placeholder: "Name", type: "text", }, ...formFields, }; const navigate = useNavigate(); const dispatch = useAppDispatch(); const [fields, setFields] = useState({}); const [loadingCreate, setLoadingCreate] = useState(false); const validSave = () => { for (const [key, value] of Object.entries(extraFormFields)) { if ( value.required && !( fields[key] !== undefined && fields[key] !== null && fields[key] !== "" ) ) { return false; } } return true; }; const resetForm = () => { setFields({}); }; const addRecord = (event: React.FormEvent) => { setLoadingCreate(true); event.preventDefault(); const name = fields["name"]; let input = ""; for (const key of Object.keys(formFields)) { if (fields[key]) { input += `${key}=${fields[key]} `; } } api.idp .createConfiguration("openid", { name, input }) .then((res: HttpResponse) => { navigate(backLink); dispatch(setServerNeedsRestart(res.data.restart === true)); }) .catch((res: HttpResponse) => { dispatch(setErrorSnackMessage(errorToHandler(res.error))); }) .finally(() => setLoadingCreate(false)); }; const renderFormField = (key: string, value: any) => { switch (value.type) { case "toggle": return ( setFields({ ...fields, [key]: e.target.checked ? "on" : "off" }) } description="" /> ); default: return ( ) => setFields({ ...fields, [key]: e.target.value }) } placeholder={value.placeholder} type={value.type} /> ); } }; useEffect(() => { dispatch(setHelpName("add_idp_config")); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( navigate(backLink)} label={header} />} actions={} /> {title}
) => { addRecord(e); }} > {Object.entries(extraFormFields).map(([key, value]) => renderFormField(key, value), )} ); }; export default LDAPEntitiesQuery; ================================================ FILE: web-app/src/screens/Console/IDP/LDAP/LDAPResultsBlock.tsx ================================================ // This file is part of MinIO Console Server // Copyright (c) 2023 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public 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 } from "react"; import { Box, CollapseCaret, GroupsMenuIcon, SectionTitle } from "mds"; import { LdapEntities } from "api/consoleApi"; interface IResultBlock { entityName: "Group" | "User" | "Policy"; results: LdapEntities; } interface IEntityResultName { name: string; } interface IEntityResultItem { blockName: "Policies" | "Groups" | "Users"; results: string[]; } const EntityResultTitle = ({ name }: IEntityResultName) => { return (

{name}

); }; const EntityResultItems = ({ blockName, results }: IEntityResultItem) => { return ( {blockName}:
    {results.map((res, index) => (
  • {res}
  • ))}
); }; const LDAPResultsBlock = ({ entityName, results }: IResultBlock) => { let entityLength = 0; switch (entityName) { case "Group": entityLength = results.groups?.length || 0; break; case "Policy": entityLength = results.policies?.length || 0; break; case "User": entityLength = results.users?.length || 0; break; } return ( } actions={ {entityLength} Entit {entityLength === 1 ? "y" : "ies"} Found } > {entityName} Mappings {entityName === "Group" && results.groups?.map((groupData, index) => { return ( {groupData.policies && ( )} ); })} {entityName === "User" && results.users?.map((groupData, index) => { return ( {groupData.policies && ( )} ); })} {entityName === "Policy" && results.policies?.map((groupData, index) => { return ( {groupData.groups && ( )} {groupData.users && ( )} ); })} ); }; export default LDAPResultsBlock; ================================================ FILE: web-app/src/screens/Console/IDP/utils.tsx ================================================ // 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 { LockIcon, LoginIcon } from "mds"; export const ldapHelpBoxContents = [ { text: "MinIO supports using an Active Directory or LDAP (AD/LDAP) service for external management of user identities. Configuring an external IDentity Provider (IDP) enables Single-Sign On (SSO) workflows, where applications authenticate against the external IDP before accessing MinIO.", icon: , iconDescription: "Create Configurations", }, { text: "MinIO queries the configured Active Directory / LDAP server to verify the credentials specified by the application and optionally return a list of groups in which the user has membership. MinIO supports two modes (Lookup-Bind Mode and Username-Bind Mode) for performing these queries", icon: null, iconDescription: "", }, { text: "MinIO recommends using Lookup-Bind mode as the preferred method for verifying AD/LDAP credentials. Username-Bind mode is a legacy method retained for backwards compatibility only.", icon: null, iconDescription: "", }, ]; export const openIDHelpBoxContents = [ { text: "MinIO supports using an OpenID Connect (OIDC) compatible IDentity Provider (IDP) such as Okta, KeyCloak, Dex, Google, or Facebook for external management of user identities.", icon: , iconDescription: "Create Configurations", }, { text: "Configuring an external IDP enables Single-Sign On workflows, where applications authenticate against the external IDP before accessing MinIO.", icon: null, iconDescription: "", }, ]; export const openIDFormFields = { config_url: { required: true, hasError: (s: string, editMode: boolean) => { return !s && editMode ? "Config URL is required" : ""; }, label: "Config URL", tooltip: "Config URL for identity provider configuration", placeholder: "https://identity-provider-url/.well-known/openid-configuration", type: "text", editOnly: false, }, client_id: { required: true, hasError: (s: string, editMode: boolean) => { return !s && editMode ? "Client ID is required" : ""; }, label: "Client ID", tooltip: "Identity provider Client ID", placeholder: "Enter Client ID", type: "text", editOnly: false, }, client_secret: { required: true, hasError: (s: string, editMode: boolean) => { return !s && editMode ? "Client Secret is required" : ""; }, label: "Client Secret", tooltip: "Identity provider Client Secret", placeholder: "Enter Client Secret", type: "password", editOnly: true, }, claim_name: { required: false, label: "Claim Name", tooltip: "Claim from which MinIO will read the policy or role to use", placeholder: "Enter Claim Name", type: "text", hasError: (s: string, editMode: boolean) => "", editOnly: false, }, display_name: { required: false, label: "Display Name", tooltip: "", placeholder: "Enter Display Name", type: "text", hasError: (s: string, editMode: boolean) => "", editOnly: false, }, claim_prefix: { required: false, label: "Claim Prefix", tooltip: "", placeholder: "Enter Claim Prefix", type: "text", hasError: (s: string, editMode: boolean) => "", editOnly: false, }, scopes: { required: false, label: "Scopes", tooltip: "", placeholder: "openid,profile,email", type: "text", hasError: (s: string, editMode: boolean) => "", editOnly: false, }, redirect_uri: { required: false, label: "Redirect URI", tooltip: "", placeholder: "https://console-endpoint-url/oauth_callback", type: "text", hasError: (s: string, editMode: boolean) => "", editOnly: false, }, role_policy: { required: false, label: "Role Policy", tooltip: "", placeholder: "readonly", type: "text", hasError: (s: string, editMode: boolean) => "", editOnly: false, }, claim_userinfo: { required: false, label: "Claim User Info", tooltip: "", placeholder: "Claim User Info", type: "toggle", hasError: (s: string, editMode: boolean) => "", editOnly: false, }, redirect_uri_dynamic: { required: false, label: "Redirect URI Dynamic", tooltip: "", placeholder: "Redirect URI Dynamic", type: "toggle", hasError: (s: string, editMode: boolean) => "", editOnly: false, }, }; export const ldapFormFields = { server_insecure: { required: true, hasError: (s: string, editMode: boolean) => { return !s && editMode ? "Server Address is required" : ""; }, label: "Server Insecure", tooltip: "Disable SSL certificate verification ", placeholder: "myldapserver.com:636", type: "toggle", editOnly: false, }, server_addr: { required: true, hasError: (s: string, editMode: boolean) => { return !s && editMode ? "Server Address is required" : ""; }, label: "Server Address", tooltip: 'AD/LDAP server address e.g. "myldapserver.com:636"', placeholder: "myldapserver.com:636", type: "text", editOnly: false, }, lookup_bind_dn: { required: true, hasError: (s: string, editMode: boolean) => { return !s && editMode ? "Lookup Bind DN is required" : ""; }, label: "Lookup Bind DN", tooltip: "DN (Distinguished Name) for LDAP read-only service account used to perform DN and group lookups", placeholder: "cn=admin,dc=min,dc=io", type: "text", editOnly: false, }, lookup_bind_password: { required: true, hasError: (s: string, editMode: boolean) => { return !s && editMode ? "Lookup Bind Password is required" : ""; }, label: "Lookup Bind Password", tooltip: "Password for LDAP read-only service account used to perform DN and group lookups", placeholder: "admin", type: "password", editOnly: true, }, user_dn_search_base_dn: { required: true, hasError: (s: string, editMode: boolean) => { return !s && editMode ? "User DN Search Base DN is required" : ""; }, label: "User DN Search Base", tooltip: "", placeholder: "DC=example,DC=net", type: "text", editOnly: false, }, user_dn_search_filter: { required: true, hasError: (s: string, editMode: boolean) => { return !s && editMode ? "User DN Search Filter is required" : ""; }, label: "User DN Search Filter", tooltip: "", placeholder: "(sAMAccountName=%s)", type: "text", editOnly: false, }, group_search_base_dn: { required: false, hasError: (s: string, editMode: boolean) => "", label: "Group Search Base DN", tooltip: "", placeholder: "ou=swengg,dc=min,dc=io", type: "text", editOnly: false, }, group_search_filter: { required: false, hasError: (s: string, editMode: boolean) => "", label: "Group Search Filter", tooltip: "", placeholder: "(&(objectclass=groupofnames)(member=%d))", type: "text", editOnly: false, }, }; ================================================ FILE: web-app/src/screens/Console/KMS/AddKey.tsx ================================================ // 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 } from "react"; import { BackLink, Grid } from "mds"; import { useNavigate } from "react-router-dom"; import { IAM_PAGES } from "../../../common/SecureComponent/permissions"; import { useAppDispatch } from "../../../store"; import AddKeyForm from "./AddKeyForm"; import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; import HelpMenu from "../HelpMenu"; import { setHelpName } from "systemSlice"; const AddKey = () => { const dispatch = useAppDispatch(); const navigate = useNavigate(); useEffect(() => { dispatch(setHelpName("add_key")); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( navigate(IAM_PAGES.KMS_KEYS)} /> } actions={} /> ); }; export default AddKey; ================================================ FILE: web-app/src/screens/Console/KMS/AddKeyForm.tsx ================================================ // 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, { useState } from "react"; import { AddAccessRuleIcon, Button, FormLayout, PageLayout, Grid, InputBox, } from "mds"; import { modalStyleUtils } from "../Common/FormComponents/common/styleLibrary"; import KMSHelpBox from "./KMSHelpbox"; import { api } from "api"; import { useAppDispatch } from "store"; import { useNavigate } from "react-router-dom"; import { ApiError, HttpResponse } from "api/consoleApi"; import { setErrorSnackMessage } from "systemSlice"; import { errorToHandler } from "api/errors"; import { IAM_PAGES } from "common/SecureComponent/permissions"; const AddKeyForm = () => { const dispatch = useAppDispatch(); const navigate = useNavigate(); const [keyName, setKeyName] = useState(""); const [loadingCreate, setLoadingCreate] = useState(false); const addRecord = (event: React.FormEvent) => { event.preventDefault(); setLoadingCreate(true); api.kms .kmsCreateKey({ key: keyName }) .then((_) => { navigate(`${IAM_PAGES.KMS_KEYS}`); }) .catch(async (res: HttpResponse) => { const err = (await res.json()) as ApiError; dispatch(setErrorSnackMessage(errorToHandler(err))); }) .finally(() => setLoadingCreate(false)); }; const resetForm = () => { setKeyName(""); }; const validateKeyName = (keyName: string) => { if (keyName.indexOf(" ") !== -1) { return "Key name cannot contain spaces"; } else return ""; }; const validSave = keyName.trim() !== "" && keyName.indexOf(" ") === -1; return ( } helpBox={ } >
) => { addRecord(e); }} > ) => { setKeyName(e.target.value); }} /> } promoHeader={ Welcome to

CONSOLE
} promoInfo={ This is just a fork of the MinIO Console for my own personal educational purposes, and therefore it incorporates MinIO® source code. You may also want to look for other maintained forks.

It is important to note that MINIO is a registered trademark of the MinIO Corporation. Consequently, this project is not affiliated with or endorsed by the MinIO Corporation.
} /> ) : null; }; export default LoginCallback; ================================================ FILE: web-app/src/screens/LoginPage/SSOLogin.tsx ================================================ // This file is part of Console Server // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public 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, { useEffect } from "react"; import { useNavigate } from "react-router-dom"; import { loginStrategyType } from "./login.types"; import { AppState, useAppDispatch } from "../../store"; import { useSelector } from "react-redux"; import { getFetchConfigurationAsync } from "./loginThunks"; import { fetchSession } from "./sessionThunk"; import LoadingComponent from "common/LoadingComponent"; const SSOLogin = () => { const dispatch = useAppDispatch(); const navigate = useNavigate(); const userLoggedIn = useSelector((state: AppState) => state.system.loggedIn); const sessionLoadingState = useSelector( (state: AppState) => state.console.sessionLoadingState, ); useEffect(() => { dispatch(fetchSession()); }, [dispatch]); const loginStrategy = useSelector( (state: AppState) => state.login.loginStrategy, ); const loadingFetchConfiguration = useSelector( (state: AppState) => state.login.loadingFetchConfiguration, ); useEffect(() => { if (loadingFetchConfiguration) { dispatch(getFetchConfigurationAsync()); } }, [loadingFetchConfiguration, sessionLoadingState, dispatch]); useEffect(() => { if (!loadingFetchConfiguration) { if (!userLoggedIn) { if (loginStrategy.loginStrategy === loginStrategyType.redirect) { if ( loginStrategy.redirectRules && loginStrategy.redirectRules.length > 0 ) { if (loginStrategy.redirectRules[0].redirect) { window.location.href = loginStrategy.redirectRules[0].redirect; return; } } } else { navigate("login"); return; } } else { navigate("browser"); return; } } }, [ loadingFetchConfiguration, sessionLoadingState, userLoggedIn, loginStrategy, dispatch, navigate, ]); return ; }; export default SSOLogin; ================================================ FILE: web-app/src/screens/LoginPage/StrategyForm.tsx ================================================ // 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, useState } from "react"; import { Box, Button, DropdownSelector, Grid, IdentitiesMenuIcon, InputBox, LockFilledIcon, LogoutIcon, PasswordKeyIcon, ProgressBar, Select, Tag, UserFilledIcon, } from "mds"; import { setAccessKey, setDisplayEmbeddedIDPForms, setSecretKey, setSTS, setUseSTS, } from "./loginSlice"; import { AppState, useAppDispatch } from "../../store"; import { useSelector } from "react-redux"; import { doLoginAsync } from "./loginThunks"; import { RedirectRule } from "api/consoleApi"; const StrategyForm = ({ redirectRules }: { redirectRules: RedirectRule[] }) => { const dispatch = useAppDispatch(); const [ssoOptionsOpen, ssoOptionsSetOpen] = useState(false); const [anchorEl, setAnchorEl] = React.useState< (EventTarget & HTMLButtonElement) | null >(null); const ldap_enabled = useSelector( (state: AppState) => state.login.ldap_enabled, ); const accessKey = useSelector((state: AppState) => state.login.accessKey); const secretKey = useSelector((state: AppState) => state.login.secretKey); const sts = useSelector((state: AppState) => state.login.sts); const useSTS = useSelector((state: AppState) => state.login.useSTS); const displaySSOForm = useSelector( (state: AppState) => state.login.ssoEmbeddedIDPDisplay, ); const loginSending = useSelector( (state: AppState) => state.login.loginSending, ); const formSubmit = (e: React.FormEvent) => { e.preventDefault(); dispatch(doLoginAsync()); }; let selectOptions = [ { label: useSTS ? "Use Credentials" : "Use STS", value: useSTS ? "use-sts-cred" : "use-sts", }, ]; let ssoOptions: any[] = []; if (redirectRules.length > 0) { ssoOptions = redirectRules.map((r) => ({ label: `${r.displayName}${r.serviceType ? ` - ${r.serviceType}` : ""}`, value: r.redirect, icon: , })); selectOptions = [ { label: "Use Credentials", value: "use-sts-cred" }, { label: "Use STS", value: "use-sts" }, ]; } const extraActionSelector = (value: string) => { if (value) { if (redirectRules.length > 0) { let stsState = true; if (value === "use-sts-cred") { stsState = false; } dispatch(setUseSTS(stsState)); dispatch(setDisplayEmbeddedIDPForms(true)); return; } if (value.includes("use-sts")) { dispatch(setUseSTS(!useSTS)); return; } } }; const submitSSOInitRequest = (value: string) => { window.location.href = value; }; return ( {redirectRules.length > 0 && (